summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_new.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-10-27 23:31:49 (GMT)
committerGuido van Rossum <guido@python.org>2006-10-27 23:31:49 (GMT)
commit4f72a78684bbfcdc43ceeabb240ceee54706c4b0 (patch)
tree743c27c5125dcef580cffe77395fe97bedf40d5f /Lib/test/test_new.py
parentfc2a0a8e3cb1d40fd965576060c28c8bd2ea1ad5 (diff)
downloadcpython-4f72a78684bbfcdc43ceeabb240ceee54706c4b0.zip
cpython-4f72a78684bbfcdc43ceeabb240ceee54706c4b0.tar.gz
cpython-4f72a78684bbfcdc43ceeabb240ceee54706c4b0.tar.bz2
Jiwon Seo's PEP 3102 implementation.
See SF#1549670. The compiler package has not yet been updated.
Diffstat (limited to 'Lib/test/test_new.py')
-rw-r--r--Lib/test/test_new.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/Lib/test/test_new.py b/Lib/test/test_new.py
index 2819923..3c16bf5 100644
--- a/Lib/test/test_new.py
+++ b/Lib/test/test_new.py
@@ -103,6 +103,7 @@ if hasattr(new, 'code'):
c = f.func_code
argcount = c.co_argcount
+ kwonlyargcount = c.co_kwonlyargcount
nlocals = c.co_nlocals
stacksize = c.co_stacksize
flags = c.co_flags
@@ -117,17 +118,20 @@ if hasattr(new, 'code'):
freevars = c.co_freevars
cellvars = c.co_cellvars
- d = new.code(argcount, nlocals, stacksize, flags, codestring,
+ d = new.code(argcount, kwonlyargcount,
+ nlocals, stacksize, flags, codestring,
constants, names, varnames, filename, name,
firstlineno, lnotab, freevars, cellvars)
# test backwards-compatibility version with no freevars or cellvars
- d = new.code(argcount, nlocals, stacksize, flags, codestring,
+ d = new.code(argcount, kwonlyargcount,
+ nlocals, stacksize, flags, codestring,
constants, names, varnames, filename, name,
firstlineno, lnotab)
try: # this used to trigger a SystemError
- d = new.code(-argcount, nlocals, stacksize, flags, codestring,
+ d = new.code(-argcount, kwonlyargcount,
+ nlocals, stacksize, flags, codestring,
constants, names, varnames, filename, name,
firstlineno, lnotab)
except ValueError:
@@ -136,7 +140,8 @@ if hasattr(new, 'code'):
raise TestFailed, "negative co_argcount didn't trigger an exception"
try: # this used to trigger a SystemError
- d = new.code(argcount, -nlocals, stacksize, flags, codestring,
+ d = new.code(argcount, kwonlyargcount,
+ -nlocals, stacksize, flags, codestring,
constants, names, varnames, filename, name,
firstlineno, lnotab)
except ValueError:
@@ -145,7 +150,8 @@ if hasattr(new, 'code'):
raise TestFailed, "negative co_nlocals didn't trigger an exception"
try: # this used to trigger a Py_FatalError!
- d = new.code(argcount, nlocals, stacksize, flags, codestring,
+ d = new.code(argcount, kwonlyargcount,
+ nlocals, stacksize, flags, codestring,
constants, (5,), varnames, filename, name,
firstlineno, lnotab)
except TypeError:
@@ -156,7 +162,8 @@ if hasattr(new, 'code'):
# new.code used to be a way to mutate a tuple...
class S(str): pass
t = (S("ab"),)
- d = new.code(argcount, nlocals, stacksize, flags, codestring,
+ d = new.code(argcount, kwonlyargcount,
+ nlocals, stacksize, flags, codestring,
constants, t, varnames, filename, name,
firstlineno, lnotab)
verify(type(t[0]) is S, "eek, tuple changed under us!")