-
Notifications
You must be signed in to change notification settings - Fork 62
Timeout does not detect debugger and times out during debugging session #109
Copy link
Copy link
Closed
Description
With version 2.0.0 a debugger-detection was implemented that allows developers to debug without time-limits. However, the detection of whether a debugger is attached or not does not work as expected, and I'm still getting timeouts in PyCharm when debugging, even after upgrading to 2.0.1.
I've played around and found this thread: https://stackoverflow.com/a/38637774/448357, which shows a way how the debugger-detection for PyCharm works. Basically:
import sys
gettrace = getattr(sys, 'gettrace', None)
if gettrace is None:
print('No sys.gettrace - no debugger. Use normal timeout')
elif gettrace():
print('Debugger found - disable timeout to enable debugging')
else:
print("No Debugger - Use normal timeout")Would it be possible to extend the mechanism to include this, in order to correctly disable timeouts when debugging with PyCharm?
Upon further investigation it seems like the known debuggers should either be extended or the mechanism should be made more flexible:
How about:
KNOWN_DEBUGGING_MODULES = {"pydevd", "bdb", "pydevd_frame_evaluator"}
trace_func = None
if trace_func is None:
trace_func = sys.gettrace()
if trace_func and inspect.getmodule(trace_func):
parts = inspect.getmodule(trace_func).__name__.split(".")
for name in KNOWN_DEBUGGING_MODULES:
for part in parts:
if name in part:
return TrueReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
