New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python3.11 breaks pdbpp -m #516
Comments
This works with pdb++ from the master branch, please test it there. |
Installing this via Including this in PYTHONPATH as suggested by the README results in the issue as reported. |
Installation via pip should work (via local checkout ( |
Unfortunately installing this via pip and the GH URL results in the same error reported initially. The |
Confirmed. This fixes it, but likely needs checks to handle / skip it with older Pythons, and I am not sure if classes should be used as-is really: src/pdbpp.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git i/src/pdbpp.py w/src/pdbpp.py
index c64aa22..0022c5d 100644
--- i/src/pdbpp.py
+++ w/src/pdbpp.py
@@ -131,6 +131,10 @@ def rebind_globals(func, newglobals):
_newfunc(func.func, newglobals), *func.args, **func.keywords
)
+ if isinstance(func, type):
+ # Classes (_ModuleTarget, _ScriptTarget).
+ return func
+
raise ValueError("cannot handle func {!r}".format(func))
@@ -2199,7 +2203,16 @@ def _remove_bdb_context(evalue):
_usage = pdb._usage
# copy some functions from pdb.py, but rebind the global dictionary
-for name in 'run runeval runctx runcall main set_trace'.split():
+for name in (
+ "run",
+ "runeval",
+ "runctx",
+ "runcall",
+ "main",
+ "set_trace",
+ "_ModuleTarget", # Python 3.11
+ "_ScriptTarget", # Python 3.11
+):
func = getattr(pdb, name)
globals()[name] = rebind_globals(func, globals())
del name, func |
Confirmed that this fixes the issue on 3.11. Once it's entered pypi, I might do a regression on older Python versions. |
Let's keep the issue open until a fix is committed. |
Don't know if it helps. When I
|
I get the same error! The patch fixes it. |
@blueyed can you commit your patch? It seems to be working. |
Invoking Python 3.11 with -mpdb results in
This problem can be reproduced on Ubuntu (22.04, Python 3.11.0) and Homebrew (with Python 3.11.2, see backtrace above). Please let me know if more info is required.
The text was updated successfully, but these errors were encountered: