bored-art-40741
04/12/2021, 1:19 AMassert classpath_entry == ResolvedClasspathEntry(
coord=MavenCoord(coord="org.hamcrest:hamcrest-core:1.3"),
file_name="hamcrest-core-1.3.jar",
digest=Digest(
fingerprint="66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9",
serialized_bytes_length=45024,
),
)
But my test failure looks like this:
E AssertionError: assert equals failed
E ResolvedClasspathEntry(coord=Ma ResolvedClasspathEntry(coord=Ma
E venCoord(coord='junit:junit:4.1 venCoord(coord='junit:junit:4.1
E 3.2'), file_name='junit-4.13.2. 3.2'), file_name='junit-4.13.2.
E jar', digest=<pants.engine.inte jar', digest=<pants.engine.inte
E rnals.native_engine.PyDigest ob rnals.native_engine.PyDigest ob
E ject at 0x7f3992464810>) ject at 0x7f39924d3998>)
Which suggests that Python is reverting back to "pointer" comparison for the two Digest objects. But what's weird (and I'm about to validate this to be sure) is that my recent change to add __repr__
to Digest
apparently fixes this, so it compares again. And that's kind of terrifying in a different way, because in both cases it should be using some flavor of cmp or eqfast-nail-55400
04/12/2021, 3:17 AM__richcmp__
and __hash__
. https://github.com/pantsbuild/pants/blob/0a43fdf296204e0b28e1473620328f0c8f485795/src/rust/engine/src/externs/fs.rs#L85-L101fast-nail-55400
04/12/2021, 3:24 AM__eq__
and friends on PyDigest?fast-nail-55400
04/12/2021, 3:27 AM__richcmp__
even a thing? PEP 207 https://www.python.org/dev/peps/pep-0207/ acts like it is a rejected idea in favor of __eq__
and friends.fast-nail-55400
04/12/2021, 3:29 AM