-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to persistent >= 4.2.3. #9
Conversation
There seems to be regression in persistent 4.2.3+ breaking the test when using the C implementation.
The tests are failing with this error:
That was surprising because it indicates that the tests are using the pure-Python implementation of the PickleCache. But sure enough, that's what they're importing with This type checking and exception was added to the Python PickleCache way back in 2015 and persistent 4.1.0, as part of the efforts to make the Python implementations behave more like the C implementation. The C implementation has always enforced that type check AFAICS (well, or at least attempted to; the check is very poor for some reason). So basically AFAICS the tests are broken not because of a regression in persistent but because they're legitimately wrong. They were getting away with bad behaviour before, but not any longer. |
I noticed the test failure before, but didn't follow up :( See #5. |
@jamadden I think (but I could not prove it yet) that the following change in But maybe the failure here is only exists because it always uses the Python implementation of the pickle cache. And |
Yes, it's absolutely possible that, by making the PickleCache even more strict and more like the cPickleCache (only accepting the kind of objects it knew about), the referenced change exposed the error here (said error being mixing and matching C and Python implementations of classes). The handling of PURE_PYTHON complicates things... |
I switched the test to use the version of Now I get another error: Error in test test_oid_jar_attrs (Persistence.tests.test_persistent.PersistenceTest)
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
yield
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/case.py", line 605, in run
testMethod()
File "/Users/mac/vcs/gocept/Persistence/src/Persistence/tests/test_persistent.py", line 113, in test_oid_jar_attrs
del obj._p_oid
ValueError: can't delete _p_oid of cached object @hannosch Could you please have a look into it because to were the last one who has changed the code. |
@icemac I think the whole test_oid_jar_attrs test is useless. Or rather I'm not quite sure why it tries to test deleting the I think I'd just delete the test and treat this as an internal detail of lowercase persistent. |
That's expected in both cache implementations when used with their corresponding persistent type (C and Python) But when the C persistent object is put in the pure-Python PickleCache, as happened when the import was wrong, the C-level object didn't know that it was in the Python-level cache, and so the check didn't get done. Now that the imports and implementations match, the behaviour should be consistent, and the |
@jamadden Thank you for your analysis of the problem, I fixed the tests according to your suggestions and modernised the code a bit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I just had one comment about the version pin in setup.py and buildout.cfg not matching.
buildout.cfg
Outdated
@@ -5,6 +5,7 @@ parts = interpreter test | |||
|
|||
[versions] | |||
Persistence = | |||
persistent = >= 4.2.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup.py does not match this. It seems to me like it probably should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was planning to remove this change before the merge because it was only necessary to force this new versions as it was not used by Zope because of the issue now fixed in this PR.
I'll have a look if this change is actually needed and has to be ported to setup.py
.
There seems to be regression in persistent 4.2.3+ breaking the test when using the C implementation.
The previously used version was pinned to 4.2.2 using Zope/master/versions.cfg.
Fixes #5 (currently it only demonstrates the problem)