[issue9266] ctypes "ValueError: NULL pointer access" on Win7 x64

Greg Hazel report at bugs.python.org
Thu Jul 15 14:55:50 CEST 2010


New submission from Greg Hazel <ghazel at users.sourceforge.net>:

ctypes on Windows on a 64bit Python installation gets a NULL pointer access where one is not expected.

To reproduce the problem, run make.bat then "python ctypes_test.py"


Failure output looks like this:

Three! 1 2 <__main__.LP_Some object at 0x000000000209C4C8>
<__main__.Some object at 0x000000000209C548>
91
Four! 1 2 3 <__main__.LP_Some object at 0x000000000209C4C8>
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 291, in 'calling callback function'
  File "ctypes_test.py", line 21, in fourprinter
    print(to.contents)
ValueError: NULL pointer access


Otherwise, successful output looks something like:

Three! 1 2 <ctypes.LP_Some object at 0x2acc9482aed0>
<__main__.Some object at 0x2acc9482ae50>
91
Four! 1 2 3 <ctypes.LP_Some object at 0x2acc9482aed0>
<__main__.Some object at 0x2acc9482ae50>
91



Environments exhibiting this problem:

Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.architecture()
('64bit', 'WindowsPE')

Python 3.1.2 (r312:79149, Mar 20 2010, 22:55:39) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.architecture()
('64bit', 'WindowsPE')


Environments NOT exhibiting the problem:

Python 2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.architecture()
('64bit', 'ELF')

Also Windows on a 32bit architecture seems unaffected.

----------
assignee: theller
components: ctypes
files: ctypes_test.zip
messages: 110362
nosy: ghazel, theller
priority: normal
severity: normal
status: open
title: ctypes "ValueError: NULL pointer access" on Win7 x64
type: crash
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file18012/ctypes_test.zip

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


More information about the Python-bugs-list mailing list