The code snippet is as follows:
PyArg_VaParse function.
unsigned long l;
char s[...];
....
PyArg_VaParse( (PyObject p, "si", &s, &l );
.....
if (l == 0) { do something if 0 }
else { do something if not 0 }
PyArg_VaParse (which is quite similar to C scanf function) replaces "i" position parameter with integer variable. In 32 bit environment it does not make any harm because both long and int are 32 bit variables. But in 64 bit environment long is 64 bit and int is 32 bit. Because 32 bit value is stored in 64 bit it did not raise any run-time errors.
It works if compiled as 32 bit application. But it was very nasty after compiling as 64 bit application. In most cases it worked also as expected but sometimes it behaves badly.
Brak komentarzy:
Prześlij komentarz