Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

typing._UnionGenericAlias is unhashable in 3.14 #133925

Closed
Labels
@neutrinoceros

Description

@neutrinoceros

Bug report

Bug description:

typing._UnionGenericAlias) became unshable somewhere between 3.13 and 3.14.0b1 (most likely ingh-105511)

importtypinghash(typing._UnionGenericAlias)
Traceback (most recent call last):  File"<python-input-0>", line2, in<module>hash(typing._UnionGenericAlias)~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^TypeError:unhashable type: '_UnionGenericAliasMeta'

This was hit in a doctest fromastropy: xrefastropy/astropy#18126
To be clear, the test in question doesn't necessarily correspond to a real-life application; we're testing that ouritersubclasses utility function works in a very broad case where we try to retrieve all defined subclasses ofobject, and do a bit of internal book-keeping using aset of already-visited classes. This used to work in Python 3.13 (and seems to have worked with no interruption for 10+ years), so it still seemed worth a shot to see if that would be considered a bug here. Otherwise, it should be possible to fix the function on our side to either special case this exact class, ignore any unhashable class, or avoid reequiring hashability altogether.

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp