Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bf457c7d
Commit
bf457c7d
authored
May 21, 2019
by
Rémi Lapeyre
Committed by
Pablo Galindo
May 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36969: Make PDB args command display keyword only arguments (GH-13452)
parent
1a3faf9d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
7 deletions
+26
-7
Lib/pdb.py
Lib/pdb.py
+3
-3
Lib/test/test_pdb.py
Lib/test/test_pdb.py
+21
-4
Misc/NEWS.d/next/Library/2019-05-20-23-31-20.bpo-36969.JkZORP.rst
...S.d/next/Library/2019-05-20-23-31-20.bpo-36969.JkZORP.rst
+2
-0
No files found.
Lib/pdb.py
View file @
bf457c7d
...
...
@@ -1132,9 +1132,9 @@ class Pdb(bdb.Bdb, cmd.Cmd):
"""
co
=
self
.
curframe
.
f_code
dict
=
self
.
curframe_locals
n
=
co
.
co_argcount
if
co
.
co_flags
&
4
:
n
=
n
+
1
if
co
.
co_flags
&
8
:
n
=
n
+
1
n
=
co
.
co_argcount
+
co
.
co_kwonlyargcount
if
co
.
co_flags
&
inspect
.
CO_VARARGS
:
n
=
n
+
1
if
co
.
co_flags
&
inspect
.
CO_VARKEYWORDS
:
n
=
n
+
1
for
i
in
range
(
n
):
name
=
co
.
co_varnames
[
i
]
if
name
in
dict
:
...
...
Lib/test/test_pdb.py
View file @
bf457c7d
...
...
@@ -77,9 +77,13 @@ def test_pdb_basic_commands():
... print('...')
... return foo.upper()
>>> def test_function3(arg=None, *, kwonly=None):
... pass
>>> def test_function():
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
... ret = test_function_2('baz')
... test_function3(kwonly=True)
... print(ret)
>>> with PdbTestInput([ # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
...
...
@@ -97,10 +101,13 @@ def test_pdb_basic_commands():
... 'jump 8', # jump over second for loop
... 'return', # return out of function
... 'retval', # display return value
... 'next', # step to test_function3()
... 'step', # stepping into test_function3()
... 'args', # display function args
... 'continue',
... ]):
... test_function()
> <doctest test.test_pdb.test_pdb_basic_commands[
1
]>(3)test_function()
> <doctest test.test_pdb.test_pdb_basic_commands[
2
]>(3)test_function()
-> ret = test_function_2('baz')
(Pdb) step
--Call--
...
...
@@ -123,14 +130,14 @@ def test_pdb_basic_commands():
[EOF]
(Pdb) bt
...
<doctest test.test_pdb.test_pdb_basic_commands[
2]>(18
)<module>()
<doctest test.test_pdb.test_pdb_basic_commands[
3]>(21
)<module>()
-> test_function()
<doctest test.test_pdb.test_pdb_basic_commands[
1
]>(3)test_function()
<doctest test.test_pdb.test_pdb_basic_commands[
2
]>(3)test_function()
-> ret = test_function_2('baz')
> <doctest test.test_pdb.test_pdb_basic_commands[0]>(1)test_function_2()
-> def test_function_2(foo, bar='default'):
(Pdb) up
> <doctest test.test_pdb.test_pdb_basic_commands[
1
]>(3)test_function()
> <doctest test.test_pdb.test_pdb_basic_commands[
2
]>(3)test_function()
-> ret = test_function_2('baz')
(Pdb) down
> <doctest test.test_pdb.test_pdb_basic_commands[0]>(1)test_function_2()
...
...
@@ -168,6 +175,16 @@ def test_pdb_basic_commands():
-> return foo.upper()
(Pdb) retval
'BAZ'
(Pdb) next
> <doctest test.test_pdb.test_pdb_basic_commands[2]>(4)test_function()
-> test_function3(kwonly=True)
(Pdb) step
--Call--
> <doctest test.test_pdb.test_pdb_basic_commands[1]>(1)test_function3()
-> def test_function3(arg=None, *, kwonly=None):
(Pdb) args
arg = None
kwonly = True
(Pdb) continue
BAZ
"""
...
...
Misc/NEWS.d/next/Library/2019-05-20-23-31-20.bpo-36969.JkZORP.rst
0 → 100644
View file @
bf457c7d
PDB command `args` now display keyword only arguments. Patch contributed by
Rémi Lapeyre.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment