From 4fcaf844398eb4cc9cbd85b069e34786257526fd Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Mon, 8 May 2017 12:29:08 -0500 Subject: [PATCH] Fix pypy --- src/zc/catalog/extentcatalog.rst | 3 +-- src/zc/catalog/index.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/zc/catalog/extentcatalog.rst b/src/zc/catalog/extentcatalog.rst index 786fc82..30aa324 100644 --- a/src/zc/catalog/extentcatalog.rst +++ b/src/zc/catalog/extentcatalog.rst @@ -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) diff --git a/src/zc/catalog/index.py b/src/zc/catalog/index.py index 9359827..ab27f6d 100644 --- a/src/zc/catalog/index.py +++ b/src/zc/catalog/index.py @@ -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": @@ -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__