Skip to content

Commit

Permalink
If gevent tries to disable the tracing prevent it. Fixes microsoft#1126
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Nov 18, 2022
1 parent 5b27a35 commit 7a4f5de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def enable_gevent_integration():

if not hasattr(greenlet, 'settrace'):
# In older versions it was optional.
# We still try to use if available though (because without it
# We still try to use if available though.
pydev_log.debug('greenlet.settrace not available. GEVENT_SHOW_PAUSED_GREENLETS will have no effect.')
return
try:
Expand Down
14 changes: 9 additions & 5 deletions src/debugpy/_vendored/pydevd/pydevd_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ def _internal_set_trace(tracing_func):
if TracingFunctionHolder._warn:
frame = get_frame()
if frame is not None and frame.f_back is not None:
filename = frame.f_back.f_code.co_filename.lower()
if not filename.endswith(
filename = os.path.splitext(frame.f_back.f_code.co_filename.lower())[0]
if filename.endswith('threadpool') and 'gevent' in filename:
if tracing_func is None:
pydev_log.debug('Disabled internal sys.settrace from gevent threadpool.')
return

elif not filename.endswith(
(
'threading.py',
'pydevd_tracing.py',
'threadpool.py', # This is from gevent.
'threading',
'pydevd_tracing',
)
):

Expand Down

0 comments on commit 7a4f5de

Please sign in to comment.