[pypy-svn] r11650 - pypy/dist/pypy/objspace/std
pedronis at codespeak.net
pedronis at codespeak.net
Sat Apr 30 16:56:52 CEST 2005
Author: pedronis
Date: Sat Apr 30 16:56:52 2005
New Revision: 11650
Modified:
pypy/dist/pypy/objspace/std/typeobject.py
pypy/dist/pypy/objspace/std/typetype.py
Log:
factor out is_heaptype
Modified: pypy/dist/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/typeobject.py (original)
+++ pypy/dist/pypy/objspace/std/typeobject.py Sat Apr 30 16:56:52 2005
@@ -215,6 +215,8 @@
from pypy.objspace.std.model import UnwrapError
raise UnwrapError(w_self)
+ def is_heaptype(w_self):
+ return w_self.__flags__&_HEAPTYPE
def call__Type(space, w_type, __args__):
# special case for type(x)
Modified: pypy/dist/pypy/objspace/std/typetype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/typetype.py (original)
+++ pypy/dist/pypy/objspace/std/typetype.py Sat Apr 30 16:56:52 2005
@@ -2,8 +2,6 @@
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.dictproxyobject import descr_get_dictproxy
-from copy_reg import _HEAPTYPE
-
def descr__new__(space, w_typetype, w_name, w_bases, w_dict):
"This is used to create user-defined classes only."
from pypy.objspace.std.typeobject import W_TypeObject
@@ -104,7 +102,7 @@
return space.wrap(w_type.__flags__)
def defunct_descr_get__module(space, w_type):
- if w_type.__flags__ & _HEAPTYPE:
+ if w_type.is_heaptype():
return w_type.dict_w['__module__']
else:
# here CPython checks for a module.name in the type description.
@@ -124,7 +122,7 @@
def descr_set__module(space, w_type, w_value):
w_type = _check(space, w_type)
- if not (w_type.__flags__ & _HEAPTYPE):
+ if not w_type.is_heaptype():
raise OperationError(space.w_TypeError,
space.wrap("can't set %s.__module__" %
w_type.name))
More information about the Pypy-commit
mailing list