Re: Migrating to BTrees 4.x

Jim Fulton <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <CAPDm-FgU_jx4Ev+JcKoGWqgTsPxgJ9bj4vE70TRgmEjgpLgJOg@mail.gmail.com>
So, now the problem will move up through the application stack. :)

And perhaps become harder.

But surely people have built apps with BTrees 4, because BTrees 4 was
released a loooooooong time ago (late 2012), and this seatbelt was
introduced in BTrees 4.0.

When indexing content, you will very often encounter content without a
value set, typically defaulting to None.

When such values are indexed, you'll get an error.  I don't see any guard
against this error in, for example, zope.index.

Have people built newer apps with indexing on BTrees 4? If so, how have you
dealt with this issue?

Jim

On Thu, Jan 5, 2017 at 12:02 PM, Jim Fulton <[email protected]> wrote:

>
>
> On Sun, Nov 27, 2016 at 4:43 PM, David Glick (Glick Software) <
> [email protected]> wrote:
>
>> On 11/27/16 9:43 AM, Jim Fulton wrote:
>>
>>
>>
>> On Sat, Nov 26, 2016 at 8:55 PM, David Glick <[email protected]> wrote:
>>
>>> On 11/20/16 9:31 AM, Jim Fulton wrote:
>>>
>>>
>>>
>>> On Sun, Nov 20, 2016 at 12:11 PM, Jason Madden <
>>> [email protected]> wrote:
>>>
>>> ...
>
>> 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...
>>>
>>
>> Well
>>
>> a) We don't have a way to use databases created in Python 2 in Python 3
>> (do we?).
>>
>> b) It's impossible to insert None as a key in Python 3.
>>
>> If a & b, then this seems to be a non-issue and the tests should be
>> Python version dependent.
>>
>> I was thinking the same thing, and I've opened a pull request:
>> https://github.com/zopefoundation/BTrees/pull/54
>>
>
> This got merged a couple of weeks ago.
>
> I just made a release with this fix.  Thanks!
>
> Jim
>
> --
> Jim Fulton
> http://jimfulton.info
>



-- 
Jim Fulton
http://jimfulton.info

-- 
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.