Add pudb.b#110
Merged
Merged
Conversation
This lets you just run import pudb.b to trigger a set_trace(). It works by monkey-patching __builtins__.__import__. It does not yet work in Python 3.3, due to the new import mechanism. See inducer#109.
Collaborator
Author
|
How do we feel about the name |
Owner
|
Will this work with PyPy? |
Collaborator
Author
|
Looks like it doesn't. |
Collaborator
Author
|
I changed it to use Traceback (most recent call last):
File "app_main.py", line 72, in run_toplevel
File "test.py", line 1, in <module>
import pudb.b
File "/Users/aaronmeurer/Documents/pudb/pudb/b.py", line 20, in <module>
set_trace()
File "/Users/aaronmeurer/Documents/pudb/pudb/b.py", line 16, in set_trace
dbg = _get_debugger()
File "/Users/aaronmeurer/Documents/pudb/pudb/__init__.py", line 34, in _get_debugger
from pudb.debugger import Debugger
File "/Users/aaronmeurer/Documents/pudb/pudb/b.py", line 8, in __myimport__
return __origimport__(name, *args, **kwargs)
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 5, in <module>
import urwid
File "/Users/aaronmeurer/Documents/pudb/pudb/b.py", line 8, in __myimport__
return __origimport__(name, *args, **kwargs)
ImportError: No module named urwid |
Owner
|
I'm not sure I'm a huge fan of this, but I'll merge it for the time being. I reserve the right to yank it out if we determine it's a bad idea. (Which it may be because of how deeply it has to reach into Python's guts...import hooks?) On the upside, the change is self-contained, so there isn't much risk here. |
Collaborator
Author
|
I do intend to make this work with Python 3. It's pretty useless to me if it doesn't work there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This lets you just run
to trigger a set_trace(). It works by monkey-patching
__builtins__.__import__. It does not yet work in Python 3.3, due to the newimport mechanism.
See #109.