Skip to content

Commit 5dbaed3

Browse files
committed
Adress Victor's feedback
1 parent 791c44c commit 5dbaed3

File tree

8 files changed

+130
-129
lines changed

8 files changed

+130
-129
lines changed

Lib/importlib/_bootstrap_external.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ def _write_atomic(path, data, mode=0o666):
265265
# this might affected the first line number #32911)
266266
# Python 3.8a1 3400 (move frame block handling to compiler #17611)
267267
# Python 3.8a1 3401 (add END_ASYNC_FOR #33041)
268+
# Python 3.8a1 3410 (PEP570 Python Positional-Only Parameters #36540)
268269
#
269270
# MAGIC must change whenever the bytecode emitted by the compiler may no
270271
# longer be understood by older implementations of the eval loop (usually
@@ -273,7 +274,7 @@ def _write_atomic(path, data, mode=0o666):
273274
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
274275
# in PC/launcher.c must also be updated.
275276

276-
MAGIC_NUMBER = (3401).to_bytes(2, 'little') + b'\r\n'
277+
MAGIC_NUMBER = (3410).to_bytes(2, 'little') + b'\r\n'
277278
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c
278279

279280
_PYCACHE = '__pycache__'

Lib/test/inspect_fodder2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,17 @@ def func137():
139139
never_reached2
140140

141141
#line 141
142-
def positional_only_arg(a,/):
142+
def positional_only_arg(a, /):
143143
pass
144144

145145
#line 145
146-
def all_markers(a,b,/,c,d,*,e,f):
146+
def all_markers(a, b, /, c, d, *, e, f):
147147
pass
148148

149149
# line 149
150-
def all_markers_with_args_and_kwargs(a,b,/,c,d,*args,e,f,**kwargs):
150+
def all_markers_with_args_and_kwargs(a, b, /, c, d, *args, e, f, **kwargs):
151151
pass
152152

153153
#line 153
154-
def all_markers_with_defaults(a,b=1,/,c=2,d=3,*,e=4,f=5):
154+
def all_markers_with_defaults(a, b=1, /, c=2, d=3, *, e=4, f=5):
155155
pass

Lib/test/test_importlib/test_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ def test_magic_number(self):
862862
in advance. Such exceptional releases will then require an
863863
adjustment to this test case.
864864
"""
865-
EXPECTED_MAGIC_NUMBER = 3400
865+
EXPECTED_MAGIC_NUMBER = 3410
866866
actual = int.from_bytes(importlib.util.MAGIC_NUMBER[:2], 'little')
867867

868868
msg = (

Lib/test/test_inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ def assertFullArgSpecEquals(self, routine, args_e, varargs_e=None,
784784
formatted)
785785

786786
def test_getargspec(self):
787-
# self.assertArgSpecEquals(mod.eggs, ['x', 'y'], formatted='(x, y)')
787+
self.assertArgSpecEquals(mod.eggs, ['x', 'y'], formatted='(x, y)')
788788

789789
self.assertRaises(ValueError, self.assertArgSpecEquals,
790790
mod.spam, [])

Lib/test/test_positional_only_arg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Unit tests for the positional only argument syntax specified in PEP 570."""
22

3-
import unittest
43
import pickle
4+
import unittest
55

66

77
def global_pos_only_f(a, b, /):

PC/launcher.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ static PYC_MAGIC magic_values[] = {
11391139
{ 3320, 3351, L"3.5" },
11401140
{ 3360, 3379, L"3.6" },
11411141
{ 3390, 3399, L"3.7" },
1142-
{ 3400, 3409, L"3.8" },
1142+
{ 3400, 3410, L"3.8" },
11431143
{ 0 }
11441144
};
11451145

Python/ceval.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3722,23 +3722,23 @@ too_many_positional(PyCodeObject *co, Py_ssize_t given, Py_ssize_t defcount,
37223722
PyObject *sig, *kwonly_sig;
37233723
Py_ssize_t co_posonlyargcount = co->co_posonlyargcount;
37243724
Py_ssize_t co_argcount = co->co_argcount;
3725-
Py_ssize_t co_total_positional = co_argcount + co_posonlyargcount;
3725+
Py_ssize_t total_positional = co_argcount + co_posonlyargcount;
37263726

37273727
assert((co->co_flags & CO_VARARGS) == 0);
37283728
/* Count missing keyword-only args. */
3729-
for (i = co_total_positional; i < co_total_positional + co->co_kwonlyargcount; i++) {
3729+
for (i = total_positional; i < total_positional + co->co_kwonlyargcount; i++) {
37303730
if (GETLOCAL(i) != NULL) {
37313731
kwonly_given++;
37323732
}
37333733
}
37343734
if (defcount) {
3735-
Py_ssize_t atleast = co_total_positional - defcount;
3735+
Py_ssize_t atleast = total_positional - defcount;
37363736
plural = 1;
3737-
sig = PyUnicode_FromFormat("from %zd to %zd", atleast, co_total_positional);
3737+
sig = PyUnicode_FromFormat("from %zd to %zd", atleast, total_positional);
37383738
}
37393739
else {
3740-
plural = (co_total_positional != 1);
3741-
sig = PyUnicode_FromFormat("%zd", co_total_positional);
3740+
plural = (total_positional != 1);
3741+
sig = PyUnicode_FromFormat("%zd", total_positional);
37423742
}
37433743
if (sig == NULL)
37443744
return;

Python/importlib_external.h

Lines changed: 114 additions & 114 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)