Skip to content

gh-133438: Fix the use of the terms "argument" and "parameter" in dis.show_code() #135170

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions Lib/dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ def _format_code_info(co):
lines = []
lines.append("Name: %s" % co.co_name)
lines.append("Filename: %s" % co.co_filename)
lines.append("Argument count: %s" % co.co_argcount)
lines.append("Positional-only arguments: %s" % co.co_posonlyargcount)
lines.append("Kw-only arguments: %s" % co.co_kwonlyargcount)
lines.append("Positional parameters: %s" % co.co_argcount)
lines.append("Positional-only parameters: %s" % co.co_posonlyargcount)
lines.append("Keyword-only parameters: %s" % co.co_kwonlyargcount)
lines.append("Number of locals: %s" % co.co_nlocals)
lines.append("Stack size: %s" % co.co_stacksize)
lines.append("Flags: %s" % pretty_flags(co.co_flags))
Expand Down
42 changes: 21 additions & 21 deletions Lib/test/test_dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,9 +1461,9 @@ def get_disassembly(self, func, lasti=-1, wrapper=True, **kwargs):
code_info_code_info = f"""\
Name: code_info
Filename: (.*)
Argument count: 1
Positional-only arguments: 0
Kw-only arguments: 0
Positional parameters: 1
Positional-only parameters: 0
Keyword-only parameters: 0
Number of locals: 1
Stack size: \\d+
Flags: OPTIMIZED, NEWLOCALS, HAS_DOCSTRING
Expand All @@ -1485,9 +1485,9 @@ def f(c=c):
code_info_tricky = """\
Name: tricky
Filename: (.*)
Argument count: 5
Positional-only arguments: 2
Kw-only arguments: 3
Positional parameters: 5
Positional-only parameters: 2
Keyword-only parameters: 3
Number of locals: 10
Stack size: \\d+
Flags: OPTIMIZED, NEWLOCALS, VARARGS, VARKEYWORDS, GENERATOR
Expand Down Expand Up @@ -1520,9 +1520,9 @@ def f(c=c):

code_info_tricky_nested_f = """\
Filename: (.*)
Argument count: 1
Positional-only arguments: 0
Kw-only arguments: 0
Positional parameters: 1
Positional-only parameters: 0
Keyword-only parameters: 0
Number of locals: 1
Stack size: \\d+
Flags: OPTIMIZED, NEWLOCALS, NESTED
Expand All @@ -1543,9 +1543,9 @@ def f(c=c):
code_info_expr_str = """\
Name: <module>
Filename: <disassembly>
Argument count: 0
Positional-only arguments: 0
Kw-only arguments: 0
Positional parameters: 0
Positional-only parameters: 0
Keyword-only parameters: 0
Number of locals: 0
Stack size: \\d+
Flags: 0x0
Expand All @@ -1557,9 +1557,9 @@ def f(c=c):
code_info_simple_stmt_str = """\
Name: <module>
Filename: <disassembly>
Argument count: 0
Positional-only arguments: 0
Kw-only arguments: 0
Positional parameters: 0
Positional-only parameters: 0
Keyword-only parameters: 0
Number of locals: 0
Stack size: \\d+
Flags: 0x0
Expand All @@ -1572,9 +1572,9 @@ def f(c=c):
code_info_compound_stmt_str = """\
Name: <module>
Filename: <disassembly>
Argument count: 0
Positional-only arguments: 0
Kw-only arguments: 0
Positional parameters: 0
Positional-only parameters: 0
Keyword-only parameters: 0
Number of locals: 0
Stack size: \\d+
Flags: 0x0
Expand All @@ -1592,9 +1592,9 @@ async def async_def():
code_info_async_def = """\
Name: async_def
Filename: (.*)
Argument count: 0
Positional-only arguments: 0
Kw-only arguments: 0
Positional parameters: 0
Positional-only parameters: 0
Keyword-only parameters: 0
Number of locals: 2
Stack size: \\d+
Flags: OPTIMIZED, NEWLOCALS, COROUTINE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix the use of the terms "argument" and "parameter" in
:func:`dis.show_code`.
Loading