Commit a37df864 authored by Jason Madden's avatar Jason Madden

Remove the unused __ring_handle, and tweak move_to_head to avoid recursive...

Remove the unused __ring_handle, and tweak move_to_head to avoid recursive call to __getattribute__ based on benchmarks.
parent 1c1e2c79
...@@ -56,7 +56,7 @@ _SPECIAL_NAMES = set(SPECIAL_NAMES) ...@@ -56,7 +56,7 @@ _SPECIAL_NAMES = set(SPECIAL_NAMES)
class Persistent(object): class Persistent(object):
""" Pure Python implmentation of Persistent base class """ Pure Python implmentation of Persistent base class
""" """
__slots__ = ('__jar', '__oid', '__serial', '__flags', '__size', '__ring', '__ring_handle') __slots__ = ('__jar', '__oid', '__serial', '__flags', '__size', '__ring',)
def __new__(cls, *args, **kw): def __new__(cls, *args, **kw):
inst = super(Persistent, cls).__new__(cls) inst = super(Persistent, cls).__new__(cls)
...@@ -70,7 +70,6 @@ class Persistent(object): ...@@ -70,7 +70,6 @@ class Persistent(object):
_OSA(inst, '_Persistent__flags', None) _OSA(inst, '_Persistent__flags', None)
_OSA(inst, '_Persistent__size', 0) _OSA(inst, '_Persistent__size', 0)
_OSA(inst, '_Persistent__ring', None) _OSA(inst, '_Persistent__ring', None)
_OSA(inst, '_Persistent__ring_handle', None)
return inst return inst
# _p_jar: see IPersistent. # _p_jar: see IPersistent.
...@@ -487,12 +486,6 @@ class Persistent(object): ...@@ -487,12 +486,6 @@ class Persistent(object):
jar = oga(self, '_Persistent__jar') jar = oga(self, '_Persistent__jar')
if jar is None: if jar is None:
return return
# XXX: If we bail here, a number of persistence tests
# fail. However, the C implementation only does this if
# it's already in the ring (maybe somebody does that earlier?)
#myring = oga(self, '_Persistent__ring')
#if myring is None or not myring.r_next:
# return
oid = oga(self, '_Persistent__oid') oid = oga(self, '_Persistent__oid')
if oid is None: if oid is None:
return return
......
...@@ -131,7 +131,7 @@ try: ...@@ -131,7 +131,7 @@ try:
node = ffi.new("CPersistentRing*") node = ffi.new("CPersistentRing*")
ring.ring_add(self.ring_home, node) ring.ring_add(self.ring_home, node)
self.ring_to_obj[node] = pobj self.ring_to_obj[node] = pobj
object.__setattr__(pobj, '_Persistent__ring', node) _OSA(pobj, '_Persistent__ring', node)
def delete(self, pobj): def delete(self, pobj):
deleted = 0 deleted = 0
...@@ -143,7 +143,7 @@ try: ...@@ -143,7 +143,7 @@ try:
return deleted return deleted
def move_to_head(self, pobj): def move_to_head(self, pobj):
node = pobj._Persistent__ring node = _OGA(pobj, '_Persistent__ring')
ring.ring_move_to_head(self.ring_home, node) ring.ring_move_to_head(self.ring_home, node)
def delete_all(self, indexes_and_values): def delete_all(self, indexes_and_values):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment