summaryrefslogtreecommitdiffstats
path: root/src/H5HFspace.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-05-15 01:57:34 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-05-15 01:57:34 (GMT)
commit668be45b5678fc38c58fbb657c04b557c7baffe7 (patch)
tree92ad940a12c254a081ae259cb8eda305deb27746 /src/H5HFspace.c
parentd0de32fc3adc28c7a20ee07928eeeee522d4fcf5 (diff)
downloadhdf5-668be45b5678fc38c58fbb657c04b557c7baffe7.zip
hdf5-668be45b5678fc38c58fbb657c04b557c7baffe7.tar.gz
hdf5-668be45b5678fc38c58fbb657c04b557c7baffe7.tar.bz2
[svn-r27075] Description:
Clean up H5F interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel
Diffstat (limited to 'src/H5HFspace.c')
0 files changed, 0 insertions, 0 deletions
h: 0.0%;'/> -rw-r--r--Doc/library/crypt.rst2
-rw-r--r--Doc/library/crypto.rst1
-rw-r--r--Doc/library/datetime.rst135
-rw-r--r--Doc/library/decimal.rst13
-rw-r--r--Doc/library/dis.rst22
-rw-r--r--Doc/library/enum.rst12
-rw-r--r--Doc/library/faulthandler.rst3
-rw-r--r--Doc/library/fileinput.rst9
-rw-r--r--Doc/library/grp.rst3
-rw-r--r--Doc/library/http.server.rst7
-rw-r--r--Doc/library/imaplib.rst11
-rw-r--r--Doc/library/imp.rst15
-rw-r--r--Doc/library/importlib.rst129
-rw-r--r--Doc/library/inspect.rst25
-rw-r--r--Doc/library/logging.handlers.rst14
-rw-r--r--Doc/library/mmap.rst9
-rw-r--r--Doc/library/multiprocessing.rst9
-rw-r--r--Doc/library/os.rst32
-rw-r--r--Doc/library/pathlib.rst2
-rw-r--r--Doc/library/pickle.rst19
-rw-r--r--Doc/library/random.rst3
-rw-r--r--Doc/library/secrets.rst198
-rw-r--r--Doc/library/site.rst3
-rw-r--r--Doc/library/socket.rst4
-rw-r--r--Doc/library/socketserver.rst61
-rw-r--r--Doc/library/spwd.rst3
-rw-r--r--Doc/library/stdtypes.rst15
-rw-r--r--Doc/library/string.rst10
-rw-r--r--Doc/library/sys.rst7
-rw-r--r--Doc/library/sysconfig.rst2
-rw-r--r--Doc/library/telnetlib.rst11
-rw-r--r--Doc/library/test.rst42
-rw-r--r--Doc/library/time.rst4
-rw-r--r--Doc/library/tracemalloc.rst45
-rw-r--r--Doc/library/typing.rst21
-rw-r--r--Doc/library/unittest.mock.rst28
-rw-r--r--Doc/library/urllib.parse.rst18
-rw-r--r--Doc/library/urllib.robotparser.rst30
-rw-r--r--Doc/library/warnings.rst16
-rw-r--r--Doc/library/wsgiref.rst32
-rw-r--r--Doc/library/xmlrpc.server.rst59
-rw-r--r--Doc/library/zipfile.rst17
-rw-r--r--Doc/library/zlib.rst11
-rw-r--r--Doc/reference/compound_stmts.rst8
-rw-r--r--Doc/reference/datamodel.rst5
-rw-r--r--Doc/reference/import.rst17
-rw-r--r--Doc/reference/lexical_analysis.rst108
-rw-r--r--Doc/tools/extensions/pyspecific.py2
-rw-r--r--Doc/tutorial/controlflow.rst3
-rw-r--r--Doc/tutorial/inputoutput.rst3
-rw-r--r--Doc/tutorial/interpreter.rst14
-rw-r--r--Doc/tutorial/introduction.rst3
-rw-r--r--Doc/tutorial/stdlib.rst2
-rw-r--r--Doc/tutorial/stdlib2.rst2
-rw-r--r--Doc/using/cmdline.rst55
-rw-r--r--Doc/using/mac.rst6
-rw-r--r--Doc/whatsnew/3.6.rst535
-rw-r--r--Doc/whatsnew/index.rst1
-rw-r--r--Grammar/Grammar17
-rw-r--r--Include/Python-ast.h30
-rw-r--r--Include/asdl.h1
-rw-r--r--Include/bytes_methods.h6
-rw-r--r--Include/bytesobject.h90
-rw-r--r--Include/ceval.h8
-rw-r--r--Include/code.h2
-rw-r--r--Include/longobject.h10
-rw-r--r--Include/object.h2
-rw-r--r--Include/opcode.h1
-rw-r--r--Include/patchlevel.h8
-rw-r--r--Include/py_curses.h4
-rw-r--r--Include/pylifecycle.h1
-rw-r--r--Include/pymacro.h4
-rw-r--r--Include/pymath.h2
-rw-r--r--Include/pymem.h43
-rw-r--r--Include/pystate.h18
-rw-r--r--Include/pythonrun.h8
-rw-r--r--Include/pytime.h5
-rw-r--r--Include/setobject.h11
-rw-r--r--Include/traceback.h50
-rw-r--r--Include/unicodeobject.h23
-rw-r--r--Include/warnings.h7
-rw-r--r--Lib/_collections_abc.py23
-rw-r--r--Lib/_pydecimal.py52
-rw-r--r--Lib/_pyio.py6
-rw-r--r--Lib/_strptime.py83
-rw-r--r--Lib/aifc.py9
-rw-r--r--Lib/argparse.py10
-rw-r--r--Lib/ast.py52
-rw-r--r--Lib/asyncio/base_events.py3
-rw-r--r--Lib/asyncio/base_subprocess.py3
-rw-r--r--Lib/asyncio/proactor_events.py3
-rw-r--r--Lib/asyncio/selector_events.py3
-rw-r--r--Lib/asyncio/sslproto.py3
-rw-r--r--Lib/asyncio/unix_events.py6
-rw-r--r--Lib/asyncio/windows_utils.py3
-rw-r--r--Lib/asyncore.py3
-rwxr-xr-xLib/base64.py3
-rw-r--r--Lib/calendar.py85
-rw-r--r--Lib/collections/__init__.py4
-rw-r--r--Lib/compileall.py16
-rw-r--r--Lib/contextlib.py42
-rw-r--r--Lib/copy.py115
-rw-r--r--Lib/crypt.py3
-rw-r--r--Lib/csv.py11
-rw-r--r--Lib/ctypes/util.py4
-rw-r--r--Lib/datetime.py54
-rw-r--r--Lib/dis.py16
-rw-r--r--Lib/distutils/command/bdist_msi.py2
-rw-r--r--Lib/distutils/command/bdist_wininst.py2
-rw-r--r--Lib/distutils/command/build.py4
-rw-r--r--Lib/distutils/command/install.py4
-rw-r--r--Lib/distutils/command/install_egg_info.py4
-rw-r--r--Lib/distutils/core.py5
-rw-r--r--Lib/distutils/sysconfig.py2
-rw-r--r--Lib/distutils/tests/test_build.py5
-rw-r--r--Lib/distutils/tests/test_core.py30
-rw-r--r--Lib/distutils/util.py15
-rw-r--r--Lib/doctest.py17
-rw-r--r--Lib/enum.py10
-rw-r--r--Lib/fileinput.py10
-rw-r--r--Lib/fractions.py32
-rw-r--r--Lib/ftplib.py3
-rw-r--r--Lib/http/client.py49
-rw-r--r--Lib/http/server.py70
-rw-r--r--Lib/idlelib/NEWS.txt16
-rw-r--r--Lib/imaplib.py10
-rw-r--r--Lib/imp.py2
-rw-r--r--Lib/importlib/_bootstrap.py28
-rw-r--r--Lib/importlib/_bootstrap_external.py58
-rw-r--r--Lib/importlib/util.py4
-rw-r--r--Lib/inspect.py24
-rw-r--r--Lib/json/encoder.py3
-rw-r--r--Lib/lib2to3/fixes/fix_types.py2
-rw-r--r--Lib/lib2to3/tests/test_fixers.py4
-rw-r--r--Lib/locale.py8
-rw-r--r--Lib/logging/__init__.py5
-rw-r--r--Lib/logging/handlers.py15
-rw-r--r--Lib/modulefinder.py12
-rw-r--r--Lib/msilib/__init__.py10
-rw-r--r--Lib/multiprocessing/pool.py20
-rw-r--r--Lib/opcode.py6
-rw-r--r--Lib/optparse.py3
-rw-r--r--Lib/os.py89
-rw-r--r--Lib/pickle.py105
-rw-r--r--Lib/pickletools.py1
-rw-r--r--Lib/pkgutil.py2
-rw-r--r--[-rwxr-xr-x]Lib/pydoc.py25
-rw-r--r--Lib/pydoc_data/topics.py32
-rw-r--r--Lib/rlcompleter.py38
-rw-r--r--Lib/sched.py11
-rw-r--r--Lib/secrets.py71
-rw-r--r--Lib/shutil.py3
-rw-r--r--Lib/site-packages/README.txt2
-rw-r--r--Lib/site.py42
-rw-r--r--Lib/sndhdr.py12
-rw-r--r--Lib/socketserver.py37
-rw-r--r--Lib/sre_compile.py117
-rw-r--r--Lib/ssl.py1
-rw-r--r--Lib/string.py9
-rw-r--r--Lib/subprocess.py17
-rw-r--r--Lib/sysconfig.py8
-rwxr-xr-xLib/tarfile.py73
-rw-r--r--Lib/telnetlib.py15
-rw-r--r--Lib/tempfile.py1
-rw-r--r--Lib/test/__main__.py5
-rw-r--r--Lib/test/_test_multiprocessing.py24
-rw-r--r--Lib/test/autotest.py5
-rw-r--r--Lib/test/capath/0e4015b9.016
-rw-r--r--Lib/test/capath/b1930218.021
-rw-r--r--Lib/test/capath/ce7b8643.016
-rw-r--r--Lib/test/capath/ceff1710.021
-rw-r--r--Lib/test/datetimetester.py51
-rw-r--r--Lib/test/eintrdata/eintr_tester.py7
-rw-r--r--Lib/test/libregrtest/__init__.py5
-rw-r--r--Lib/test/libregrtest/cmdline.py344
-rw-r--r--Lib/test/libregrtest/main.py504
-rw-r--r--Lib/test/libregrtest/refleak.py202
-rw-r--r--Lib/test/libregrtest/runtest.py247
-rw-r--r--Lib/test/libregrtest/runtest_mp.py244
-rw-r--r--Lib/test/libregrtest/save_env.py286
-rw-r--r--Lib/test/libregrtest/setup.py121
-rw-r--r--Lib/test/lock_tests.py12
-rw-r--r--Lib/test/pickletester.py23
-rw-r--r--[-rwxr-xr-x]Lib/test/regrtest.py1593
-rw-r--r--Lib/test/signalinterproctester.py84
-rw-r--r--Lib/test/support/__init__.py68
-rw-r--r--Lib/test/test_argparse.py15
-rw-r--r--Lib/test/test_array.py21
-rw-r--r--Lib/test/test_ast.py129
-rw-r--r--Lib/test/test_binascii.py26
-rw-r--r--Lib/test/test_bytes.py121
-rw-r--r--Lib/test/test_calendar.py17
-rw-r--r--Lib/test/test_capi.py90
-rw-r--r--Lib/test/test_cmd_line.py3
-rw-r--r--Lib/test/test_cmd_line_script.py5
-rw-r--r--Lib/test/test_codecs.py143
-rw-r--r--Lib/test/test_collections.py31
-rw-r--r--Lib/test/test_compileall.py45
-rw-r--r--Lib/test/test_contextlib.py35
-rw-r--r--Lib/test/test_copy.py2
-rw-r--r--Lib/test/test_csv.py27
-rw-r--r--Lib/test/test_decimal.py33
-rw-r--r--Lib/test/test_deque.py79
-rw-r--r--Lib/test/test_descr.py9
-rw-r--r--Lib/test/test_dict.py13
-rw-r--r--Lib/test/test_dictviews.py22
-rw-r--r--Lib/test/test_doctest.py3
-rw-r--r--Lib/test/test_eintr.py10
-rw-r--r--Lib/test/test_enum.py29
-rw-r--r--Lib/test/test_faulthandler.py92
-rw-r--r--Lib/test/test_file.py2
-rw-r--r--Lib/test/test_fileinput.py13
-rw-r--r--Lib/test/test_format.py2
-rw-r--r--Lib/test/test_fractions.py14
-rw-r--r--Lib/test/test_fstring.py745
-rw-r--r--Lib/test/test_ftplib.py11
-rw-r--r--Lib/test/test_functools.py2
-rw-r--r--Lib/test/test_gc.py2
-rw-r--r--Lib/test/test_gdb.py27
-rw-r--r--Lib/test/test_generators.py6
-rw-r--r--Lib/test/test_genericpath.py270
-rw-r--r--Lib/test/test_getargs2.py8
-rw-r--r--Lib/test/test_gettext.py6
-rw-r--r--Lib/test/test_grammar.py38
-rw-r--r--Lib/test/test_grp.py10
-rw-r--r--Lib/test/test_httpservers.py46
-rw-r--r--Lib/test/test_imaplib.py49
-rw-r--r--Lib/test/test_imp.py2
-rw-r--r--Lib/test/test_importlib/import_/test___package__.py55
-rw-r--r--Lib/test/test_importlib/import_/test_relative_imports.py23
-rw-r--r--Lib/test/test_importlib/regrtest.py17
-rw-r--r--Lib/test/test_importlib/test_windows.py2
-rw-r--r--Lib/test/test_inspect.py11
-rw-r--r--Lib/test/test_io.py9
-rw-r--r--Lib/test/test_itertools.py50
-rw-r--r--Lib/test/test_linecache.py75
-rw-r--r--Lib/test/test_logging.py14
-rw-r--r--Lib/test/test_long.py33
-rw-r--r--Lib/test/test_marshal.py7
-rw-r--r--Lib/test/test_mmap.py8
-rw-r--r--Lib/test/test_operator.py50
-rw-r--r--Lib/test/test_optparse.py7
-rw-r--r--Lib/test/test_ordered_dict.py12
-rw-r--r--Lib/test/test_os.py400
-rw-r--r--Lib/test/test_pathlib.py8
-rw-r--r--Lib/test/test_peepholer.py20
-rw-r--r--Lib/test/test_pickle.py5
-rw-r--r--Lib/test/test_pickletools.py33
-rw-r--r--Lib/test/test_posix.py6
-rw-r--r--Lib/test/test_pty.py1
-rw-r--r--Lib/test/test_pyclbr.py2
-rw-r--r--Lib/test/test_pydoc.py16
-rw-r--r--Lib/test/test_regrtest.py606
-rw-r--r--Lib/test/test_richcmp.py25
-rw-r--r--Lib/test/test_rlcompleter.py55
-rw-r--r--Lib/test/test_robotparser.py90
-rw-r--r--Lib/test/test_secrets.py123
-rw-r--r--Lib/test/test_set.py24
-rw-r--r--Lib/test/test_signal.py171
-rw-r--r--Lib/test/test_site.py7
-rw-r--r--Lib/test/test_socket.py12
-rw-r--r--Lib/test/test_socketserver.py99
-rw-r--r--Lib/test/test_spwd.py15
-rw-r--r--Lib/test/test_ssl.py695
-rw-r--r--Lib/test/test_statistics.py3
-rw-r--r--Lib/test/test_strptime.py65
-rw-r--r--Lib/test/test_subprocess.py3
-rw-r--r--Lib/test/test_support.py31
-rw-r--r--Lib/test/test_symbol.py55
-rw-r--r--Lib/test/test_sys_settrace.py4
-rw-r--r--Lib/test/test_tarfile.py18
-rw-r--r--Lib/test/test_telnetlib.py5
-rw-r--r--Lib/test/test_threading.py8
-rw-r--r--Lib/test/test_time.py598
-rw-r--r--Lib/test/test_tokenize.py55
-rw-r--r--Lib/test/test_tools/test_unparse.py9
-rw-r--r--Lib/test/test_trace.py66
-rw-r--r--Lib/test/test_traceback.py16
-rw-r--r--Lib/test/test_tracemalloc.py219
-rw-r--r--Lib/test/test_urllib2_localnet.py39
-rw-r--r--Lib/test/test_urlparse.py36
-rw-r--r--Lib/test/test_userdict.py4
-rw-r--r--Lib/test/test_venv.py28
-rw-r--r--Lib/test/test_warnings/__init__.py45
-rw-r--r--Lib/test/test_warnings/data/import_warning.py2
-rw-r--r--Lib/test/test_wave.py7
-rw-r--r--Lib/test/test_with.py4
-rw-r--r--Lib/test/test_xml_etree.py16
-rw-r--r--Lib/test/test_zipfile.py15
-rw-r--r--Lib/test/test_zipimport.py21
-rw-r--r--Lib/test/test_zlib.py4
-rw-r--r--Lib/threading.py8
-rw-r--r--[-rwxr-xr-x]Lib/timeit.py32
-rw-r--r--Lib/tkinter/__init__.py3
-rw-r--r--Lib/tkinter/test/test_tkinter/test_widgets.py7
-rw-r--r--Lib/tkinter/ttk.py10
-rw-r--r--Lib/tokenize.py118
-rwxr-xr-xLib/trace.py382
-rw-r--r--Lib/traceback.py5
-rw-r--r--Lib/tracemalloc.py73
-rw-r--r--Lib/unittest/mock.py20
-rw-r--r--Lib/unittest/test/testmock/testmock.py21
-rw-r--r--Lib/urllib/parse.py70
-rw-r--r--Lib/urllib/request.py62
-rw-r--r--Lib/urllib/robotparser.py39
-rw-r--r--Lib/venv/__init__.py40
-rw-r--r--Lib/warnings.py118
-rw-r--r--Lib/wave.py2
-rw-r--r--Lib/wsgiref/simple_server.py13
-rw-r--r--Lib/xml/etree/ElementTree.py94
-rw-r--r--Lib/xmlrpc/client.py2
-rw-r--r--Lib/xmlrpc/server.py25
-rw-r--r--Lib/zipfile.py75
-rw-r--r--Makefile.pre.in5
-rw-r--r--Misc/ACKS16
-rw-r--r--Misc/NEWS693
-rw-r--r--Misc/README.valgrind3
-rw-r--r--Misc/SpecialBuilds.txt8
-rw-r--r--Misc/coverity_model.c2
-rw-r--r--Modules/_bisectmodule.c6
-rw-r--r--Modules/_codecsmodule.c261
-rw-r--r--Modules/_collectionsmodule.c671
-rw-r--r--Modules/_csv.c8
-rw-r--r--Modules/_ctypes/_ctypes.c30
-rw-r--r--Modules/_ctypes/callbacks.c2
-rw-r--r--Modules/_ctypes/callproc.c18
-rw-r--r--Modules/_ctypes/ctypes.h2
-rw-r--r--Modules/_curses_panel.c4
-rw-r--r--Modules/_datetimemodule.c255
-rw-r--r--Modules/_dbmmodule.c8
-rw-r--r--Modules/_decimal/_decimal.c101
-rw-r--r--Modules/_decimal/docstrings.h9
-rw-r--r--Modules/_decimal/libmpdec/memory.c5
-rw-r--r--Modules/_decimal/libmpdec/mpdecimal.h4
-rw-r--r--Modules/_decimal/tests/deccheck.py6
-rw-r--r--Modules/_elementtree.c575
-rw-r--r--Modules/_gdbmmodule.c2
-rw-r--r--Modules/_heapqmodule.c10
-rw-r--r--Modules/_io/_iomodule.c19
-rw-r--r--Modules/_io/_iomodule.h2
-rw-r--r--Modules/_io/bufferedio.c2
-rw-r--r--Modules/_io/bytesio.c6
-rw-r--r--Modules/_io/fileio.c7
-rw-r--r--Modules/_io/iobase.c2
-rw-r--r--Modules/_io/stringio.c2
-rw-r--r--Modules/_io/textio.c26
-rw-r--r--Modules/_json.c4
-rw-r--r--Modules/_localemodule.c2
-rw-r--r--Modules/_lsprof.c7
-rw-r--r--Modules/_pickle.c253
-rw-r--r--Modules/_posixsubprocess.c2
-rw-r--r--Modules/_randommodule.c2
-rw-r--r--Modules/_scproxy.c2
-rw-r--r--Modules/_sqlite/cache.c3
-rw-r--r--Modules/_sqlite/connection.c26
-rw-r--r--Modules/_sqlite/cursor.c16
-rw-r--r--Modules/_sqlite/module.c13
-rw-r--r--Modules/_sre.c7
-rw-r--r--Modules/_ssl.c4
-rw-r--r--Modules/_struct.c10
-rw-r--r--Modules/_testbuffer.c2
-rw-r--r--Modules/_testcapimodule.c151
-rw-r--r--Modules/_testmultiphase.c2
-rw-r--r--Modules/_tkinter.c8
-rw-r--r--Modules/_tracemalloc.c584
-rw-r--r--Modules/_winapi.c4
-rw-r--r--Modules/arraymodule.c40
-rw-r--r--Modules/audioop.c20
-rw-r--r--Modules/binascii.c287
-rw-r--r--Modules/clinic/_codecsmodule.c.h32
-rw-r--r--Modules/clinic/_elementtree.c.h7
-rw-r--r--Modules/clinic/binascii.c.h17
-rw-r--r--Modules/clinic/posixmodule.c.h10
-rw-r--r--Modules/clinic/zlibmodule.c.h29
-rw-r--r--Modules/faulthandler.c298
-rw-r--r--Modules/gcmodule.c2
-rw-r--r--Modules/getaddrinfo.c4
-rw-r--r--Modules/getpath.c4
-rw-r--r--Modules/grpmodule.c21
-rw-r--r--Modules/hashtable.c196
-rw-r--r--Modules/hashtable.h181
-rw-r--r--Modules/itertoolsmodule.c391
-rw-r--r--Modules/main.c47
-rw-r--r--Modules/mathmodule.c4
-rw-r--r--Modules/mmapmodule.c5
-rw-r--r--Modules/nismodule.c6
-rw-r--r--Modules/parsermodule.c14
-rw-r--r--Modules/posixmodule.c320
-rw-r--r--Modules/pyexpat.c26
-rw-r--r--Modules/readline.c6
-rw-r--r--Modules/selectmodule.c4
-rw-r--r--Modules/socketmodule.c148
-rw-r--r--Modules/spwdmodule.c5
-rw-r--r--Modules/sre_lib.h59
-rw-r--r--Modules/timemodule.c6
-rw-r--r--Modules/unicodedata.c4
-rw-r--r--Modules/xxlimited.c2
-rw-r--r--Modules/xxmodule.c2
-rw-r--r--Modules/zlibmodule.c19
-rw-r--r--Objects/abstract.c11
-rw-r--r--Objects/bytearrayobject.c141
-rw-r--r--Objects/bytes_methods.c6
-rw-r--r--Objects/bytesobject.c1384
-rw-r--r--Objects/codeobject.c11
-rw-r--r--Objects/descrobject.c2
-rw-r--r--Objects/dictobject.c63
-rw-r--r--Objects/exceptions.c22
-rw-r--r--Objects/floatobject.c48
-rw-r--r--Objects/frameobject.c8
-rw-r--r--Objects/funcobject.c35
-rw-r--r--Objects/genobject.c14
-rw-r--r--Objects/listobject.c22
-rw-r--r--Objects/listsort.txt2
-rw-r--r--Objects/lnotab_notes.txt47
-rw-r--r--Objects/longobject.c212
-rw-r--r--Objects/memoryobject.c4
-rw-r--r--Objects/object.c66
-rw-r--r--Objects/obmalloc.c280
-rw-r--r--Objects/odictobject.c23
-rw-r--r--Objects/setobject.c610
-rw-r--r--Objects/stringlib/codecs.h201
-rw-r--r--Objects/stringlib/fastsearch.h150
-rw-r--r--Objects/stringlib/find.h13
-rw-r--r--Objects/stringlib/unicode_format.h2
-rw-r--r--Objects/structseq.c30
-rw-r--r--Objects/tupleobject.c5
-rw-r--r--Objects/typeobject.c98
-rw-r--r--Objects/unicodeobject.c1416
-rw-r--r--Objects/weakrefobject.c2
-rw-r--r--PC/_msi.c12
-rw-r--r--PC/bdist_wininst/install.c18
-rw-r--r--PC/getpathp.c4
-rw-r--r--PC/launcher.c10
-rw-r--r--PC/msvcrtmodule.c3
-rw-r--r--PC/pyconfig.h4
-rw-r--r--PC/python3.def1419
-rw-r--r--PC/testpy.py4
-rw-r--r--PCbuild/build_pgo.bat6
-rw-r--r--PCbuild/prepare_ssl.bat4
-rw-r--r--PCbuild/readme.txt2
-rw-r--r--PCbuild/rt.bat2
-rw-r--r--PCbuild/xxlimited.vcxproj2
-rw-r--r--Parser/Python.asdl9
-rw-r--r--Parser/asdl.py3
-rw-r--r--[-rwxr-xr-x]Parser/asdl_c.py16
-rw-r--r--Parser/parser.c9
-rw-r--r--Parser/parsetok.c4
-rw-r--r--Parser/pgen.c6
-rw-r--r--Parser/pgenmain.c12
-rw-r--r--Parser/tokenizer.c20
-rw-r--r--Programs/python.c9
-rw-r--r--Python/Python-ast.c239
-rw-r--r--Python/_warnings.c221
-rw-r--r--Python/ast.c1248
-rw-r--r--Python/bltinmodule.c18
-rw-r--r--Python/ceval.c92
-rw-r--r--Python/compile.c236
-rw-r--r--Python/dtoa.c6
-rw-r--r--Python/dynload_win.c8
-rw-r--r--Python/fileutils.c34
-rw-r--r--Python/formatter_unicode.c2
-rw-r--r--Python/frozenmain.c4
-rw-r--r--Python/future.c5
-rw-r--r--Python/getargs.c122
-rw-r--r--Python/graminit.c106
-rw-r--r--Python/import.c76
-rw-r--r--Python/importdl.c4
-rw-r--r--Python/importlib.h950
-rw-r--r--Python/importlib_external.h4995
-rwxr-xr-xPython/makeopcodetargets.py48
-rw-r--r--Python/marshal.c118
-rw-r--r--Python/modsupport.c4
-rw-r--r--Python/mystrtoul.c6
-rw-r--r--Python/opcode_targets.h2
-rw-r--r--Python/peephole.c55
-rw-r--r--Python/pylifecycle.c91
-rw-r--r--Python/pystate.c32
-rw-r--r--Python/pystrtod.c9
-rw-r--r--Python/pythonrun.c22
-rw-r--r--Python/pytime.c274
-rw-r--r--Python/random.c2
-rw-r--r--Python/symtable.c13
-rw-r--r--Python/sysmodule.c25
-rw-r--r--Python/traceback.c183
-rw-r--r--README44
-rw-r--r--Tools/buildbot/test.bat2
-rwxr-xr-xTools/freeze/freeze.py2
-rwxr-xr-xTools/i18n/pygettext.py51
-rw-r--r--Tools/msi/lib/lib_files.wxs6
-rw-r--r--Tools/parser/unparse.py68
-rwxr-xr-xTools/scripts/combinerefs.py4
-rwxr-xr-xTools/scripts/nm2def.py4
-rwxr-xr-xTools/scripts/pyvenv6
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--setup.py2
513 files changed, 24087 insertions, 13745 deletions
diff --git a/Doc/Makefile b/Doc/Makefile
index a42e98b..03a37f1 100644
--- a/Doc/Makefile
+++ b/Doc/Makefile
@@ -153,7 +153,7 @@ dist:
cp -pPR build/epub/Python.epub dist/python-$(DISTVERSION)-docs.epub
check:
- $(PYTHON) tools/rstlint.py -i tools
+ $(PYTHON) tools/rstlint.py -i tools -i venv
serve:
../Tools/scripts/serve.py build/html
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst
index 983d113..d9f0f43 100644
--- a/Doc/c-api/arg.rst
+++ b/Doc/c-api/arg.rst
@@ -206,8 +206,7 @@ Unless otherwise stated, buffers are not NUL-terminated.
:c:func:`PyArg_ParseTuple` will use this location as the buffer and interpret the
initial value of *\*buffer_length* as the buffer size. It will then copy the
encoded data into the buffer and NUL-terminate it. If the buffer is not large
- enough, a :exc:`TypeError` will be set.
- Note: starting from Python 3.6 a :exc:`ValueError` will be set.
+ enough, a :exc:`ValueError` will be set.
In both cases, *\*buffer_length* is set to the length of the encoded data
without the trailing NUL byte.
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 19cbb3b..226b619 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -334,6 +334,14 @@ an error value).
.. versionadded:: 3.2
+.. c:function:: int PyErr_ResourceWarning(PyObject *source, Py_ssize_t stack_level, const char *format, ...)
+
+ Function similar to :c:func:`PyErr_WarnFormat`, but *category* is
+ :exc:`ResourceWarning` and pass *source* to :func:`warnings.WarningMessage`.
+
+ .. versionadded:: 3.6
+
+
Querying the error indicator
============================
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 81823bf..465147c 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -25,7 +25,7 @@ Initializing and finalizing the interpreter
triple: module; search; path
single: PySys_SetArgv()
single: PySys_SetArgvEx()
- single: Py_Finalize()
+ single: Py_FinalizeEx()
Initialize the Python interpreter. In an application embedding Python, this
should be called before using any other Python/C API functions; with the
@@ -34,7 +34,7 @@ Initializing and finalizing the interpreter
modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It also initializes
the module search path (``sys.path``). It does not set ``sys.argv``; use
:c:func:`PySys_SetArgvEx` for that. This is a no-op when called for a second time
- (without calling :c:func:`Py_Finalize` first). There is no return value; it is a
+ (without calling :c:func:`Py_FinalizeEx` first). There is no return value; it is a
fatal error if the initialization fails.
@@ -48,19 +48,20 @@ Initializing and finalizing the interpreter
.. c:function:: int Py_IsInitialized()
Return true (nonzero) when the Python interpreter has been initialized, false
- (zero) if not. After :c:func:`Py_Finalize` is called, this returns false until
+ (zero) if not. After :c:func:`Py_FinalizeEx` is called, this returns false until
:c:func:`Py_Initialize` is called again.
-.. c:function:: void Py_Finalize()
+.. c:function:: int Py_FinalizeEx()
Undo all initializations made by :c:func:`Py_Initialize` and subsequent use of
Python/C API functions, and destroy all sub-interpreters (see
:c:func:`Py_NewInterpreter` below) that were created and not yet destroyed since
the last call to :c:func:`Py_Initialize`. Ideally, this frees all memory
allocated by the Python interpreter. This is a no-op when called for a second
- time (without calling :c:func:`Py_Initialize` again first). There is no return
- value; errors during finalization are ignored.
+ time (without calling :c:func:`Py_Initialize` again first). Normally the
+ return value is 0. If there were errors during finalization
+ (flushing buffered data), -1 is returned.
This function is provided for a number of reasons. An embedding application
might want to restart Python without having to restart the application itself.
@@ -79,7 +80,15 @@ Initializing and finalizing the interpreter
freed. Some memory allocated by extension modules may not be freed. Some
extensions may not work properly if their initialization routine is called more
than once; this can happen if an application calls :c:func:`Py_Initialize` and
- :c:func:`Py_Finalize` more than once.
+ :c:func:`Py_FinalizeEx` more than once.
+
+ .. versionadded:: 3.6
+
+
+.. c:function:: void Py_Finalize()
+
+ This is a backwards-compatible version of :c:func:`Py_FinalizeEx` that
+ disregards the return value.
Process-wide parameters
@@ -107,7 +116,7 @@ Process-wide parameters
Note that :data:`sys.stderr` always uses the "backslashreplace" error
handler, regardless of this (or any other) setting.
- If :c:func:`Py_Finalize` is called, this function will need to be called
+ If :c:func:`Py_FinalizeEx` is called, this function will need to be called
again in order to affect subsequent calls to :c:func:`Py_Initialize`.
Returns 0 if successful, a nonzero value on error (e.g. calling after the
@@ -918,7 +927,7 @@ using the following functions:
entry.)
.. index::
- single: Py_Finalize()
+ single: Py_FinalizeEx()
single: Py_Initialize()
Extension modules are shared between (sub-)interpreters as follows: the first
@@ -928,7 +937,7 @@ using the following functions:
and filled with the contents of this copy; the extension's ``init`` function is
not called. Note that this is different from what happens when an extension is
imported after the interpreter has been completely re-initialized by calling
- :c:func:`Py_Finalize` and :c:func:`Py_Initialize`; in that case, the extension's
+ :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, the extension's
``initmodule`` function *is* called again.
.. index:: single: close() (in module os)
@@ -936,14 +945,14 @@ using the following functions:
.. c:function:: void Py_EndInterpreter(PyThreadState *tstate)
- .. index:: single: Py_Finalize()
+ .. index:: single: Py_FinalizeEx()
Destroy the (sub-)interpreter represented by the given thread state. The given
thread state must be the current thread state. See the discussion of thread
states below. When the call returns, the current thread state is *NULL*. All
thread states associated with this interpreter are destroyed. (The global
interpreter lock must be held before calling this function and is still held
- when it returns.) :c:func:`Py_Finalize` will destroy all sub-interpreters that
+ when it returns.) :c:func:`Py_FinalizeEx` will destroy all sub-interpreters that
haven't been explicitly destroyed at that point.
diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst
index bc3a752..74681d2 100644
--- a/Doc/c-api/intro.rst
+++ b/Doc/c-api/intro.rst
@@ -64,9 +64,10 @@ The header files are typically installed with Python. On Unix, these are
located in the directories :file:`{prefix}/include/pythonversion/` and
:file:`{exec_prefix}/include/pythonversion/`, where :envvar:`prefix` and
:envvar:`exec_prefix` are defined by the corresponding parameters to Python's
-:program:`configure` script and *version* is ``sys.version[:3]``. On Windows,
-the headers are installed in :file:`{prefix}/include`, where :envvar:`prefix` is
-the installation directory specified to the installer.
+:program:`configure` script and *version* is
+``'%d.%d' % sys.version_info[:2]``. On Windows, the headers are installed
+in :file:`{prefix}/include`, where :envvar:`prefix` is the installation
+directory specified to the installer.
To include the headers, place both directories (if different) on your compiler's
search path for includes. Do *not* place the parent directories on the search
@@ -578,9 +579,9 @@ Sometimes, it is desirable to "uninitialize" Python. For instance, the
application may want to start over (make another call to
:c:func:`Py_Initialize`) or the application is simply done with its use of
Python and wants to free memory allocated by Python. This can be accomplished
-by calling :c:func:`Py_Finalize`. The function :c:func:`Py_IsInitialized` returns
+by calling :c:func:`Py_FinalizeEx`. The function :c:func:`Py_IsInitialized` returns
true if Python is currently in the initialized state. More information about
-these functions is given in a later chapter. Notice that :c:func:`Py_Finalize`
+these functions is given in a later chapter. Notice that :c:func:`Py_FinalizeEx`
does *not* free all memory allocated by the Python interpreter, e.g. memory
allocated by extension modules currently cannot be released.
diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst
index 290ef09..bd0bc12 100644
--- a/Doc/c-api/memory.rst
+++ b/Doc/c-api/memory.rst
@@ -85,9 +85,12 @@ for the I/O buffer escapes completely the Python memory manager.
.. seealso::
+ The :envvar:`PYTHONMALLOC` environment variable can be used to configure
+ the memory allocators used by Python.
+
The :envvar:`PYTHONMALLOCSTATS` environment variable can be used to print
- memory allocation statistics every time a new object arena is created, and
- on shutdown.
+ statistics of the :ref:`pymalloc memory allocator <pymalloc>` every time a
+ new pymalloc object arena is created, and on shutdown.
Raw Memory Interface
@@ -338,30 +341,54 @@ Customize Memory Allocators
Newly allocated memory is filled with the byte ``0xCB``, freed memory is
filled with the byte ``0xDB``. Additional checks:
- - detect API violations, ex: :c:func:`PyObject_Free` called on a buffer
+ - Detect API violations, ex: :c:func:`PyObject_Free` called on a buffer
allocated by :c:func:`PyMem_Malloc`
- - detect write before the start of the buffer (buffer underflow)
- - detect write after the end of the buffer (buffer overflow)
+ - Detect write before the start of the buffer (buffer underflow)
+ - Detect write after the end of the buffer (buffer overflow)
+ - Check that the :term:`GIL <global interpreter lock>` is held when
+ allocator functions of :c:data:`PYMEM_DOMAIN_OBJ` (ex:
+ :c:func:`PyObject_Malloc`) and :c:data:`PYMEM_DOMAIN_MEM` (ex:
+ :c:func:`PyMem_Malloc`) domains are called
+
+ On error, the debug hooks use the :mod:`tracemalloc` module to get the
+ traceback where a memory block was allocated. The traceback is only
+ displayed if :mod:`tracemalloc` is tracing Python memory allocations and the
+ memory block was traced.
+
+ These hooks are installed by default if Python is compiled in debug
+ mode. The :envvar:`PYTHONMALLOC` environment variable can be used to install
+ debug hooks on a Python compiled in release mode.
- The function does nothing if Python is not compiled is debug mode.
+ .. versionchanged:: 3.6
+ This function now also works on Python compiled in release mode.
+ On error, the debug hooks now use :mod:`tracemalloc` to get the traceback
+ where a memory block was allocated. The debug hooks now also check
+ if the GIL is held when functions of :c:data:`PYMEM_DOMAIN_OBJ` and
+ :c:data:`PYMEM_DOMAIN_MEM` domains are called.
-Customize PyObject Arena Allocator
-==================================
+.. _pymalloc:
-Python has a *pymalloc* allocator for allocations smaller than 512 bytes. This
-allocator is optimized for small objects with a short lifetime. It uses memory
-mappings called "arenas" with a fixed size of 256 KB. It falls back to
-:c:func:`PyMem_RawMalloc` and :c:func:`PyMem_RawRealloc` for allocations larger
-than 512 bytes. *pymalloc* is the default allocator used by
-:c:func:`PyObject_Malloc`.
+The pymalloc allocator
+======================
-The default arena allocator uses the following functions:
+Python has a *pymalloc* allocator optimized for small objects (smaller or equal
+to 512 bytes) with a short lifetime. It uses memory mappings called "arenas"
+with a fixed size of 256 KB. It falls back to :c:func:`PyMem_RawMalloc` and
+:c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes.
+
+*pymalloc* is the default allocator of the :c:data:`PYMEM_DOMAIN_OBJ` domain
+(ex: :c:func:`PyObject_Malloc`).
+
+The arena allocator uses the following functions:
* :c:func:`VirtualAlloc` and :c:func:`VirtualFree` on Windows,
* :c:func:`mmap` and :c:func:`munmap` if available,
* :c:func:`malloc` and :c:func:`free` otherwise.
+Customize pymalloc Arena Allocator
+----------------------------------
+
.. versionadded:: 3.4
.. c:type:: PyObjectArenaAllocator
diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst
index 3d83b27..9ba6496 100644
--- a/Doc/c-api/sys.rst
+++ b/Doc/c-api/sys.rst
@@ -212,20 +212,24 @@ Process Control
.. c:function:: void Py_Exit(int status)
.. index::
- single: Py_Finalize()
+ single: Py_FinalizeEx()
single: exit()
- Exit the current process. This calls :c:func:`Py_Finalize` and then calls the
- standard C library function ``exit(status)``.
+ Exit the current process. This calls :c:func:`Py_FinalizeEx` and then calls the
+ standard C library function ``exit(status)``. If :c:func:`Py_FinalizeEx`
+ indicates an error, the exit status is set to 120.
+
+ .. versionchanged:: 3.6
+ Errors from finalization no longer ignored.
.. c:function:: int Py_AtExit(void (*func) ())
.. index::
- single: Py_Finalize()
+ single: Py_FinalizeEx()
single: cleanup functions
- Register a cleanup function to be called by :c:func:`Py_Finalize`. The cleanup
+ Register a cleanup function to be called by :c:func:`Py_FinalizeEx`. The cleanup
function will be called with no arguments and should return no value. At most
32 cleanup functions can be registered. When the registration is successful,
:c:func:`Py_AtExit` returns ``0``; on failure, it returns ``-1``. The cleanup
diff --git a/Doc/extending/embedding.rst b/Doc/extending/embedding.rst
index acd60ae..1546b1a 100644
--- a/Doc/extending/embedding.rst
+++ b/Doc/extending/embedding.rst
@@ -67,7 +67,9 @@ perform some operation on a file. ::
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print('Today is', ctime(time()))\n");
- Py_Finalize();
+ if (Py_FinalizeEx() < 0) {
+ exit(120);
+ }
PyMem_RawFree(program);
return 0;
}
@@ -76,7 +78,7 @@ The :c:func:`Py_SetProgramName` function should be called before
:c:func:`Py_Initialize` to inform the interpreter about paths to Python run-time
libraries. Next, the Python interpreter is initialized with
:c:func:`Py_Initialize`, followed by the execution of a hard-coded Python script
-that prints the date and time. Afterwards, the :c:func:`Py_Finalize` call shuts
+that prints the date and time. Afterwards, the :c:func:`Py_FinalizeEx` call shuts
the interpreter down, followed by the end of the program. In a real program,
you may want to get the Python script from another source, perhaps a text-editor
routine, a file, or a database. Getting the Python code from a file can better
diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst
index 746efc6..ac3ba42 100644
--- a/Doc/faq/programming.rst
+++ b/Doc/faq/programming.rst
@@ -839,7 +839,8 @@ How do I convert a number to a string?
To convert, e.g., the number 144 to the string '144', use the built-in type
constructor :func:`str`. If you want a hexadecimal or octal representation, use
the built-in functions :func:`hex` or :func:`oct`. For fancy formatting, see
-the :ref:`formatstrings` section, e.g. ``"{:04d}".format(144)`` yields
+the :ref:`f-strings` and :ref:`formatstrings` sections,
+e.g. ``"{:04d}".format(144)`` yields
``'0144'`` and ``"{:.3f}".format(1.0/3.0)`` yields ``'0.333'``.
diff --git a/Doc/howto/argparse.rst b/Doc/howto/argparse.rst
index cfe9868..7a60165 100644
--- a/Doc/howto/argparse.rst
+++ b/Doc/howto/argparse.rst
@@ -547,7 +547,8 @@ And this is what it gives:
Traceback (most recent call last):
File "prog.py", line 11, in <module>
if args.verbosity >= 2:
- TypeError: unorderable types: NoneType() >= int()
+ TypeError: '>=' not supported between instances of 'NoneType' and 'int'
+
* First output went well, and fixes the bug we had before.
That is, we want any value >= 2 to be as verbose as possible.
diff --git a/Doc/includes/run-func.c b/Doc/includes/run-func.c
index 986d670..ead7bdd 100644
--- a/Doc/includes/run-func.c
+++ b/Doc/includes/run-func.c
@@ -63,6 +63,8 @@ main(int argc, char *argv[])
fprintf(stderr, "Failed to load \"%s\"\n", argv[1]);
return 1;
}
- Py_Finalize();
+ if (Py_FinalizeEx() < 0) {
+ return 120;
+ }
return 0;
}
diff --git a/Doc/includes/test.py b/Doc/includes/test.py
index 7ebf46a..9e9d4a6 100644
--- a/Doc/includes/test.py
+++ b/Doc/includes/test.py
@@ -204,7 +204,7 @@ Test cyclic gc(?)
import os
import sys
from distutils.util import get_platform
-PLAT_SPEC = "%s-%s" % (get_platform(), sys.version[0:3])
+PLAT_SPEC = "%s-%d.%d" % (get_platform(), *sys.version_info[:2])
src = os.path.join("build", "lib.%s" % PLAT_SPEC)
sys.path.append(src)
diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst
index ff2bdda..632ecf7 100644
--- a/Doc/library/binascii.rst
+++ b/Doc/library/binascii.rst
@@ -52,13 +52,14 @@ The :mod:`binascii` module defines the following functions:
than one line may be passed at a time.
-.. function:: b2a_base64(data)
+.. function:: b2a_base64(data, \*, newline=True)
Convert binary data to a line of ASCII characters in base64 coding. The return
- value is the converted line, including a newline char. The newline is
- added because the original use case for this function was to feed it a
- series of 57 byte input lines to get output lines that conform to the
- MIME-base64 standard. Otherwise the output conforms to :rfc:`3548`.
+ value is the converted line, including a newline char if *newline* is
+ true. The output of this function conforms to :rfc:`3548`.
+
+ .. versionchanged:: 3.6
+ Added the *newline* parameter.
.. function:: a2b_qp(data, header=False)
diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst
index d9b93ad..bbd0eda 100644
--- a/Doc/library/collections.abc.rst
+++ b/Doc/library/collections.abc.rst
@@ -40,12 +40,13 @@ ABC Inherits from Abstract Methods Mixin
:class:`Hashable` ``__hash__``
:class:`Iterable` ``__iter__``
:class:`Iterator` :class:`Iterable` ``__next__`` ``__iter__``
+:class:`Reversible` :class:`Iterable` ``__reversed__``
:class:`Generator` :class:`Iterator` ``send``, ``throw`` ``close``, ``__iter__``, ``__next__``
:class:`Sized` ``__len__``
:class:`Callable` ``__call__``
:class:`Sequence` :class:`Sized`, ``__getitem__``, ``__contains__``, ``__iter__``, ``__reversed__``,
- :class:`Iterable`, ``__len__`` ``index``, and ``count``
+ :class:`Reversible`, ``__len__`` ``index``, and ``count``
:class:`Container`
:class:`MutableSequence` :class:`Sequence` ``__getitem__``, Inherited :class:`Sequence` methods and
@@ -107,6 +108,12 @@ ABC Inherits from Abstract Methods Mixin
:meth:`~iterator.__next__` methods. See also the definition of
:term:`iterator`.
+.. class:: Reversible
+
+ ABC for classes that provide the :meth:`__reversed__` method.
+
+ .. versionadded:: 3.6
+
.. class:: Generator
ABC for generator classes that implement the protocol defined in
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 6e165ab..37d9e00 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -963,6 +963,9 @@ customize a prototype instance:
constructor that is convenient for use cases where named tuples are being
subclassed.
+ * :meth:`types.SimpleNamespace` for a mutable namespace based on an underlying
+ dictionary instead of a tuple.
+
:class:`OrderedDict` objects
----------------------------
diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst
index c5736f2..679c2b4 100644
--- a/Doc/library/compileall.rst
+++ b/Doc/library/compileall.rst
@@ -103,7 +103,8 @@ Public functions
.. function:: compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1, workers=1)
Recursively descend the directory tree named by *dir*, compiling all :file:`.py`
- files along the way.
+ files along the way. Return a true value if all the files compiled successfully,
+ and a false value otherwise.
The *maxlevels* parameter is used to limit the depth of the recursion; it
defaults to ``10``.
@@ -155,7 +156,8 @@ Public functions
.. function:: compile_file(fullname, ddir=None, force=False, rx=None, quiet=0, legacy=False, optimize=-1)
- Compile the file with path *fullname*.
+ Compile the file with path *fullname*. Return a true value if the file
+ compiled successfully, and a false value otherwise.
If *ddir* is given, it is prepended to the path to the file being compiled
for use in compilation time tracebacks, and is also compiled in to the
@@ -191,8 +193,10 @@ Public functions
.. function:: compile_path(skip_curdir=True, maxlevels=0, force=False, quiet=0, legacy=False, optimize=-1)
- Byte-compile all the :file:`.py` files found along ``sys.path``. If
- *skip_curdir* is true (the default), the current directory is not included
+ Byte-compile all the :file:`.py` files found along ``sys.path``. Return a
+ true value if all the files compiled successfully, and a false value otherwise.
+
+ If *skip_curdir* is true (the default), the current directory is not included
in the search. All other parameters are passed to the :func:`compile_dir`
function. Note that unlike the other compile functions, ``maxlevels``
defaults to ``0``.
diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst
index c112241..7876e7a 100644
--- a/Doc/library/contextlib.rst
+++ b/Doc/library/contextlib.rst
@@ -18,6 +18,18 @@ Utilities
Functions and classes provided:
+.. class:: AbstractContextManager
+
+ An abstract base class for classes that implement
+ :meth:`object.__enter__` and :meth:`object.__exit__`. A default
+ implementation for :meth:`object.__enter__` is provided which returns
+ ``self`` while :meth:`object.__exit__` is an abstract method which by default
+ returns ``None``. See also the definition of :ref:`typecontextmanager`.
+
+ .. versionadded:: 3.6
+
+
+
.. decorator:: contextmanager
This function is a :term:`decorator` that can be used to define a factory
@@ -447,9 +459,9 @@ Here's an example of doing this for a context manager that accepts resource
acquisition and release functions, along with an optional validation function,
and maps them to the context management protocol::
- from contextlib import contextmanager, ExitStack
+ from contextlib import contextmanager, AbstractContextManager, ExitStack
- class ResourceManager:
+ class ResourceManager(AbstractContextManager):
def __init__(self, acquire_resource, release_resource, check_resource_ok=None):
self.acquire_resource = acquire_resource
diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst
index b4c90cd..04ffdb2 100644
--- a/Doc/library/crypt.rst
+++ b/Doc/library/crypt.rst
@@ -64,7 +64,7 @@ Module Attributes
A list of available password hashing algorithms, as
``crypt.METHOD_*`` objects. This list is sorted from strongest to
- weakest, and is guaranteed to have at least ``crypt.METHOD_CRYPT``.
+ weakest.
Module Functions
diff --git a/Doc/library/crypto.rst b/Doc/library/crypto.rst
index 1eddfdc..ae45549 100644
--- a/Doc/library/crypto.rst
+++ b/Doc/library/crypto.rst
@@ -16,3 +16,4 @@ Here's an overview:
hashlib.rst
hmac.rst
+ secrets.rst
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index 3553d49..9e6b66a 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -607,7 +607,8 @@ Instance methods:
.. method:: date.__format__(format)
Same as :meth:`.date.strftime`. This makes it possible to specify a format
- string for a :class:`.date` object when using :meth:`str.format`. For a
+ string for a :class:`.date` object in :ref:`formatted string
+ literals <f-strings>` and when using :meth:`str.format`. For a
complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
@@ -1135,7 +1136,7 @@ Instance methods:
``self.date().isocalendar()``.
-.. method:: datetime.isoformat(sep='T')
+.. method:: datetime.isoformat(sep='T', timespec='auto')
Return a string representing the date and time in ISO 8601 format,
YYYY-MM-DDTHH:MM:SS.mmmmmm or, if :attr:`microsecond` is 0,
@@ -1156,6 +1157,37 @@ Instance methods:
>>> datetime(2002, 12, 25, tzinfo=TZ()).isoformat(' ')
'2002-12-25 00:00:00-06:39'
+ The optional argument *timespec* specifies the number of additional
+ components of the time to include (the default is ``'auto'``).
+ It can be one of the following:
+
+ - ``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0,
+ same as ``'microseconds'`` otherwise.
+ - ``'hours'``: Include the :attr:`hour` in the two-digit HH format.
+ - ``'minutes'``: Include :attr:`hour` and :attr:`minute` in HH:MM format.
+ - ``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second`
+ in HH:MM:SS format.
+ - ``'milliseconds'``: Include full time, but truncate fractional second
+ part to milliseconds. HH:MM:SS.sss format.
+ - ``'microseconds'``: Include full time in HH:MM:SS.mmmmmm format.
+
+ .. note::
+
+ Excluded time components are truncated, not rounded.
+
+ :exc:`ValueError` will be raised on an invalid *timespec* argument.
+
+
+ >>> from datetime import datetime
+ >>> datetime.now().isoformat(timespec='minutes')
+ '2002-12-25T00:00'
+ >>> dt = datetime(2015, 1, 1, 12, 30, 59, 0)
+ >>> dt.isoformat(timespec='microseconds')
+ '2015-01-01T12:30:59.000000'
+
+ .. versionadded:: 3.6
+ Added the *timespec* argument.
+
.. method:: datetime.__str__()
@@ -1182,7 +1214,8 @@ Instance methods:
.. method:: datetime.__format__(format)
Same as :meth:`.datetime.strftime`. This makes it possible to specify a format
- string for a :class:`.datetime` object when using :meth:`str.format`. For a
+ string for a :class:`.datetime` object in :ref:`formatted string
+ literals <f-strings>` and when using :meth:`str.format`. For a
complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
@@ -1404,13 +1437,46 @@ Instance methods:
aware :class:`.time`, without conversion of the time data.
-.. method:: time.isoformat()
+.. method:: time.isoformat(timespec='auto')
Return a string representing the time in ISO 8601 format, HH:MM:SS.mmmmmm or, if
- self.microsecond is 0, HH:MM:SS If :meth:`utcoffset` does not return ``None``, a
+ :attr:`microsecond` is 0, HH:MM:SS If :meth:`utcoffset` does not return ``None``, a
6-character string is appended, giving the UTC offset in (signed) hours and
minutes: HH:MM:SS.mmmmmm+HH:MM or, if self.microsecond is 0, HH:MM:SS+HH:MM
+ The optional argument *timespec* specifies the number of additional
+ components of the time to include (the default is ``'auto'``).
+ It can be one of the following:
+
+ - ``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0,
+ same as ``'microseconds'`` otherwise.
+ - ``'hours'``: Include the :attr:`hour` in the two-digit HH format.
+ - ``'minutes'``: Include :attr:`hour` and :attr:`minute` in HH:MM format.
+ - ``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second`
+ in HH:MM:SS format.
+ - ``'milliseconds'``: Include full time, but truncate fractional second
+ part to milliseconds. HH:MM:SS.sss format.
+ - ``'microseconds'``: Include full time in HH:MM:SS.mmmmmm format.
+
+ .. note::
+
+ Excluded time components are truncated, not rounded.
+
+ :exc:`ValueError` will be raised on an invalid *timespec* argument.
+
+
+ >>> from datetime import time
+ >>> time(hours=12, minute=34, second=56, microsecond=123456).isoformat(timespec='minutes')
+ '12:34'
+ >>> dt = time(hours=12, minute=34, second=56, microsecond=0)
+ >>> dt.isoformat(timespec='microseconds')
+ '12:34:56.000000'
+ >>> dt.isoformat(timespec='auto')
+ '12:34:56'
+
+ .. versionadded:: 3.6
+ Added the *timespec* argument.
+
.. method:: time.__str__()
@@ -1427,7 +1493,8 @@ Instance methods:
.. method:: time.__format__(format)
Same as :meth:`.time.strftime`. This makes it possible to specify a format string
- for a :class:`.time` object when using :meth:`str.format`. For a
+ for a :class:`.time` object in :ref:`formatted string
+ literals <f-strings>` and when using :meth:`str.format`. For a
complete list of formatting directives, see
:ref:`strftime-strptime-behavior`.
@@ -1738,10 +1805,7 @@ made to civil time.
otherwise :exc:`ValueError` is raised.
The *name* argument is optional. If specified it must be a string that
- is used as the value returned by the ``tzname(dt)`` method. Otherwise,
- ``tzname(dt)`` returns a string 'UTCsHH:MM', where s is the sign of
- *offset*, HH and MM are two digits of ``offset.hours`` and
- ``offset.minutes`` respectively.
+ will be used as the value returned by the :meth:`datetime.tzname` method.
.. versionadded:: 3.2
@@ -1754,11 +1818,19 @@ made to civil time.
.. method:: timezone.tzname(dt)
- Return the fixed value specified when the :class:`timezone` instance is
- constructed or a string 'UTCsHH:MM', where s is the sign of
- *offset*, HH and MM are two digits of ``offset.hours`` and
+ Return the fixed value specified when the :class:`timezone` instance
+ is constructed. If *name* is not provided in the constructor, the
+ name returned by ``tzname(dt)`` is generated from the value of the
+ ``offset`` as follows. If *offset* is ``timedelta(0)``, the name
+ is "UTC", otherwise it is a string 'UTC±HH:MM', where ± is the sign
+ of ``offset``, HH and MM are two digits of ``offset.hours`` and
``offset.minutes`` respectively.
+ .. versionchanged:: 3.6
+ Name generated from ``offset=timedelta(0)`` is now plain 'UTC', not
+ 'UTC+00:00'.
+
+
.. method:: timezone.dst(dt)
Always returns ``None``.
@@ -1908,6 +1980,34 @@ format codes.
| ``%%`` | A literal ``'%'`` character. | % | |
+-----------+--------------------------------+------------------------+-------+
+Several additional directives not required by the C89 standard are included for
+convenience. These parameters all correspond to ISO 8601 date values. These
+may not be available on all platforms when used with the :meth:`strftime`
+method. The ISO 8601 year and ISO 8601 week directives are not interchangeable
+with the year and week number directives above. Calling :meth:`strptime` with
+incomplete or ambiguous ISO 8601 directives will raise a :exc:`ValueError`.
+
++-----------+--------------------------------+------------------------+-------+
+| Directive | Meaning | Example | Notes |
++===========+================================+========================+=======+
+| ``%G`` | ISO 8601 year with century | 0001, 0002, ..., 2013, | \(8) |
+| | representing the year that | 2014, ..., 9998, 9999 | |
+| | contains the greater part of | | |
+| | the ISO week (``%V``). | | |
++-----------+--------------------------------+------------------------+-------+
+| ``%u`` | ISO 8601 weekday as a decimal | 1, 2, ..., 7 | |
+| | number where 1 is Monday. | | |
++-----------+--------------------------------+------------------------+-------+
+| ``%V`` | ISO 8601 week as a decimal | 01, 02, ..., 53 | \(8) |
+| | number with Monday as | | |
+| | the first day of the week. | | |
+| | Week 01 is the week containing | | |
+| | Jan 4. | | |
++-----------+--------------------------------+------------------------+-------+
+
+.. versionadded:: 3.6
+ ``%G``, ``%u`` and ``%V`` were added.
+
Notes:
(1)
@@ -1972,7 +2072,14 @@ Notes:
(7)
When used with the :meth:`strptime` method, ``%U`` and ``%W`` are only used
- in calculations when the day of the week and the year are specified.
+ in calculations when the day of the week and the calendar year (``%Y``)
+ are specified.
+
+(8)
+ Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the
+ day of the week and the ISO year (``%G``) are specified in a
+ :meth:`strptime` format string. Also note that ``%G`` and ``%Y`` are not
+ interchangable.
.. rubric:: Footnotes
diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst
index d46f850..6796f8a 100644
--- a/Doc/library/decimal.rst
+++ b/Doc/library/decimal.rst
@@ -445,6 +445,19 @@ Decimal objects
``Decimal('321e+5').adjusted()`` returns seven. Used for determining the
position of the most significant digit with respect to the decimal point.
+ .. method:: as_integer_ratio()
+
+ Return a pair ``(n, d)`` of integers that represent the given
+ :class:`Decimal` instance as a fraction, in lowest terms and
+ with a positive denominator::
+
+ >>> Decimal('-3.14').as_integer_ratio()
+ (-157, 50)
+
+ The conversion is exact. Raise OverflowError on infinities and ValueError
+ on NaNs.
+
+ .. versionadded:: 3.6
.. method:: as_tuple()
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 68c196e..229b9a1 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -989,6 +989,28 @@ the more significant byte last.
arguments.
+.. opcode:: FORMAT_VALUE (flags)
+
+ Used for implementing formatted literal strings (f-strings). Pops
+ an optional *fmt_spec* from the stack, then a required *value*.
+ *flags* is interpreted as follows:
+
+ * ``(flags & 0x03) == 0x00``: *value* is formatted as-is.
+ * ``(flags & 0x03) == 0x01``: call :func:`str` on *value* before
+ formatting it.
+ * ``(flags & 0x03) == 0x02``: call :func:`repr` on *value* before
+ formatting it.
+ * ``(flags & 0x03) == 0x03``: call :func:`ascii` on *value* before
+ formatting it.
+ * ``(flags & 0x04) == 0x04``: pop *fmt_spec* from the stack and use
+ it, else use an empty *fmt_spec*.
+
+ Formatting is performed using :c:func:`PyObject_Format`. The
+ result is pushed on the stack.
+
+ .. versionadded:: 3.6
+
+
.. opcode:: HAVE_ARGUMENT
This is not really an opcode. It identifies the dividing line between
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst
index 8a02a55..b3691ca 100644
--- a/Doc/library/enum.rst
+++ b/Doc/library/enum.rst
@@ -558,7 +558,8 @@ Some rules:
4. %-style formatting: `%s` and `%r` call the :class:`Enum` class's
:meth:`__str__` and :meth:`__repr__` respectively; other codes (such as
`%i` or `%h` for IntEnum) treat the enum member as its mixed-in type.
-5. :meth:`str.format` (or :func:`format`) will use the mixed-in
+5. :ref:`Formatted string literals <f-strings>`, :meth:`str.format`,
+ and :func:`format` will use the mixed-in
type's :meth:`__format__`. If the :class:`Enum` class's :func:`str` or
:func:`repr` is desired, use the `!s` or `!r` format codes.
@@ -747,6 +748,15 @@ besides the :class:`Enum` member you looking for::
.. versionchanged:: 3.5
+Boolean evaluation: Enum classes that are mixed with non-Enum types (such as
+:class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in
+type's rules; otherwise, all members evaluate as ``True``. To make your own
+Enum's boolean evaluation depend on the member's value add the following to
+your class::
+
+ def __bool__(self):
+ return bool(self.value)
+
The :attr:`__members__` attribute is only available on the class.
If you give your :class:`Enum` subclass extra methods, like the `Planet`_
diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst
index 3a5badd..3c49649 100644
--- a/Doc/library/faulthandler.rst
+++ b/Doc/library/faulthandler.rst
@@ -68,6 +68,9 @@ Fault handler state
.. versionchanged:: 3.5
Added support for passing file descriptor to this function.
+ .. versionchanged:: 3.6
+ On Windows, a handler for Windows exception is also installed.
+
.. function:: disable()
Disable the fault handler: uninstall the signal handlers installed by
diff --git a/Doc/library/fileinput.rst b/Doc/library/fileinput.rst
index 9510f76..6ca4008 100644
--- a/Doc/library/fileinput.rst
+++ b/Doc/library/fileinput.rst
@@ -71,9 +71,8 @@ The following function is the primary interface of this module:
.. versionchanged:: 3.2
Can be used as a context manager.
- .. versionchanged:: 3.5.2
- The *bufsize* parameter is no longer used.
-
+ .. deprecated-removed:: 3.6 3.8
+ The *bufsize* parameter.
The following functions use the global state created by :func:`fileinput.input`;
if there is no active state, :exc:`RuntimeError` is raised.
@@ -166,8 +165,8 @@ available for subclassing as well:
.. deprecated:: 3.4
The ``'rU'`` and ``'U'`` modes.
- .. versionchanged:: 3.5.2
- The *bufsize* parameter is no longer used.
+ .. deprecated-removed:: 3.6 3.8
+ The *bufsize* parameter.
**Optional in-place filtering:** if the keyword argument ``inplace=True`` is
diff --git a/Doc/library/grp.rst b/Doc/library/grp.rst
index 8882140..c840cfe 100644
--- a/Doc/library/grp.rst
+++ b/Doc/library/grp.rst
@@ -42,6 +42,9 @@ It defines the following items:
Return the group database entry for the given numeric group ID. :exc:`KeyError`
is raised if the entry asked for cannot be found.
+ .. deprecated:: 3.6
+ Since Python 3.6 the support of non-integer arguments like floats or
+ strings in :func:`getgrgid` is deprecated.
.. function:: getgrnam(name)
diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst
index 0bde35b..7ab249a 100644
--- a/Doc/library/http.server.rst
+++ b/Doc/library/http.server.rst
@@ -375,10 +375,9 @@ the current directory::
Handler = http.server.SimpleHTTPRequestHandler
- httpd = socketserver.TCPServer(("", PORT), Handler)
-
- print("serving at port", PORT)
- httpd.serve_forever()
+ with socketserver.TCPServer(("", PORT), Handler) as httpd:
+ print("serving at port", PORT)
+ httpd.serve_forever()
.. _http-server-cli:
diff --git a/Doc/library/imaplib.rst b/Doc/library/imaplib.rst
index 15b0932..cd214ff 100644
--- a/Doc/library/imaplib.rst
+++ b/Doc/library/imaplib.rst
@@ -500,6 +500,17 @@ An :class:`IMAP4` instance has the following methods:
M.store(num, '+FLAGS', '\\Deleted')
M.expunge()
+ .. note::
+
+ Creating flags containing ']' (for example: "[test]") violates
+ :rfc:`3501` (the IMAP protocol). However, imaplib has historically
+ allowed creation of such tags, and popular IMAP servers, such as Gmail,
+ accept and produce such flags. There are non-Python programs which also
+ create such tags. Although it is an RFC violation and IMAP clients and
+ servers are supposed to be strict, imaplib nontheless continues to allow
+ such tags to be created for backward compatibility reasons, and as of
+ python 3.6, handles them if they are sent from the server, since this
+ improves real-world compatibility.
.. method:: IMAP4.subscribe(mailbox)
diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst
index 68a6b68..420031a 100644
--- a/Doc/library/imp.rst
+++ b/Doc/library/imp.rst
@@ -81,7 +81,9 @@ This module provides an interface to the mechanisms used to implement the
.. deprecated:: 3.3
Use :func:`importlib.util.find_spec` instead unless Python 3.3
compatibility is required, in which case use
- :func:`importlib.find_loader`.
+ :func:`importlib.find_loader`. For example usage of the former case,
+ see the :ref:`importlib-examples` section of the :mod:`importlib`
+ documentation.
.. function:: load_module(name, file, pathname, description)
@@ -108,9 +110,12 @@ This module provides an interface to the mechanisms used to implement the
If previously used in conjunction with :func:`imp.find_module` then
consider using :func:`importlib.import_module`, otherwise use the loader
returned by the replacement you chose for :func:`imp.find_module`. If you
- called :func:`imp.load_module` and related functions directly then use the
- classes in :mod:`importlib.machinery`, e.g.
- ``importlib.machinery.SourceFileLoader(name, path).load_module()``.
+ called :func:`imp.load_module` and related functions directly with file
+ path arguments then use a combination of
+ :func:`importlib.util.spec_from_file_location` and
+ :func:`importlib.util.module_from_spec`. See the :ref:`importlib-examples`
+ section of the :mod:`importlib` documentation for details of the various
+ approaches.
.. function:: new_module(name)
@@ -119,7 +124,7 @@ This module provides an interface to the mechanisms used to implement the
in ``sys.modules``.
.. deprecated:: 3.4
- Use :class:`types.ModuleType` instead.
+ Use :func:`importlib.util.module_from_spec` instead.
.. function:: reload(module)
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 43b34e9..1a1348f 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -256,7 +256,7 @@ ABC hierarchy::
module and *path* will be the value of :attr:`__path__` from the
parent package. If a spec cannot be found, ``None`` is returned.
When passed in, ``target`` is a module object that the finder may
- use to make a more educated about what spec to return.
+ use to make a more educated guess about what spec to return.
.. versionadded:: 3.4
@@ -306,7 +306,7 @@ ABC hierarchy::
within the :term:`path entry` to which it is assigned. If a spec
cannot be found, ``None`` is returned. When passed in, ``target``
is a module object that the finder may use to make a more educated
- about what spec to return.
+ guess about what spec to return.
.. versionadded:: 3.4
@@ -921,6 +921,10 @@ find and load modules.
Concrete implementation of :meth:`importlib.abc.Loader.load_module` where
specifying the name of the module to load is optional.
+ .. deprecated:: 3.6
+
+ Use :meth:`importlib.abc.Loader.exec_module` instead.
+
.. class:: SourcelessFileLoader(fullname, path)
@@ -960,6 +964,10 @@ find and load modules.
Concrete implementation of :meth:`importlib.abc.Loader.load_module` where
specifying the name of the module to load is optional.
+ .. deprecated:: 3.6
+
+ Use :meth:`importlib.abc.Loader.exec_module` instead.
+
.. class:: ExtensionFileLoader(fullname, path)
@@ -1300,3 +1308,120 @@ an :term:`importer`.
loader = importlib.machinery.SourceFileLoader
lazy_loader = importlib.util.LazyLoader.factory(loader)
finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))
+
+.. _importlib-examples:
+
+Examples
+--------
+
+To programmatically import a module, use :func:`importlib.import_module`.
+::
+
+ import importlib
+
+ itertools = importlib.import_module('itertools')
+
+If you need to find out if a module can be imported without actually doing the
+import, then you should use :func:`importlib.util.find_spec`.
+::
+
+ import importlib.util
+ import sys
+
+ # For illustrative purposes.
+ name = 'itertools'
+
+ spec = importlib.util.find_spec(name)
+ if spec is None:
+ print("can't find the itertools module")
+ else:
+ # If you chose to perform the actual import ...
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ # Adding the module to sys.modules is optional.
+ sys.modules[name] = module
+
+To import a Python source file directly, use the following recipe
+(Python 3.4 and newer only)::
+
+ import importlib.util
+ import sys
+
+ # For illustrative purposes.
+ import tokenize
+ file_path = tokenize.__file__
+ module_name = tokenize.__name__
+
+ spec = importlib.util.spec_from_file_location(module_name, file_path)
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ # Optional; only necessary if you want to be able to import the module
+ # by name later.
+ sys.modules[module_name] = module
+
+For deep customizations of import, you typically want to implement an
+:term:`importer`. This means managing both the :term:`finder` and :term:`loader`
+side of things. For finders there are two flavours to choose from depending on
+your needs: a :term:`meta path finder` or a :term:`path entry finder`. The
+former is what you would put on :attr:`sys.meta_path` while the latter is what
+you create using a :term:`path entry hook` on :attr:`sys.path_hooks` which works
+with :attr:`sys.path` entries to potentially create a finder. This example will
+show you how to register your own importers so that import will use them (for
+creating an importer for yourself, read the documentation for the appropriate
+classes defined within this package)::
+
+ import importlib.machinery
+ import sys
+
+ # For illustrative purposes only.
+ SpamMetaPathFinder = importlib.machinery.PathFinder
+ SpamPathEntryFinder = importlib.machinery.FileFinder
+ loader_details = (importlib.machinery.SourceFileLoader,
+ importlib.machinery.SOURCE_SUFFIXES)
+
+ # Setting up a meta path finder.
+ # Make sure to put the finder in the proper location in the list in terms of
+ # priority.
+ sys.meta_path.append(SpamMetaPathFinder)
+
+ # Setting up a path entry finder.
+ # Make sure to put the path hook in the proper location in the list in terms
+ # of priority.
+ sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))
+
+Import itself is implemented in Python code, making it possible to
+expose most of the import machinery through importlib. The following
+helps illustrate the various APIs that importlib exposes by providing an
+approximate implementation of
+:func:`importlib.import_module` (Python 3.4 and newer for the importlib usage,
+Python 3.6 and newer for other parts of the code).
+::
+
+ import importlib.util
+ import sys
+
+ def import_module(name, package=None):
+ """An approximate implementation of import."""
+ absolute_name = importlib.util.resolve_name(name, package)
+ try:
+ return sys.modules[absolute_name]
+ except KeyError:
+ pass
+
+ path = None
+ if '.' in absolute_name:
+ parent_name, _, child_name = absolute_name.rpartition('.')
+ parent_module = import_module(parent_name)
+ path = parent_module.spec.submodule_search_locations
+ for finder in sys.meta_path:
+ spec = finder.find_spec(absolute_name, path)
+ if spec is not None:
+ break
+ else:
+ raise ImportError(f'No module named {absolute_name!r}')
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ sys.modules[absolute_name] = module
+ if path is not None:
+ setattr(parent_module, child_name, module)
+ return module
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst