File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -1103,10 +1103,13 @@ typing
11031103 return two different objects. Users should use ``== `` to compare unions for equality, not
11041104 ``is ``. New-style unions have never been cached this way.
11051105 This change could increase memory usage for some programs that use a large number of
1106- unions, but unions used in annotations are no longer evaluated by default in Python 3.14
1107- (because of :pep: `649 `), the new union object is itself much smaller, and removing the
1108- cache also saves some space, so it is unlikely that this change will cause a significant
1109- increase in memory usage.
1106+ unions created by subscripting ``typing.Union ``. However, several factors offset this cost:
1107+ unions used in annotations are no longer evaluated by default in Python 3.14
1108+ because of :pep: `649 `; an instance of :class: `types.UnionType ` is
1109+ itself much smaller than the object returned by ``Union[] `` was on prior Python
1110+ versions; and removing the cache also saves some space. It is therefore
1111+ unlikely that this change will cause a significant increase in memory usage for most
1112+ users.
11101113 - Previously, old-style unions were implemented using the private class
11111114 ``typing._UnionGenericAlias ``. This class is no longer needed for the implementation,
11121115 but it has been retained for backward compatibility, with removal scheduled for Python
You can’t perform that action at this time.
0 commit comments