Commit d60092f2 authored by Stefan Behnel's avatar Stefan Behnel

Make co_argcount for positional-only arguments behave correctly, now that...

Make co_argcount for positional-only arguments behave correctly, now that CPython 3.8 (beta 1) includes the pos-only count in it rather than adding it.
parent 8a910f47
......@@ -392,13 +392,13 @@ class __Pyx_FakeReference {
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(p+a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#define __Pyx_DefaultClassType PyClass_Type
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#if PY_VERSION_HEX < 0x030800A4
#define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(p+a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
#define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
......
......@@ -78,10 +78,8 @@ def func_introspection1(a, b, c, /, d, e=1, *, f, g=2):
"""
>>> if sys.version_info[0] < 3:
... assert func_introspection2.__code__.co_argcount == 7, func_introspection2.__code__.co_argcount
... elif sys.version_info < (3, 8):
... assert func_introspection2.__code__.co_argcount == 5, func_introspection2.__code__.co_argcount
... else:
... assert func_introspection2.__code__.co_argcount == 2, func_introspection2.__code__.co_argcount
... assert func_introspection2.__code__.co_argcount == 5, func_introspection2.__code__.co_argcount
>>> func_introspection1.__defaults__
(1,)
"""
......@@ -91,10 +89,8 @@ def func_introspection2(a, b, c=1, /, d=2, e=3, *, f, g=4):
"""
>>> if sys.version_info[0] < 3:
... assert func_introspection2.__code__.co_argcount == 7, func_introspection2.__code__.co_argcount
... elif sys.version_info < (3, 8):
... assert func_introspection2.__code__.co_argcount == 5, func_introspection2.__code__.co_argcount
... else:
... assert func_introspection2.__code__.co_argcount == 2, func_introspection2.__code__.co_argcount
... assert func_introspection2.__code__.co_argcount == 5, func_introspection2.__code__.co_argcount
>>> func_introspection2.__defaults__
(1, 2, 3)
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment