Merge py-trunk tip

--HG--
branch : trunk
This commit is contained in:
Floris Bruynooghe 2010-09-07 22:45:19 +01:00
commit 2b3ac35780
2 changed files with 6 additions and 0 deletions

View File

@ -259,6 +259,8 @@ class MultiCall:
return kwargs
def varnames(func):
if not inspect.isfunction(func) and not inspect.ismethod(func):
func = getattr(func, '__call__', func)
ismethod = inspect.ismethod(func)
rawcode = py.code.getrawcode(func)
try:

View File

@ -340,8 +340,12 @@ def test_varnames():
class A:
def f(self, y):
pass
class B(object):
def __call__(self, z):
pass
assert varnames(f) == ("x",)
assert varnames(A().f) == ('y',)
assert varnames(B()) == ('z',)
class TestMultiCall:
def test_uses_copy_of_methods(self):