mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Merged revisions 55328-55341 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55329 | brett.cannon | 2007-05-14 16:36:56 -0700 (Mon, 14 May 2007) | 3 lines Implement the removal of tuple parameter unpacking (PEP 3113). Thanks, Tony Lownds for the patch. ........ r55331 | neal.norwitz | 2007-05-14 16:40:30 -0700 (Mon, 14 May 2007) | 1 line Update to use Python 3.0 ........ r55332 | brett.cannon | 2007-05-14 16:47:18 -0700 (Mon, 14 May 2007) | 2 lines Mention PEP 3113. And thanks to Tony Lownds for the PEP 3113 patch. ........ r55333 | neal.norwitz | 2007-05-14 16:57:06 -0700 (Mon, 14 May 2007) | 1 line Fix exception printing (no more exceptions module) ........ r55334 | neal.norwitz | 2007-05-14 17:11:10 -0700 (Mon, 14 May 2007) | 1 line Remove popen* functions from os ........ r55335 | neal.norwitz | 2007-05-14 18:03:38 -0700 (Mon, 14 May 2007) | 1 line Get rid of most of popen. There are still some uses I need to cleanup. ........ r55336 | neal.norwitz | 2007-05-14 21:11:34 -0700 (Mon, 14 May 2007) | 1 line Remove a few more remnants of the compiler package ........ r55337 | neal.norwitz | 2007-05-14 22:28:27 -0700 (Mon, 14 May 2007) | 1 line Get test_[cx]pickle working on 64-bit platforms (avoid overflow int/long) ........
This commit is contained in:
parent
360e4b8fb1
commit
1bc535dc78
64 changed files with 1614 additions and 2842 deletions
|
@ -124,29 +124,9 @@ def f(x):
|
|||
exec(code, g)
|
||||
self.assertEqual(g['f'](5), 0)
|
||||
|
||||
def test_complex_args(self):
|
||||
|
||||
def comp_args((a, b)):
|
||||
return a,b
|
||||
self.assertEqual(comp_args((1, 2)), (1, 2))
|
||||
|
||||
def comp_args((a, b)=(3, 4)):
|
||||
return a, b
|
||||
self.assertEqual(comp_args((1, 2)), (1, 2))
|
||||
self.assertEqual(comp_args(), (3, 4))
|
||||
|
||||
def comp_args(a, (b, c)):
|
||||
return a, b, c
|
||||
self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3))
|
||||
|
||||
def comp_args(a=2, (b, c)=(3, 4)):
|
||||
return a, b, c
|
||||
self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3))
|
||||
self.assertEqual(comp_args(), (2, 3, 4))
|
||||
|
||||
def test_argument_order(self):
|
||||
try:
|
||||
exec('def f(a=1, (b, c)): pass')
|
||||
exec('def f(a=1, b): pass')
|
||||
self.fail("non-default args after default")
|
||||
except SyntaxError:
|
||||
pass
|
||||
|
@ -394,16 +374,16 @@ if 1:
|
|||
self.assertEqual((Ellipsis, Ellipsis) in d, False)
|
||||
|
||||
def test_annotation_limit(self):
|
||||
# 16 bits are available for # of annotations, and the
|
||||
# tuple of annotations names is counted, hence 65534
|
||||
# 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.
|
||||
s = "def f((%s)): pass"
|
||||
s %= ', '.join('a%d:%d' % (i,i) for i in range(65535))
|
||||
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(65534))
|
||||
s = "def f(%s): pass"
|
||||
s %= ', '.join('a%d:%d' % (i,i) for i in range(255))
|
||||
compile(s, '?', 'exec')
|
||||
|
||||
def test_mangling(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue