[pypy-svn] r73600 - in pypy/branch/cpython-extension/pypy/module/cpyext: . src

jandem at codespeak.net jandem at codespeak.net
Fri Apr 9 20:22:33 CEST 2010


Author: jandem
Date: Fri Apr  9 20:22:30 2010
New Revision: 73600

Added:
   pypy/branch/cpython-extension/pypy/module/cpyext/stubsactive.py
Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/__init__.py
   pypy/branch/cpython-extension/pypy/module/cpyext/src/bufferobject.c
   pypy/branch/cpython-extension/pypy/module/cpyext/stubs.py
Log:
Add stubsactive.py as suggested by xorAxAx


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/__init__.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/__init__.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/__init__.py	Fri Apr  9 20:22:30 2010
@@ -61,6 +61,7 @@
 import pypy.module.cpyext.sysmodule
 import pypy.module.cpyext.number
 import pypy.module.cpyext.sliceobject
+import pypy.module.cpyext.stubsactive
 
 # now that all rffi_platform.Struct types are registered, configure them
 api.configure_types()

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/src/bufferobject.c
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/src/bufferobject.c	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/src/bufferobject.c	Fri Apr  9 20:22:30 2010
@@ -840,7 +840,7 @@
 	(hashfunc)buffer_hash,			/* tp_hash */
 	0,					/* tp_call */
 	(reprfunc)buffer_str,			/* tp_str */
-	0, //XXX PyObject_GenericGetAttr,		/* tp_getattro */
+	PyObject_GenericGetAttr,		/* tp_getattro */
 	0,					/* tp_setattro */
 	&buffer_as_buffer,			/* tp_as_buffer */
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GETCHARBUFFER, /* tp_flags */

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/stubs.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/stubs.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/stubs.py	Fri Apr  9 20:22:30 2010
@@ -4308,16 +4308,6 @@
     expression o.attr_name."""
     raise NotImplementedError
 
- at cpython_api([PyObject, PyObject], PyObject)
-def PyObject_GenericGetAttr(space, o, name):
-    """Generic attribute getter function that is meant to be put into a type
-    object's tp_getattro slot.  It looks for a descriptor in the dictionary
-    of classes in the object's MRO as well as an attribute in the object's
-    __dict__ (if present).  As outlined in descriptors, data
-    descriptors take preference over instance attributes, while non-data
-    descriptors don't.  Otherwise, an AttributeError is raised."""
-    raise NotImplementedError
-
 @cpython_api([PyObject, rffi.CCHARP, PyObject], rffi.INT_real)
 def PyObject_SetAttrString(space, o, attr_name, v):
     """Set the value of the attribute named attr_name, for object o, to the value

Added: pypy/branch/cpython-extension/pypy/module/cpyext/stubsactive.py
==============================================================================
--- (empty file)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/stubsactive.py	Fri Apr  9 20:22:30 2010
@@ -0,0 +1,13 @@
+from pypy.module.cpyext.pyobject import PyObject
+from pypy.module.cpyext.api import cpython_api, Py_ssize_t, CANNOT_FAIL
+from pypy.rpython.lltypesystem import rffi, lltype
+
+ at cpython_api([PyObject, PyObject], PyObject)
+def PyObject_GenericGetAttr(space, o, name):
+    """Generic attribute getter function that is meant to be put into a type
+    object's tp_getattro slot.  It looks for a descriptor in the dictionary
+    of classes in the object's MRO as well as an attribute in the object's
+    __dict__ (if present).  As outlined in descriptors, data
+    descriptors take preference over instance attributes, while non-data
+    descriptors don't.  Otherwise, an AttributeError is raised."""
+    raise NotImplementedError



More information about the Pypy-commit mailing list