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
{{ message }}
Repository navigation
Code objects have incorrect hash/equality when code is instrumented for sys.monitoring #111984
A thread stress test in the coverage.py test suite was failing with seemingly impossible behavior: a code object is used as a key in a dict, and then cannot be found. I eventually tracked it down to a mismatch between how bytecodes are examined in code_hash and in code_richcompare.
I'm adding support in coverage.py for sys.monitoring. If we don't backport this, then any code that hashes code objects could behave strangely under coverage measurement.
Activity
gaogaotiantian commentedon Nov 11, 2023
This is fixed in main in #109107. Do we want to backport it @brandtbucher? There might be conflicts as the executor part is not there in 3.12.
nedbat commentedon Nov 11, 2023
I'm adding support in coverage.py for sys.monitoring. If we don't backport this, then any code that hashes code objects could behave strangely under coverage measurement.
brandtbucher commentedon Nov 22, 2023
Yeah, the
code_richcomparestuff and test should probably be backported manually to 3.12.@gaogaotiantian, interested in opening a PR?
gaogaotiantian commentedon Nov 23, 2023
Done in #112329