mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Get rid of many apply() calls.
This commit is contained in:
parent
f389c77273
commit
68468eba63
38 changed files with 85 additions and 91 deletions
|
@ -239,5 +239,5 @@ for name in ['za', 'zade', 'zabk', 'zabdv', 'zabdevk']:
|
|||
kwdict = {}
|
||||
for k in kwargs: kwdict[k] = k + k
|
||||
print func.func_name, args, sortdict(kwdict), '->',
|
||||
try: apply(func, args, kwdict)
|
||||
try: func(*args, **kwdict)
|
||||
except TypeError, err: print err
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from test.test_support import TestFailed, verbose, verify
|
||||
import struct
|
||||
## import pdb
|
||||
|
||||
import sys
|
||||
ISBIGENDIAN = sys.byteorder == "big"
|
||||
|
@ -21,23 +20,21 @@ def bigendian_to_native(value):
|
|||
|
||||
def simple_err(func, *args):
|
||||
try:
|
||||
apply(func, args)
|
||||
func(*args)
|
||||
except struct.error:
|
||||
pass
|
||||
else:
|
||||
raise TestFailed, "%s%s did not raise struct.error" % (
|
||||
func.__name__, args)
|
||||
## pdb.set_trace()
|
||||
|
||||
def any_err(func, *args):
|
||||
try:
|
||||
apply(func, args)
|
||||
func(*args)
|
||||
except (struct.error, OverflowError, TypeError):
|
||||
pass
|
||||
else:
|
||||
raise TestFailed, "%s%s did not raise error" % (
|
||||
func.__name__, args)
|
||||
## pdb.set_trace()
|
||||
|
||||
|
||||
simple_err(struct.calcsize, 'Z')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue