https://pantsbuild.org/ logo
#development
Title
# development
h

happy-kitchen-89482

11/07/2022, 6:14 PM
Under what conditions might we get two different Python instances representing the same target? Seeing this happen intermittently in a test (and breaking that test) but it is inconsistent and appears to be subject to a race condition.
Specifically, this happens when we request Targets from RawSpecs - we may or may not get the same instances of those targets that were already in play
I can fix the test issue by adding proper equality semantics to PythonArtifact, but I’m curious why this is happening intermittently and not consistently
w

witty-crayon-22786

11/07/2022, 6:19 PM
if equality/hashing are broken, many bets are off. race conditions of “who set the value first” come into play
but would need more context
h

happy-kitchen-89482

11/07/2022, 6:22 PM
PythonArtifact (the value of
provides=
on
python_distribution
) has broken equality/hashing, indeed
But it is the
python_distribution
target itself that is sometimes different
w

witty-crayon-22786

11/07/2022, 6:33 PM
well, if the effect is that two different
python_distribution
instances have the “same” value from an eq/hash perspective, then memoization might give you back one of the values when you’re expecting the other.
h

happy-kitchen-89482

11/07/2022, 6:39 PM
The break was the other way (two semantically identical PythonArtifacts appeared to be inequal), but yeah, something like that was happening
Fix is easy enough