cpython/Lib
Miss Islington (bot) d0e04c8244
bpo-32873: Treat type variables and special typing forms as immutable by copy and pickle (GH-6216)
This also fixes python/typingGH-512
This also fixes python/typingGH-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  GH- 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
(cherry picked from commit 834940375a)

Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2018-03-26 15:29:06 -07:00
..
asyncio bpo-33037: Skip sending/receiving after SSL transport closing (GH-6044) (GH-6057) 2018-03-10 18:27:01 +02:00
collections
concurrent bpo-33056 FIX leaking fd in concurrent.futures.ProcessPoolExecutor (GH-6084) (#6092) 2018-03-13 10:10:57 +01:00
ctypes
curses
dbm
distutils
email
encodings bpo-32943: Fix confusing error message for rot13 codec (GH-5869) 2018-03-24 21:30:39 -07:00
ensurepip Upgrade pip to v9.0.3 and setuptools to v39.0.1 (GH-6184) 2018-03-21 23:38:24 -04:00
html
http bpo-31639: Use threads in http.server module. (GH-5018) 2018-03-23 13:31:20 -07:00
idlelib bpo-32984: IDLE - set __file__ for startup files (GH-5981) 2018-03-05 08:49:15 -08:00
importlib bpo-32838: Fix Python versions in the table of magic numbers. (GH-5658) 2018-02-23 11:01:54 -08:00
json
lib2to3 Revert "bpo-30406: Make async and await proper keywords (GH-1669)" (GH-6143) 2018-03-18 12:15:52 -07:00
logging Revert unneccessary changes made in bpo-30296 and apply other improvements. (GH-2624) 2018-02-26 08:22:24 -08:00
msilib
multiprocessing bpo-33078 - Fix queue size on pickling error (GH-6119) (GH-6178) 2018-03-21 17:21:15 +01:00
pydoc_data Update NEWS, docs, and patchlevel for 3.7.0b2 2018-02-27 19:49:18 -05:00
site-packages
sqlite3 bpo-27645: Fix version number in 'database in transaction' fallback (GH-6131) 2018-03-18 09:24:33 +03:00
test bpo-32873: Treat type variables and special typing forms as immutable by copy and pickle (GH-6216) 2018-03-26 15:29:06 -07:00
tkinter bpo-33096: Fix ttk.Treeview.insert. (GH-6228) 2018-03-26 01:19:52 -07:00
turtledemo
unittest
urllib Revert unneccessary changes made in bpo-30296 and apply other improvements. (GH-2624) 2018-02-26 08:22:24 -08:00
venv
wsgiref
xml
xmlrpc
__future__.py
__phello__.foo.py
_bootlocale.py
_collections_abc.py
_compat_pickle.py
_compression.py
_dummy_thread.py
_markupbase.py
_osx_support.py
_py_abc.py bpo-33018: Improve issubclass() error checking and message. (GH-5944) 2018-03-22 04:49:26 -07:00
_pydecimal.py
_pyio.py
_sitebuiltins.py
_strptime.py
_threading_local.py Delete a broken threading.local example (GH-5870) 2018-02-25 07:23:25 -08:00
_weakrefset.py
abc.py
aifc.py bpo-32056: Improve exceptions in aifc, wave and sunau. (GH-5951) 2018-03-18 13:50:41 -07:00
antigravity.py
argparse.py
ast.py
asynchat.py
asyncore.py
base64.py
bdb.py
binhex.py
bisect.py
bz2.py
calendar.py
cgi.py
cgitb.py
chunk.py
cmd.py
code.py
codecs.py
codeop.py
colorsys.py
compileall.py
configparser.py
contextlib.py
contextvars.py
copy.py
copyreg.py
cProfile.py
crypt.py
csv.py
dataclasses.py bpo-33141: Have dataclasses.Field pass through __set_name__ to any default argument. (GH-6260) 2018-03-26 10:55:13 -07:00
datetime.py
decimal.py
difflib.py bpo-32981: Fix catastrophic backtracking vulns (GH-5955) 2018-03-03 21:55:07 -08:00
dis.py
doctest.py
dummy_threading.py
enum.py
filecmp.py
fileinput.py
fnmatch.py
formatter.py
fractions.py
ftplib.py
functools.py
genericpath.py
getopt.py
getpass.py
gettext.py
glob.py
gzip.py
hashlib.py
heapq.py
hmac.py
imaplib.py
imghdr.py
imp.py
inspect.py bpo-33009: Fix inspect.signature() for single-parameter partialmethods. (GH-6004) 2018-03-06 10:23:48 -08:00
io.py
ipaddress.py bpo-27683: Fix a regression for host() of ipaddress network objects (GH-6016) 2018-03-20 18:22:23 -07:00
keyword.py
linecache.py
locale.py
lzma.py
macpath.py
mailbox.py
mailcap.py
mimetypes.py
modulefinder.py
netrc.py
nntplib.py
ntpath.py
nturl2path.py
numbers.py
opcode.py
operator.py
optparse.py
os.py
pathlib.py
pdb.py
pickle.py
pickletools.py
pipes.py
pkgutil.py
platform.py
plistlib.py
poplib.py bpo-32981: Fix catastrophic backtracking vulns (GH-5955) 2018-03-03 21:55:07 -08:00
posixpath.py
pprint.py
profile.py
pstats.py Revert unneccessary changes made in bpo-30296 and apply other improvements. (GH-2624) 2018-02-26 08:22:24 -08:00
pty.py
py_compile.py
pyclbr.py
pydoc.py
queue.py
quopri.py
random.py
re.py bpo-32338: OrderedDict import is no longer needed in re. (GH-4891) 2018-03-10 23:01:58 -08:00
reprlib.py
rlcompleter.py
runpy.py
sched.py
secrets.py
selectors.py
shelve.py
shlex.py
shutil.py
signal.py
site.py
smtpd.py
smtplib.py
sndhdr.py
socket.py
socketserver.py
sre_compile.py
sre_constants.py
sre_parse.py
ssl.py [3.7] bpo-24334: Remove inaccurate match_hostname call (GH-6211) (#6212) 2018-03-24 15:59:16 +01:00
stat.py
statistics.py
string.py
stringprep.py
struct.py
subprocess.py Revert "bpo-31961: subprocess now accepts path-like args (GH-4329)" (GH-5912) (GH-5931) 2018-02-27 18:30:30 -05:00
sunau.py bpo-32056: Improve exceptions in aifc, wave and sunau. (GH-5951) 2018-03-18 13:50:41 -07:00
symbol.py
symtable.py
sysconfig.py
tabnanny.py
tarfile.py bpo-32713: Fix tarfile.itn for large/negative float values. (GH-5434) 2018-02-26 16:50:09 -08:00
telnetlib.py
tempfile.py
textwrap.py
this.py
threading.py
timeit.py
token.py
tokenize.py
trace.py
traceback.py
tracemalloc.py
tty.py
turtle.py Revert unneccessary changes made in bpo-30296 and apply other improvements. (GH-2624) 2018-02-26 08:22:24 -08:00
types.py
typing.py bpo-32873: Treat type variables and special typing forms as immutable by copy and pickle (GH-6216) 2018-03-26 15:29:06 -07:00
uu.py
uuid.py
warnings.py
wave.py bpo-32056: Improve exceptions in aifc, wave and sunau. (GH-5951) 2018-03-18 13:50:41 -07:00
weakref.py
webbrowser.py
xdrlib.py
zipapp.py
zipfile.py