[pypy-commit] pypy cpyext-injection: hack for initialization
fijal
pypy.commits at gmail.com
Wed Oct 26 09:46:50 EDT 2016
Author: fijal
Branch: cpyext-injection
Changeset: r87937:6bfd7994f601
Date: 2016-10-26 15:46 +0200
http://bitbucket.org/pypy/pypy/changeset/6bfd7994f601/
Log: hack for initialization
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -125,12 +125,14 @@
def gettypeobject(self, typedef):
# typeobject.TypeCache maps a TypeDef instance to its
# unique-for-this-space W_TypeObject instance
+ from rpython.rlib.objectmodel import we_are_translated
assert typedef is not None
if typedef.injected_type:
w_type_injected = typedef.get_injected_type()
- assert w_type_injected is not None
- assert w_type_injected.space is self
- return w_type_injected
+ if w_type_injected is not None or we_are_translated():
+ assert w_type_injected is not None
+ assert w_type_injected.space is self
+ return w_type_injected
return self.fromcache(TypeCache).getorbuild(typedef)
@specialize.argtype(1)
More information about the pypy-commit
mailing list