From 502793eddceae2954f52553b47ea8f319ee1964f Mon Sep 17 00:00:00 2001 From: Andrey Lisin Date: Mon, 11 Dec 2023 12:20:16 +0100 Subject: [PATCH] PY-65243 Obey `PYDEVD_USE_CYTHON` environment variable when importing tracing module for Python 3.12 GitOrigin-RevId: cd153cf56d18c3bc3858f31259d8a8252314578e --- .../pydevd_pep_669_tracing_wrapper.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/python/helpers/pydev/_pydevd_bundle/pydevd_pep_669_tracing_wrapper.py b/python/helpers/pydev/_pydevd_bundle/pydevd_pep_669_tracing_wrapper.py index 4b8983fba98f..13fc94bc59cd 100644 --- a/python/helpers/pydev/_pydevd_bundle/pydevd_pep_669_tracing_wrapper.py +++ b/python/helpers/pydev/_pydevd_bundle/pydevd_pep_669_tracing_wrapper.py @@ -1,9 +1,17 @@ +import os import sys -try: - from _pydevd_bundle import pydevd_pep_669_tracing_cython as mod -except ImportError: +use_cython = os.getenv('PYDEVD_USE_CYTHON', None) + +if use_cython == 'NO': from _pydevd_bundle import pydevd_pep_669_tracing as mod +elif use_cython == 'YES': + from _pydevd_bundle import pydevd_pep_669_tracing_cython as mod +else: + try: + from _pydevd_bundle import pydevd_pep_669_tracing_cython as mod + except ImportError: + from _pydevd_bundle import pydevd_pep_669_tracing as mod sys.modules['_pydevd_bundle.pydevd_pep_669_tracing'] = mod