[New-bugs-announce] [issue44001] typing.Literal: args must be hashable, not immutable

Jelle Zijlstra report at bugs.python.org
Sat May 1 13:15:22 EDT 2021


New submission from Jelle Zijlstra <jelle.zijlstra at gmail.com>:

After the changes from bpo-42345, the Literal documentation claims that "Literal objects will now raise a TypeError exception during equality comparisons if one of their parameters are not immutable." But in fact it's *unhashable* types that raise an error; mutable but hashable types such as functions or custom objects work fine.

I'll submit a PR for this but may wait until GH-25787 is resolved.

----------
assignee: Jelle Zijlstra
components: Documentation
messages: 392608
nosy: Jelle Zijlstra
priority: normal
severity: normal
status: open
title: typing.Literal: args must be hashable, not immutable
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44001>
_______________________________________


More information about the New-bugs-announce mailing list