Commit 58706481 authored by Jason Madden's avatar Jason Madden

A pure-python implementation of ContainedProxy that works on pypy

parent 3f9b5cb3
...@@ -66,6 +66,7 @@ setup(name='zope.container', ...@@ -66,6 +66,7 @@ setup(name='zope.container',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English', 'Natural Language :: English',
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP',
......
This diff is collapsed.
...@@ -214,7 +214,7 @@ WrapperType_Lookup(PyTypeObject *type, PyObject *name) ...@@ -214,7 +214,7 @@ WrapperType_Lookup(PyTypeObject *type, PyObject *name)
base = PyTuple_GET_ITEM(mro, i); base = PyTuple_GET_ITEM(mro, i);
if (((PyTypeObject *)base) != &ProxyType) { if (((PyTypeObject *)base) != &ProxyType) {
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3 && !defined(PYPY_VERSION)
if (PyClass_Check(base)) if (PyClass_Check(base))
dict = ((PyClassObject *)base)->cl_dict; dict = ((PyClassObject *)base)->cl_dict;
else else
...@@ -1253,4 +1253,3 @@ MOD_INIT(_zope_proxy_proxy) ...@@ -1253,4 +1253,3 @@ MOD_INIT(_zope_proxy_proxy)
return MOD_SUCCESS_VAL(m); return MOD_SUCCESS_VAL(m);
} }
...@@ -29,8 +29,12 @@ from zope.location.interfaces import IContained ...@@ -29,8 +29,12 @@ from zope.location.interfaces import IContained
from zope.container.interfaces import INameChooser from zope.container.interfaces import INameChooser
from zope.container.interfaces import IReservedNames, NameReserved from zope.container.interfaces import IReservedNames, NameReserved
from zope.container.interfaces import IContainerModifiedEvent from zope.container.interfaces import IContainerModifiedEvent
from zope.container._zope_container_contained import ContainedProxyBase try:
from zope.container._zope_container_contained import getProxiedObject from zope.container._zope_container_contained import ContainedProxyBase
from zope.container._zope_container_contained import getProxiedObject
except ImportError: # PyPy
from _proxy import py_getProxiedObject as getProxiedObject
from _proxy import PyProxyBase as ContainedProxyBase
from zope.lifecycleevent import ObjectMovedEvent from zope.lifecycleevent import ObjectMovedEvent
from zope.lifecycleevent import ObjectAddedEvent from zope.lifecycleevent import ObjectAddedEvent
...@@ -956,4 +960,3 @@ class ContainedProxy(ContainedProxyBase): ...@@ -956,4 +960,3 @@ class ContainedProxy(ContainedProxyBase):
DecoratedSecurityCheckerDescriptor()) DecoratedSecurityCheckerDescriptor())
ContainedProxy.__provides__ = ContainedProxyClassProvides(ContainedProxy, type) ContainedProxy.__provides__ = ContainedProxyClassProvides(ContainedProxy, type)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment