[pypy-commit] pypy default: don't capture "func" as a positional argument

Digenis noreply at buildbot.pypy.org
Fri Jan 2 07:17:29 CET 2015


Author: Nikolaos-Digenis Karagiannis <digenishjkl at gmail.com>
Branch: 
Changeset: r75203:d4b4902dad5e
Date: 2015-01-02 07:22 +0200
http://bitbucket.org/pypy/pypy/changeset/d4b4902dad5e/

Log:	don't capture "func" as a positional argument

diff --git a/lib_pypy/_functools.py b/lib_pypy/_functools.py
--- a/lib_pypy/_functools.py
+++ b/lib_pypy/_functools.py
@@ -9,7 +9,10 @@
     of the given arguments and keywords.
     """
 
-    def __init__(self, func, *args, **keywords):
+    def __init__(self, *args, **keywords):
+        if not args:
+            raise TypeError('__init__() takes at least 2 arguments (1 given)')
+        func, args = args[0], args[1:]
         if not callable(func):
             raise TypeError("the first argument must be callable")
         self._func = func


More information about the pypy-commit mailing list