MCPcopy Index your code
hub / github.com/fabioz/PyDev.Debugger / install_breakpointhook

Function install_breakpointhook

pydevd.py:187–221  ·  view source on GitHub ↗
(pydevd_breakpointhook=None)

Source from the content-addressed store, hash-verified

185
186
187def install_breakpointhook(pydevd_breakpointhook=None):
188 if pydevd_breakpointhook is None:
189
190 def pydevd_breakpointhook(*args, **kwargs):
191 hookname = os.getenv("PYTHONBREAKPOINT")
192 if (
193 hookname is not None
194 and len(hookname) > 0
195 and hasattr(sys, "__breakpointhook__")
196 and sys.__breakpointhook__ != pydevd_breakpointhook
197 ):
198 sys.__breakpointhook__(*args, **kwargs)
199 else:
200 settrace(*args, **kwargs)
201
202 if sys.version_info[0:2] >= (3, 7):
203 # There are some choices on how to provide the breakpoint hook. Namely, we can provide a
204 # PYTHONBREAKPOINT which provides the import path for a method to be executed or we
205 # can override sys.breakpointhook.
206 # pydevd overrides sys.breakpointhook instead of providing an environment variable because
207 # it's possible that the debugger starts the user program but is not available in the
208 # PYTHONPATH (and would thus fail to be imported if PYTHONBREAKPOINT was set to pydevd.settrace).
209 # Note that the implementation still takes PYTHONBREAKPOINT in account (so, if it was provided
210 # by someone else, it'd still work).
211 sys.breakpointhook = pydevd_breakpointhook
212 else:
213 if sys.version_info[0] >= 3:
214 import builtins as __builtin__ # Py3 noqa
215 else:
216 import __builtin__ # noqa
217
218 # In older versions, breakpoint() isn't really available, so, install the hook directly
219 # in the builtins.
220 __builtin__.breakpoint = pydevd_breakpointhook
221 sys.__breakpointhook__ = pydevd_breakpointhook
222
223
224# Install the breakpoint hook at import time.

Callers 1

pydevd.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected