Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,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
34 changes: 34 additions & 0 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,40 @@ 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"',
... '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) c
"""
Comment thread
gaogaotiantian marked this conversation as resolved.

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