From: Adam H. <ad...@de...> - 2005-08-31 05:53:37
|
I had a hell of a time getting python-sybase working on x86-64, and I ended up with only a workaround, so I thought I'd ask for the proper fix on the mailing list. The problem begins in servermsg_cb in ctx.c -- and so an exception is triggered on the very first command to interact with the server (ct_connect()). Coming into servermsg_cb(), cs_msg is a valid CS_SERVERMSG struct, with msgnumber =3D=3D 5701 ("Database context switched to 'blah'"). After the memmove() on line 315 (I'm using python-sybase 0.37), server_msg->msg.msgnumber =3D=3D 5701, still. Then comes the Py_BuildValue(= ) (which I don't understand too well, I'm no Python-C API expert), and finally call_callback() is called, which calls _servermsg_cb() in Sybase.py. The first line is: mn =3D msg.msgnumber However, msg.msgnumber =3D=3D 8589940293L ! If I ignore that error and proceed, the very next server message (a database switch, since I pass 4 arguments to Sybase.connect()), comes back with msg.msgnumber =3D=3D 4294972997L. For some reason, Python is using more bits than it needs. 8589940293L =3D= =3D 2**33 + 5701, and 4294972997L =3D=3D 2**32 + 5701. My workaround is to change the line in Sybase.py:_servermsg_cb() to: mn =3D msg.msgnumber % 2**32 Now everything seems to work perfectly! Yay! However, that's obviously not the proper solution. Can anybody see what's wrong? Has anybody else gotten python-sybase working on amd64? --=20 Adam Hooper <ad...@de...> |