summaryrefslogtreecommitdiffstats
path: root/Misc/NEWS.d
diff options
context:
space:
mode:
authorIvan Levkivskyi <levkivskyi@gmail.com>2018-03-26 22:01:12 (GMT)
committerGitHub <noreply@github.com>2018-03-26 22:01:12 (GMT)
commit834940375ae88bc95794226dd8eff1f25fba1cf9 (patch)
tree5a14eb4adb449c670e322463c9c690b4ac3f727b /Misc/NEWS.d
parent0e7144b064a19493a146af94175a087b3888c37b (diff)
downloadcpython-834940375ae88bc95794226dd8eff1f25fba1cf9.zip
cpython-834940375ae88bc95794226dd8eff1f25fba1cf9.tar.gz
cpython-834940375ae88bc95794226dd8eff1f25fba1cf9.tar.bz2
bpo-32873: Treat type variables and special typing forms as immutable by copy and pickle (GH-6216)
This also fixes python/typing#512 This also fixes python/typing#511 As was discussed in both issues, some typing forms deserve to be treated as immutable by copy and pickle modules, so that: * copy(X) is X * deepcopy(X) is X * loads(dumps(X)) is X # pickled by reference This PR adds such behaviour to: * Type variables * Special forms like Union, Any, ClassVar * Unsubscripted generic aliases to containers like List, Mapping, Iterable This not only resolves inconsistencies mentioned in the issues, but also improves backwards compatibility with previous versions of Python (including 3.6). Note that this requires some dances with __module__ for type variables (similar to NamedTuple) because the class TypeVar itself is define in typing, while type variables should get module where they were defined. https://bugs.python.org/issue32873
Diffstat (limited to 'Misc/NEWS.d')
-rw-r--r--Misc/NEWS.d/next/Library/2018-03-24-19-54-48.bpo-32873.cHyoAm.rst3
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2018-03-24-19-54-48.bpo-32873.cHyoAm.rst b/Misc/NEWS.d/next/Library/2018-03-24-19-54-48.bpo-32873.cHyoAm.rst
new file mode 100644
index 0000000..99f8088
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-03-24-19-54-48.bpo-32873.cHyoAm.rst
@@ -0,0 +1,3 @@
+Treat type variables and special typing forms as immutable by copy and
+pickle. This fixes several minor issues and inconsistencies, and improves
+backwards compatibility with Python 3.6.