mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
better portability fix for f(*args), use apply(f, args) as Stephane Bidoul
* python/tests/tstLastError.py: better portability fix for f(*args), use apply(f, args) as Stephane Bidoul suggested Daniel
This commit is contained in:
@ -21,16 +21,7 @@ class TestCase(unittest.TestCase):
|
||||
# disable the default error handler
|
||||
libxml2.registerErrorHandler(None,None)
|
||||
try:
|
||||
# Emulate f(*args) for older Pythons.
|
||||
l = len(args)
|
||||
if l == 0: f
|
||||
elif l == 1: f(args[0])
|
||||
elif l == 2: f(args[0], args[1])
|
||||
elif l == 3: f(args[0], args[1], args[2])
|
||||
elif l == 4: f(args[0], args[1], args[2], args[3])
|
||||
elif l == 5: f(args[0], args[1], args[2], args[3], args[4])
|
||||
else:
|
||||
self.fail("Too many arguments for function")
|
||||
apply(f,args)
|
||||
except exc:
|
||||
e = libxml2.lastError()
|
||||
if e is None:
|
||||
|
Reference in New Issue
Block a user