diff options
author | Matti Picus <matti.picus@gmail.com> | 2021-01-28 08:51:10 +0200 |
---|---|---|
committer | Matti Picus <matti.picus@gmail.com> | 2021-01-28 08:51:10 +0200 |
commit | 426327768b449916e565f2a8fd865fddfe686eb7 (patch) | |
tree | 8ca5a840a284aa0feaf8db5d86fa4b9a279dcb90 /rpython | |
parent | improve the test to check that if we constant-fold the MyClass malloc(), ever... (diff) | |
download | pypy-426327768b449916e565f2a8fd865fddfe686eb7.tar.gz pypy-426327768b449916e565f2a8fd865fddfe686eb7.tar.bz2 pypy-426327768b449916e565f2a8fd865fddfe686eb7.zip |
unify 'hints' and '_hints' to '_hints'
Diffstat (limited to 'rpython')
-rw-r--r-- | rpython/rtyper/lltypesystem/ll2ctypes.py | 6 | ||||
-rw-r--r-- | rpython/rtyper/lltypesystem/lltype.py | 2 | ||||
-rw-r--r-- | rpython/translator/c/database.py | 14 | ||||
-rw-r--r-- | rpython/translator/c/node.py | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py b/rpython/rtyper/lltypesystem/ll2ctypes.py index bf6d627597..5396675e5d 100644 --- a/rpython/rtyper/lltypesystem/ll2ctypes.py +++ b/rpython/rtyper/lltypesystem/ll2ctypes.py @@ -374,9 +374,9 @@ def build_new_ctypes_type(T, delayed_builders): elif isinstance(T, lltype.OpaqueType): if T is lltype.RuntimeTypeInfo: return ctypes.c_char * 2 - if T.hints.get('external', None) != 'C': + if T._hints.get('external', None) != 'C': raise TypeError("%s is not external" % T) - return ctypes.c_char * T.hints['getsize']() + return ctypes.c_char * T._hints['getsize']() else: _setup_ctypes_cache() if T in _ctypes_cache: @@ -932,7 +932,7 @@ def lltype2ctypes(llobj, normalize=True): convert_array(container) elif isinstance(T.TO, lltype.OpaqueType): if T.TO != lltype.RuntimeTypeInfo: - cbuf = ctypes.create_string_buffer(T.TO.hints['getsize']()) + cbuf = ctypes.create_string_buffer(T.TO._hints['getsize']()) else: cbuf = ctypes.create_string_buffer("\x00") cbuf = ctypes.cast(cbuf, ctypes.c_void_p) diff --git a/rpython/rtyper/lltypesystem/lltype.py b/rpython/rtyper/lltypesystem/lltype.py index eaa51f1edc..c75fd90e7a 100644 --- a/rpython/rtyper/lltypesystem/lltype.py +++ b/rpython/rtyper/lltypesystem/lltype.py @@ -584,7 +584,7 @@ class OpaqueType(ContainerType): """ self.tag = tag self.__name__ = tag - self.hints = frozendict(hints) + self._hints = frozendict(hints) def __str__(self): return "%s (opaque)" % self.tag diff --git a/rpython/translator/c/database.py b/rpython/translator/c/database.py index f21f661ba3..bf0ced6418 100644 --- a/rpython/translator/c/database.py +++ b/rpython/translator/c/database.py @@ -84,7 +84,7 @@ class LowLevelDatabase(object): node = BareBoneArrayDefNode(self, T, varlength) else: node = ArrayDefNode(self, T, varlength) - elif isinstance(T, OpaqueType) and T.hints.get("render_structure", False): + elif isinstance(T, OpaqueType) and T._hints.get("render_structure", False): node = ExtTypeOpaqueDefNode(self, T) elif T == WeakRef: REALT = self.gcpolicy.get_real_weakref_type() @@ -102,8 +102,8 @@ class LowLevelDatabase(object): return '%s @' % T.c_name elif isinstance(T, Ptr): if (isinstance(T.TO, OpaqueType) and - T.TO.hints.get('c_pointer_typedef') is not None): - return '%s @' % T.TO.hints['c_pointer_typedef'] + T.TO._hints.get('c_pointer_typedef') is not None): + return '%s @' % T.TO._hints['c_pointer_typedef'] try: node = self.gettypedefnode(T.TO) except NoCorrespondingNode: @@ -134,13 +134,13 @@ class LowLevelDatabase(object): elif isinstance(T, OpaqueType): if T == RuntimeTypeInfo: return self.gcpolicy.rtti_type() - elif T.hints.get("render_structure", False): + elif T._hints.get("render_structure", False): node = self.gettypedefnode(T, varlength=varlength) if who_asks is not None: who_asks.dependencies.add(node) return 'struct %s @' % node.name - elif T.hints.get('external', None) == 'C': - return '%s @' % T.hints['c_name'] + elif T._hints.get('external', None) == 'C': + return '%s @' % T._hints['c_name'] else: #raise Exception("don't know about opaque type %r" % (T,)) return 'struct %s @' % ( @@ -182,7 +182,7 @@ class LowLevelDatabase(object): return PrimitiveName[T](obj, self) elif isinstance(T, Ptr): if (isinstance(T.TO, OpaqueType) and - T.TO.hints.get('c_pointer_typedef') is not None): + T.TO._hints.get('c_pointer_typedef') is not None): if obj._obj is not None: value = rffi.cast(rffi.SSIZE_T, obj) return '((%s) %s)' % (cdecl(self.gettype(T), ''), diff --git a/rpython/translator/c/node.py b/rpython/translator/c/node.py index 993023b8d4..1d4df11db8 100644 --- a/rpython/translator/c/node.py +++ b/rpython/translator/c/node.py @@ -947,7 +947,7 @@ class ExtType_OpaqueNode(ContainerNode): def opaquenode_factory(db, T, obj): if T == RuntimeTypeInfo: return db.gcpolicy.rtti_node_factory()(db, T, obj) - if T.hints.get("render_structure", False): + if T._hints.get("render_structure", False): return ExtType_OpaqueNode(db, T, obj) raise Exception("don't know about %r" % (T,)) |