[Zope3-dev] Testing ZODB in Python2.5.

Tim Peters tim.peters at gmail.com
Wed Jun 6 15:19:01 EDT 2007


[nikhil n]
> ZODB shows an error when tested with
> python2.5.(http://zope3.pastey.net/52960)
> I think Python 2.5 unified long and normal integer and this caused
> the error.

This is actually due to changes in Python's `struct` module, more
accidentally than not related to the ongoing int/long unification.
Here's a little program:

import struct
x = struct.pack(">Q", 42)
print repr(struct.unpack(">Q", x))

Under 2.4 that prints (42L,), under 2.5 (42,).  ZODB's u64() is a
wrapper around a similar struct.unpack() call, so inherits the same
behavior.

> Is it enough that we add a renormalizer in testrunner.py?

I think it's better to change the specific test that failed; e.g., change the

    u64(oid)

part to

    int(u64(oid))

in the test, and change the expected output to match the new output,
That way the test will pass under all versions of Python, without
anything hidden in magical normalizers.


More information about the Zope3-dev mailing list