This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients FFY00, brandtbucher, gvanrossum, jefferyto, lukasz.langa, methane, obfusk, pablogsal, rhettinger, serhiy.storchaka, vstinner
Date 2021-09-03.11:44:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630669458.92.0.739288668298.issue37596@roundup.psfhosted.org>
In-reply-to
Content
The test failed at:

    def test_deterministic_sets(self):
        # bpo-37596: To support reproducible builds, sets and frozensets need to
        # have their elements serialized in a consistent order (even when they
        # have been scrambled by hash randomization):
        for kind in ("set", "frozenset"):
            for elements in (
                "float('nan'), b'a', b'b', b'c', 'x', 'y', 'z'",
                # Also test for bad interactions with backreferencing:
                "('string', 1), ('string', 2), ('string', 3)",
            ):
                s = f"{kind}([{elements}])"
                with self.subTest(s):
                    # First, make sure that our test case still has different
                    # orders under hash seeds 0 and 1. If this check fails, we
                    # need to update this test with different elements:
                    args = ["-c", f"print({s})"]
                    _, repr_0, _ = assert_python_ok(*args, PYTHONHASHSEED="0")
                    _, repr_1, _ = assert_python_ok(*args, PYTHONHASHSEED="1")
                    self.assertNotEqual(repr_0, repr_1)  # <=== HERE
                    (...)

It checks that the representation of a set is different for two different PYTHONHASHSEED values (0 and 1). On my Fedora 34, I confirm that they are different:

PYTHONHASHSEED=0:

vstinner@apu$ PYTHONHASHSEED=0 ./python -c "print(set([('string', 1), ('string', 2), ('string', 3)]))"
{('string', 1), ('string', 2), ('string', 3)}
vstinner@apu$ PYTHONHASHSEED=0 ./python -c "print(set([('string', 1), ('string', 2), ('string', 3)]))"
{('string', 1), ('string', 2), ('string', 3)}
vstinner@apu$ PYTHONHASHSEED=0 ./python -c "print(set([('string', 1), ('string', 2), ('string', 3)]))"
{('string', 1), ('string', 2), ('string', 3)}

versus PYTHONHASHSEED=1:

vstinner@apu$ PYTHONHASHSEED=1 ./python -c "print(set([('string', 1), ('string', 2), ('string', 3)]))"
{('string', 3), ('string', 1), ('string', 2)}
vstinner@apu$ PYTHONHASHSEED=1 ./python -c "print(set([('string', 1), ('string', 2), ('string', 3)]))"
{('string', 3), ('string', 1), ('string', 2)}
vstinner@apu$ PYTHONHASHSEED=1 ./python -c "print(set([('string', 1), ('string', 2), ('string', 3)]))"
History
Date User Action Args
2021-09-03 11:44:18vstinnersetrecipients: + vstinner, gvanrossum, rhettinger, methane, lukasz.langa, serhiy.storchaka, pablogsal, brandtbucher, FFY00, jefferyto, obfusk
2021-09-03 11:44:18vstinnersetmessageid: <1630669458.92.0.739288668298.issue37596@roundup.psfhosted.org>
2021-09-03 11:44:18vstinnerlinkissue37596 messages
2021-09-03 11:44:18vstinnercreate