You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ctypes "ValueError: NULL pointer access" on Win7 x64 #53512
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.
Ok, this issue is worse, and much easier to reproduce, than I thought. Here is an updated ctypes_test.zip with a repro using only integers and callbacks.
Activity
ghazel commentedon Jul 15, 2010
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:
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:
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.
ghazel commentedon Jul 16, 2010
Ok, this issue is worse, and much easier to reproduce, than I thought. Here is an updated ctypes_test.zip with a repro using only integers and callbacks.
Correct output:
('three', (1, 2, 3))
('four', (1, 2, 3, 4))
('five', (1, 2, 3, 4, 5))
Incorrect output:
('three', (1, 2, 3))
('four', (1, 2, 3, 0))
('five', (1, 2, 3, 0, 5))
I built Python 2.7 from source with MSVC 9. This is not reproducible in Debug mode, or Win32 Release mode. It only happens in x64 Release mode.
One very interesting discovery is that if I set these options:
Optimization: Disabled (/Od)
Enable Instrinsic Functions: No
the error does not occur!
ocean-city commentedon Oct 3, 2010
Probably this issue is duplicate of bpo-9884.
stanmihai commentedon Jan 26, 2011
The problem was an uninitialized variable. Attached is the patch that fixes it.
mattip commentedon May 14, 2014
This was fixed with changeset 8fa73a0885c9 in Jan 2011, probably should be closed