[pypy-svn] r20489 - in pypy/branch/somepbc-refactoring/pypy: annotation rpython rpython/lltypesystem
arigo at codespeak.net
arigo at codespeak.net
Thu Dec 1 12:59:33 CET 2005
Author: arigo
Date: Thu Dec 1 12:59:32 2005
New Revision: 20489
Modified:
pypy/branch/somepbc-refactoring/pypy/annotation/classdef.py
pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rpbc.py
pypy/branch/somepbc-refactoring/pypy/rpython/rpbc.py
Log:
* fix obscure rtyper bug: a bad caching.
* small unrelated fix in classdef.
Modified: pypy/branch/somepbc-refactoring/pypy/annotation/classdef.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/annotation/classdef.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/annotation/classdef.py Thu Dec 1 12:59:32 2005
@@ -150,7 +150,6 @@
def add_source_for_attribute(self, attr, source):
"""Adds information about a constant source for an attribute.
"""
- sources = self.attr_sources.setdefault(attr, [])
for cdef in self.getmro():
if attr in cdef.attrs:
# the Attribute() exists already for this class (or a parent)
@@ -165,6 +164,7 @@
return
else:
# remember the source in self.attr_sources
+ sources = self.attr_sources.setdefault(attr, [])
sources.append(source)
# register the source in any Attribute found in subclasses,
# to restore invariant (III)
Modified: pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rpbc.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rpbc.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rpbc.py Thu Dec 1 12:59:32 2005
@@ -28,10 +28,9 @@
class MultipleFrozenPBCRepr(MultiplePBCRepr):
"""Representation selected for multiple non-callable pre-built constants."""
- def __init__(self, rtyper, frozendescs):
+ def __init__(self, rtyper, access_set):
self.rtyper = rtyper
- self.descs = frozendescs
- self.access_set = frozendescs[0].queryattrfamily()
+ self.access_set = access_set
self.pbc_type = ForwardReference()
self.lowleveltype = Ptr(self.pbc_type)
self.pbc_cache = {}
@@ -52,8 +51,9 @@
self.llfieldmap = llfieldmap
def convert_desc(self, frozendesc):
- if self.access_set is not None and frozendesc not in self.descs:
- raise TyperError("not found in PBC set: %r" % (frozendesc,))
+ if (self.access_set is not None and
+ frozendesc not in self.access_set.descs):
+ raise TyperError("not found in PBC access set: %r" % (frozendesc,))
try:
return self.pbc_cache[frozendesc]
except KeyError:
Modified: pypy/branch/somepbc-refactoring/pypy/rpython/rpbc.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/rpbc.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/rpbc.py Thu Dec 1 12:59:32 2005
@@ -308,7 +308,8 @@
try:
return rtyper.pbc_reprs[access]
except KeyError:
- result = rtyper.type_system.rpbc.MultipleFrozenPBCRepr(rtyper, descs)
+ result = rtyper.type_system.rpbc.MultipleFrozenPBCRepr(rtyper,
+ access)
rtyper.pbc_reprs[access] = result
rtyper.add_pendingsetup(result)
return result
More information about the Pypy-commit
mailing list