[New-bugs-announce] [issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit
report at bugs.python.org
Wed May 8 00:11:49 CEST 2013
New submission from STINNER Victor:
The issue #1983 was not fixed on Windows: pid_t is HANDLE on Windows, which is a pointer. SIZEOF_PID_T is not defined in PC/pyconfig.h and so longobject.h takes the default implementation (use C long type):
/* Issue #1983: pid_t can be longer than a C long on some systems */
#if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT
#define _Py_PARSE_PID "i"
#define PyLong_FromPid PyLong_FromLong
#define PyLong_AsPid PyLong_AsLong
#elif SIZEOF_PID_T == SIZEOF_LONG
The consequence is a compiler warning:
..\Modules\posixmodule.c(6603): warning C4244: 'function' : conversion from 'Py_intptr_t' to 'long', possible loss of data [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\pythoncore.vcxproj]
It would be safer to define SIZEOF_PID_T on Windows:
#define SIZEOF_PID_T SIZEOF_VOID_P
I didn't test attached patch on Windows.
Python 3.2 is affected, but I don't think that the issue is important enough to touch this branch (which now only accept security fixes).
See also issue #17870.
nosy: haypo, serhiy.storchaka, tim.golden
title: PyLong_FromPid() is not correctly defined on Windows 64-bit
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file30170/win_sizeof_pid_t.patch
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce