mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #18896: Python function can now have more than 255 parameters.
collections.namedtuple() now supports tuples with more than 255 elements.
This commit is contained in:
parent
14d8b9693b
commit
5bb8b9134b
10 changed files with 33 additions and 49 deletions
|
@ -401,16 +401,9 @@ if 1:
|
|||
self.assertNotIn((Ellipsis, Ellipsis), d)
|
||||
|
||||
def test_annotation_limit(self):
|
||||
# 16 bits are available for # of annotations, but only 8 bits are
|
||||
# available for the parameter count, hence 255
|
||||
# is the max. Ensure the result of too many annotations is a
|
||||
# SyntaxError.
|
||||
# more than 255 annotations, should compile ok
|
||||
s = "def f(%s): pass"
|
||||
s %= ', '.join('a%d:%d' % (i,i) for i in range(256))
|
||||
self.assertRaises(SyntaxError, compile, s, '?', 'exec')
|
||||
# Test that the max # of annotations compiles.
|
||||
s = "def f(%s): pass"
|
||||
s %= ', '.join('a%d:%d' % (i,i) for i in range(255))
|
||||
s %= ', '.join('a%d:%d' % (i,i) for i in range(300))
|
||||
compile(s, '?', 'exec')
|
||||
|
||||
def test_mangling(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue