[Python-Dev] os.spawnv problem

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Sun, 9 Jul 2000 15:12:04 +0200


I wrote:
> according to posixmodule.c (trent?), they return an
> intptr_t.
>=20
> unfortunately, this little change causes some inter-
> resting problems; spawnv tells me that my program
> returns the following exit code:
>=20
>     2167387144924954624
>=20
> or, in another base:
>=20
>      0x1E141B2000000000L
>=20
> unless anyone can explain what those upper bit mean,
> and why they are relevant, I suggest casting the return
> code down to an int.

nevermind; I found the problem: the preprocessor doesn't
complain if you're comparing variables that doesn't exist,
so the following code didn't quite do what the programmer
had expected:

#if SIZEOF_LONG =3D=3D SIZE_VOID_P
  return Py_BuildValue("l", spawnval);
#else
  return Py_BuildValue("L", spawnval);
#endif

(SIZE_VOID_P is not defined, and you cannot really expect
Py_BuildValue to do the right thing if spawnval is an integer).

patch coming.

</F>