This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_ctypes crashes on Windows on debug builds
Type: crash Stage: resolved
Components: ctypes Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Claudiu.Popa, python-dev, zach.ware
Priority: low Keywords:

Created on 2015-01-17 14:34 by Claudiu.Popa, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg234168 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2015-01-17 14:34
Hi,

Doing the following on Windows leads to a nasty crash "python_d -m test test_ctypes":


[1/1] test_ctypes
Fatal Python error: Segmentation fault

Current thread 0x000016fc (most recent call first):
  File "E:\Projects\repos\cpython\lib\unittest\case.py", line 162 in handle
  File "E:\Projects\repos\cpython\lib\unittest\case.py", line 704 in assertRaises
  File "E:\Projects\repos\cpython\lib\ctypes\test\test_win32.py", line 47 in test_SEH
  File "E:\Projects\repos\cpython\lib\unittest\case.py", line 577 in run
  File "E:\Projects\repos\cpython\lib\unittest\case.py", line 625 in __call__
  File "E:\Projects\repos\cpython\lib\unittest\suite.py", line 125 in run
  File "E:\Projects\repos\cpython\lib\unittest\suite.py", line 87 in __call__
  File "E:\Projects\repos\cpython\lib\unittest\suite.py", line 125 in run
  File "E:\Projects\repos\cpython\lib\unittest\suite.py", line 87 in __call__
  File "E:\Projects\repos\cpython\lib\unittest\suite.py", line 125 in run
  File "E:\Projects\repos\cpython\lib\unittest\suite.py", line 87 in __call__
  File "E:\Projects\repos\cpython\lib\unittest\suite.py", line 125 in run
  File "E:\Projects\repos\cpython\lib\unittest\suite.py", line 87 in __call__
  File "E:\Projects\repos\cpython\lib\unittest\suite.py", line 125 in run
  File "E:\Projects\repos\cpython\lib\unittest\suite.py", line 87 in __call__
  File "E:\Projects\repos\cpython\lib\test\support\__init__.py", line 1669 in run
  File "E:\Projects\repos\cpython\lib\test\support\__init__.py", line 1770 in _run_suite
  File "E:\Projects\repos\cpython\lib\test\support\__init__.py", line 1804 in run_unittest
  File "E:\Projects\repos\cpython\lib\test\regrtest.py", line 1283 in test_runner
  File "E:\Projects\repos\cpython\lib\test\regrtest.py", line 1284 in runtest_inner
  File "E:\Projects\repos\cpython\lib\test\regrtest.py", line 978 in runtest
  File "E:\Projects\repos\cpython\lib\test\regrtest.py", line 763 in main
  File "E:\Projects\repos\cpython\lib\test\regrtest.py", line 1568 in main_in_temp_cwd
  File "E:\Projects\repos\cpython\lib\test\__main__.py", line 3 in <module>
  File "E:\Projects\repos\cpython\lib\runpy.py", line 85 in _run_code
  File "E:\Projects\repos\cpython\lib\runpy.py", line 170 in _run_module_as_main


It seems that test_SEH is not properly skipped, since on my machine, sys.executable is in fact cpython\PCbuild\win32\python_d.EXE. Not sure from where the .EXE part comes, but the following patch makes the test pass.



diff -r d3671e6ba106 Lib/ctypes/test/test_win32.py
--- a/Lib/ctypes/test/test_win32.py	Fri Jan 16 20:46:37 2015 -0500
+++ b/Lib/ctypes/test/test_win32.py	Sat Jan 17 16:32:23 2015 +0200
@@ -38,7 +38,7 @@
 @unittest.skipUnless(sys.platform == "win32", 'Windows-specific test')
 class FunctionCallTestCase(unittest.TestCase):
     @unittest.skipUnless('MSC' in sys.version, "SEH only supported by MSC")
-    @unittest.skipIf(sys.executable.endswith('_d.exe'),
+    @unittest.skipIf(sys.executable.lower().endswith('_d.exe'),
                      "SEH not enabled in debug builds")
     def test_SEH(self):
         # Call functions with invalid arguments, and make sure
msg234169 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-01-17 14:53
New changeset 2bbd7b739b85 by Zachary Ware in branch '3.4':
Closes #23256: Avoid a crash in test_ctypes
https://hg.python.org/cpython/rev/2bbd7b739b85

New changeset b5821f7493c1 by Zachary Ware in branch 'default':
Merge with 3.4 (#23256)
https://hg.python.org/cpython/rev/b5821f7493c1
msg234170 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2015-01-17 14:55
The .EXE is very strange, but the fix was simple enough.  Thanks for the report.
History
Date User Action Args
2022-04-11 14:58:12adminsetgithub: 67445
2015-01-17 14:55:55zach.waresetmessages: + msg234170
versions: + Python 3.4
2015-01-17 14:53:21python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg234169

resolution: fixed
stage: patch review -> resolved
2015-01-17 14:34:14Claudiu.Popacreate