Giter VIP home page Giter VIP logo

Comments (12)

agroszer avatar agroszer commented on June 20, 2024

@jamadden ^

from persistent.

mgedmin avatar mgedmin commented on June 20, 2024

I have a feeling this is because the tests run on a 32-bit build rather than because it's Windows or because it's Python 2.6.

Note that hash('a string') will differ on 32- and 64-bit platforms (and also different Python versions may compute different hashes):

>>> hash('a string')  # Python 2.6.5, Linux, 32-bit
1827144452
>>> hash('a string')  # Python 2.6.9, Linux, 64-bit
-8411828025894108412
>>> hash('a string')  # Python 3.4.2, Linux, 64-bit
-8227545103199816438

from persistent.

mgedmin avatar mgedmin commented on June 20, 2024

At some point Travis CI might allow us to test both 32- and 64-bit builds in the build matrix: travis-ci/travis-ci#986

from persistent.

mgedmin avatar mgedmin commented on June 20, 2024

Okay, string hashes are irrelevant for this issue:

static long
TimeStamp_hash(TimeStamp *self)
{
register unsigned char *p = (unsigned char *)self->data;
register int len = 8;
register long x = *p << 7;
while (--len >= 0)
x = (1000003*x) ^ *p++;
x ^= 8;
if (x == -1)
x = -2;
return x;
}

from persistent.

mgedmin avatar mgedmin commented on June 20, 2024

Perhaps it would be sufficient to replace ctypes.c_int64 with ctypes.c_long in pyTimeStamp.hash?

from persistent.

mgedmin avatar mgedmin commented on June 20, 2024

Unfortunately the test still fails: http://winbot.zope.org/builders/persistent_py_265_32/builds/972/steps/test/logs/stdio

Failure in test test_hash_equal_constants (persistent.tests.test_timestamp.PyAndCComparisonTests)
Traceback (most recent call last):
  File "c:\Python26_32\lib\unittest.py", line 279, in run
    testMethod()
  File "c:\buildslave\persistent\build\persistent\tests\test_timestamp.py", line 302, in test_hash_equal_constants
    self.assertEqual(hash(c), 1000006000001)
  File "c:\Python26_32\lib\unittest.py", line 350, in failUnlessEqual
    (msg or '%r != %r' % (first, second))
AssertionError: -721379967 != 1000006000001L
Failure in test test_py_hash_32_64_bit (persistent.tests.test_timestamp.PyAndCComparisonTests)
Traceback (most recent call last):
  File "c:\Python26_32\lib\unittest.py", line 279, in run
    testMethod()
  File "c:\buildslave\persistent\build\persistent\tests\test_timestamp.py", line 275, in test_py_hash_32_64_bit
    self.assertEqual(hash(py), bit_64_hash)
  File "c:\Python26_32\lib\unittest.py", line 350, in failUnlessEqual
    (msg or '%r != %r' % (first, second))
AssertionError: 1979033151 != -3850693964765720575L

from persistent.

mgedmin avatar mgedmin commented on June 20, 2024

The 1st failure (test_hash_equal_constants) is the same as before. The failure in test_hash_equal is gone. The failure in test_py_hash_32_64_bit is new.

from persistent.

jamadden avatar jamadden commented on June 20, 2024

In test_py_hash_32_64_bit, I probably need to directly call __hash__ to avoid the interpreter's built-in truncating of the 64-bit value.

As for the constants, sorry I missed those the first time around. I obviously calculated those based on a 64-bit platform. What if we skip that test on a 32-bit platform?

from persistent.

jamadden avatar jamadden commented on June 20, 2024

By the way, these failures don't go to the "zope-dev" mailing list, like, for example, the zope.toolkit failures do. Is there some other list they go to so I could catch them earlier?

from persistent.

jamadden avatar jamadden commented on June 20, 2024

I found a 32-bit Python to test on, so hopefully PR #23 should really do it.

from persistent.

mgedmin avatar mgedmin commented on June 20, 2024

The failures go to [email protected], and then a daily summary is sent to [email protected] (but it's basically delayed by a whole day). I use this script to analyze the daily summaries in a non-painful way.

from persistent.

jamadden avatar jamadden commented on June 20, 2024

Thank you.

from persistent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.