python / cpython

The Python programming language
https://www.python.org/
Other
60.06k stars 29.09k forks source link

fix simple 64-bit warnings/errors in signalmodule.c #32449

Closed bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 closed 23 years ago

bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 commented 23 years ago
BPO 400527
Nosy @gvanrossum
Files
  • None: None
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = 'https://github.com/gvanrossum' closed_at = created_at = labels = [] title = 'fix simple 64-bit warnings/errors in signalmodule.c ' updated_at = user = 'https://bugs.python.org/tmick' ``` bugs.python.org fields: ```python activity = actor = 'tmick' assignee = 'gvanrossum' closed = True closed_date = None closer = None components = ['None'] creation = creator = 'tmick' dependencies = [] files = ['2457'] hgrepos = [] issue_num = 400527 keywords = ['patch'] message_count = 5.0 messages = ['32799', '32800', '32801', '32802', '32803'] nosy_count = 2.0 nosy_names = ['gvanrossum', 'tmick'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue400527' versions = [] ```

    bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 commented 23 years ago
    gvanrossum commented 23 years ago

    I suppose this is to avoid a compiler warning more than a real problem? Trent, could you explain?

    bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 commented 23 years ago

    I confirm that, to the best of my knowledge and belief, this contribution is free of any claims of third parties under copyright, patent or other rights or interests ("claims"). To the extent that I have any such claims, I hereby grant to CNRI a nonexclusive, irrevocable, royalty-free, worldwide license to reproduce, distribute, perform and/or display publicly, prepare derivative versions, and otherwise use this contribution as part of the Python software and its related documentation, or any derivative versions thereof, at no cost to CNRI or its licensed users, and to authorize others to do so.

    I acknowledge that CNRI may, at its sole discretion, decide whether or not to incorporate this contribution in the Python software and its related documentation. I further grant CNRI permission to use my name and other identifying information provided to CNRI by me for use in connection with the Python software and its related documentation.

    bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 commented 23 years ago

    Fix warnings on 64-bit build build of signalmodule.c

    bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 commented 23 years ago

    As I understand signal handling, the signal() function takes a callback and returns a callback -- what they do is beside the point here. A callback can either be a function pointer or one of some special #define'd flags (SIG_DFL [default], SIG_IGN [ignore], others?). Practically speaking, these constants are likely to be 0 and 1 or, in any case, *not* big enough to overflow a 32-bit value. Theoretically, on Win64 there is room for overflow if these constants are treated as a long because, I think, they are only guaranteed to fit in a pointer (at least they are cast freely to function pointers).

    So, effectively you are right. This patch is mainly to avoid compiler warnings, with a little healthy anal-retentiveness to boot.