Skip to content

Commit

Permalink
wip - format last?
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Feb 18, 2024
1 parent b980e5a commit e60b241
Show file tree
Hide file tree
Showing 16 changed files with 1,814 additions and 1,796 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,7 @@ def update_class_to_generate_init(class_to_generate):
# Note: added kwargs because some messages are expected to be extended by the user (so, we'll actually
# make all extendable so that we don't have to worry about which ones -- we loose a little on typing,
# but may be better than doing a allow list based on something only pointed out in the documentation).
class_to_generate[
"init"
] = '''def __init__(self%(args)s, update_ids_from_dap=False, **kwargs): # noqa (update_ids_from_dap may be unused)
class_to_generate["init"] = '''def __init__(self%(args)s, update_ids_from_dap=False, **kwargs): # noqa (update_ids_from_dap may be unused)
"""
%(docstring)s
"""
Expand Down
82 changes: 41 additions & 41 deletions _pydevd_bundle/pydevd_additional_thread_info.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
# Defines which version of the PyDBAdditionalThreadInfo we'll use.
from _pydevd_bundle.pydevd_constants import ENV_FALSE_LOWER_VALUES, USE_CYTHON_FLAG, ENV_TRUE_LOWER_VALUES

if USE_CYTHON_FLAG in ENV_TRUE_LOWER_VALUES:
# We must import the cython version if forcing cython
from _pydevd_bundle.pydevd_cython_wrapper import (
PyDBAdditionalThreadInfo,
set_additional_thread_info,
_set_additional_thread_info_lock, # @UnusedImport
any_thread_stepping,
remove_additional_info,
) # @UnusedImport

elif USE_CYTHON_FLAG in ENV_FALSE_LOWER_VALUES:
# Use the regular version if not forcing cython
from _pydevd_bundle.pydevd_additional_thread_info_regular import (
PyDBAdditionalThreadInfo,
set_additional_thread_info,
_set_additional_thread_info_lock, # @UnusedImport @Reimport
any_thread_stepping,
remove_additional_info,
) # @UnusedImport @Reimport

else:
# Regular: use fallback if not found (message is already given elsewhere).
try:
from _pydevd_bundle.pydevd_cython_wrapper import (
PyDBAdditionalThreadInfo,
set_additional_thread_info,
_set_additional_thread_info_lock,
any_thread_stepping,
remove_additional_info,
)
except ImportError:
from _pydevd_bundle.pydevd_additional_thread_info_regular import (
PyDBAdditionalThreadInfo,
set_additional_thread_info,
_set_additional_thread_info_lock, # @UnusedImport
any_thread_stepping,
remove_additional_info,
) # @UnusedImport
# Defines which version of the PyDBAdditionalThreadInfo we'll use.
from _pydevd_bundle.pydevd_constants import ENV_FALSE_LOWER_VALUES, USE_CYTHON_FLAG, ENV_TRUE_LOWER_VALUES

if USE_CYTHON_FLAG in ENV_TRUE_LOWER_VALUES:
# We must import the cython version if forcing cython
from _pydevd_bundle.pydevd_cython_wrapper import (
PyDBAdditionalThreadInfo,
set_additional_thread_info,
_set_additional_thread_info_lock, # @UnusedImport
any_thread_stepping,
remove_additional_info,
) # @UnusedImport

elif USE_CYTHON_FLAG in ENV_FALSE_LOWER_VALUES:
# Use the regular version if not forcing cython
from _pydevd_bundle.pydevd_additional_thread_info_regular import (
PyDBAdditionalThreadInfo,
set_additional_thread_info,
_set_additional_thread_info_lock, # @UnusedImport @Reimport
any_thread_stepping,
remove_additional_info,
) # @UnusedImport @Reimport

else:
# Regular: use fallback if not found (message is already given elsewhere).
try:
from _pydevd_bundle.pydevd_cython_wrapper import (
PyDBAdditionalThreadInfo,
set_additional_thread_info,
_set_additional_thread_info_lock,
any_thread_stepping,
remove_additional_info,
)
except ImportError:
from _pydevd_bundle.pydevd_additional_thread_info_regular import (
PyDBAdditionalThreadInfo,
set_additional_thread_info,
_set_additional_thread_info_lock, # @UnusedImport
any_thread_stepping,
remove_additional_info,
) # @UnusedImport
1,090 changes: 545 additions & 545 deletions _pydevd_bundle/pydevd_cython.c

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions _pydevd_bundle/pydevd_cython.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ cdef class PyDBFrame:
# is reused for the entire context.
# """
#
# ENDIF
# ENDIF

# IFDEF CYTHON -- DONT EDIT THIS FILE (it is automatically generated)
cdef tuple _args
Expand Down Expand Up @@ -1804,7 +1804,9 @@ def fix_top_level_trace_and_get_trace_func(py_db, frame):
if top_level_thread_tracer is None:
# Stop in some internal place to report about unhandled exceptions
top_level_thread_tracer = TopLevelThreadTracerOnlyUnhandledExceptions(args)
additional_info.top_level_thread_tracer_unhandled = top_level_thread_tracer # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
additional_info.top_level_thread_tracer_unhandled = (
top_level_thread_tracer
) # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).

# print(' --> found to trace unhandled', f_unhandled.f_code.co_name, f_unhandled.f_code.co_filename, f_unhandled.f_code.co_firstlineno)
f_trace = top_level_thread_tracer.get_trace_dispatch_func()
Expand Down
2 changes: 1 addition & 1 deletion _pydevd_bundle/pydevd_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class PyDBFrame:
is reused for the entire context.
"""

# ENDIF
# ENDIF

# IFDEF CYTHON
# cdef tuple _args
Expand Down
4 changes: 3 additions & 1 deletion _pydevd_bundle/pydevd_trace_dispatch_regular.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ def fix_top_level_trace_and_get_trace_func(py_db, frame):
if top_level_thread_tracer is None:
# Stop in some internal place to report about unhandled exceptions
top_level_thread_tracer = TopLevelThreadTracerOnlyUnhandledExceptions(args)
additional_info.top_level_thread_tracer_unhandled = top_level_thread_tracer # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
additional_info.top_level_thread_tracer_unhandled = (
top_level_thread_tracer
) # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).

# print(' --> found to trace unhandled', f_unhandled.f_code.co_name, f_unhandled.f_code.co_filename, f_unhandled.f_code.co_firstlineno)
f_trace = top_level_thread_tracer.get_trace_dispatch_func()
Expand Down

0 comments on commit e60b241

Please sign in to comment.