mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-21 14:01:44 +07:00
PY-62566 Use cythonized version of helper functions in PEP 669 debugger when possible
GitOrigin-RevId: 979a5472e027266b911b1a2d3dc2f1fdb3ce10fa
This commit is contained in:
committed by
intellij-monorepo-bot
parent
004e2e15fc
commit
f91a4c223c
@@ -173,9 +173,6 @@ USE_LIB_COPY = SUPPORT_GEVENT and \
|
||||
USE_LOW_IMPACT_MONITORING = (IS_PY312_OR_GREATER and
|
||||
os.environ.get('USE_LOW_IMPACT_MONITORING', False))
|
||||
|
||||
if USE_LOW_IMPACT_MONITORING:
|
||||
CYTHON_SUPPORTED = False
|
||||
|
||||
# The tool name to use in the API calls from PEP 669.
|
||||
PYDEVD_TOOL_NAME = 'pydevd'
|
||||
|
||||
|
||||
@@ -60,3 +60,12 @@ global_cache_frame_skips = mod.global_cache_frame_skips
|
||||
_set_additional_thread_info_lock = mod._set_additional_thread_info_lock
|
||||
|
||||
fix_top_level_trace_and_get_trace_func = mod.fix_top_level_trace_and_get_trace_func
|
||||
|
||||
# Common frame functions to be used in PEP 669 debugger callbacks.
|
||||
handle_breakpoint_condition = mod.handle_breakpoint_condition
|
||||
handle_breakpoint_expression = mod.handle_breakpoint_expression
|
||||
DEBUG_START = mod.DEBUG_START
|
||||
DEBUG_START_PY3K = mod.DEBUG_START_PY3K
|
||||
should_stop_on_exception = mod.should_stop_on_exception
|
||||
handle_exception = mod.handle_exception
|
||||
manage_return_values = mod.manage_return_values
|
||||
|
||||
@@ -6,8 +6,10 @@ from os.path import splitext, basename
|
||||
|
||||
from _pydev_bundle import pydev_log
|
||||
from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
|
||||
from _pydevd_bundle.pydevd_additional_thread_info_regular import \
|
||||
set_additional_thread_info
|
||||
from _pydevd_bundle.pydevd_trace_dispatch import set_additional_thread_info, \
|
||||
handle_breakpoint_condition, handle_breakpoint_expression, \
|
||||
DEBUG_START, DEBUG_START_PY3K, should_stop_on_exception, handle_exception, \
|
||||
manage_return_values
|
||||
from _pydevd_bundle.pydevd_breakpoints import stop_on_unhandled_exception
|
||||
from _pydevd_bundle.pydevd_bytecode_utils import find_last_call_name, \
|
||||
find_last_func_call_order
|
||||
@@ -17,9 +19,6 @@ from _pydevd_bundle.pydevd_comm_constants import CMD_STEP_OVER, CMD_SMART_STEP_I
|
||||
from _pydevd_bundle.pydevd_constants import get_current_thread_id, PYDEVD_TOOL_NAME, \
|
||||
STATE_RUN, STATE_SUSPEND
|
||||
from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
|
||||
from _pydevd_bundle.pydevd_frame import handle_breakpoint_condition, \
|
||||
handle_breakpoint_expression, DEBUG_START, DEBUG_START_PY3K, \
|
||||
should_stop_on_exception, handle_exception, manage_return_values
|
||||
from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
|
||||
from pydevd_file_utils import NORM_PATHS_AND_BASE_CONTAINER, \
|
||||
get_abs_path_real_path_and_base_from_frame
|
||||
|
||||
@@ -40,7 +40,17 @@ show_tracing_warning = False
|
||||
|
||||
if use_cython == 'YES':
|
||||
# We must import the cython version if forcing cython
|
||||
from _pydevd_bundle.pydevd_cython_wrapper import trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips, fix_top_level_trace_and_get_trace_func
|
||||
# noinspection PyUnresolvedReferences
|
||||
from _pydevd_bundle.pydevd_cython_wrapper import (
|
||||
trace_dispatch as _trace_dispatch,
|
||||
global_cache_skips,
|
||||
global_cache_frame_skips,
|
||||
fix_top_level_trace_and_get_trace_func,
|
||||
set_additional_thread_info,
|
||||
handle_breakpoint_condition,
|
||||
handle_breakpoint_expression, DEBUG_START, DEBUG_START_PY3K,
|
||||
should_stop_on_exception, handle_exception, manage_return_values,
|
||||
)
|
||||
def trace_dispatch(py_db, frame, event, arg):
|
||||
if _trace_dispatch is None:
|
||||
return None
|
||||
@@ -48,12 +58,34 @@ if use_cython == 'YES':
|
||||
|
||||
elif use_cython == 'NO':
|
||||
# Use the regular version if not forcing cython
|
||||
from _pydevd_bundle.pydevd_trace_dispatch_regular import trace_dispatch, global_cache_skips, global_cache_frame_skips, fix_top_level_trace_and_get_trace_func # @UnusedImport
|
||||
# noinspection PyUnresolvedReferences
|
||||
from _pydevd_bundle.pydevd_trace_dispatch_regular import (
|
||||
trace_dispatch,
|
||||
global_cache_skips,
|
||||
global_cache_frame_skips,
|
||||
fix_top_level_trace_and_get_trace_func,
|
||||
set_additional_thread_info,
|
||||
)
|
||||
# noinspection PyUnresolvedReferences
|
||||
from _pydevd_bundle.pydevd_frame import (
|
||||
handle_breakpoint_condition,
|
||||
handle_breakpoint_expression, DEBUG_START, DEBUG_START_PY3K,
|
||||
should_stop_on_exception, handle_exception, manage_return_values,
|
||||
)
|
||||
|
||||
elif use_cython is None:
|
||||
# Regular: use fallback if not found and give message to user
|
||||
try:
|
||||
from _pydevd_bundle.pydevd_cython_wrapper import trace_dispatch as _trace_dispatch, global_cache_skips, global_cache_frame_skips, fix_top_level_trace_and_get_trace_func
|
||||
from _pydevd_bundle.pydevd_cython_wrapper import (
|
||||
trace_dispatch as _trace_dispatch,
|
||||
global_cache_skips,
|
||||
global_cache_frame_skips,
|
||||
fix_top_level_trace_and_get_trace_func,
|
||||
set_additional_thread_info,
|
||||
handle_breakpoint_condition,
|
||||
handle_breakpoint_expression, DEBUG_START, DEBUG_START_PY3K,
|
||||
should_stop_on_exception, handle_exception, manage_return_values,
|
||||
)
|
||||
def trace_dispatch(py_db, frame, event, arg):
|
||||
if _trace_dispatch is None:
|
||||
return None
|
||||
@@ -63,7 +95,18 @@ elif use_cython is None:
|
||||
try:
|
||||
if hasattr(e, 'version_mismatch'):
|
||||
delete_old_compiled_extensions()
|
||||
from _pydevd_bundle.pydevd_trace_dispatch_regular import trace_dispatch, global_cache_skips, global_cache_frame_skips, fix_top_level_trace_and_get_trace_func # @UnusedImport
|
||||
from _pydevd_bundle.pydevd_trace_dispatch_regular import (
|
||||
trace_dispatch,
|
||||
global_cache_skips,
|
||||
global_cache_frame_skips,
|
||||
fix_top_level_trace_and_get_trace_func,
|
||||
set_additional_thread_info,
|
||||
)
|
||||
from _pydevd_bundle.pydevd_frame import (
|
||||
handle_breakpoint_condition,
|
||||
handle_breakpoint_expression, DEBUG_START, DEBUG_START_PY3K,
|
||||
should_stop_on_exception, handle_exception, manage_return_values,
|
||||
)
|
||||
from _pydev_bundle.pydev_monkey import log_error_once
|
||||
|
||||
if not IS_PYCHARM:
|
||||
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
import sys
|
||||
|
||||
from _pydev_bundle.pydev_monkey import log_error_once
|
||||
from _pydevd_bundle.pydevd_constants import IS_PYCHARM, IS_PY311_OR_GREATER
|
||||
from _pydevd_bundle.pydevd_constants import IS_PYCHARM, IS_PY311, IS_PY312_OR_GREATER
|
||||
|
||||
IS_PY36_OR_GREATER = sys.version_info >= (3, 6)
|
||||
|
||||
@@ -20,7 +20,10 @@ use_cython = os.getenv('PYDEVD_USE_CYTHON', None)
|
||||
if not IS_PY36_OR_GREATER or sys.version_info[:3] == (3, 6, 1): # PY-37312
|
||||
pass
|
||||
|
||||
elif IS_PY311_OR_GREATER: # PY-51730
|
||||
elif IS_PY311: # PY-51730
|
||||
pass
|
||||
|
||||
elif IS_PY312_OR_GREATER: # PEP 669 tracing should be used instead.
|
||||
pass
|
||||
|
||||
elif use_cython == 'NO':
|
||||
|
||||
Reference in New Issue
Block a user