[issue41033] readline.c: endless loop on SIGWINCH when loaded twice
daniel hahler added the comment: Yes, the example also does not segfault for me either (also with Python 3.8.12 I have now as `python3.8`), so this was likely only happening in the more complex setup, and/or maybe with some specific version of readline back then. -- title: readline.c: SEGFAULT on SIGWINCH when loaded twice -> readline.c: endless loop on SIGWINCH when loaded twice ___ Python tracker <https://bugs.python.org/issue41033> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41033] readline.c: endless loop on SIGWINCH when loaded twice
Change by daniel hahler : -- versions: +Python 3.11 ___ Python tracker <https://bugs.python.org/issue41033> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17446] doctest test finder doesnt find line numbers of properties
daniel hahler added the comment: The PR appears to need a better test according to https://github.com/python/cpython/pull/3419#issuecomment-350570083. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue17446> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43798] Add position metadata to alias AST type
daniel hahler added the comment: @Pablo: the problem (referenced in the pytest issue) is that `ast.alias` has new required arguments now (see also the adjusted test in https://github.com/python/cpython/commit/75a06f067bd0a2687312e5f8e78f9075be76ad3a#diff-3f516b60719dd445d33225e4f316b36e85c9c51a843a0147349d11a005c55937R1060-R1061). That's expected/wanted though (assuming that it should not have "defaults" for B/C), and there's a patch for the issue at https://github.com/pytest-dev/pytest/pull/8540. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue43798> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43798] Add position metadata to alias AST type
Change by daniel hahler : -- versions: -Python 3.9 ___ Python tracker <https://bugs.python.org/issue43798> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36550] Avoid creating AttributeError exceptions in the debugger
daniel hahler added the comment: Given code like the following the try/except handling of Pdb (via `Cmd.onecmd`, see https://github.com/python/cpython/pull/4666) will mess with `sys.exc_info()`, which could be avoided: ``` try: raise ValueError() except Exception as exc: e = exc __import__('pdb').set_trace() ``` ``` % ./python t_issue36550.py --Return-- > …/t_issue36550.py(5)()->None -> __import__('pdb').set_trace() (Pdb) import sys; sys.exc_info() (, AttributeError("'Pdb' object has no attribute 'do_import'"), ) ``` The initial / better motivation was described in the original issue: with pdb++/pdbpp I want to display tracebacks/errors with errors that might occur via Pdb's prompt, where this then showed up as interfering with it. (Sorry for not responding on https://github.com/python/cpython/pull/4666 earlier, but I think it is only part of this issue, and therefore it should not get closed, and also creating a new one instead does not sound useful to me, so please consider to re-open it instead.) -- versions: +Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue36550> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45249] Update doctect SyntaxErrors for location range
daniel hahler added the comment: I've noticed a regression/change with the code change for this issue. When not catching the exception from `compile("invalid(", "", "single")` it has a caret below the opening parenthesis: ``` Traceback (most recent call last): File "…/t-syntaxerror-chained.py", line 2, in compile("invalid(", "", "single") File "", line 1 invalid( ^ SyntaxError: '(' was never closed ``` When using `traceback.print_exc` however this is missing: ``` Traceback (most recent call last): File "…/t-syntaxerror-chained.py", line 2, in compile("invalid(", "", "single") File "", line 1 invalid( SyntaxError: '(' was never closed ``` The file used for testing: ``` try: compile("invalid(", "", "single") except Exception: # raise __import__("traceback").print_exc() ``` (this change was noticed between 3.10.0rc2 and the final release with pdbpp's test suite) I've not investigated further (yet), and also feel free to ask for creating a new issue, but I've figured it would be good to notify you here first (where the code was changed). -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue45249> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45249] Update doctect SyntaxErrors for location range
Change by daniel hahler : -- versions: +Python 3.10 ___ Python tracker <https://bugs.python.org/issue45249> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38806] "pdb.Pdb(skip=…).set_trace()" should always stop on calling frame
New submission from daniel hahler : The following will not stop for debugging: python3.8 -c 'import pdb; pdb.Pdb(skip=["__main__"]).set_trace()' The example is contrived, the real case would be to have some "noisy" module being excluded in general, but when you add an explicit "set_trace()" in there it should still stop there, and not on some upper frame. This was changed a long time already in https://github.com/python/cpython/commit/313a7513b0c5771042d850d70782a2448d1cdcb7 (Python 2.3), but it is not really clear. I will create a PR reverting that part and see how it goes. -- components: Library (Lib) messages: 356638 nosy: blueyed priority: normal severity: normal status: open title: "pdb.Pdb(skip=…).set_trace()" should always stop on calling frame type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue38806> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38806] "pdb.Pdb(skip=…).set_trace()" should always stop on calling frame
Change by daniel hahler : -- keywords: +patch pull_requests: +16668 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17159 ___ Python tracker <https://bugs.python.org/issue38806> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36130] Pdb(skip=[...]) + module without __name__ => TypeError
daniel hahler added the comment: This was fixed / can be closed (https://github.com/python/cpython/pull/12064). -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue36130> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24565] the f_lineno getter is broken
daniel hahler added the comment: This is likely covered by existing/linked issues already, but wanted to leave it here nonetheless: Given t-pdb.py: ``` import sys def main(): sys.stdout.write("main...\n") assert 0 if __name__ == "__main__": main() ``` Without the fix from the PR: ``` % python3.8 -m pdb -c cont t-pdb.py main... Traceback (most recent call last): File "…/pyenv/3.8.0/lib/python3.8/pdb.py", line 1702, in main pdb._runscript(mainpyfile) File "…/pyenv/3.8.0/lib/python3.8/pdb.py", line 1571, in _runscript self.run(statement) File "…/pyenv/3.8.0/lib/python3.8/bdb.py", line 587, in run exec(cmd, globals, locals) File "", line 1, in File "…/Vcs/cpython/t-pdb.py", line 1, in import sys File "…/Vcs/cpython/t-pdb.py", line 6, in main assert 0 AssertionError Uncaught exception. Entering post mortem debugging Running 'cont' or 'step' will restart the program > …/Vcs/cpython/t-pdb.py(6)main() -> assert 0 (Pdb) ``` With the fix: ``` % /tmp/cpython-bisect/bin/python3.8 -m pdb -c cont t-pdb.py main... Traceback (most recent call last): File "/tmp/cpython-bisect/lib/python3.8/pdb.py", line 1703, in main pdb._runscript(mainpyfile) File "/tmp/cpython-bisect/lib/python3.8/pdb.py", line 1572, in _runscript self.run(statement) File "/tmp/cpython-bisect/lib/python3.8/bdb.py", line 583, in run exec(cmd, globals, locals) File "", line 1, in File "…/Vcs/cpython/t-pdb.py", line 10, in main() File "…/Vcs/cpython/t-pdb.py", line 6, in main assert 0 AssertionError Uncaught exception. Entering post mortem debugging Running 'cont' or 'step' will restart the program > …/Vcs/cpython/t-pdb.py(6)main() -> assert 0 (Pdb) ``` As you can see the traceback in the fixed case contains `main()` correctly, while it has `import sys` (the scripts first line) otherwise. I can only repeat myself to ask for reviewing/merging https://github.com/python/cpython/pull/12419. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue24565> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34444] Module's __file__ should be absolute always ("." in sys.path)
daniel hahler added the comment: > And changing this to have to check every time import runs if an entry in > sys.path is absolute would be costly (that's not a insignificant number of > stat calls which we always try to avoid during import when possible). This could be done when inserting something into `sys.path` maybe then only? But might only make sense when there is some special handling in that case already though - and would change existing behavior of course. (Therefore I am OK with rejecting this, but wanted to mention it anyway) > Your best option is to insert an absolute path to begin with. That's a good enough option to have anyway, of course. -- ___ Python tracker <https://bugs.python.org/issue3> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`
New submission from daniel hahler : Exceptions within `__repr__` methods of captured locals (e.g. via the `capture_locals` argument of `TracebackException`) are not handled: ``` import traceback class CrashingRepr: def __repr__(self): raise RuntimeError("crash") traceback.FrameSummary("fname", 1, "name", locals={"crash": CrashingRepr()}) ``` Result: ``` Traceback (most recent call last): File "test_framesummary_repr.py", line 9, in traceback.FrameSummary("fname", 1, "name", locals={"crash": CrashingRepr()}) File "…/pyenv/3.8.0/lib/python3.8/traceback.py", line 260, in __init__ self.locals = {k: repr(v) for k, v in locals.items()} if locals else None File "…/pyenv/3.8.0/lib/python3.8/traceback.py", line 260, in self.locals = {k: repr(v) for k, v in locals.items()} if locals else None File "test_framesummary_repr.py", line 6, in __repr__ raise RuntimeError("crash") RuntimeError: crash ``` The following patch would fix this: ```diff diff --git i/Lib/traceback.py w/Lib/traceback.py index 7a4c8e19f9..eed7082db4 100644 --- i/Lib/traceback.py +++ w/Lib/traceback.py class FrameSummary: """A single frame from a traceback. @@ -257,7 +265,17 @@ def __init__(self, filename, lineno, name, *, lookup_line=True, self._line = line if lookup_line: self.line -self.locals = {k: repr(v) for k, v in locals.items()} if locals else None +if locals: +self.locals = {} +for k, v in locals.items(): +try: +self.locals[k] = repr(v) +except (KeyboardInterrupt, SystemExit): +raise +except BaseException as exc: +self.locals[k] = f"" +else: +self.locals = None def __eq__(self, other): if isinstance(other, FrameSummary): ``` -- components: Library (Lib) messages: 359400 nosy: blueyed priority: normal severity: normal status: open title: traceback.FrameSummary does not handle exceptions from `repr()` type: behavior versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue39228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`
Change by daniel hahler : -- keywords: +patch pull_requests: +17276 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17855 ___ Python tracker <https://bugs.python.org/issue39228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37022] pdb: do_p and do_pp swallow exceptions from __repr__
Change by daniel hahler : -- keywords: +patch pull_requests: +17564 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18180 ___ Python tracker <https://bugs.python.org/issue37022> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39649] bdb.Bdb.format_stack_entry: checks for obsolete __args__
New submission from daniel hahler : It does: ``` if '__args__' in frame.f_locals: args = frame.f_locals['__args__'] else: args = None if args: s += reprlib.repr(args) else: s += '()' ``` However that appears to be wrong/unnecessary since the following likely, but maybe also others: commit 75bb54c3d8 Author: Guido van Rossum Date: Mon Sep 28 15:33:38 1998 + Don't set a local variable named __args__; this feature no longer works and Greg Ward just reported a problem it caused... diff --git a/Lib/bdb.py b/Lib/bdb.py index 3ca25adbbf..f2cf4caa36 100644 --- a/Lib/bdb.py +++ b/Lib/bdb.py @@ -46,7 +46,7 @@ def dispatch_line(self, frame): return self.trace_dispatch def dispatch_call(self, frame, arg): - frame.f_locals['__args__'] = arg + # XXX 'arg' is no longer used if self.botframe is None: # First call of dispatch since reset() self.botframe = frame Code ref: https://github.com/python/cpython/blob/1ed61617a4a6632905ad6a0b440cd2cafb8b6414/Lib/bdb.py#L551-L558. So it should either get removed, or likely be replaced with actually displaying the args. For this the part could be factored out of `do_args` maybe, adjusting it for handling non-current frames. Of course somebody might inject/set `__args__` still (I've thought about doing that initially for pdb++, but will rather re-implement/override `format_stack_entry` instead), so support for this could be kept additionally. -- components: Library (Lib) messages: 362070 nosy: blueyed priority: normal severity: normal status: open title: bdb.Bdb.format_stack_entry: checks for obsolete __args__ type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue39649> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39649] bdb.Bdb.format_stack_entry: checks for obsolete __args__
Change by daniel hahler : -- keywords: +patch pull_requests: +17907 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18531 ___ Python tracker <https://bugs.python.org/issue39649> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39649] bdb.Bdb.format_stack_entry: checks for obsolete __args__
daniel hahler added the comment: Sure: https://github.com/python/cpython/pull/18531 -- ___ Python tracker <https://bugs.python.org/issue39649> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39766] unittest's assertRaises removes locals from tracebacks
New submission from daniel hahler : I was a bit surprised to find that unittest's assertRaises clears the locals on the traceback, which e.g. prevents pytest to display them in case of failures. This was done via https://bugs.python.org/issue9815 (https://github.com/python/cpython/commit/9681022f1ee5c6c9160c515b24d2a3d1efe8b90d). Maybe this should only get done for expected failures, so that unexpected exceptions can be inspected better? -- components: Library (Lib) messages: 362744 nosy: blueyed priority: normal severity: normal status: open title: unittest's assertRaises removes locals from tracebacks versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue39766> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39766] unittest's assertRaises removes locals from tracebacks
daniel hahler added the comment: The test for issue9815 passes since bbd3cf8f1e (bpo-23890). It seems like `traceback.clear_frames(tb)` should probably removed altogether? -- nosy: +vstinner ___ Python tracker <https://bugs.python.org/issue39766> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39913] Document warnings.WarningMessage ?
New submission from daniel hahler : I've noticed that `warnings.WarningMessage` is not documented, i.e. it does not show up in the intersphinx object list. I'm not sure how to document it best, but maybe just describing its attributes? Ref: https://github.com/blueyed/cpython/blob/598d29c51c7b5a77f71eed0f615eb0b3865a4085/Lib/warnings.py#L398-L417 -- assignee: docs@python components: Documentation messages: 363735 nosy: blueyed, docs@python priority: normal severity: normal status: open title: Document warnings.WarningMessage ? ___ Python tracker <https://bugs.python.org/issue39913> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39967] bdb calls linecache.checkcache, resulting in source being different from code
New submission from daniel hahler : `Bdb.reset` calls `linecache.checkcache`, which will clear the cache for any updated source files. This however might result in displayed source code being different from the actual code, in case you are editing the file being currently debugged. I think it is better to keep the initially cached version (which might still get invalidated/checked via inspect itself), but that is another issue. The code is very old already, merged in b6775db241: commit b6775db241 Author: Guido van Rossum Date: Mon Aug 1 11:34:53 1994 + Merge alpha100 branch back to main trunk I will try a PR that removes it to see if it causes any test failures. Code ref: https://github.com/python/cpython/blob/598d29c51c7b5a77f71eed0f615eb0b3865a4085/Lib/bdb.py#L56-L57 -- components: Library (Lib) messages: 364224 nosy: blueyed priority: normal severity: normal status: open title: bdb calls linecache.checkcache, resulting in source being different from code versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue39967> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39967] bdb calls linecache.checkcache, resulting in source being different from code
Change by daniel hahler : -- keywords: +patch pull_requests: +18360 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19013 ___ Python tracker <https://bugs.python.org/issue39967> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37961] Tracemalloc traces do not include original stack trace length
Change by daniel hahler : -- nosy: +blueyed nosy_count: 2.0 -> 3.0 pull_requests: +22665 pull_request: https://github.com/python/cpython/pull/23805 ___ Python tracker <https://bugs.python.org/issue37961> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39041] Support GitHub Actions in CI
Daniel Hahler added the comment: Is it planned to enable coverage uploads for PRs? This would really help with seeing if code (to be merged) is covered etc. -- nosy: +blueyed2 ___ Python tracker <https://bugs.python.org/issue39041> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39041] Support GitHub Actions in CI
Change by Daniel Hahler : -- nosy: +blueyed -blueyed2 ___ Python tracker <https://bugs.python.org/issue39041> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39041] Support GitHub Actions in CI
Daniel Hahler added the comment: Brett, thanks for the reference. I've found https://discuss.python.org/t/coverage-report-in-github-ci-for-standard-library/2836/11, and https://bugs.python.org/issue40993 through it. -- ___ Python tracker <https://bugs.python.org/issue39041> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35212] Expressions with format specifiers in f-strings give wrong code position in AST
Change by daniel hahler : -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue35212> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22433] Argparse considers unknown optional arguments with spaces as a known positional argument
Change by daniel hahler : -- nosy: +blueyed nosy_count: 3.0 -> 4.0 pull_requests: +20102 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20924 ___ Python tracker <https://bugs.python.org/issue22433> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41033] readline.c: SEGFAULT on SIGWINCH when loaded twice
New submission from daniel hahler : The following will crash due to the signal handler calling itself recursively: ``` import os, readline, signal, sys del sys.modules["readline"] import readline os.kill(os.getpid(), signal.SIGWINCH) ``` This fixes it: ``` diff --git a/Modules/readline.c b/Modules/readline.c index 081657fb23..174e0117a9 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -967,6 +967,7 @@ readline_sigwinch_handler(int signum) { sigwinch_received = 1; if (sigwinch_ohandler && +sigwinch_ohandler != readline_sigwinch_handler && sigwinch_ohandler != SIG_IGN && sigwinch_ohandler != SIG_DFL) sigwinch_ohandler(signum); ``` It gets installed/saved in https://github.com/python/cpython/blob/01ece63d42b830df106948db0aefa6c1ba24416a/Modules/readline.c#L-L1112. Maybe it could also not save it in the first place if it is itself / has been installed already. Or, it could be uninstalled when the module is unloaded, if there is such a thing? I've seen the crash initially in a more complex setup, where it is not really clear why/how the readline module gets initialized twice really, but the above appears to simulate the situation. (Hints on where to break in gdb to see where/when a module gets unloaded would be appreciated) Added in https://github.com/python/cpython/commit/5dbbf1abba89ef1766759fbc9d5a5af02db49505 (3.5.2). -- components: Extension Modules messages: 371861 nosy: blueyed priority: normal severity: normal status: open title: readline.c: SEGFAULT on SIGWINCH when loaded twice type: crash versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue41033> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9348] Calling argparse's add_argument with the wrong number of metavars causes delayed error message
daniel hahler added the comment: This adds overhead, since it creates a formatter and uses it for formatting only for validation purposes. I think it is better to only have the error when the formatter is actually used (i.e. the help is displayed - which is not the typical use case, and it should be optimized for not displaying the help (i.e. only parsing args)). The error could be more specific than before/initially though, of course. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue9348> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41033] readline.c: SEGFAULT on SIGWINCH when loaded twice
daniel hahler added the comment: 91e1bc18bd (bpo-41194) reminded me of this. Maybe the same mechanism could be used here. -- ___ Python tracker <https://bugs.python.org/issue41033> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38854] Decorator breaks inspect.getsource
Change by daniel hahler : -- components: +Library (Lib) type: -> behavior versions: +Python 3.10, Python 3.9 ___ Python tracker <https://bugs.python.org/issue38854> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38854] Decorator with paren tokens in arguments breaks inspect.getsource
Change by daniel hahler : -- title: Decorator breaks inspect.getsource -> Decorator with paren tokens in arguments breaks inspect.getsource ___ Python tracker <https://bugs.python.org/issue38854> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15872] shutil.rmtree(..., ignore_errors=True) doesn't ignore all errors
Change by daniel hahler : -- nosy: +blueyed nosy_count: 11.0 -> 12.0 pull_requests: +21883 pull_request: https://github.com/python/cpython/pull/22967 ___ Python tracker <https://bugs.python.org/issue15872> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4489] shutil.rmtree is vulnerable to a symlink attack
Change by daniel hahler : -- nosy: +blueyed nosy_count: 18.0 -> 19.0 pull_requests: +21884 pull_request: https://github.com/python/cpython/pull/22968 ___ Python tracker <https://bugs.python.org/issue4489> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24120] pathlib.(r)glob stops on PermissionDenied exception
Change by daniel hahler : -- nosy: +blueyed nosy_count: 7.0 -> 8.0 pull_requests: +21942 pull_request: https://github.com/python/cpython/pull/23025 ___ Python tracker <https://bugs.python.org/issue24120> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38894] Path.glob() sometimes misses files that match
Change by daniel hahler : -- nosy: +blueyed nosy_count: 4.0 -> 5.0 pull_requests: +21943 pull_request: https://github.com/python/cpython/pull/23025 ___ Python tracker <https://bugs.python.org/issue38894> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36388] pdb: do_debug installs sys.settrace handler when used inside post_mortem
Change by daniel hahler : -- pull_requests: +22102 pull_request: https://github.com/python/cpython/pull/23202 ___ Python tracker <https://bugs.python.org/issue36388> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36969] pdb: do_args: display/handle keyword-only arguments
New submission from daniel hahler : With a program like the following, `args` will not display the keyword-only argument: ``` def f1(arg=None, *, kwonly=None): __import__('pdb').set_trace() f1() ``` ``` (Pdb) args arg = 'arg' kw = 'kw' ``` Related code: https://github.com/python/cpython/blob/5c08ce9bf712acbb3f05a3a57baf51fcb534cdf0/Lib/pdb.py#L1129-L1144 -- components: Library (Lib) messages: 342878 nosy: blueyed priority: normal severity: normal status: open title: pdb: do_args: display/handle keyword-only arguments type: behavior versions: Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue36969> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37011] pdb: restore original tracing function instead of sys.settrace(None)
New submission from daniel hahler : bdb/pdb currently uses `sys.settrace(None)` when uninstalling its trace function (trace_dispatch), but should rather store the original trace function in the beginning and use this instead of `None`. While typically pdb is not used in tests, it is just good practice, given that there can only be a single trace function. I've done this via monkeypatching for pdbpp's tests, which resulted in an easy 2% coverage gain (https://github.com/antocuni/pdb/pull/253). -- components: Library (Lib) messages: 343188 nosy: blueyed priority: normal severity: normal status: open title: pdb: restore original tracing function instead of sys.settrace(None) type: behavior versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue37011> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37011] pdb: restore original tracing function instead of sys.settrace(None)
Change by daniel hahler : -- versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue37011> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37011] pdb: restore original tracing function instead of sys.settrace(None)
daniel hahler added the comment: Looks great, thanks! -- ___ Python tracker <https://bugs.python.org/issue37011> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37022] pdb: do_p and do_pp swallow exceptions from __repr__
New submission from daniel hahler : Given: ``` class BadRepr: def __repr__(self): raise Exception('repr_exc') obj = BadRepr() __import__('pdb').set_trace() ``` ``` (Pdb) p obj (Pdb) pp obj (Pdb) ``` Possible patch - clumsy due to `self._getval` both printing any error already, and raising the exception: ``` diff --git i/Lib/pdb.py w/Lib/pdb.py index f5d33c27fc..59a419d961 100755 --- i/Lib/pdb.py +++ w/Lib/pdb.py @@ -1177,18 +1177,28 @@ def do_p(self, arg): Print the value of the expression. """ try: -self.message(repr(self._getval(arg))) +val = self._getval(arg) except: -pass +return +try: +self.message(repr(val)) +except: +exc_info = sys.exc_info()[:2] +self.error(traceback.format_exception_only(*exc_info)[-1].strip()) def do_pp(self, arg): """pp expression Pretty-print the value of the expression. """ try: -self.message(pprint.pformat(self._getval(arg))) +val = self._getval(arg) except: -pass +return +try: +self.message(pprint.pformat(val)) +except: +exc_info = sys.exc_info()[:2] +self.error(traceback.format_exception_only(*exc_info)[-1].strip()) complete_print = _complete_expression complete_p = _complete_expression ``` -- components: Library (Lib) messages: 343306 nosy: blueyed priority: normal severity: normal status: open title: pdb: do_p and do_pp swallow exceptions from __repr__ type: behavior versions: Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue37022> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37022] pdb: do_p and do_pp swallow exceptions from __repr__
daniel hahler added the comment: Thanks for the feedback. What do you think of refactoring the common block (also used in other places) into a method? +except: +exc_info = sys.exc_info()[:2] +self.error(traceback.format_exception_only(*exc_info)[-1].strip()) This could/should be done separately probably then, just want your opinion on it. This would also allow to customize/override it in a single place then (e.g. with pdbpp I am displaying tracebacks for errors, which is done via error() currently then). -- ___ Python tracker <https://bugs.python.org/issue37022> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37011] pdb: restore original tracing function instead of sys.settrace(None)
daniel hahler added the comment: > In that case the proposed change builds an implicit stack of trace functions > that is increased each time the interpreter executes this hard breakpoint Very valid and good point. Would it work to store it on the class then (once)? FWIW: pdbpp uses a global Pdb instance - mainly to support the use case of hard breakpoints like this (to remember/re-use its configuration then). -- ___ Python tracker <https://bugs.python.org/issue37011> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37011] pdb: restore original tracing function instead of sys.settrace(None)
daniel hahler added the comment: I've just found that I've created an issue with regard to `do_debug` for this already (https://bugs.python.org/issue36388), and a PR: https://github.com/python/cpython/pull/12479. -- ___ Python tracker <https://bugs.python.org/issue37011> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37011] pdb: restore original tracing function instead of sys.settrace(None)
daniel hahler added the comment: >From my initial comment: > I've done this via monkeypatching for pdbpp's tests, which resulted in an > easy 2% coverage gain (https://github.com/antocuni/pdb/pull/253). It will also affect running tests with coverage (in general, or using tools like pytest-testmon), and using pdb.set_trace then (either for debugging, or via post-mortem, e.g. pytest's `--pdb`). -- ___ Python tracker <https://bugs.python.org/issue37011> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37011] pdb: restore original tracing function instead of sys.settrace(None)
daniel hahler added the comment: Just for reference: I've just spent quite some time debugging missing coverage with pytest, and it turned out that part of it is because of this issue. Most of the pdb related tests run in a subprocess (via pexpect), but not all of them. I am using a wrapper now to restore this manually (https://github.com/pytest-dev/pytest/pull/5406). Even though I was aware of this issue, it took me quite a while, mainly because this started out with slash related issues for Windows only, and I was debugging this on/via CI only at first. -- ___ Python tracker <https://bugs.python.org/issue37011> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36786] "make install" should run compileall in parallel
daniel hahler added the comment: This can be closed as per https://github.com/python/cpython/commit/1a2dd82f56bd813aacc570e172cefe55a8a41504. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue36786> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37175] make install: make compileall optional
New submission from daniel hahler : I'd like to make running compileall optionally during installation, since it takes quite a while by itself (with lots of output), and gets a bit into the way when installing often (e.g. with git-bisect). AFAIK it should not be required, because the files would be compiled on demand as usual. I could imagine having an explicit target for this, or a make variable to control this, i.e. "make install COMPILEALL=0". -- components: Installation messages: 344812 nosy: blueyed priority: normal severity: normal status: open title: make install: make compileall optional type: enhancement versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue37175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37032] Add CodeType.replace() method
daniel hahler added the comment: Thanks for this great improvement! Was about to suggest having something more futureproof when noticing this with pdbpp, found this, and submitted PRs to use it for ipython and hypothesis also. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue37032> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26967] argparse: allow_abbrev=False stops -vv from working
daniel hahler added the comment: https://github.com/python/cpython/pull/14316 has a fix. -- nosy: +blueyed versions: +Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue26967> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37634] doc: "module" of a warning might be its filename
New submission from daniel hahler : With e.g. DeprecationWarnings for "invalid escape sequence" the "module" part is the file name (with ".py" removed), because it calls PyErr_WarnExplicitObject directly: https://github.com/python/cpython/blob/3cba3d3c55f230a59174a0dfcafb1d4685269e60/Python/ast.c#L4668-L4692 While this properly cannot be fixed to have the module name (yet), it should at least be documented then. With `warnings.warn` the module is set via `setup_context` (https://github.com/python/cpython/blob/3cba3d3c55f230a59174a0dfcafb1d4685269e60/Python/_warnings.c#L932-L933). This conflicts with https://github.com/python/cpython/pull/9358 (issue34624), which enables the documented behavior to not escape the pattern there. -- components: Library (Lib) messages: 348201 nosy: blueyed priority: normal severity: normal status: open title: doc: "module" of a warning might be its filename type: behavior versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue37634> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34624] -W option and PYTHONWARNINGS env variable does not accept module regexes
daniel hahler added the comment: Note that "module" might also be the filename (with ".py" removed). I've just created issue37634 - might be worth including in your PR if it makes sense to only document this. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue34624> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21161] list comprehensions don't see local variables in pdb in python3
daniel hahler added the comment: Georg, please consider re-opening. This patch here appears to fix this after all. -- nosy: +blueyed versions: +Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue21161> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37803] "python -m pdb --help" does not work
New submission from daniel hahler : The long options passed to `getopt.getopt` should not include the leading dashes: % python -m pdb --help Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/daniel/src/pdbpp/pdb.py", line 1672, in pdb.main() File "/usr/lib/python3.7/pdb.py", line 1662, in main opts, args = getopt.getopt(sys.argv[1:], 'mhc:', ['--help', '--command=']) File "/usr/lib/python3.7/getopt.py", line 93, in getopt opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) File "/usr/lib/python3.7/getopt.py", line 157, in do_longs has_arg, opt = long_has_args(opt, longopts) File "/usr/lib/python3.7/getopt.py", line 174, in long_has_args raise GetoptError(_('option --%s not recognized') % opt, opt) getopt.GetoptError: option --help not recognized (it works in Python 2.7) -- components: Library (Lib) messages: 349291 nosy: blueyed priority: normal severity: normal status: open title: "python -m pdb --help" does not work type: behavior versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue37803> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37803] "python -m pdb --help" does not work
Change by daniel hahler : -- keywords: +patch pull_requests: +14925 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15193 ___ Python tracker <https://bugs.python.org/issue37803> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21161] list comprehensions don't see local variables in pdb in python3
Change by daniel hahler : -- pull_requests: +14926 pull_request: https://github.com/python/cpython/pull/15194 ___ Python tracker <https://bugs.python.org/issue21161> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31495] Wrong offset with IndentationError ("expected an indented block")
New submission from daniel hahler: Given the following file `t-expected-indent.py`: ``` if 1: foo ``` python t-expected-indent.py reports: ``` File "t-expected-indent.py", line 2 foo ^ IndentationError: expected an indented block ``` However, it should get reported for column 1 instead of 3. -- components: Interpreter Core messages: 302354 nosy: blueyed priority: normal severity: normal status: open title: Wrong offset with IndentationError ("expected an indented block") type: behavior versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue31495> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35931] pdb: "debug print(" crashes with SyntaxError
Change by daniel hahler : -- keywords: +patch pull_requests: +11767 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35931] pdb: "debug print(" crashes with SyntaxError
Change by daniel hahler : -- keywords: +patch, patch pull_requests: +11767, 11768 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35931] pdb: "debug print(" crashes with SyntaxError
New submission from daniel hahler : `debug print(` will make pdb crash with a SyntaxError: % python -c '__import__("pdb").set_trace()' --Return-- > (1)()->None (Pdb) print( *** SyntaxError: unexpected EOF while parsing (Pdb) debug print( ENTERING RECURSIVE DEBUGGER Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.7/bdb.py", line 92, in trace_dispatch return self.dispatch_return(frame, arg) File "/usr/lib64/python3.7/bdb.py", line 151, in dispatch_return self.user_return(frame, arg) File "/usr/lib64/python3.7/pdb.py", line 293, in user_return self.interaction(frame, None) File "/usr/lib64/python3.7/pdb.py", line 352, in interaction self._cmdloop() File "/usr/lib64/python3.7/pdb.py", line 321, in _cmdloop self.cmdloop() File "/usr/lib64/python3.7/cmd.py", line 138, in cmdloop stop = self.onecmd(line) File "/usr/lib64/python3.7/pdb.py", line 418, in onecmd return cmd.Cmd.onecmd(self, line) File "/usr/lib64/python3.7/cmd.py", line 217, in onecmd return func(arg) File "/usr/lib64/python3.7/pdb.py", line 1099, in do_debug sys.call_tracing(p.run, (arg, globals, locals)) File "/usr/lib64/python3.7/bdb.py", line 582, in run cmd = compile(cmd, "", "exec") File "", line 1 print( ^ SyntaxError: unexpected EOF while parsing -- components: Library (Lib) messages: 335025 nosy: blueyed priority: normal severity: normal status: open title: pdb: "debug print(" crashes with SyntaxError versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue35931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35931] pdb: "debug print(" crashes with SyntaxError
daniel hahler added the comment: Thanks for the review and backport! -- ___ Python tracker <https://bugs.python.org/issue35931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31078] pdb's debug command (Pdb.do_debug) doesn't use rawinput even if the parent pdb uses rawinput
daniel hahler added the comment: I can confirm that this fixes cursor keys not working properly after "debug foo()" (recursive debugging) with pdb. -- nosy: +blueyed versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue31078> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35931] pdb: "debug print(" crashes with SyntaxError
daniel hahler added the comment: Re-opening: it currently still crashes with a NameError when using "debug doesnotexist", or "debug doesnotexist()". Will create a new PR for this. -- status: closed -> open ___ Python tracker <https://bugs.python.org/issue35931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35931] pdb: "debug print(" crashes with SyntaxError
Change by daniel hahler : -- pull_requests: +12109 stage: resolved -> patch review ___ Python tracker <https://bugs.python.org/issue35931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13120] Default nosigint option to pdb.Pdb() prevents use in non-main thread
Change by daniel hahler : -- pull_requests: +12238 ___ Python tracker <https://bugs.python.org/issue13120> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36250] pdb: interaction might cause "ValueError: signal only works in main thread"
New submission from daniel hahler : This is similar to https://bugs.python.org/issue13120. I have a patch for a fix already, but no test - will add a PR for it. Fixed in pdbpp in https://github.com/antocuni/pdb/pull/143, which also has a test that demonstrates it. -- components: Library (Lib) messages: 337572 nosy: blueyed priority: normal severity: normal status: open title: pdb: interaction might cause "ValueError: signal only works in main thread" versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue36250> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36250] pdb: interaction might cause "ValueError: signal only works in main thread"
Change by daniel hahler : -- keywords: +patch pull_requests: +12239 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36250> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13120] Default nosigint option to pdb.Pdb() prevents use in non-main thread
daniel hahler added the comment: Just for reference: there is a similar issue with `interaction`: https://bugs.python.org/issue36250. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue13120> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35931] pdb: "debug print(" crashes with SyntaxError
daniel hahler added the comment: Bumping. The first (merged) patch is not sufficient, and causes even an API breakage, because it disallows passing in a code object (via compile()) anymore. A better fix is waiting at https://github.com/python/cpython/pull/12103, and should also get backported to for 3.7.3 then (or the first backport being reverted). -- resolution: fixed -> ___ Python tracker <https://bugs.python.org/issue35931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35931] pdb: "debug print(" crashes with SyntaxError
daniel hahler added the comment: Example of the API breakage: ``` /opt/python/3.8-dev/lib/python3.8/pdb.py:321: in _cmdloop self.cmdloop() /opt/python/3.8-dev/lib/python3.8/cmd.py:138: in cmdloop stop = self.onecmd(line) /opt/python/3.8-dev/lib/python3.8/pdb.py:418: in onecmd return cmd.Cmd.onecmd(self, line) /opt/python/3.8-dev/lib/python3.8/cmd.py:217: in onecmd return func(arg) pdb.py:699: in do_debug return orig_do_debug(self, cmd) /opt/python/3.8-dev/lib/python3.8/pdb.py:1097: in do_debug code = compile(arg, "", "exec") E TypeError: compile() arg 1 must be a string, bytes or AST object ``` (via https://travis-ci.org/antocuni/pdb/jobs/504061679#L367) -- ___ Python tracker <https://bugs.python.org/issue35931> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36335] Factor out / add bdb.Bdb.is_skipped_frame
New submission from daniel hahler : In https://bugs.python.org/issue36130 is_skipped_module was changed to handle frames without __name__, but I think it makes sense being able to skip e.g. frames on frame.f_code.co_name then. Factoring out is_skipped_frame allows for this. The default implementation would call is_skipped_module if there are any skip patterns, and return False otherwise. -- components: Library (Lib) messages: 338159 nosy: blueyed priority: normal severity: normal status: open title: Factor out / add bdb.Bdb.is_skipped_frame type: enhancement versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue36335> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36335] Factor out / add bdb.Bdb.is_skipped_frame
Change by daniel hahler : -- keywords: +patch pull_requests: +12347 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36335> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36264] os.path.expanduser should not use HOME on windows
daniel hahler added the comment: Just as a sidenote: the other day I was checking Python's source to see how to override a user's home (in tests, when os.path.expanduser` is used in code), and found it easy to just set $HOME in the environment in the end. I guess this change will cause quite some regressions in this regard - even though $HOME might not be used in practice on Windows. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue36264> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36388] pdb: do_debug installs sys.settrace handler when used inside post_mortem
New submission from daniel hahler : It seems like the "debug" command is not properly handled with "post_mortem()". It appears due to using `sys.settrace(self.trace_dispatch)` in the end of `do_debug`, although no tracing is installed with post_mortem in the first place. More info: Given the following test script: ``` def exc(): raise Exception() try: exc() except Exception: import pdb pdb.post_mortem() ``` The behavior with just "quit" is fine: ``` % python3.8 t_pdb.py > …/project/t_pdb.py(2)exc() -> raise Exception() (Pdb) q ``` But when using `debug` inside of it, it will stop at `cmd.postcmd`, and you have to use "continue" twice: ``` % python3.8 t_pdb.py > …/project/t_pdb.py(2)exc() -> raise Exception() (Pdb) debug print(1) ENTERING RECURSIVE DEBUGGER > (1)() ((Pdb)) c 1 LEAVING RECURSIVE DEBUGGER > …/pyenv/3.8-dev/lib/python3.8/cmd.py(159)postcmd() -> return stop (Pdb) c (Pdb) c ``` Also when using `quit` inside of the `debug`: ``` % python3.8 t_pdb.py > …/project/t_pdb.py(2)exc() -> raise Exception() (Pdb) debug print(1) ENTERING RECURSIVE DEBUGGER > (1)() ((Pdb)) q LEAVING RECURSIVE DEBUGGER > …/pyenv/3.8-dev/lib/python3.8/cmd.py(159)postcmd() -> return stop (Pdb) c (Pdb) c ``` When using `quit` when at `postcmd()` it will even raise `BdbQuit`: ``` % python3.8 t_pdb.py > …/project/t_pdb.py(2)exc() -> raise Exception() (Pdb) debug print(1) ENTERING RECURSIVE DEBUGGER > (1)() ((Pdb)) q LEAVING RECURSIVE DEBUGGER > …/pyenv/3.8-dev/lib/python3.8/cmd.py(159)postcmd() -> return stop (Pdb) q Traceback (most recent call last): File "t_pdb.py", line 6, in exc() File "t_pdb.py", line 2, in exc raise Exception() Exception During handling of the above exception, another exception occurred: Traceback (most recent call last): File "t_pdb.py", line 9, in pdb.post_mortem() File "…/pyenv/3.8-dev/lib/python3.8/pdb.py", line 1626, in post_mortem p.interaction(None, t) File "…/pyenv/3.8-dev/lib/python3.8/pdb.py", line 352, in interaction self._cmdloop() File "…/pyenv/3.8-dev/lib/python3.8/pdb.py", line 321, in _cmdloop self.cmdloop() File "…/pyenv/3.8-dev/lib/python3.8/cmd.py", line 139, in cmdloop stop = self.postcmd(stop, line) File "…/pyenv/3.8-dev/lib/python3.8/cmd.py", line 159, in postcmd return stop File "…/pyenv/3.8-dev/lib/python3.8/cmd.py", line 159, in postcmd return stop File "…/pyenv/3.8-dev/lib/python3.8/bdb.py", line 88, in trace_dispatch return self.dispatch_line(frame) File "…/pyenv/3.8-dev/lib/python3.8/bdb.py", line 113, in dispatch_line if self.quitting: raise BdbQuit bdb.BdbQuit ``` -- components: Library (Lib) messages: 338531 nosy: blueyed priority: normal severity: normal status: open title: pdb: do_debug installs sys.settrace handler when used inside post_mortem versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue36388> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36388] pdb: do_debug installs sys.settrace handler when used inside post_mortem
Change by daniel hahler : -- keywords: +patch pull_requests: +12431 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36388> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24565] the f_lineno getter is broken
Change by daniel hahler : -- versions: +Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue24565> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36474] RecursionError resets trace function set via sys.settrace
New submission from daniel hahler : A RecursionError causes the trace function set via `sys.settrace` to get removed/unset. Given the following script: ``` import sys def trace(*args): print("trace", args) return trace sys.settrace(trace) def f(): f() print(sys.gettrace()) try: f() except Exception as exc: print(exc) print(sys.gettrace()) ``` Running it will output: ``` trace (, 'call', None) trace (, 'line', None) trace (, 'call', None) trace (, 'line', None) … trace (, 'call', None) trace (, 'line', None) trace maximum recursion depth exceeded while getting the repr of an object None ``` -- components: Interpreter Core messages: 339135 nosy: blueyed priority: normal severity: normal status: open title: RecursionError resets trace function set via sys.settrace versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue36474> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36474] RecursionError resets trace function set via sys.settrace
daniel hahler added the comment: Discovered via / relevant for coverage's PyTracer: https://github.com/nedbat/coveragepy/issues/787. -- ___ Python tracker <https://bugs.python.org/issue36474> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36494] bdb: should set f_trace_lines = True
New submission from daniel hahler : bdb.Bdb.set_trace should set "f_trace_lines = True" on frames explicitly. Otherwise they might be skipped if something else has set it to False already, e.g. via a suggested change for coverage.py to set this for performance reasons (https://github.com/nedbat/coveragepy/pull/791). -- messages: 339259 nosy: blueyed priority: normal severity: normal status: open title: bdb: should set f_trace_lines = True versions: Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue36494> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36494] bdb: should set f_trace_lines = True
Change by daniel hahler : -- keywords: +patch pull_requests: +12572 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36494> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36494] bdb.Bdb.set_trace: should set f_trace_lines = True
Change by daniel hahler : -- components: +Library (Lib) title: bdb: should set f_trace_lines = True -> bdb.Bdb.set_trace: should set f_trace_lines = True type: -> behavior ___ Python tracker <https://bugs.python.org/issue36494> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14841] os.get_terminal_size() should check stdin as a fallback
Change by daniel hahler : -- keywords: +patch pull_requests: +12622 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue14841> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14841] os.get_terminal_size() should check stdin as a fallback
daniel hahler added the comment: Created a PR at https://github.com/python/cpython/pull/12697. It prefers stdin and stderr over stdout. I think stdin is most likely connected to a terminal, and wondered why ncurses uses stderr/stdout first, and only then stdin. stdin handling was added there in https://github.com/mirror/ncurses/commit/aa70bf3c#diff-10ad6ea20599ac9258757354665b80cbR1295, and it looks just like an oversight maybe - it is also not that critical in C I guess. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue14841> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36550] Avoid creating AttributeError exceptions in the debugger
New submission from daniel hahler : pdb should try (hard) to avoid creating unnecessary exceptions, e.g. ``AttributeError`` when looking up commands, since this will show up in exception chains then (as "'Pdb' object has no attribute 'do_foo'"). See https://github.com/python/cpython/pull/4666 for an older PR in this regard. My use case is to display the traceback for exceptions caused within/via Pdb.default(), to see more context when running code from pdb's prompt directly, where currently it would only display the exception itself. -- components: Library (Lib) messages: 339583 nosy: blueyed priority: normal severity: normal status: open title: Avoid creating AttributeError exceptions in the debugger versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue36550> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36550] Avoid creating AttributeError exceptions in the debugger
Change by daniel hahler : -- keywords: +patch pull_requests: +12643 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36550> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36563] pdbrc home twice
Change by daniel hahler : -- nosy: blueyed priority: normal severity: normal status: open title: pdbrc home twice ___ Python tracker <https://bugs.python.org/issue36563> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36563] pdbrc is read twice if current directory is the home directory
New submission from daniel hahler : If $HOME is $PWD, .pdbrc is read twice. This confused me when seeing intentional errors from there twice during tests. It should be only read once. -- components: +Library (Lib) title: pdbrc home twice -> pdbrc is read twice if current directory is the home directory versions: +Python 3.9 ___ Python tracker <https://bugs.python.org/issue36563> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36563] pdbrc is read twice if current directory is the home directory
Change by daniel hahler : -- keywords: +patch pull_requests: +12654 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36563> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36663] pdb: store whole exception information in locals (via user_exception)
New submission from daniel hahler : Currently Pdb.user_exception does not store the traceback in "user_exception", but only passes it to `interaction`: def user_exception(self, frame, exc_info): """This function is called if an exception occurs, but only if we are to stop at or just below this level.""" if self._wait_for_mainpyfile: return exc_type, exc_value, exc_traceback = exc_info frame.f_locals['__exception__'] = exc_type, exc_value … self.interaction(frame, exc_traceback) I think it would be useful to have the whole exception info at hand in the debugger (via the frame locals) directly. If backward compatible is important it should use a new name for this maybe (`__excinfo__`), i.e. if current code would assume `__exception__` to be of length 2 only. But on the other hand this only affects extensions to the debugger, and not "real" programs, and therefore backward compatibility is not really required here? Currenly pdb extensions (e.g. pdbpp) can get it either by going up in the stack, or grabbing it via `interaction`, but this issue is mainly about making it available in plain pdb for the user to interact with. Code ref: https://github.com/python/cpython/blob/e8113f51a8bdf33188ee30a1c038a298329e7bfa/Lib/pdb.py#L295-L301 -- components: Library (Lib) messages: 340512 nosy: blueyed priority: normal severity: normal status: open title: pdb: store whole exception information in locals (via user_exception) versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue36663> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14788] Pdb debugs itself after ^C and a breakpoint is set anywhere
daniel hahler added the comment: I think this issue itself might be fixed already / changed since 3.5. I've came up with something similar in this area though, which is only triggered when using Ctrl-C while pdb is waiting for the next statement: https://github.com/python/cpython/pull/12880 -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue14788> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22135] allow to break into pdb with Ctrl-C for all the commands that resume execution
daniel hahler added the comment: Would be nice to have this indeed. Please consider creating a PR with an updated patch then for easier review. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue22135> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36667] pdb: restore SIGINT handler in sigint_handler already
New submission from daniel hahler : Without this, and additional SIGINT while waiting for the next statement (e.g. during `time.sleep`) will stop at `sigint_handler`. With this patch: > …/t-pdb-sigint-in-sleep.py(10)() -> sleep() (Pdb) c ^C Program interrupted. (Use 'cont' to resume). ^CKeyboardInterrupt > …/t-pdb-sigint-in-sleep.py(6)sleep() -> time.sleep(10) (Pdb) Without this patch: > …/t-pdb-sigint-in-sleep.py(10)() -> sleep() (Pdb) c ^C Program interrupted. (Use 'cont' to resume). ^C--Call-- > …/cpython/Lib/pdb.py(188)sigint_handler() -> def sigint_handler(self, signum, frame): (Pdb) This was changed / regressed in https://github.com/python/cpython/commit/10e54aeaa234f2806b367c66e3fb4ac6568b39f6 (3.5.3rc1?), when it was moved while fixing issue 20766. -- components: Library (Lib) messages: 340539 nosy: blueyed priority: normal severity: normal status: open title: pdb: restore SIGINT handler in sigint_handler already type: behavior versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue36667> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36667] pdb: restore SIGINT handler in sigint_handler already
Change by daniel hahler : -- keywords: +patch pull_requests: +12804 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36667> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20766] reference leaks in pdb
daniel hahler added the comment: Please see https://bugs.python.org/issue36667 for a followup. It does not look like moving it to `interaction` is relevant for fixing the leak, is it? I think it should be restored in both places. -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue20766> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35824] http.cookies._CookiePattern modifying regular expressions
daniel hahler added the comment: Another example of a value that fails to parse is if "-" is used instead of "GMT", which is the case with GitHub: > Set-Cookie: has_recent_activity=1; path=/; expires=Mon, 22 Apr 2019 23:27:18 > - So using a regular expression here to only parse the sane-cookie-date format (that is recommended for output) is wrong. The last change to it was in 2012 only (https://github.com/python/cpython/commit/aeeba2629aa52e4e73e19a1502b3d3133ea68dec) -- nosy: +blueyed ___ Python tracker <https://bugs.python.org/issue35824> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35824] http.cookies._CookiePattern modifying regular expressions
daniel hahler added the comment: http.cookiejar parses this correctly, using http2time: >>> import http.cookiejar >>> http.cookiejar.parse_ns_headers(["has_recent_activity=1; path=/; expires=Mon, 22 Apr 2019 23:27:18 -"]) [[('has_recent_activity', '1'), ('path', '/'), ('expires', 1555975638), ('version', '0')]] Ref: https://github.com/python/cpython/blob/9f316bd9684d27b7e21fbf43ca86dc5e65dac4af/Lib/http/cookiejar.py#L204-L249 -- ___ Python tracker <https://bugs.python.org/issue35824> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com