This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: fix simple 64-bit warnings/errors in signalmodule.c
Type: Stage:
Components: None Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum, tmick
Priority: normal Keywords: patch

Created on 2000-06-07 03:58 by tmick, last changed 2022-04-10 16:02 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
None tmick, 2000-06-07 03:58 None
Messages (5)
msg32799 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2000-06-07 03:58
 
msg32800 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-06-27 15:14
I suppose this is to avoid a compiler warning more than a real problem?
Trent, could you explain?
msg32801 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2000-06-07 03:58
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.
msg32802 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2000-06-07 03:58
Fix warnings on 64-bit build build of signalmodule.c

- Though I know that SIG_DFL and SIG_IGN are just small constants, there are
  cast to function pointers so the appropriate Python call is
  PyLong_FromVoidPtr so that the pointer value cannot overflow on Win64 where
  sizeof(long) < sizeof(void*).
msg32803 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2000-06-27 16:17
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.
History
Date User Action Args
2022-04-10 16:02:01adminsetgithub: 32449
2000-06-07 03:58:10tmickcreate