[pypy-svn] r73548 - in pypy/branch/cpython-extension/pypy/module/cpyext: . test
xoraxax at codespeak.net
xoraxax at codespeak.net
Thu Apr 8 15:21:43 CEST 2010
Author: xoraxax
Date: Thu Apr 8 15:21:41 2010
New Revision: 73548
Modified:
pypy/branch/cpython-extension/pypy/module/cpyext/methodobject.py
pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py
Log:
Add __methods__ support to Py_FindMethod.
Modified: pypy/branch/cpython-extension/pypy/module/cpyext/methodobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/methodobject.py (original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/methodobject.py Thu Apr 8 15:21:41 2010
@@ -190,13 +190,19 @@
name = rffi.charp2str(name_ptr)
methods = rffi.cast(rffi.CArrayPtr(PyMethodDef), table)
+ method_list_w = []
+
if methods:
i = -1
while True:
i = i + 1
method = methods[i]
if not method.c_ml_name: break
- if rffi.charp2str(method.c_ml_name) == name: # XXX expensive copying
+ if name == "__methods__":
+ method_list_w.append(space.wrap(rffi.charp2str(method.c_ml_name)))
+ elif rffi.charp2str(method.c_ml_name) == name: # XXX expensive copying
return PyCFunction_NewEx(space, method, w_ob)
+ if name == "__methods__":
+ return space.newlist(method_list_w)
raise OperationError(space.w_AttributeError, space.wrap(name))
Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py (original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py Thu Apr 8 15:21:41 2010
@@ -97,6 +97,6 @@
assert m
m = re.search("xyz", "xyzxyz")
assert m
- assert dir(m)
+ assert "groupdict" in dir(m)
re._cache.clear()
re._cache_repl.clear()
More information about the Pypy-commit
mailing list