Skip to content

Commit

Permalink
Cython speedups break debugging with Stackless (PY-23283)
Browse files Browse the repository at this point in the history
The problem appears when compiling Cython extensions with Cython 0.25, and it doesn't appear when compiling them with Cython 0.24. It looks like it's Cython bug, but we can't use old version of Cython, because it isn't compatible with Python 3.6 on Windows. So we have to (temporarily) disable Cython extensions for Stackless despite the fact that its implementation is "CPython".

(cherry picked from commit 2ac81cb)
  • Loading branch information
Elizaveta239 committed Apr 18, 2017
1 parent b06a3de commit 5ea0f3b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion _pydevd_bundle/pydevd_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def get_frame():
if sys.version_info[0] == 2 and sys.version_info[1] < 5:
IS_JYTH_LESS25 = True

IS_PYTHON_STACKLESS = "stackless" in sys.version.lower()
CYTHON_SUPPORTED = False

try:
Expand All @@ -52,7 +53,7 @@ def get_frame():
except:
pass
else:
if python_implementation == 'CPython':
if python_implementation == 'CPython' and not IS_PYTHON_STACKLESS:
# Only available for CPython!
if (
(sys.version_info[0] == 2 and sys.version_info[1] >= 7)
Expand Down
23 changes: 12 additions & 11 deletions _pydevd_bundle/pydevd_trace_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
# Should give warning only here if cython is not available but supported.

import os
use_cython = os.getenv('PYDEVD_USE_CYTHON', None)
import sys
from _pydevd_bundle.pydevd_constants import CYTHON_SUPPORTED


use_cython = os.getenv('PYDEVD_USE_CYTHON', None)
dirname = os.path.dirname(os.path.dirname(__file__))
# Do not show incorrect warning for .egg files for Remote debugger
if not CYTHON_SUPPORTED or dirname.endswith('.egg'):
# Do not try to import cython extensions if cython isn't supported
use_cython = 'NO'


def delete_old_compiled_extensions():
Expand Down Expand Up @@ -55,17 +63,10 @@ def trace_dispatch(py_db, frame, event, arg):
except ImportError:
from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo # @UnusedImport
from _pydevd_bundle.pydevd_trace_dispatch_regular import trace_dispatch, global_cache_skips, global_cache_frame_skips # @UnusedImport
from _pydevd_bundle.pydevd_constants import CYTHON_SUPPORTED

dirname = os.path.dirname(os.path.dirname(__file__))
if dirname.endswith('.egg'):
# Do not show incorrect warning for .egg files for Remote debugger
CYTHON_SUPPORTED = False
from _pydev_bundle.pydev_monkey import log_error_once

if CYTHON_SUPPORTED:
from _pydev_bundle.pydev_monkey import log_error_once
log_error_once("warning: Debugger speedups using cython not found. Run '\"%s\" \"%s\" build_ext --inplace' to build." % (
sys.executable, os.path.join(dirname, 'setup_cython.py')))
log_error_once("warning: Debugger speedups using cython not found. Run '\"%s\" \"%s\" build_ext --inplace' to build." % (
sys.executable, os.path.join(dirname, 'setup_cython.py')))

else:
raise RuntimeError('Unexpected value for PYDEVD_USE_CYTHON: %s (accepted: YES, NO)' % (use_cython,))
Expand Down

0 comments on commit 5ea0f3b

Please sign in to comment.