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.
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
-------
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 = []
(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.
--- /dev/null
+Make expressions/statements work as expected in pdb