You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although 12044 fixes the problem, something a bit more fundamental may have changed. I have spent time investigating why this is happening and the problem is that in the line:
self.assertEqual(c.attr, 1)
Evil.__eq__ is invoked twice where before it was only invoked once. This does not happen all the time, and it seems to only happen under some combination of hashes in the class dictionary, being the extra __eq__ invocation a check for equality when looking up attr in the c object. When the test succeeds, the extra check is not done (and therefore the attribute is not deleted). I think this happens because some identity is used to check when doing the lookup (comparing the pointers) but I would like to understand exactly how the hash is influencing the different code paths to be sure that nothing important has changed recently.
Ok, actually this turns to be much easier: Sometimes __eq__ was also called twice but now as we use PyDict_GetItemWithError instead of PyDict_GetItem, if the extra __eq__ happens as a consequence of a dict lookup the error is ignored so that was the reason the test was not failing before.
changed the title [-]test_descr fails on AMD64 Windows8 3.x buildbots[/-][+]test_descr: test_vicious_descriptor_nonsense() fails randomly[/+]on Feb 26, 2019
Activity
pablogsal commentedon Feb 25, 2019
https://buildbot.python.org/all/#/builders/32/builds/2198
======================================================================
ERROR: test_vicious_descriptor_nonsense (test.test_descr.ClassPropertiesAndMethods)
----------------------------------------------------------------------
Ran 140 tests in 7.836s
pablogsal commentedon Feb 25, 2019
I can reproduce this locally. How has this not being spotted by the CI:
test_descr failed
== Tests result: FAILURE ==
1 test failed:
test_descr
Total duration: 2 sec 437 ms
Tests result: FAILURE
pablogsal commentedon Feb 25, 2019
It seems that this is a race condition created as a consequence of:
https://github.com/python/cpython/pull/11112/files
pablogsal commentedon Feb 26, 2019
Although 12044 fixes the problem, something a bit more fundamental may have changed. I have spent time investigating why this is happening and the problem is that in the line:
Evil.__eq__ is invoked twice where before it was only invoked once. This does not happen all the time, and it seems to only happen under some combination of hashes in the class dictionary, being the extra __eq__ invocation a check for equality when looking up attr in the c object. When the test succeeds, the extra check is not done (and therefore the attribute is not deleted). I think this happens because some identity is used to check when doing the lookup (comparing the pointers) but I would like to understand exactly how the hash is influencing the different code paths to be sure that nothing important has changed recently.
pablogsal commentedon Feb 26, 2019
Ok, actually this turns to be much easier: Sometimes __eq__ was also called twice but now as we use PyDict_GetItemWithError instead of PyDict_GetItem, if the extra __eq__ happens as a consequence of a dict lookup the error is ignored so that was the reason the test was not failing before.
pablogsal commentedon Feb 26, 2019
New changeset ff3d39f by Pablo Galindo (Serhiy Storchaka) in branch 'master':
bpo-36109: Fix random test_descr failure. (GH-12044)
ff3d39f
pablogsal commentedon Feb 26, 2019
A lot of buildbots were failing for this test so a lot of them will become green after ff3d39f.
[-]test_descr fails on AMD64 Windows8 3.x buildbots[/-][+]test_descr: test_vicious_descriptor_nonsense() fails randomly[/+]