|
Ran
|
Jobs
1
|
Files
1265
|
Run time
1min
|
Badge
README BADGES
|
push
github
Fix `Channel.__hash__` in multiprocessing contexts (#11251) (#11255) * Fix `Channel.__hash__` in multiprocessing contexts Storing an explicit hash key is fragile in cases that a channel might be created in a different process to where it might be compared or the hash used, because the hash seeding can vary depending on how the new interpreter process was created, especially if it's not done by `fork`. In this case, transmitting the stored `_hash` over pickle meant that a `DriveChannel(0)` created in the main process of a macOS runner could compare equal to a `DriveChannel(0)` created in a separate process (standard start method `spawn`) and pickled over the wire to the main process, but have different hashes, violating the Python data model. Instead, we can just use the standard Python behaviour of creating the hash on demand when requested; this should typically be preferred unless absolutely necessary for critical performance reasons, because it will generally fail safe. * Fix `hash` and equality in other pulse objects This removes all caching of items' `hash`es. This practice is quite fraught in multiprocessing contexts, and should only be done when it is absolutely performance critical. In a couple of cases, the pulse objects were using the cached `hash` as the main component of their `__eq__` methods, which is not correct; it's totally valid to have hash collisions without implying that two objects are equal. (cherry picked from commit 3c1a87c48) Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
2 of 2 new or added lines in 2 files covered. (100.0%)
4 existing lines in 1 file now uncovered.74217 of 85343 relevant lines covered (86.96%)
92025.04 hits per line
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | 6890289762.1 | 0 |
86.96 |
GitHub Action Run |