[issue15637] Segfault reading null VMA (works fine in python 2.x)

Amaury Forgeot d'Arc report at bugs.python.org
Tue Aug 21 16:16:39 CEST 2012


Amaury Forgeot d'Arc added the comment:

The example script has two errors IMO:
- XOpenDisplay accepts a char*, but display_url is certainly a unicode string; it should be converted to a bytes string::
    xlib.XOpenDisplay(display_url.encode('utf-8'))
- XOpenDisplay.restype is not set, so it will be coerced to a C int (and truncated in the case of a 64bit pointer)

I strongly suggest to set .argtypes and .restype, to ensure proper type check and conversion.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15637>
_______________________________________


More information about the Python-bugs-list mailing list