classification
Title: Python considers pid longs under 64-bit Windows
Type: behavior Stage: resolved
Components: Extension Modules, Interpreter Core, Windows Versions: Python 3.2
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, brian.curtin, georg.brandl, pitrou, tim.golden
Priority: normal Keywords:

Created on 2010-08-15 18:02 by pitrou, last changed 2013-10-13 18:37 by pitrou. This issue is now closed.

Messages (4)
msg113982 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-08-15 18:02
Under 64-bit Windows, Python aliases PyLong_FromPid() to PyLong_FromLong() (and PyLong_AsPid() to PyLong_AsLong()), but a C "long" is 32-bit, while apparently the MSVCRT defines a pid to be intptr_t, that is 64-bit. A potential loss of data ensues.
msg115027 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-08-26 21:22
The spawn* functions return intptr_t, because it's the process handle.
But _getpid() returns an int.
Both seem to be correctly handled.

Which part do you suspect to truncate data?
msg199754 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-10-13 18:30
Antoine, ping?
msg199760 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-13 18:37
Amaury is right, it seems a Windows pid is an int after all. I don't know where I got the other impression :-)
History
Date User Action Args
2013-10-13 18:37:49pitrousetstatus: open -> closed
resolution: not a bug
messages: + msg199760

stage: resolved
2013-10-13 18:30:03georg.brandlsetstatus: pending -> open
nosy: + georg.brandl
messages: + msg199754

2012-11-19 15:16:35serhiy.storchakasetstatus: open -> pending
2010-08-26 21:22:23amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg115027
2010-08-15 18:02:25pitroucreate