@@ -1454,3 +1454,32 @@ Removed
1454
1454
``PyNullImporter_Type ``, ``PyCmpWrapper_Type ``, ``PySortWrapper_Type ``,
1455
1455
``PyNoArgsFunction ``.
1456
1456
(Contributed by Pablo Galindo Salgado in :issue: `39372 `.)
1457
+
1458
+ Notable changes in Python 3.9.1
1459
+ ===============================
1460
+
1461
+ typing
1462
+ ------
1463
+
1464
+ The behavior of :class: `typing.Literal ` was changed to conform with :pep: `586 `
1465
+ and to match the behavior of static type checkers specified in the PEP.
1466
+
1467
+ 1. ``Literal `` now de-duplicates parameters.
1468
+ 2. Equality comparisons between ``Literal `` objects are now order independent.
1469
+ 3. ``Literal `` comparisons now respect types. For example,
1470
+ ``Literal[0] == Literal[False] `` previously evaluated to ``True ``. It is
1471
+ now ``False ``. To support this change, the internally used type cache now
1472
+ supports differentiating types.
1473
+ 4. ``Literal `` objects will now raise a :exc: `TypeError ` exception during
1474
+ equality comparisons if one of their parameters are not :term: `immutable `.
1475
+ Note that declaring ``Literal `` with mutable parameters will not throw
1476
+ an error::
1477
+
1478
+ >>> from typing import Literal
1479
+ >>> Literal[{0}]
1480
+ >>> Literal[{0}] == Literal[{False}]
1481
+ Traceback (most recent call last):
1482
+ File "<stdin>", line 1, in <module>
1483
+ TypeError: unhashable type: 'set'
1484
+
1485
+ (Contributed by Yurii Karabas in :issue: `42345 `.)
0 commit comments