diff options
| author | Pablo Galindo <Pablogsal@gmail.com> | 2019-04-29 13:36:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-29 13:36:57 +0100 |
| commit | 8c77b8cb9188165a123f2512026e3629bf03dc9b (patch) | |
| tree | 863ea19f5f2c8ec179c32b3d06dc8366859ae26e /Lib/test/test_dis.py | |
| parent | 99fcc616d400cd31af0733c3f8cc93bcc1d32a44 (diff) | |
| download | cpython-git-8c77b8cb9188165a123f2512026e3629bf03dc9b.tar.gz | |
bpo-36540: PEP 570 -- Implementation (GH-12701)
This commit contains the implementation of PEP570: Python positional-only parameters.
* Update Grammar/Grammar with new typedarglist and varargslist
* Regenerate grammar files
* Update and regenerate AST related files
* Update code object
* Update marshal.c
* Update compiler and symtable
* Regenerate importlib files
* Update callable objects
* Implement positional-only args logic in ceval.c
* Regenerate frozen data
* Update standard library to account for positional-only args
* Add test file for positional-only args
* Update other test files to account for positional-only args
* Add News entry
* Update inspect module and related tests
Diffstat (limited to 'Lib/test/test_dis.py')
| -rw-r--r-- | Lib/test/test_dis.py | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index 8d1912b6ee..1561021f5b 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -617,6 +617,7 @@ code_info_code_info = """\ Name: code_info Filename: (.*) Argument count: 1 +Positional-only arguments: 0 Kw-only arguments: 0 Number of locals: 1 Stack size: 3 @@ -631,50 +632,53 @@ Variable names: if sys.flags.optimize < 2 else (None,)) @staticmethod -def tricky(x, y, z=True, *args, c, d, e=[], **kwds): +def tricky(a, b, /, x, y, z=True, *args, c, d, e=[], **kwds): def f(c=c): - print(x, y, z, c, d, e, f) - yield x, y, z, c, d, e, f + print(a, b, x, y, z, c, d, e, f) + yield a, b, x, y, z, c, d, e, f code_info_tricky = """\ Name: tricky Filename: (.*) Argument count: 3 +Positional-only arguments: 2 Kw-only arguments: 3 -Number of locals: 8 -Stack size: 7 +Number of locals: 10 +Stack size: 9 Flags: OPTIMIZED, NEWLOCALS, VARARGS, VARKEYWORDS, GENERATOR Constants: 0: None 1: <code object f at (.*), file "(.*)", line (.*)> 2: 'tricky.<locals>.f' Variable names: - 0: x - 1: y - 2: z - 3: c - 4: d - 5: e - 6: args - 7: kwds + 0: a + 1: b + 2: x + 3: y + 4: z + 5: c + 6: d + 7: e + 8: args + 9: kwds Cell variables: - 0: [edfxyz] - 1: [edfxyz] - 2: [edfxyz] - 3: [edfxyz] - 4: [edfxyz] - 5: [edfxyz]""" + 0: [abedfxyz] + 1: [abedfxyz] + 2: [abedfxyz] + 3: [abedfxyz] + 4: [abedfxyz] + 5: [abedfxyz]""" # NOTE: the order of the cell variables above depends on dictionary order! co_tricky_nested_f = tricky.__func__.__code__.co_consts[1] code_info_tricky_nested_f = """\ -Name: f Filename: (.*) Argument count: 1 +Positional-only arguments: 0 Kw-only arguments: 0 Number of locals: 1 -Stack size: 8 +Stack size: 10 Flags: OPTIMIZED, NEWLOCALS, NESTED Constants: 0: None @@ -683,17 +687,18 @@ Names: Variable names: 0: c Free variables: - 0: [edfxyz] - 1: [edfxyz] - 2: [edfxyz] - 3: [edfxyz] - 4: [edfxyz] - 5: [edfxyz]""" + 0: [abedfxyz] + 1: [abedfxyz] + 2: [abedfxyz] + 3: [abedfxyz] + 4: [abedfxyz] + 5: [abedfxyz]""" code_info_expr_str = """\ Name: <module> Filename: <disassembly> Argument count: 0 +Positional-only arguments: 0 Kw-only arguments: 0 Number of locals: 0 Stack size: 2 @@ -707,6 +712,7 @@ code_info_simple_stmt_str = """\ Name: <module> Filename: <disassembly> Argument count: 0 +Positional-only arguments: 0 Kw-only arguments: 0 Number of locals: 0 Stack size: 2 @@ -721,6 +727,7 @@ code_info_compound_stmt_str = """\ Name: <module> Filename: <disassembly> Argument count: 0 +Positional-only arguments: 0 Kw-only arguments: 0 Number of locals: 0 Stack size: 2 @@ -742,6 +749,7 @@ code_info_async_def = """\ Name: async_def Filename: (.*) Argument count: 0 +Positional-only arguments: 0 Kw-only arguments: 0 Number of locals: 2 Stack size: 10 |
