Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc6a438

Browse files
committed
Trent Mick:
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*).
1 parent 534b7c5 commit cc6a438

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Modules/signalmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,11 @@ initsignal()
356356
/* Add some symbolic constants to the module */
357357
d = PyModule_GetDict(m);
358358

359-
x = DefaultHandler = PyInt_FromLong((long)SIG_DFL);
359+
x = DefaultHandler = PyLong_FromVoidPtr(SIG_DFL);
360360
if (!x || PyDict_SetItemString(d, "SIG_DFL", x) < 0)
361361
goto finally;
362362

363-
x = IgnoreHandler = PyInt_FromLong((long)SIG_IGN);
363+
x = IgnoreHandler = PyLong_FromVoidPtr(SIG_IGN);
364364
if (!x || PyDict_SetItemString(d, "SIG_IGN", x) < 0)
365365
goto finally;
366366

0 commit comments

Comments
 (0)