This was considered as bugfix in python 3.8 because bound methods should only be equal if they are bound on the same instance, not if their instances are equal. In Python <= 3.7 the bound method equality calls the equivalent of instance1 == instance2 and return true based on that and while in Python 3.8 it checks if instance1 is instance2.
You can see details about this behavior change in py3.8 - https://bugs.python.org/issue1617161 - python-dev discussion: https://mail.python.org/pipermail/python-dev/2018-June/153959.html With that and for cases of 'strict=False', oslo utils is_same_callback() method behaviour also changed. With 'strict=False', this method returned *True* for python <3.7 (because == comparison used to call the __eq__ method return value) and *False* for python3.8 onwards (because == never call __eq__ method and check the id of self). -https://github.com/openstack/oslo.utils/blob/7c4a94c0c3fcbd8f05541944851728f30deadd9b/oslo_utils/reflection.py#L172-L174 For 'strict' is True (which is the default) there is no behavior change because is_same_callback() method checks if 'self' of both bound methods are equal or not - https://github.com/openstack/oslo.utils/blob/7c4a94c0c3fcbd8f05541944851728f30deadd9b/oslo_utils/reflection.py#L183 We should modify the test to test the behaviors this way and in is_same_callback() method we should clearly document that 'strict' is no more an option or valid thing for python3.8 onwards and we should even deprecate this arg itself. ** Bug watch added: Python Roundup #1617161 http://bugs.python.org/issue1617161 ** Changed in: oslo.utils Status: New => Confirmed ** Changed in: oslo.utils Assignee: (unassigned) => Ghanshyam Mann (ghanshyammann) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to python3-defaults in Ubuntu. https://bugs.launchpad.net/bugs/1841072 Title: test_reflection.CallbackEqualityTest.test_different_instance_callbacks fails on Python 3.8 Status in oslo.utils: Confirmed Status in python-oslo.utils package in Ubuntu: Fix Released Status in python3-defaults package in Ubuntu: Invalid Bug description: When running the unit test on Python 3.8, it fails with the following traceback: oslo_utils.tests.test_reflection.CallbackEqualityTest.test_different_instance_callbacks --------------------------------------------------------------------------------------- Captured traceback: ~~~~~~~~~~~~~~~~~~~ b'Traceback (most recent call last):' b' File "/tmp/oslo.utils/oslo_utils/tests/test_reflection.py", line 156, in test_different_instance_callbacks' b' self.assertTrue(reflection.is_same_callback(b.b, c.b, strict=False))' b' File "/tmp/oslo.utils/.tox/py38/lib/python3.8/site-packages/unittest2/case.py", line 702, in assertTrue' b' raise self.failureException(msg)' b'AssertionError: False is not true' b'' This is apparently caused by a behavior change in Python 3.8 due to [1]. I have confirmed the different behavior by running tests manually on 3.6, 3.7 (both return True) and 3.8. According to [2], only taskflow seems to be using that method now, and it is not changing the default value for the "strict" parameter. [1] - https://bugs.python.org/issue1617161 [2] - http://codesearch.openstack.org/?q=is_same_callback&i=nope&files=&repos= To manage notifications about this bug go to: https://bugs.launchpad.net/oslo.utils/+bug/1841072/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp