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 Antony.Lee
Recipients Antony.Lee, barneygale, brett.cannon, pitrou
Date 2020-02-28.22:53:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
A problem of having this bit of state in paths is that it violates assumptions based on immutability/hashability, e.g. with

    from pathlib import Path

    p = Path("foo")
    q = Path("foo")

    with p: pass

    unique_paths = {p, q}

    print(len(unique_paths))  # == 1, as p == q
    for path in unique_paths:
        print(path.resolve())  # Fails if the path is closed.

The last line fails with `unique_paths = {p, q}` as p has been closed (and apparently sets keep the first element when multiple "equal" elements are passed in), but not with `unique_paths = {q, p}`.

It would also prevent optimizations based on immutability as proposed in
Date User Action Args
2020-02-28 22:53:44Antony.Leesetrecipients: + Antony.Lee, brett.cannon, pitrou, barneygale
2020-02-28 22:53:43Antony.Leesetmessageid: <>
2020-02-28 22:53:43Antony.Leelinkissue39682 messages
2020-02-28 22:53:43Antony.Leecreate