Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-108463: Make expressions/statements work as expected in pdb#108464

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletionsDoc/library/pdb.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -252,6 +252,10 @@ change a variable or call a function. When an exception occurs in such a
statement, the exception name is printed but the debugger's state is not
changed.

.. versionchanged:: 3.13
Expressions/Statements whose prefix is a pdb command are now correctly
identified and executed.

The debugger supports :ref:`aliases <debugger-aliases>`. Aliases can have
parameters which allows one a certain level of adaptability to the context under
examination.
Expand Down
4 changes: 4 additions & 0 deletionsDoc/whatsnew/3.13.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -173,6 +173,10 @@ pdb
the new ``exceptions [exc_number]`` command for Pdb. (Contributed by Matthias
Bussonnier in :gh:`106676`.)

* Expressions/Statements whose prefix is a pdb command are now correctly
identified and executed.
(Contributed by Tian Gao in :gh:`108464`.)

sqlite3
-------

Expand Down
3 changes: 3 additions & 0 deletionsLib/pdb.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -237,6 +237,9 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None,
pass
self.allow_kbdint = False
self.nosigint = nosigint
# Consider these characters as part of the command so when the users type
# c.a or c['a'], it won't be recognized as a c(ontinue) command
self.identchars = cmd.Cmd.identchars + '=.[](),"\'+-*/%@&|<>~^'

# Read ~/.pdbrc and ./.pdbrc
self.rcLines = []
Expand Down
40 changes: 40 additions & 0 deletionsLib/test/test_pdb.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1957,6 +1957,46 @@ def test_pdb_multiline_statement():
(Pdb) c
"""

def test_pdb_show_attribute_and_item():
"""Test for multiline statement

>>> def test_function():
... n = lambda x: x
... c = {"a": 1}
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
... pass

>>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE
... 'c["a"]',
... 'c.get("a")',
... 'n(1)',
... 'j=1',
... 'j+1',
... 'r"a"',
... 'next(iter([1]))',
... 'list((0, 1))',
... 'c'
... ]):
... test_function()
> <doctest test.test_pdb.test_pdb_show_attribute_and_item[0]>(5)test_function()
-> pass
(Pdb) c["a"]
1
(Pdb) c.get("a")
1
(Pdb) n(1)
1
(Pdb) j=1
(Pdb) j+1
2
(Pdb) r"a"
'a'
(Pdb) next(iter([1]))
1
(Pdb) list((0, 1))
[0, 1]
(Pdb) c
"""

def test_pdb_issue_20766():
"""Test for reference leaks when the SIGINT handler is set.
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
Make expressions/statements work as expected in pdb

[8]ページ先頭

©2009-2025 Movatter.jp