[pypy-svn] r25775 - pypy/dist/pypy/annotation
arigo at codespeak.net
arigo at codespeak.net
Thu Apr 13 12:10:35 CEST 2006
Author: arigo
Date: Thu Apr 13 12:10:34 2006
New Revision: 25775
Modified:
pypy/dist/pypy/annotation/binaryop.py
pypy/dist/pypy/annotation/unaryop.py
Log:
Clean up old code.
Modified: pypy/dist/pypy/annotation/binaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/binaryop.py (original)
+++ pypy/dist/pypy/annotation/binaryop.py Thu Apr 13 12:10:34 2006
@@ -775,6 +775,7 @@
return s_result.return_annotation()
class __extend__(pairtype(SomeCTypesObject, SomeSlice)):
+ # XXX ctypes array slicing not really supported for now
def setitem((s_cto, s_slice), s_iterable):
pass
Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py (original)
+++ pypy/dist/pypy/annotation/unaryop.py Thu Apr 13 12:10:34 2006
@@ -638,30 +638,9 @@
def getattr(cto, s_attr):
if s_attr.is_constant() and isinstance(s_attr.const, str):
attr = s_attr.const
- # We reactivate the old contents field hack
- if False:
- try:
- atype = cto.knowntype._fields_def_[attr]
- except AttributeError:
- # We are dereferencing a pointer by accessing its contents attribute
- if s_attr.const == "contents":
- return SomeCTypesObject(
- cto.knowntype._type_, cto.MEMORYALIAS)
- else:
- raise AttributeError(
- "%r object has no attribute %r" % (
- cto.knowntype, s_attr.const))
- else:
- if extregistry.is_registered_type(cto.knowntype):
- entry = extregistry.lookup_type(cto.knowntype)
- s_value = entry.get_field_annotation(cto, attr)
- return s_value
- else:
- atype = cto.knowntype._fields_def_[attr]
- try:
- return atype.annotator_type
- except AttributeError:
- return SomeCTypesObject(atype)
+ entry = extregistry.lookup_type(cto.knowntype)
+ s_value = entry.get_field_annotation(cto, attr)
+ return s_value
else:
return SomeObject()
More information about the Pypy-commit
mailing list