Skip to content

Commit

Permalink
Fix pypy
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed May 8, 2017
1 parent a3aab9c commit 4fcaf84
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/zc/catalog/extentcatalog.rst
Expand Up @@ -200,8 +200,7 @@ weighted.
... extent.add(i, None)
...
>>> alt_set = TreeSet()
>>> alt_set.update(range(0, 166, 33)) # return value is unimportant here
6
>>> _ = alt_set.update(range(0, 166, 33)) # return value is unimportant here
>>> sorted(alt_set)
[0, 33, 66, 99, 132, 165]
>>> sorted(extent & alt_set)
Expand Down
11 changes: 11 additions & 0 deletions src/zc/catalog/index.py
Expand Up @@ -43,6 +43,7 @@ def __get__(self, instance, type=None):
d = instance.__dict__
if "family" in d:
return d["family"]

if "btreemodule" in d:
iftype = d["btreemodule"].split(".")[-1][:2]
if iftype == "IF":
Expand All @@ -55,11 +56,21 @@ def __get__(self, instance, type=None):
else:
d["family"] = BTrees.family32
self._clear_old_cruft(instance)

if isinstance(instance, persistent.Persistent):
# Mutating the dict directly is not guaranteed to
# register with the data manager.
instance._p_changed = True

return d["family"]

def __set__(self, instance, value):
instance.__dict__["family"] = value
self._clear_old_cruft(instance)
if isinstance(instance, persistent.Persistent):
# Mutating the dict directly is not guaranteed to
# register with the data manager.
instance._p_changed = True

def _clear_old_cruft(self, instance):
d = instance.__dict__
Expand Down

0 comments on commit 4fcaf84

Please sign in to comment.