cpython: 7454ca88aacb (original) (raw)

Mercurial > cpython

changeset 105683:7454ca88aacb

Issue #18896: Python function can now have more than 255 parameters. collections.namedtuple() now supports tuples with more than 255 elements. [#18896]

Serhiy Storchaka storchaka@gmail.com
date Fri, 16 Dec 2016 19:19:02 +0200
parents 79d52e7d472d
children 25b8b5cf8e2f
files Doc/whatsnew/3.7.rst Include/code.h Lib/test/test_collections.py Lib/test/test_compile.py Lib/test/test_keywordonlyarg.py Lib/test/test_sys.py Misc/NEWS Objects/codeobject.c Python/ast.c Python/ceval.c
diffstat 10 files changed, 33 insertions(+), 49 deletions(-)[+] [-] Doc/whatsnew/3.7.rst 5 Include/code.h 7 Lib/test/test_collections.py 3 Lib/test/test_compile.py 11 Lib/test/test_keywordonlyarg.py 24 Lib/test/test_sys.py 2 Misc/NEWS 3 Objects/codeobject.c 20 Python/ast.c 5 Python/ceval.c 2

line wrap: on

line diff

--- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -75,8 +75,9 @@ New Features Other Language Changes ====================== -* More than 255 arguments can now be passed to a function.

--- a/Include/code.h +++ b/Include/code.h @@ -37,7 +37,7 @@ typedef struct { for tracebacks and debuggers; otherwise, constant de-duplication would collapse identical functions/lambdas defined on different lines. */

#define CO_FUTURE_GENERATOR_STOP 0x80000 /* This value is found in the co_cell2arg array when the associated cell

/* This should be defined if a future statement modifies the syntax. For example, when a keyword is added.

--- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -319,8 +319,7 @@ class TestNamedTuple(unittest.TestCase): self.assertEqual(Dot(1)._replace(d=999), (999,)) self.assertEqual(Dot(1)._fields, ('d',))

--- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -401,16 +401,9 @@ if 1: self.assertNotIn((Ellipsis, Ellipsis), d) def test_annotation_limit(self):

def test_mangling(self):

--- a/Lib/test/test_keywordonlyarg.py +++ b/Lib/test/test_keywordonlyarg.py @@ -51,24 +51,12 @@ class KeywordOnlyArgTestCase(unittest.Te self.assertRaisesSyntaxError("def f(p, *, (k1, k2), **kw):\n pass\n") def testSyntaxForManyArguments(self):

-

-

def testTooManyPositionalErrorMessage(self): def f(a, b=None, *, c=None):

--- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -926,7 +926,7 @@ class SizeofTest(unittest.TestCase): def inner(): return x return inner

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.7.0 alpha 1 Core and Builtins ----------------- +- Issue #18896: Python function can now have more than 255 parameters.

--- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -110,7 +110,7 @@ PyCode_New(int argcount, int kwonlyargco PyObject *lnotab) { PyCodeObject *co;

@@ -449,7 +455,7 @@ code_sizeof(PyCodeObject *co, void *unus res = _PyObject_SIZE(Py_TYPE(co)); if (co->co_cell2arg != NULL && co->co_cellvars != NULL)

--- a/Python/ast.c +++ b/Python/ast.c @@ -1411,11 +1411,6 @@ ast_for_arguments(struct compiling *c, c if (!kwdefaults && nkwonlyargs) return NULL;

- /* tfpdef: NAME [':' test] vfpdef: NAME */

--- a/Python/ceval.c +++ b/Python/ceval.c @@ -4100,7 +4100,7 @@ static PyObject * vars into frame. */ for (i = 0; i < PyTuple_GET_SIZE(co->co_cellvars); ++i) { PyObject *c;