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)
class Persistent(object):
""" 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):
inst = super(Persistent, cls).__new__(cls)
......@@ -70,7 +70,6 @@ class Persistent(object):
_OSA(inst, '_Persistent__flags', None)
_OSA(inst, '_Persistent__size', 0)
_OSA(inst, '_Persistent__ring', None)
_OSA(inst, '_Persistent__ring_handle', None)
return inst
# _p_jar: see IPersistent.
......@@ -487,12 +486,6 @@ class Persistent(object):
jar = oga(self, '_Persistent__jar')
if jar is None:
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')
if oid is None:
return
......
......@@ -131,7 +131,7 @@ try:
node = ffi.new("CPersistentRing*")
ring.ring_add(self.ring_home, node)
self.ring_to_obj[node] = pobj
object.__setattr__(pobj, '_Persistent__ring', node)
_OSA(pobj, '_Persistent__ring', node)
def delete(self, pobj):
deleted = 0
......@@ -143,7 +143,7 @@ try:
return deleted
def move_to_head(self, pobj):
node = pobj._Persistent__ring
node = _OGA(pobj, '_Persistent__ring')
ring.ring_move_to_head(self.ring_home, node)
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