Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded cython .exe crashes on super().__init__() #2959

deekay42 opened this issue May 17, 2019 · 0 comments


None yet
1 participant
Copy link

commented May 17, 2019

Steps to reproduce:

  1. Set env: vcvars64.bat
  2. Create file: out.pyx:
#cython: language_level=3
def foo():
    class A:
    class B(A):
        def __init__(self):
    return 42
  1. Cythonize: cython --embed out.pyx
  2. Compile: cl.exe /nologo /Ox /MD /W3 /GS- /Zi -I"c:\Program Files\Python37\include" /Tcout.c /link /OUT:"out.exe" /SUBSYSTEM:CONSOLE /MACHINE:X64 /LIBPATH:"c:\Program Files\Python37\libs"
  3. Debug: devenv /debugexe out.exe
  4. Run the exe

Expected result: No crash.
Actual result: Crashes with
Exception thrown at 0x00007FF7CDB236B5 in out.exe: 0xC0000005: Access violation writing location 0x0000000000000000.
in this line(marked //HERE):

/* "out.pyx":8
*         def __init__(self):
*             super().__init__()
*     return 42             # <<<<<<<<<<<<<<
* foo()
 __pyx_r = __pyx_int_42;
 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; //HERE
 goto __pyx_L0;

Call stack:

>	out.exe!__pyx_pf_3out_foo(_object * __pyx_self) Line 1413	C
 	out.exe!__Pyx_PyObject_CallMethO(_object * func, _object * arg) Line 2071	C
 	out.exe!__pyx_pymod_exec_out(_object * __pyx_pyinit_module) Line 1836	C
 	[External Code]	
 	out.exe!wmain(int argc, wchar_t * * argv) Line 3260	C
 	[External Code]	
  Name Value Type
__pyx_r python37.dll!0x00007ffd9a48e870 (load symbols for additional information) {ob_refcnt=3 ob_type=python37.dll!0x00007ffd9a4171e0 {...} } _object *
__pyx_self 0x0000000000000000 _object *
__pyx_t_1 0x0000021912c889e8 {ob_refcnt=1 ob_type=python37.dll!0x00007ffd9a419a10 {ob_base={ob_base={ob_refcnt=...} ...} ...} } _object *
  __pyx_t_2 Variable is optimized away and not available.  
__pyx_t_3 0x0000021912988240 {ob_refcnt=0 ob_type=python37.dll!0x00007ffd9a40e860 {ob_base={ob_base={ob_refcnt=...} ...} ...} } _object *
__pyx_t_4 0x0000021912916288 {ob_refcnt=0 ob_type=python37.dll!0x00007ffd9a416d30 {ob_base={ob_base={ob_refcnt=...} ...} ...} } _object *
  __pyx_t_5 Variable is optimized away and not available.  
__pyx_v_A 0x0000021910d2d298 {ob_refcnt=7 ob_type=python37.dll!0x00007ffd9a419ba0 {ob_base={ob_base={ob_refcnt=...} ...} ...} } _object *
__pyx_v_B 0x0000021910d2aa08 {ob_refcnt=3 ob_type=python37.dll!0x00007ffd9a419ba0 {ob_base={ob_base={ob_refcnt=...} ...} ...} } _object *
  _py_decref_tmp Variable is optimized away and not available.  

Additional info:

C:\Users\Dom\code\league_iq_flutter\windows>pip show cython
Name: Cython
Version: 0.29.7
Summary: The Cython compiler for writing C extensions for the Python language.
Author: Robert Bradshaw, Stefan Behnel, Dag Seljebotn, Greg Ewing, et al.
License: Apache
Location: c:\program files\python37\lib\site-packages

C:\Users\Dom\code\league_iq_flutter\windows>python --version
Python 3.7.2


Platform: Windows 10 64bit
If I run this file in python it runs fine.
If i remove the line super().init() in class B the program runs fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.