Re: Migrating to BTrees 4.x

"David Glick (Glick Software)" <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <[email protected]>
On 11/20/16 9:31 AM, Jim Fulton wrote:
>
>
> On Sun, Nov 20, 2016 at 12:11 PM, Jason Madden 
> <[email protected] <mailto:[email protected]>> 
> wrote:
>
>
>     > On Nov 20, 2016, at 10:25, Jim Fulton <[email protected]
>     <mailto:[email protected]>> wrote:
>     >
>     >> But it seems safe to say there are at least some discrepancies
>     and some clear bugs in the handling of unorderable objects still.
>     >
>     > Yup.  Partly I suspect this is the related to the many ways one
>     can express comparison in Python. (Talk about more than one way to
>     do it.)
>     >
>     > I think this may also be related to inserting into an empty
>     BTree, where there's noting to compare the new item to and thus no
>     opportunity to fail.  Perhaps, if we're paranoid, we should
>     compare the first item to itself on insert.
>
>     You're right, under Python 3, this only happens in an empty tree.
>     Once there are other items, you get "TypeError: unorderable types:
>     Bad() < ..." errors. Under Python 2, of course, no such luck.
>
>     > In any case, I think the focus for this seat belt should be on
>     insertion.
>
>     I've opened a series of issues in the repository
>     (https://github.com/zopefoundation/BTrees/issues
>     <https://github.com/zopefoundation/BTrees/issues>) that I think
>     capture the discussion here.
>
>
> Thanks.
>
>     I may be able to come up with some PRs over the next week for them.
>
>
> It looks like David was going to try a fix. David, did this discussion 
> help?

I finally had time to look at this again today. I've got a branch 
(check-obj-cmp-on-insert-only) that makes the CPython implementation 
only do the check on insertion so it's more like the Python 
implementation. However, trying to delete None as a key still raises 
"TypeError: unorderable types: NoneType() < NoneType()" in Python 3 
(both implementations; we weren't testing the pure-Python implementation 
on Python 3 except for PyPy3). This is presumably Python itself 
complaining when trying to search for the bucket. I suppose the 
workaround is: for the search during delete only, if the keys use 
default comparison, compare them using a function that mimics Python 2 
comparison and thus skips the check for unorderable types. Gaaa...

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.