-
-
Notifications
You must be signed in to change notification settings - Fork 252
Expand file tree
/
Copy pathdebugger.py
More file actions
36 lines (28 loc) · 863 Bytes
/
debugger.py
File metadata and controls
36 lines (28 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
"""
Debugger factory. Set PYTHON_DEBUGGER to a module path that has a post_mortem
function in it. Defaults to bpdb. This allows alternate debuggers to be used,
such as pycopia.debugger. :)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import os
import sys
post_mortem = None
def _get_debugger():
global post_mortem
modname = os.environ.get("PYTHON_DEBUGGER", "bpdb")
__import__(modname)
mod = sys.modules[modname]
pm = getattr(mod, "post_mortem")
if pm.__code__.co_argcount > 2:
post_mortem = pm
else:
def _post_mortem(t, ex, exval):
return pm(t)
post_mortem = _post_mortem
_get_debugger()