Skip to content

Commit cfe4bf3

Browse files
gh-133438: Fix the use of the terms "argument" and "parameter" in dis.show_code()
1 parent 3d396ab commit cfe4bf3

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

Lib/dis.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ def _format_code_info(co):
246246
lines = []
247247
lines.append("Name: %s" % co.co_name)
248248
lines.append("Filename: %s" % co.co_filename)
249-
lines.append("Argument count: %s" % co.co_argcount)
250-
lines.append("Positional-only arguments: %s" % co.co_posonlyargcount)
251-
lines.append("Kw-only arguments: %s" % co.co_kwonlyargcount)
249+
lines.append("Positional parameters: %s" % co.co_argcount)
250+
lines.append("Positional-only parameters: %s" % co.co_posonlyargcount)
251+
lines.append("Keyword-only parameters: %s" % co.co_kwonlyargcount)
252252
lines.append("Number of locals: %s" % co.co_nlocals)
253253
lines.append("Stack size: %s" % co.co_stacksize)
254254
lines.append("Flags: %s" % pretty_flags(co.co_flags))

Lib/test/test_dis.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,9 +1461,9 @@ def get_disassembly(self, func, lasti=-1, wrapper=True, **kwargs):
14611461
code_info_code_info = f"""\
14621462
Name: code_info
14631463
Filename: (.*)
1464-
Argument count: 1
1465-
Positional-only arguments: 0
1466-
Kw-only arguments: 0
1464+
Positional parameters: 1
1465+
Positional-only parameters: 0
1466+
Keyword-only parameters: 0
14671467
Number of locals: 1
14681468
Stack size: \\d+
14691469
Flags: OPTIMIZED, NEWLOCALS, HAS_DOCSTRING
@@ -1485,9 +1485,9 @@ def f(c=c):
14851485
code_info_tricky = """\
14861486
Name: tricky
14871487
Filename: (.*)
1488-
Argument count: 5
1489-
Positional-only arguments: 2
1490-
Kw-only arguments: 3
1488+
Positional parameters: 5
1489+
Positional-only parameters: 2
1490+
Keyword-only parameters: 3
14911491
Number of locals: 10
14921492
Stack size: \\d+
14931493
Flags: OPTIMIZED, NEWLOCALS, VARARGS, VARKEYWORDS, GENERATOR
@@ -1520,9 +1520,9 @@ def f(c=c):
15201520

15211521
code_info_tricky_nested_f = """\
15221522
Filename: (.*)
1523-
Argument count: 1
1524-
Positional-only arguments: 0
1525-
Kw-only arguments: 0
1523+
Positional parameters: 1
1524+
Positional-only parameters: 0
1525+
Keyword-only parameters: 0
15261526
Number of locals: 1
15271527
Stack size: \\d+
15281528
Flags: OPTIMIZED, NEWLOCALS, NESTED
@@ -1543,9 +1543,9 @@ def f(c=c):
15431543
code_info_expr_str = """\
15441544
Name: <module>
15451545
Filename: <disassembly>
1546-
Argument count: 0
1547-
Positional-only arguments: 0
1548-
Kw-only arguments: 0
1546+
Positional parameters: 0
1547+
Positional-only parameters: 0
1548+
Keyword-only parameters: 0
15491549
Number of locals: 0
15501550
Stack size: \\d+
15511551
Flags: 0x0
@@ -1557,9 +1557,9 @@ def f(c=c):
15571557
code_info_simple_stmt_str = """\
15581558
Name: <module>
15591559
Filename: <disassembly>
1560-
Argument count: 0
1561-
Positional-only arguments: 0
1562-
Kw-only arguments: 0
1560+
Positional parameters: 0
1561+
Positional-only parameters: 0
1562+
Keyword-only parameters: 0
15631563
Number of locals: 0
15641564
Stack size: \\d+
15651565
Flags: 0x0
@@ -1572,9 +1572,9 @@ def f(c=c):
15721572
code_info_compound_stmt_str = """\
15731573
Name: <module>
15741574
Filename: <disassembly>
1575-
Argument count: 0
1576-
Positional-only arguments: 0
1577-
Kw-only arguments: 0
1575+
Positional parameters: 0
1576+
Positional-only parameters: 0
1577+
Keyword-only parameters: 0
15781578
Number of locals: 0
15791579
Stack size: \\d+
15801580
Flags: 0x0
@@ -1592,9 +1592,9 @@ async def async_def():
15921592
code_info_async_def = """\
15931593
Name: async_def
15941594
Filename: (.*)
1595-
Argument count: 0
1596-
Positional-only arguments: 0
1597-
Kw-only arguments: 0
1595+
Positional parameters: 0
1596+
Positional-only parameters: 0
1597+
Keyword-only parameters: 0
15981598
Number of locals: 2
15991599
Stack size: \\d+
16001600
Flags: OPTIMIZED, NEWLOCALS, COROUTINE
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix the use of the terms "argument" and "parameter" in
2+
:func:`dis.show_code`.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy