From 7de53ac6c0cc4e04c09ab2974af384ff2d1a03c4 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 16 Oct 2017 20:02:17 +0900 Subject: [PATCH] Imported Upstream version 3.5.4 Change-Id: Id4ce80292649159c0159cab585aa21897fcc2345 Signed-off-by: DongHun Kwak --- Doc/Makefile | 21 +- Doc/c-api/exceptions.rst | 218 +- Doc/c-api/long.rst | 13 +- Doc/c-api/marshal.rst | 8 +- Doc/c-api/module.rst | 2 +- Doc/c-api/slice.rst | 11 + Doc/c-api/structures.rst | 6 +- Doc/c-api/unicode.rst | 95 +- Doc/c-api/veryhigh.rst | 5 +- Doc/conf.py | 30 +- Doc/copyright.rst | 2 +- Doc/distutils/examples.rst | 2 +- Doc/extending/newtypes.rst | 2 +- Doc/faq/general.rst | 6 +- Doc/faq/gui.rst | 9 - Doc/faq/windows.rst | 7 +- Doc/glossary.rst | 15 +- Doc/howto/argparse.rst | 2 +- Doc/howto/clinic.rst | 6 +- Doc/howto/descriptor.rst | 8 +- Doc/howto/functional.rst | 29 +- Doc/howto/logging-cookbook.rst | 6 +- Doc/howto/unicode.rst | 6 +- Doc/howto/urllib2.rst | 10 +- Doc/includes/setup.py | 1 + Doc/includes/shoddy.c | 2 +- Doc/library/2to3.rst | 7 - Doc/library/argparse.rst | 4 +- Doc/library/asyncio-protocol.rst | 16 +- Doc/library/asyncio-subprocess.rst | 4 +- Doc/library/asyncio-task.rst | 41 +- Doc/library/base64.rst | 17 +- Doc/library/binhex.rst | 2 - Doc/library/cmd.rst | 4 +- Doc/library/collections.rst | 2 +- Doc/library/configparser.rst | 16 +- Doc/library/copy.rst | 4 +- Doc/library/csv.rst | 6 +- Doc/library/ctypes.rst | 44 +- Doc/library/curses.rst | 72 +- Doc/library/dis.rst | 55 +- Doc/library/doctest.rst | 30 +- Doc/library/email.contentmanager.rst | 6 +- Doc/library/email.errors.rst | 4 +- Doc/library/email.message.rst | 2 +- Doc/library/email.mime.rst | 2 +- Doc/library/email.policy.rst | 2 +- Doc/library/fnmatch.rst | 8 +- Doc/library/fpectl.rst | 2 +- Doc/library/ftplib.rst | 6 +- Doc/library/functions.rst | 16 +- Doc/library/gettext.rst | 161 +- Doc/library/http.server.rst | 3 +- Doc/library/idle.rst | 16 +- Doc/library/inspect.rst | 395 +- Doc/library/json.rst | 24 +- Doc/library/logging.config.rst | 4 +- Doc/library/logging.handlers.rst | 8 +- Doc/library/marshal.rst | 19 +- Doc/library/mimetypes.rst | 86 +- Doc/library/multiprocessing.rst | 2 +- Doc/library/os.rst | 2 +- Doc/library/othergui.rst | 18 +- Doc/library/pdb.rst | 2 +- Doc/library/profile.rst | 17 +- Doc/library/pyexpat.rst | 2 +- Doc/library/quopri.rst | 4 +- Doc/library/re.rst | 29 +- Doc/library/selectors.rst | 2 +- Doc/library/shutil.rst | 4 +- Doc/library/signal.rst | 6 +- Doc/library/smtpd.rst | 6 + Doc/library/socket.rst | 4 +- Doc/library/sqlite3.rst | 5 + Doc/library/stdtypes.rst | 30 +- Doc/library/sunau.rst | 2 +- Doc/library/sys.rst | 2 +- Doc/library/sysconfig.rst | 1 - Doc/library/tabnanny.rst | 8 +- Doc/library/tempfile.rst | 4 +- Doc/library/test.rst | 3 +- Doc/library/threading.rst | 5 +- Doc/library/time.rst | 42 +- Doc/library/traceback.rst | 14 +- Doc/library/turtle.rst | 4 +- Doc/library/typing.rst | 54 +- Doc/library/unicodedata.rst | 2 +- Doc/library/unittest.mock.rst | 14 +- Doc/library/unittest.rst | 33 +- Doc/library/urllib.parse.rst | 6 + Doc/library/urllib.request.rst | 78 +- Doc/library/uuid.rst | 2 +- Doc/library/weakref.rst | 10 +- Doc/library/xml.dom.minidom.rst | 2 +- Doc/library/xml.dom.pulldom.rst | 2 +- Doc/library/xml.etree.elementtree.rst | 2 +- Doc/library/zipfile.rst | 6 +- Doc/library/zipimport.rst | 2 +- Doc/make.bat | 2 +- Doc/reference/datamodel.rst | 27 +- Doc/reference/executionmodel.rst | 6 - Doc/reference/expressions.rst | 27 +- Doc/reference/import.rst | 2 +- Doc/reference/simple_stmts.rst | 2 +- Doc/tools/extensions/patchlevel.py | 6 +- Doc/tools/extensions/pyspecific.py | 10 +- Doc/tools/susp-ignored.csv | 12 +- Doc/tools/templates/customsourcelink.html | 7 +- Doc/tools/templates/download.html | 20 +- Doc/tools/templates/indexcontent.html | 11 +- Doc/tools/templates/layout.html | 1 + Doc/tutorial/classes.rst | 2 +- Doc/tutorial/controlflow.rst | 4 +- Doc/tutorial/datastructures.rst | 61 +- Doc/tutorial/inputoutput.rst | 51 +- Doc/tutorial/introduction.rst | 8 +- Doc/using/cmdline.rst | 4 +- Doc/using/index.rst | 2 +- Doc/using/windows.rst | 6 +- Doc/whatsnew/2.0.rst | 8 +- Doc/whatsnew/2.1.rst | 16 +- Doc/whatsnew/2.2.rst | 8 +- Doc/whatsnew/2.3.rst | 12 +- Doc/whatsnew/2.4.rst | 32 +- Doc/whatsnew/2.5.rst | 24 +- Doc/whatsnew/2.6.rst | 4 +- Doc/whatsnew/3.5.rst | 11 +- Doc/whatsnew/changelog.rst | 2 +- Include/ceval.h | 1 + Include/dictobject.h | 1 + Include/modsupport.h | 10 +- Include/patchlevel.h | 4 +- Include/pylifecycle.h | 4 +- Include/sliceobject.h | 19 +- Include/unicodeobject.h | 63 +- LICENSE | 11 +- Lib/_osx_support.py | 2 +- Lib/aifc.py | 37 +- Lib/argparse.py | 2 +- Lib/asyncio/base_events.py | 3 +- Lib/asyncio/coroutines.py | 2 +- Lib/asyncio/events.py | 9 +- Lib/asyncio/futures.py | 1 + Lib/asyncio/locks.py | 17 +- Lib/asyncio/proactor_events.py | 5 +- Lib/asyncio/sslproto.py | 21 +- Lib/asyncio/subprocess.py | 17 +- Lib/asyncio/tasks.py | 14 +- Lib/asyncio/test_utils.py | 11 +- Lib/base64.py | 6 +- Lib/contextlib.py | 13 +- Lib/ctypes/__init__.py | 4 + Lib/ctypes/test/test_callbacks.py | 11 + Lib/ctypes/test/test_loading.py | 2 + Lib/ctypes/test/test_slicing.py | 4 +- Lib/ctypes/test/test_structures.py | 28 +- Lib/distutils/sysconfig.py | 7 +- Lib/distutils/tests/test_build_ext.py | 7 + Lib/email/_header_value_parser.py | 4 +- Lib/email/_policybase.py | 8 +- Lib/email/architecture.rst | 2 +- Lib/ftplib.py | 2 + Lib/getpass.py | 1 - Lib/gettext.py | 40 +- Lib/idlelib/EditorWindow.py | 8 +- Lib/idlelib/IOBinding.py | 86 +- Lib/idlelib/__init__.py | 1 + Lib/idlelib/help.html | 2 +- Lib/imaplib.py | 9 +- Lib/imp.py | 5 +- Lib/importlib/__init__.py | 2 +- Lib/importlib/_bootstrap.py | 7 +- Lib/importlib/_bootstrap_external.py | 28 +- Lib/importlib/util.py | 2 +- Lib/inspect.py | 44 +- Lib/ipaddress.py | 6 +- Lib/json/__init__.py | 2 +- Lib/logging/__init__.py | 11 +- Lib/logging/handlers.py | 34 +- Lib/multiprocessing/forkserver.py | 20 +- Lib/multiprocessing/pool.py | 86 +- Lib/multiprocessing/process.py | 3 + Lib/multiprocessing/queues.py | 32 +- Lib/multiprocessing/util.py | 36 +- Lib/os.py | 4 +- Lib/pathlib.py | 32 +- Lib/pkgutil.py | 5 +- Lib/platform.py | 4 +- Lib/poplib.py | 9 +- Lib/pstats.py | 13 +- Lib/pydoc.py | 7 +- Lib/pydoc_data/topics.py | 30 +- Lib/smtplib.py | 1 + Lib/sre_constants.py | 11 + Lib/sre_parse.py | 32 +- Lib/subprocess.py | 30 +- Lib/tabnanny.py | 2 +- Lib/test/185test.db | Bin 16384 -> 0 bytes Lib/test/_test_multiprocessing.py | 238 +- Lib/test/bisect.py | 167 + Lib/test/eintrdata/eintr_tester.py | 71 +- Lib/test/lock_tests.py | 19 +- Lib/test/mod_generics_cache.py | 14 + Lib/test/regrtest.py | 420 +- Lib/test/sndhdrdata/README | 7 - Lib/test/support/__init__.py | 55 +- Lib/test/support/script_helper.py | 25 +- Lib/test/test___all__.py | 11 - Lib/test/test_aifc.py | 18 +- Lib/test/test_argparse.py | 17 + Lib/test/test_array.py | 25 +- Lib/test/test_asyncio/test_events.py | 24 + Lib/test/test_asyncio/test_futures.py | 8 + Lib/test/test_asyncio/test_locks.py | 22 + Lib/test/test_asyncio/test_selector_events.py | 8 +- Lib/test/test_asyncio/test_sslproto.py | 27 + Lib/test/test_asyncio/test_subprocess.py | 24 + Lib/test/test_asyncio/test_tasks.py | 37 + Lib/test/test_asyncore.py | 3 + Lib/test/test_atexit.py | 11 + Lib/test/test_base64.py | 8 + Lib/test/test_builtin.py | 6 + Lib/test/test_capi.py | 40 +- Lib/test/test_class.py | 27 + Lib/test/test_codecencodings_cn.py | 10 + Lib/test/test_compile.py | 3 + Lib/test/test_complex.py | 23 + Lib/test/test_contextlib.py | 23 + Lib/test/test_coroutines.py | 16 + Lib/test/test_curses.py | 15 +- Lib/test/test_dict.py | 86 + Lib/test/test_eintr.py | 12 +- Lib/test/test_email/test__header_value_parser.py | 12 + Lib/test/test_email/test_generator.py | 7 + Lib/test/test_exceptions.py | 20 + Lib/test/test_extcall.py | 6 +- Lib/test/test_fileio.py | 9 +- Lib/test/test_float.py | 28 +- Lib/test/test_fnmatch.py | 64 +- Lib/test/test_ftplib.py | 6 +- Lib/test/test_functools.py | 50 + Lib/test/test_gettext.py | 132 +- Lib/test/test_grp.py | 2 + Lib/test/test_idle.py | 15 +- Lib/test/test_imaplib.py | 13 +- Lib/test/test_imp.py | 4 + Lib/test/test_import/__init__.py | 23 +- Lib/test/test_import/data/package2/submodule1.py | 3 + Lib/test/test_import/data/package2/submodule2.py | 0 .../test_importlib/import_/test___package__.py | 2 +- .../import_/test_relative_imports.py | 7 +- Lib/test/test_importlib/source/test_file_loader.py | 104 + Lib/test/test_importlib/test_util.py | 44 + Lib/test/test_inspect.py | 40 + Lib/test/test_io.py | 42 + Lib/test/test_ipaddress.py | 37 +- Lib/test/test_itertools.py | 8 + Lib/test/test_json/test_speedups.py | 26 + Lib/test/test_locale.py | 5 + Lib/test/test_logging.py | 38 +- Lib/test/test_nntplib.py | 7 +- Lib/test/test_normalization.py | 16 +- Lib/test/test_os.py | 128 +- Lib/test/test_parser.py | 81 + Lib/test/test_pathlib.py | 46 + Lib/test/test_platform.py | 12 +- Lib/test/test_posix.py | 29 +- Lib/test/test_pow.py | 3 - Lib/test/test_random.py | 5 + Lib/test/test_range.py | 17 +- Lib/test/test_re.py | 18 +- Lib/test/test_readline.py | 50 +- Lib/test/test_regrtest.py | 669 +- Lib/test/test_sax.py | 24 +- Lib/test/test_signal.py | 9 + Lib/test/test_site.py | 29 +- Lib/test/test_socket.py | 16 +- Lib/test/test_ssl.py | 4 +- Lib/test/test_struct.py | 4 + Lib/test/test_subprocess.py | 98 +- Lib/test/test_support.py | 29 +- Lib/test/test_sysconfig.py | 6 +- Lib/test/test_tempfile.py | 5 +- Lib/test/test_thread.py | 4 + Lib/test/test_threading.py | 11 +- Lib/test/test_time.py | 4 + Lib/test/test_tools/test_reindent.py | 7 + Lib/test/test_tracemalloc.py | 1 + Lib/test/test_typing.py | 507 +- Lib/test/test_unicode.py | 16 + Lib/test/test_unpack_ex.py | 2 +- Lib/test/test_urllib.py | 9 +- Lib/test/test_urllib2.py | 6 +- Lib/test/test_urllib2net.py | 6 +- Lib/test/test_urllibnet.py | 6 +- Lib/test/test_urlparse.py | 63 +- Lib/test/test_venv.py | 25 +- Lib/test/test_winsound.py | 4 + Lib/test/test_xml_etree.py | 112 + Lib/test/test_xmlrpc.py | 90 +- Lib/threading.py | 4 + Lib/tkinter/__init__.py | 15 +- Lib/tkinter/test/test_tkinter/test_widgets.py | 7 +- Lib/typing.py | 367 +- Lib/unittest/case.py | 52 +- Lib/unittest/loader.py | 8 +- Lib/unittest/main.py | 1 + Lib/unittest/mock.py | 17 +- Lib/unittest/test/test_case.py | 13 + Lib/unittest/test/test_discovery.py | 6 + Lib/unittest/test/test_loader.py | 8 +- Lib/unittest/test/testmock/testhelpers.py | 20 + Lib/unittest/test/testmock/testmock.py | 17 +- Lib/urllib/error.py | 4 - Lib/urllib/parse.py | 62 +- Lib/urllib/request.py | 10 +- Lib/venv/__init__.py | 19 +- Lib/venv/scripts/{posix => common}/activate | 0 Lib/venv/scripts/nt/Activate.ps1 | 18 +- Lib/weakref.py | 4 +- Lib/xml/sax/expatreader.py | 33 +- Lib/xmlrpc/server.py | 43 +- Lib/zipfile.py | 27 +- Mac/BuildScript/build-installer.py | 45 +- Mac/BuildScript/openssl_sdk_makedepend.patch | 2 +- Makefile.pre.in | 186 +- Misc/ACKS | 16 + Misc/HISTORY | 2 +- Misc/NEWS | 9224 +++++++++++--------- Modules/_collectionsmodule.c | 6 +- Modules/_ctypes/_ctypes.c | 10 +- Modules/_ctypes/_ctypes_test.c | 13 + Modules/_ctypes/callproc.c | 9 +- Modules/_ctypes/cfield.c | 2 +- Modules/_ctypes/libffi_msvc/ffi.c | 10 + Modules/_cursesmodule.c | 11 +- Modules/_decimal/_decimal.c | 14 +- Modules/_elementtree.c | 117 +- Modules/_functoolsmodule.c | 68 +- Modules/_io/bufferedio.c | 14 +- Modules/_io/fileio.c | 16 +- Modules/_io/iobase.c | 38 +- Modules/_io/textio.c | 25 +- Modules/_json.c | 105 +- Modules/_localemodule.c | 9 +- Modules/_pickle.c | 18 +- Modules/_posixsubprocess.c | 43 +- Modules/_randommodule.c | 11 +- Modules/_sre.c | 9 +- Modules/_ssl.c | 15 +- Modules/_struct.c | 14 +- Modules/_testbuffer.c | 7 +- Modules/_testcapimodule.c | 4 +- Modules/_tkinter.c | 2 +- Modules/_tracemalloc.c | 8 +- Modules/_winapi.c | 40 +- Modules/arraymodule.c | 119 +- Modules/atexitmodule.c | 2 +- Modules/cjkcodecs/_codecs_cn.c | 29 +- Modules/cjkcodecs/multibytecodec.c | 3 + Modules/expat/COPYING | 5 +- Modules/expat/amigaconfig.h | 32 - Modules/expat/expat.h | 35 +- Modules/expat/expat_external.h | 19 +- Modules/expat/internal.h | 22 + Modules/expat/macconfig.h | 53 - Modules/expat/siphash.h | 344 + Modules/expat/watcomconfig.h | 47 - Modules/expat/winconfig.h | 10 + Modules/expat/xmlparse.c | 700 +- Modules/expat/xmlrole.c | 230 +- Modules/expat/xmltok.c | 244 +- Modules/expat/xmltok.h | 10 +- Modules/expat/xmltok_impl.c | 226 +- Modules/faulthandler.c | 17 +- Modules/getbuildinfo.c | 46 +- Modules/grpmodule.c | 1 + Modules/itertoolsmodule.c | 52 +- Modules/main.c | 16 +- Modules/makesetup | 2 +- Modules/mmapmodule.c | 9 +- Modules/nismodule.c | 1 + Modules/overlapped.c | 2 +- Modules/parsermodule.c | 110 +- Modules/posixmodule.c | 122 +- Modules/pwdmodule.c | 1 + Modules/pyexpat.c | 6 +- Modules/readline.c | 10 +- Modules/signalmodule.c | 4 + Modules/socketmodule.c | 6 +- Modules/spwdmodule.c | 1 + Modules/timemodule.c | 2 +- Modules/xxlimited.c | 2 +- Modules/zipimport.c | 17 +- Modules/zlib/ChangeLog | 55 +- Modules/zlib/Makefile.in | 232 +- Modules/zlib/README | 6 +- Modules/zlib/adler32.c | 21 +- Modules/zlib/compress.c | 42 +- Modules/zlib/configure | 134 +- Modules/zlib/crc32.c | 41 +- Modules/zlib/deflate.c | 802 +- Modules/zlib/deflate.h | 35 +- Modules/zlib/gzguts.h | 23 +- Modules/zlib/gzlib.c | 31 +- Modules/zlib/gzread.c | 156 +- Modules/zlib/gzwrite.c | 332 +- Modules/zlib/infback.c | 4 +- Modules/zlib/inffast.c | 85 +- Modules/zlib/inflate.c | 123 +- Modules/zlib/inflate.h | 11 +- Modules/zlib/inftrees.c | 26 +- Modules/zlib/trees.c | 99 +- Modules/zlib/uncompr.c | 98 +- Modules/zlib/zconf.h | 41 +- Modules/zlib/zconf.h.cmakein | 41 +- Modules/zlib/zconf.h.in | 41 +- Modules/zlib/zlib.3 | 72 +- Modules/zlib/zlib.h | 452 +- Modules/zlib/zlib.map | 177 +- Modules/zlib/zutil.c | 49 +- Modules/zlib/zutil.h | 52 +- Objects/abstract.c | 4 +- Objects/bytearrayobject.c | 14 +- Objects/bytesobject.c | 8 +- Objects/codeobject.c | 6 +- Objects/complexobject.c | 6 +- Objects/dictobject.c | 123 +- Objects/exceptions.c | 48 + Objects/genobject.c | 3 +- Objects/listobject.c | 14 +- Objects/memoryobject.c | 4 +- Objects/obmalloc.c | 4 +- Objects/odictobject.c | 2 +- Objects/rangeobject.c | 21 +- Objects/setobject.c | 12 +- Objects/sliceobject.c | 78 +- Objects/tupleobject.c | 10 +- Objects/typeobject.c | 39 +- Objects/unicodeobject.c | 83 +- Objects/weakrefobject.c | 2 + PC/_msi.c | 6 +- PC/bdist_wininst/bdist_wininst.vcxproj | 210 +- PC/bdist_wininst/bdist_wininst.vcxproj.filters | 120 +- PC/bdist_wininst/build.bat | 11 +- PC/getpathp.c | 4 +- PC/msvcrtmodule.c | 58 +- PC/python3.def | 2 + PC/readme.txt | 162 +- PCbuild/_bz2.vcxproj | 194 +- PCbuild/_bz2.vcxproj.filters | 96 +- PCbuild/_ctypes.vcxproj | 218 +- PCbuild/_ctypes.vcxproj.filters | 128 +- PCbuild/_ctypes_test.vcxproj | 158 +- PCbuild/_ctypes_test.vcxproj.filters | 40 +- PCbuild/_decimal.vcxproj | 252 +- PCbuild/_decimal.vcxproj.filters | 230 +- PCbuild/_elementtree.vcxproj | 212 +- PCbuild/_elementtree.vcxproj.filters | 142 +- PCbuild/_freeze_importlib.vcxproj | 212 +- PCbuild/_freeze_importlib.vcxproj.filters | 54 +- PCbuild/_hashlib.vcxproj | 186 +- PCbuild/_hashlib.vcxproj.filters | 24 +- PCbuild/_lzma.vcxproj | 174 +- PCbuild/_lzma.vcxproj.filters | 24 +- PCbuild/_msi.vcxproj | 164 +- PCbuild/_msi.vcxproj.filters | 24 +- PCbuild/_multiprocessing.vcxproj | 172 +- PCbuild/_multiprocessing.vcxproj.filters | 46 +- PCbuild/_overlapped.vcxproj | 164 +- PCbuild/_overlapped.vcxproj.filters | 24 +- PCbuild/_socket.vcxproj | 170 +- PCbuild/_socket.vcxproj.filters | 40 +- PCbuild/_sqlite3.vcxproj | 216 +- PCbuild/_sqlite3.vcxproj.filters | 136 +- PCbuild/_ssl.vcxproj | 194 +- PCbuild/_ssl.vcxproj.filters | 24 +- PCbuild/_testbuffer.vcxproj | 162 +- PCbuild/_testbuffer.vcxproj.filters | 24 +- PCbuild/_testcapi.vcxproj | 164 +- PCbuild/_testcapi.vcxproj.filters | 24 +- PCbuild/_testembed.vcxproj | 158 +- PCbuild/_testembed.vcxproj.filters | 42 +- PCbuild/_testimportmultiple.vcxproj | 166 +- PCbuild/_testimportmultiple.vcxproj.filters | 26 +- PCbuild/_testmultiphase.vcxproj | 164 +- PCbuild/_testmultiphase.vcxproj.filters | 42 +- PCbuild/_tkinter.vcxproj | 186 +- PCbuild/_tkinter.vcxproj.filters | 30 +- PCbuild/build.bat | 40 +- PCbuild/find_msbuild.bat | 51 + PCbuild/get_externals.bat | 4 +- PCbuild/libeay.vcxproj | 1812 ++-- PCbuild/openssl.props | 152 +- PCbuild/pcbuild.proj | 242 +- PCbuild/pyexpat.vcxproj | 172 +- PCbuild/pyexpat.vcxproj.filters | 64 +- PCbuild/pylauncher.vcxproj | 164 +- PCbuild/pylauncher.vcxproj.filters | 62 +- PCbuild/pyproject.props | 322 +- PCbuild/pyshellext.vcxproj | 172 +- PCbuild/pyshellext.vcxproj.filters | 78 +- PCbuild/python.props | 346 +- PCbuild/python.vcxproj | 225 +- PCbuild/python.vcxproj.filters | 52 +- PCbuild/python3dll.vcxproj | 272 +- PCbuild/python3dll.vcxproj.filters | 62 +- PCbuild/pythoncore.vcxproj | 851 +- PCbuild/pythoncore.vcxproj.filters | 1964 ++--- PCbuild/pythonw.vcxproj | 156 +- PCbuild/pythonw.vcxproj.filters | 40 +- PCbuild/pywlauncher.vcxproj | 162 +- PCbuild/pywlauncher.vcxproj.filters | 62 +- PCbuild/readme.txt | 2 +- PCbuild/rmpyc.py | 20 +- PCbuild/rt.bat | 8 +- PCbuild/select.vcxproj | 162 +- PCbuild/select.vcxproj.filters | 24 +- PCbuild/sqlite3.vcxproj | 176 +- PCbuild/sqlite3.vcxproj.filters | 46 +- PCbuild/ssleay.vcxproj | 236 +- PCbuild/tcl.vcxproj | 184 +- PCbuild/tcltk.props | 88 +- PCbuild/tix.vcxproj | 186 +- PCbuild/tk.vcxproj | 192 +- PCbuild/unicodedata.vcxproj | 170 +- PCbuild/unicodedata.vcxproj.filters | 46 +- PCbuild/winsound.vcxproj | 162 +- PCbuild/winsound.vcxproj.filters | 26 +- PCbuild/xxlimited.vcxproj | 164 +- PCbuild/xxlimited.vcxproj.filters | 24 +- Python/bltinmodule.c | 23 +- Python/ceval.c | 130 +- Python/dynload_win.c | 4 +- Python/fileutils.c | 23 +- Python/import.c | 26 +- Python/importlib.h | 733 +- Python/importlib_external.h | 5145 +++++------ Python/marshal.c | 26 +- Python/pylifecycle.c | 11 +- Python/pythonrun.c | 19 +- Python/random.c | 494 +- Python/sysmodule.c | 14 +- Python/thread_pthread.h | 95 +- README | 18 +- Tools/README | 2 +- Tools/hg/hgtouch.py | 130 - Tools/importbench/README | 2 +- Tools/msi/build.bat | 10 +- Tools/msi/buildrelease.bat | 96 +- Tools/msi/bundle/bootstrap/pythonba.sln | 44 +- Tools/msi/bundle/bootstrap/pythonba.vcxproj | 136 +- Tools/msi/make_zip.proj | 79 +- Tools/msi/make_zip.py | 13 +- Tools/msi/msi.props | 352 +- Tools/msi/uploadrelease.bat | 38 +- Tools/msi/uploadrelease.proj | 192 +- Tools/msi/wix.props | 22 +- Tools/nuget/build.bat | 7 +- Tools/nuget/make_pkg.proj | 112 +- Tools/scripts/patchcheck.py | 97 +- Tools/scripts/reindent.py | 6 +- Tools/ssl/sslspeed.vcxproj | 138 +- config.guess | 31 +- config.sub | 23 +- configure | 137 +- configure.ac | 79 +- 567 files changed, 28049 insertions(+), 20438 deletions(-) delete mode 100644 Lib/test/185test.db create mode 100755 Lib/test/bisect.py create mode 100644 Lib/test/mod_generics_cache.py create mode 100644 Lib/test/test_import/data/package2/submodule1.py create mode 100644 Lib/test/test_import/data/package2/submodule2.py rename Lib/venv/scripts/{posix => common}/activate (100%) delete mode 100644 Modules/expat/amigaconfig.h delete mode 100644 Modules/expat/macconfig.h create mode 100644 Modules/expat/siphash.h delete mode 100644 Modules/expat/watcomconfig.h create mode 100644 PCbuild/find_msbuild.bat delete mode 100644 Tools/hg/hgtouch.py diff --git a/Doc/Makefile b/Doc/Makefile index 10c3288..04da82f 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -4,13 +4,14 @@ # # You can set these variables from the command line. -PYTHON = python +PYTHON = python3 SPHINXBUILD = sphinx-build +BLURB = $(PYTHON) -m blurb PAPER = SOURCES = DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py) -ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_paper_size=$(PAPER) \ +ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees -D latex_elements.papersize=$(PAPER) \ $(SPHINXOPTS) . build/$(BUILDER) $(SOURCES) .PHONY: help build html htmlhelp latex text changes linkcheck \ @@ -38,6 +39,20 @@ help: @echo " serve to serve the documentation on the localhost (8000)" build: + -mkdir -p build +# Look first for a Misc/NEWS file (building from a source release tarball +# or old repo) and use that, otherwise look for a Misc/NEWS.d directory +# (building from a newer repo) and use blurb to generate the NEWS file. + @if [ -f ../Misc/NEWS ] ; then \ + echo "Using existing Misc/NEWS file"; \ + cp ../Misc/NEWS build/NEWS; \ + elif [ -d ../Misc/NEWS.d ]; then \ + echo "Building NEWS from Misc/NEWS.d with blurb"; \ + $(BLURB) merge -f build/NEWS; \ + else \ + echo "Neither Misc/NEWS.d nor Misc/NEWS found; cannot build docs"; \ + exit 1; \ + fi $(SPHINXBUILD) $(ALLSPHINXOPTS) @echo @@ -107,7 +122,7 @@ clean: venv: $(PYTHON) -m venv venv - ./venv/bin/python3 -m pip install -U Sphinx + ./venv/bin/python3 -m pip install -U Sphinx blurb dist: rm -rf dist diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index c389888..6454eb5 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -291,16 +291,11 @@ an error value). is the function calling :c:func:`PyErr_WarnEx`, 2 is the function above that, and so forth. - Warning categories must be subclasses of :c:data:`Warning`; the default warning - category is :c:data:`RuntimeWarning`. The standard Python warning categories are - available as global variables whose names are ``PyExc_`` followed by the Python - exception name. These have the type :c:type:`PyObject\*`; they are all class - objects. Their names are :c:data:`PyExc_Warning`, :c:data:`PyExc_UserWarning`, - :c:data:`PyExc_UnicodeWarning`, :c:data:`PyExc_DeprecationWarning`, - :c:data:`PyExc_SyntaxWarning`, :c:data:`PyExc_RuntimeWarning`, and - :c:data:`PyExc_FutureWarning`. :c:data:`PyExc_Warning` is a subclass of - :c:data:`PyExc_Exception`; the other warning categories are subclasses of - :c:data:`PyExc_Warning`. + Warning categories must be subclasses of :c:data:`PyExc_Warning`; + :c:data:`PyExc_Warning` is a subclass of :c:data:`PyExc_Exception`; + the default warning category is :c:data:`PyExc_RuntimeWarning`. The standard + Python warning categories are available as global variables whose names are + enumerated at :ref:`standardwarningcategories`. For information about warning control, see the documentation for the :mod:`warnings` module and the :option:`-W` option in the command line @@ -735,6 +730,60 @@ All standard Python exceptions are available as global variables whose names are :c:type:`PyObject\*`; they are all class objects. For completeness, here are all the variables: +.. index:: + single: PyExc_BaseException + single: PyExc_Exception + single: PyExc_ArithmeticError + single: PyExc_AssertionError + single: PyExc_AttributeError + single: PyExc_BlockingIOError + single: PyExc_BrokenPipeError + single: PyExc_BufferError + single: PyExc_ChildProcessError + single: PyExc_ConnectionAbortedError + single: PyExc_ConnectionError + single: PyExc_ConnectionRefusedError + single: PyExc_ConnectionResetError + single: PyExc_EOFError + single: PyExc_FileExistsError + single: PyExc_FileNotFoundError + single: PyExc_FloatingPointError + single: PyExc_GeneratorExit + single: PyExc_ImportError + single: PyExc_IndentationError + single: PyExc_IndexError + single: PyExc_InterruptedError + single: PyExc_IsADirectoryError + single: PyExc_KeyError + single: PyExc_KeyboardInterrupt + single: PyExc_LookupError + single: PyExc_MemoryError + single: PyExc_NameError + single: PyExc_NotADirectoryError + single: PyExc_NotImplementedError + single: PyExc_OSError + single: PyExc_OverflowError + single: PyExc_PermissionError + single: PyExc_ProcessLookupError + single: PyExc_RecursionError + single: PyExc_ReferenceError + single: PyExc_RuntimeError + single: PyExc_StopAsyncIteration + single: PyExc_StopIteration + single: PyExc_SyntaxError + single: PyExc_SystemError + single: PyExc_SystemExit + single: PyExc_TabError + single: PyExc_TimeoutError + single: PyExc_TypeError + single: PyExc_UnboundLocalError + single: PyExc_UnicodeDecodeError + single: PyExc_UnicodeEncodeError + single: PyExc_UnicodeError + single: PyExc_UnicodeTranslateError + single: PyExc_ValueError + single: PyExc_ZeroDivisionError + +-----------------------------------------+---------------------------------+----------+ | C Name | Python Name | Notes | +=========================================+=================================+==========+ @@ -744,8 +793,6 @@ the variables: +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_ArithmeticError` | :exc:`ArithmeticError` | \(1) | +-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_LookupError` | :exc:`LookupError` | \(1) | -+-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_AssertionError` | :exc:`AssertionError` | | +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_AttributeError` | :exc:`AttributeError` | | @@ -754,26 +801,32 @@ the variables: +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_BrokenPipeError` | :exc:`BrokenPipeError` | | +-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ChildProcessError` | :exc:`ChildProcessError` | | +| :c:data:`PyExc_BufferError` | :exc:`BufferError` | | +-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ConnectionError` | :exc:`ConnectionError` | | +| :c:data:`PyExc_ChildProcessError` | :exc:`ChildProcessError` | | +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_ConnectionAbortedError` | :exc:`ConnectionAbortedError` | | +-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_ConnectionError` | :exc:`ConnectionError` | | ++-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_ConnectionRefusedError` | :exc:`ConnectionRefusedError` | | +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_ConnectionResetError` | :exc:`ConnectionResetError` | | +-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_EOFError` | :exc:`EOFError` | | ++-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_FileExistsError` | :exc:`FileExistsError` | | +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_FileNotFoundError` | :exc:`FileNotFoundError` | | +-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_EOFError` | :exc:`EOFError` | | -+-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_FloatingPointError` | :exc:`FloatingPointError` | | +-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_GeneratorExit` | :exc:`GeneratorExit` | | ++-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_ImportError` | :exc:`ImportError` | | +-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_IndentationError` | :exc:`IndentationError` | | ++-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_IndexError` | :exc:`IndexError` | | +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_InterruptedError` | :exc:`InterruptedError` | | @@ -784,6 +837,8 @@ the variables: +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_KeyboardInterrupt` | :exc:`KeyboardInterrupt` | | +-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_LookupError` | :exc:`LookupError` | \(1) | ++-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_MemoryError` | :exc:`MemoryError` | | +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_NameError` | :exc:`NameError` | | @@ -806,16 +861,32 @@ the variables: +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_RuntimeError` | :exc:`RuntimeError` | | +-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_StopAsyncIteration` | :exc:`StopAsyncIteration` | | ++-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_StopIteration` | :exc:`StopIteration` | | ++-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_SyntaxError` | :exc:`SyntaxError` | | +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_SystemError` | :exc:`SystemError` | | +-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_TimeoutError` | :exc:`TimeoutError` | | -+-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_SystemExit` | :exc:`SystemExit` | | +-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_TabError` | :exc:`TabError` | | ++-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_TimeoutError` | :exc:`TimeoutError` | | ++-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_TypeError` | :exc:`TypeError` | | +-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_UnboundLocalError` | :exc:`UnboundLocalError` | | ++-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_UnicodeDecodeError` | :exc:`UnicodeDecodeError` | | ++-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_UnicodeEncodeError` | :exc:`UnicodeEncodeError` | | ++-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_UnicodeError` | :exc:`UnicodeError` | | ++-----------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_UnicodeTranslateError` | :exc:`UnicodeTranslateError` | | ++-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_ValueError` | :exc:`ValueError` | | +-----------------------------------------+---------------------------------+----------+ | :c:data:`PyExc_ZeroDivisionError` | :exc:`ZeroDivisionError` | | @@ -832,11 +903,15 @@ the variables: and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`. .. versionadded:: 3.5 - :c:data:`PyExc_RecursionError`. - + :c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`. These are compatibility aliases to :c:data:`PyExc_OSError`: +.. index:: + single: PyExc_EnvironmentError + single: PyExc_IOError + single: PyExc_WindowsError + +-------------------------------------+----------+ | C Name | Notes | +=====================================+==========+ @@ -850,52 +925,6 @@ These are compatibility aliases to :c:data:`PyExc_OSError`: .. versionchanged:: 3.3 These aliases used to be separate exception types. - -.. index:: - single: PyExc_BaseException - single: PyExc_Exception - single: PyExc_ArithmeticError - single: PyExc_LookupError - single: PyExc_AssertionError - single: PyExc_AttributeError - single: PyExc_BlockingIOError - single: PyExc_BrokenPipeError - single: PyExc_ConnectionError - single: PyExc_ConnectionAbortedError - single: PyExc_ConnectionRefusedError - single: PyExc_ConnectionResetError - single: PyExc_EOFError - single: PyExc_FileExistsError - single: PyExc_FileNotFoundError - single: PyExc_FloatingPointError - single: PyExc_ImportError - single: PyExc_IndexError - single: PyExc_InterruptedError - single: PyExc_IsADirectoryError - single: PyExc_KeyError - single: PyExc_KeyboardInterrupt - single: PyExc_MemoryError - single: PyExc_NameError - single: PyExc_NotADirectoryError - single: PyExc_NotImplementedError - single: PyExc_OSError - single: PyExc_OverflowError - single: PyExc_PermissionError - single: PyExc_ProcessLookupError - single: PyExc_RecursionError - single: PyExc_ReferenceError - single: PyExc_RuntimeError - single: PyExc_SyntaxError - single: PyExc_SystemError - single: PyExc_SystemExit - single: PyExc_TimeoutError - single: PyExc_TypeError - single: PyExc_ValueError - single: PyExc_ZeroDivisionError - single: PyExc_EnvironmentError - single: PyExc_IOError - single: PyExc_WindowsError - Notes: (1) @@ -907,3 +936,60 @@ Notes: (3) Only defined on Windows; protect code that uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined. + +.. _standardwarningcategories: + +Standard Warning Categories +=========================== + +All standard Python warning categories are available as global variables whose +names are ``PyExc_`` followed by the Python exception name. These have the type +:c:type:`PyObject\*`; they are all class objects. For completeness, here are all +the variables: + +.. index:: + single: PyExc_Warning + single: PyExc_BytesWarning + single: PyExc_DeprecationWarning + single: PyExc_FutureWarning + single: PyExc_ImportWarning + single: PyExc_PendingDeprecationWarning + single: PyExc_ResourceWarning + single: PyExc_RuntimeWarning + single: PyExc_SyntaxWarning + single: PyExc_UnicodeWarning + single: PyExc_UserWarning + ++------------------------------------------+---------------------------------+----------+ +| C Name | Python Name | Notes | ++==========================================+=================================+==========+ +| :c:data:`PyExc_Warning` | :exc:`Warning` | \(1) | ++------------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_BytesWarning` | :exc:`BytesWarning` | | ++------------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_DeprecationWarning` | :exc:`DeprecationWarning` | | ++------------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_FutureWarning` | :exc:`FutureWarning` | | ++------------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_ImportWarning` | :exc:`ImportWarning` | | ++------------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_PendingDeprecationWarning`| :exc:`PendingDeprecationWarning`| | ++------------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_ResourceWarning` | :exc:`ResourceWarning` | | ++------------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_RuntimeWarning` | :exc:`RuntimeWarning` | | ++------------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_SyntaxWarning` | :exc:`SyntaxWarning` | | ++------------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_UnicodeWarning` | :exc:`UnicodeWarning` | | ++------------------------------------------+---------------------------------+----------+ +| :c:data:`PyExc_UserWarning` | :exc:`UserWarning` | | ++------------------------------------------+---------------------------------+----------+ + +.. versionadded:: 3.2 + :c:data:`PyExc_ResourceWarning`. + +Notes: + +(1) + This is a base class for other standard warning categories. diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index 68f6a8e..78e555c 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -85,13 +85,12 @@ All integers are implemented as "long" integer objects of arbitrary size. Return a new :c:type:`PyLongObject` based on the string value in *str*, which is interpreted according to the radix in *base*. If *pend* is non-*NULL*, *\*pend* will point to the first character in *str* which follows the - representation of the number. If *base* is ``0``, the radix will be - determined based on the leading characters of *str*: if *str* starts with - ``'0x'`` or ``'0X'``, radix 16 will be used; if *str* starts with ``'0o'`` or - ``'0O'``, radix 8 will be used; if *str* starts with ``'0b'`` or ``'0B'``, - radix 2 will be used; otherwise radix 10 will be used. If *base* is not - ``0``, it must be between ``2`` and ``36``, inclusive. Leading spaces are - ignored. If there are no digits, :exc:`ValueError` will be raised. + representation of the number. If *base* is ``0``, *str* is interpreted using + the :ref:`integers` definition; in this case, leading zeros in a + non-zero decimal number raises a :exc:`ValueError`. If *base* is not ``0``, + it must be between ``2`` and ``36``, inclusive. Leading spaces and single + underscores after a base specifier and between digits are ignored. If there + are no digits, :exc:`ValueError` will be raised. .. c:function:: PyObject* PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base) diff --git a/Doc/c-api/marshal.rst b/Doc/c-api/marshal.rst index a6d0f46..c6d1d02 100644 --- a/Doc/c-api/marshal.rst +++ b/Doc/c-api/marshal.rst @@ -34,7 +34,7 @@ unmarshalling. Version 2 uses a binary format for floating point numbers. .. c:function:: PyObject* PyMarshal_WriteObjectToString(PyObject *value, int version) - Return a string object containing the marshalled representation of *value*. + Return a bytes object containing the marshalled representation of *value*. *version* indicates the file format. @@ -88,10 +88,10 @@ written using these routines? :exc:`TypeError`) and returns *NULL*. -.. c:function:: PyObject* PyMarshal_ReadObjectFromString(const char *string, Py_ssize_t len) +.. c:function:: PyObject* PyMarshal_ReadObjectFromString(const char *data, Py_ssize_t len) - Return a Python object from the data stream in a character buffer - containing *len* bytes pointed to by *string*. + Return a Python object from the data stream in a byte buffer + containing *len* bytes pointed to by *data*. On error, sets the appropriate exception (:exc:`EOFError` or :exc:`TypeError`) and returns *NULL*. diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 7724350..d3125b8 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -50,7 +50,7 @@ Module Objects .. c:function:: PyObject* PyModule_New(const char *name) - Similar to :c:func:`PyImport_NewObject`, but the name is a UTF-8 encoded + Similar to :c:func:`PyModule_NewObject`, but the name is a UTF-8 encoded string instead of a Unicode object. diff --git a/Doc/c-api/slice.rst b/Doc/c-api/slice.rst index a825164..8b695e0 100644 --- a/Doc/c-api/slice.rst +++ b/Doc/c-api/slice.rst @@ -56,3 +56,14 @@ Slice Objects .. versionchanged:: 3.2 The parameter type for the *slice* parameter was ``PySliceObject*`` before. + + +Ellipsis Object +--------------- + + +.. c:var:: PyObject *Py_Ellipsis + + The Python ``Ellipsis`` object. This object has no methods. It needs to be + treated just like any other object with respect to reference counts. Like + :c:data:`Py_None` it is a singleton object. diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index 3e8a90c..c080f31 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -168,7 +168,7 @@ can be combined with a binding flag. Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. The function expects three parameters: *self*, *args*, and a dictionary of - all the keyword arguments. The flag is typically combined with + all the keyword arguments. The flag must be combined with :const:`METH_VARARGS`, and the parameters are typically processed using :c:func:`PyArg_ParseTupleAndKeywords`. @@ -241,7 +241,7 @@ definition with the same method name. +==================+=============+===============================+ | :attr:`name` | char \* | name of the member | +------------------+-------------+-------------------------------+ - | :attr:`type` | int | the type of the member in the | + | :attr:`!type` | int | the type of the member in the | | | | C struct | +------------------+-------------+-------------------------------+ | :attr:`offset` | Py_ssize_t | the offset in bytes that the | @@ -256,7 +256,7 @@ definition with the same method name. | | | docstring | +------------------+-------------+-------------------------------+ - :attr:`type` can be one of many ``T_`` macros corresponding to various C + :attr:`!type` can be one of many ``T_`` macros corresponding to various C types. When the member is accessed in Python, it will be converted to the equivalent Python type. diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 256fef3..54d0373 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -1388,77 +1388,78 @@ Character Map Codecs This codec is special in that it can be used to implement many different codecs (and this is in fact what was done to obtain most of the standard codecs included in the :mod:`encodings` package). The codec uses mapping to encode and -decode characters. - -Decoding mappings must map single string characters to single Unicode -characters, integers (which are then interpreted as Unicode ordinals) or ``None`` -(meaning "undefined mapping" and causing an error). - -Encoding mappings must map single Unicode characters to single string -characters, integers (which are then interpreted as Latin-1 ordinals) or ``None`` -(meaning "undefined mapping" and causing an error). - -The mapping objects provided must only support the __getitem__ mapping -interface. - -If a character lookup fails with a LookupError, the character is copied as-is -meaning that its ordinal value will be interpreted as Unicode or Latin-1 ordinal -resp. Because of this, mappings only need to contain those mappings which map -characters to different code points. +decode characters. The mapping objects provided must support the +:meth:`__getitem__` mapping interface; dictionaries and sequences work well. These are the mapping codec APIs: -.. c:function:: PyObject* PyUnicode_DecodeCharmap(const char *s, Py_ssize_t size, \ +.. c:function:: PyObject* PyUnicode_DecodeCharmap(const char *data, Py_ssize_t size, \ PyObject *mapping, const char *errors) - Create a Unicode object by decoding *size* bytes of the encoded string *s* using - the given *mapping* object. Return *NULL* if an exception was raised by the - codec. If *mapping* is *NULL* latin-1 decoding will be done. Else it can be a - dictionary mapping byte or a unicode string, which is treated as a lookup table. - Byte values greater that the length of the string and U+FFFE "characters" are - treated as "undefined mapping". + Create a Unicode object by decoding *size* bytes of the encoded string *s* + using the given *mapping* object. Return *NULL* if an exception was raised + by the codec. + + If *mapping* is *NULL*, Latin-1 decoding will be applied. Else + *mapping* must map bytes ordinals (integers in the range from 0 to 255) + to Unicode strings, integers (which are then interpreted as Unicode + ordinals) or ``None``. Unmapped data bytes -- ones which cause a + :exc:`LookupError`, as well as ones which get mapped to ``None``, + ``0xFFFE`` or ``'\ufffe'``, are treated as undefined mappings and cause + an error. .. c:function:: PyObject* PyUnicode_AsCharmapString(PyObject *unicode, PyObject *mapping) - Encode a Unicode object using the given *mapping* object and return the result - as Python string object. Error handling is "strict". Return *NULL* if an + Encode a Unicode object using the given *mapping* object and return the + result as a bytes object. Error handling is "strict". Return *NULL* if an exception was raised by the codec. -The following codec API is special in that maps Unicode to Unicode. - + The *mapping* object must map Unicode ordinal integers to bytes objects, + integers in the range from 0 to 255 or ``None``. Unmapped character + ordinals (ones which cause a :exc:`LookupError`) as well as mapped to + ``None`` are treated as "undefined mapping" and cause an error. -.. c:function:: PyObject* PyUnicode_TranslateCharmap(const Py_UNICODE *s, Py_ssize_t size, \ - PyObject *table, const char *errors) - - Translate a :c:type:`Py_UNICODE` buffer of the given *size* by applying a - character mapping *table* to it and return the resulting Unicode object. Return - *NULL* when an exception was raised by the codec. - The *mapping* table must map Unicode ordinal integers to Unicode ordinal - integers or ``None`` (causing deletion of the character). +.. c:function:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, \ + PyObject *mapping, const char *errors) - Mapping tables need only provide the :meth:`__getitem__` interface; dictionaries - and sequences work well. Unmapped character ordinals (ones which cause a - :exc:`LookupError`) are left untouched and are copied as-is. + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using the given + *mapping* object and return the result as a bytes object. Return *NULL* if + an exception was raised by the codec. .. deprecated-removed:: 3.3 4.0 Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using - :c:func:`PyUnicode_Translate`. or :ref:`generic codec based API - ` + :c:func:`PyUnicode_AsCharmapString` or + :c:func:`PyUnicode_AsEncodedString`. -.. c:function:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, \ +The following codec API is special in that maps Unicode to Unicode. + +.. c:function:: PyObject* PyUnicode_Translate(PyObject *unicode, \ PyObject *mapping, const char *errors) - Encode the :c:type:`Py_UNICODE` buffer of the given *size* using the given - *mapping* object and return a Python string object. Return *NULL* if an - exception was raised by the codec. + Translate a Unicode object using the given *mapping* object and return the + resulting Unicode object. Return *NULL* if an exception was raised by the + codec. + + The *mapping* object must map Unicode ordinal integers to Unicode strings, + integers (which are then interpreted as Unicode ordinals) or ``None`` + (causing deletion of the character). Unmapped character ordinals (ones + which cause a :exc:`LookupError`) are left untouched and are copied as-is. + + +.. c:function:: PyObject* PyUnicode_TranslateCharmap(const Py_UNICODE *s, Py_ssize_t size, \ + PyObject *mapping, const char *errors) + + Translate a :c:type:`Py_UNICODE` buffer of the given *size* by applying a + character *mapping* table to it and return the resulting Unicode object. + Return *NULL* when an exception was raised by the codec. .. deprecated-removed:: 3.3 4.0 Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using - :c:func:`PyUnicode_AsCharmapString` or - :c:func:`PyUnicode_AsEncodedString`. + :c:func:`PyUnicode_Translate`. or :ref:`generic codec based API + ` MBCS codecs for Windows diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst index d0ceb05..6ab5942 100644 --- a/Doc/c-api/veryhigh.rst +++ b/Doc/c-api/veryhigh.rst @@ -300,12 +300,13 @@ the same library that the Python runtime is using. set to *NULL*. -.. c:function:: PyObject* PyEval_EvalCodeEx(PyObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *closure) +.. c:function:: PyObject* PyEval_EvalCodeEx(PyObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *kwdefs, PyObject *closure) Evaluate a precompiled code object, given a particular environment for its evaluation. This environment consists of a dictionary of global variables, a mapping object of local variables, arrays of arguments, keywords and - defaults, and a closure tuple of cells. + defaults, a dictionary of default values for :ref:`keyword-only\ + ` arguments and a closure tuple of cells. .. c:type:: PyFrameObject diff --git a/Doc/conf.py b/Doc/conf.py index b1bb620..b3f26d5 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -88,11 +88,24 @@ html_split_index = True # Options for LaTeX output # ------------------------ +# Get LaTeX to handle Unicode correctly +latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''} + +# Additional stuff for the LaTeX preamble. +latex_elements['preamble'] = r''' +\authoraddress{ + \strong{Python Software Foundation}\\ + Email: \email{docs@python.org} +} +\let\Verbatim=\OriginalVerbatim +\let\endVerbatim=\endOriginalVerbatim +''' + # The paper size ('letter' or 'a4'). -latex_paper_size = 'a4' +latex_elements['papersize'] = 'a4' # The font size ('10pt', '11pt' or '12pt'). -latex_font_size = '10pt' +latex_elements['font_size'] = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). @@ -125,22 +138,9 @@ latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', for fn in os.listdir('howto') if fn.endswith('.rst') and fn != 'index.rst') -# Additional stuff for the LaTeX preamble. -latex_preamble = r''' -\authoraddress{ - \strong{Python Software Foundation}\\ - Email: \email{docs@python.org} -} -\let\Verbatim=\OriginalVerbatim -\let\endVerbatim=\endOriginalVerbatim -''' - # Documents to append as an appendix to all manuals. latex_appendices = ['glossary', 'about', 'license', 'copyright'] -# Get LaTeX to handle Unicode correctly -latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''} - # Options for Epub output # ----------------------- diff --git a/Doc/copyright.rst b/Doc/copyright.rst index 22d7705..2b5400c 100644 --- a/Doc/copyright.rst +++ b/Doc/copyright.rst @@ -4,7 +4,7 @@ Copyright Python and this documentation is: -Copyright © 2001-2016 Python Software Foundation. All rights reserved. +Copyright © 2001-2017 Python Software Foundation. All rights reserved. Copyright © 2000 BeOpen.com. All rights reserved. diff --git a/Doc/distutils/examples.rst b/Doc/distutils/examples.rst index 1f5be9c..4e2761d 100644 --- a/Doc/distutils/examples.rst +++ b/Doc/distutils/examples.rst @@ -321,7 +321,7 @@ You can read back this static file, by using the >>> metadata.description 'Easily download, build, install, upgrade, and uninstall Python packages' -Notice that the class can also be instanciated with a metadata file path to +Notice that the class can also be instantiated with a metadata file path to loads its values:: >>> pkg_info_path = 'distribute-0.6.8-py2.7.egg-info' diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index b8ce437..003b4e5 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -124,7 +124,7 @@ our objects and in some error messages, for example:: >>> "" + noddy.new_noddy() Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in TypeError: cannot add type "noddy.Noddy" to string Note that the name is a dotted name that includes both the module name and the diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst index f1e33af..8f6a907 100644 --- a/Doc/faq/general.rst +++ b/Doc/faq/general.rst @@ -159,7 +159,7 @@ How do I obtain a copy of the Python source? The latest Python source distribution is always available from python.org, at https://www.python.org/downloads/. The latest development sources can be obtained -via anonymous Mercurial access at https://hg.python.org/cpython. +at https://github.com/python/cpython/. The source distribution is a gzipped tar file containing the complete C source, Sphinx-formatted documentation, Python library modules, example programs, and @@ -222,8 +222,8 @@ releases are announced on the comp.lang.python and comp.lang.python.announce newsgroups and on the Python home page at https://www.python.org/; an RSS feed of news is available. -You can also access the development version of Python through Mercurial. See -https://docs.python.org/devguide/faq.html for details. +You can also access the development version of Python through Git. See +`The Python Developer's Guide `_ for details. How do I submit bug reports and patches for Python? diff --git a/Doc/faq/gui.rst b/Doc/faq/gui.rst index 477d8c6..38e1796 100644 --- a/Doc/faq/gui.rst +++ b/Doc/faq/gui.rst @@ -94,15 +94,6 @@ Python bindings for `the FLTK toolkit `_, a simple yet powerful and mature cross-platform windowing system, are available from `the PyFLTK project `_. - -FOX ----- - -A wrapper for `the FOX toolkit `_ called `FXpy -`_ is available. FOX supports both Unix variants -and Windows. - - OpenGL ------ diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst index d725343..6ac83e4 100644 --- a/Doc/faq/windows.rst +++ b/Doc/faq/windows.rst @@ -300,9 +300,10 @@ this respect, and is easily configured to use spaces: Take :menuselection:`Tools --> Options --> Tabs`, and for file type "Default" set "Tab size" and "Indent size" to 4, and select the "Insert spaces" radio button. -If you suspect mixed tabs and spaces are causing problems in leading whitespace, -run Python with the :option:`-t` switch or run ``Tools/Scripts/tabnanny.py`` to -check a directory tree in batch mode. +Python raises :exc:`IndentationError` or :exc:`TabError` if mixed tabs +and spaces are causing problems in leading whitespace. +You may also run the :mod:`tabnanny` module to check a directory tree +in batch mode. How do I check for a keypress without blocking? diff --git a/Doc/glossary.rst b/Doc/glossary.rst index 45b794f..f474a6d 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -103,6 +103,10 @@ Glossary binary file A :term:`file object` able to read and write :term:`bytes-like objects `. + Examples of binary files are files opened in binary mode (``'rb'``, + ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer`, + :data:`sys.stdout.buffer`, and instances of :class:`io.BytesIO` and + :class:`gzip.GzipFile`. .. seealso:: A :term:`text file` reads and writes :class:`str` objects. @@ -127,7 +131,7 @@ Glossary bytecode Python source code is compiled into bytecode, the internal representation of a Python program in the CPython interpreter. The bytecode is also - cached in ``.pyc`` and ``.pyo`` files so that executing the same file is + cached in ``.pyc`` files so that executing the same file is faster the second time (recompilation from source to bytecode can be avoided). This "intermediate language" is said to run on a :term:`virtual machine` that executes the machine code corresponding to @@ -430,9 +434,9 @@ Glossary Hashability makes an object usable as a dictionary key and a set member, because these data structures use the hash value internally. - All of Python's immutable built-in objects are hashable, while no mutable - containers (such as lists or dictionaries) are. Objects which are - instances of user-defined classes are hashable by default; they all + All of Python's immutable built-in objects are hashable; mutable + containers (such as lists or dictionaries) are not. Objects which are + instances of user-defined classes are hashable by default. They all compare unequal (except with themselves), and their hash value is derived from their :func:`id`. @@ -926,6 +930,9 @@ Glossary A :term:`file object` able to read and write :class:`str` objects. Often, a text file actually accesses a byte-oriented datastream and handles the :term:`text encoding` automatically. + Examples of text files are files opened in text mode (``'r'`` or ``'w'``), + :data:`sys.stdin`, :data:`sys.stdout`, and instances of + :class:`io.StringIO`. .. seealso:: A :term:`binary file` reads and write :class:`bytes` objects. diff --git a/Doc/howto/argparse.rst b/Doc/howto/argparse.rst index 3b79b92..fac1a35 100644 --- a/Doc/howto/argparse.rst +++ b/Doc/howto/argparse.rst @@ -221,7 +221,7 @@ before proceeding. Introducing Optional arguments ============================== -So far we, have been playing with positional arguments. Let us +So far we have been playing with positional arguments. Let us have a look on how to add optional ones:: import argparse diff --git a/Doc/howto/clinic.rst b/Doc/howto/clinic.rst index 491c5a2..8b2fc74 100644 --- a/Doc/howto/clinic.rst +++ b/Doc/howto/clinic.rst @@ -1407,8 +1407,8 @@ Let's start with defining some terminology: ``two-pass`` A buffer like ``buffer``. However, a two-pass buffer can only - be written once, and it prints out all text sent to it during - all of processing, even from Clinic blocks *after* the + be dumped once, and it prints out all text sent to it during + all processing, even from Clinic blocks *after* the dumping point. ``suppress`` The text is suppressed—thrown away. @@ -1471,7 +1471,7 @@ preset configurations, as follows: The default filename is ``"{dirname}/clinic/{basename}.h"``. ``buffer`` - Save up all most of the output from Clinic, to be written into + Save up most of the output from Clinic, to be written into your file near the end. For Python files implementing modules or builtin types, it's recommended that you dump the buffer just above the static structures for your module or diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst index c2bf473..b349375 100644 --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -252,10 +252,10 @@ to wrap access to the value attribute in a property data descriptor:: class Cell(object): . . . - def getvalue(self, obj): - "Recalculate cell before returning value" + def getvalue(self): + "Recalculate the cell before returning value" self.recalc() - return obj._value + return self._value value = property(getvalue) @@ -282,7 +282,7 @@ this:: . . . def __get__(self, obj, objtype=None): "Simulate func_descr_get() in Objects/funcobject.c" - return types.MethodType(self, obj, objtype) + return types.MethodType(self, obj) Running the interpreter shows how the function descriptor works in practice:: diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst index 8ae9679..4060181 100644 --- a/Doc/howto/functional.rst +++ b/Doc/howto/functional.rst @@ -210,7 +210,7 @@ You can experiment with the iteration interface manually: 3 >>> next(it) Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in StopIteration >>> @@ -474,7 +474,7 @@ Here's a sample usage of the ``generate_ints()`` generator: 2 >>> next(gen) Traceback (most recent call last): - File "stdin", line 1, in ? + File "stdin", line 1, in File "stdin", line 2, in generate_ints StopIteration @@ -577,7 +577,7 @@ And here's an example of changing the counter: 9 >>> next(it) #doctest: +SKIP Traceback (most recent call last): - File "t.py", line 15, in ? + File "t.py", line 15, in it.next() StopIteration @@ -653,8 +653,9 @@ This can also be written as a list comprehension: [0, 2, 4, 6, 8] -:func:`enumerate(iter) ` counts off the elements in the iterable, -returning 2-tuples containing the count and each element. :: +:func:`enumerate(iter, start=0) ` counts off the elements in the +iterable returning 2-tuples containing the count (from *start*) and +each element. :: >>> for item in enumerate(['subject', 'verb', 'object']): ... print(item) @@ -747,14 +748,16 @@ The module's functions fall into a few broad classes: Creating new iterators ---------------------- -:func:`itertools.count(n) ` returns an infinite stream of -integers, increasing by 1 each time. You can optionally supply the starting -number, which defaults to 0:: +:func:`itertools.count(start, step) ` returns an infinite +stream of evenly spaced values. You can optionally supply the starting number, +which defaults to 0, and the interval between numbers, which defaults to 1:: itertools.count() => 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ... itertools.count(10) => 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ... + itertools.count(10, 5) => + 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, ... :func:`itertools.cycle(iter) ` saves a copy of the contents of a provided iterable and returns a new iterator that returns its elements from @@ -1060,10 +1063,10 @@ write the obvious :keyword:`for` loop:: for i in [1,2,3]: product *= i -A related function is `itertools.accumulate(iterable, func=operator.add) `. It performs the same calculation, but instead of +returning only the final result, :func:`accumulate` returns an iterator that +also yields each partial result:: itertools.accumulate([1,2,3,4,5]) => 1, 3, 6, 10, 15 @@ -1235,6 +1238,8 @@ Python documentation Documentation for the :mod:`itertools` module. +Documentation for the :mod:`functools` module. + Documentation for the :mod:`operator` module. :pep:`289`: "Generator Expressions" diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst index f962cd8..6498ea5 100644 --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1683,7 +1683,7 @@ Implementing structured logging ------------------------------- Although most logging messages are intended for reading by humans, and thus not -readily machine-parseable, there might be cirumstances where you want to output +readily machine-parseable, there might be circumstances where you want to output messages in a structured format which *is* capable of being parsed by a program (without needing complex regular expressions to parse the log message). This is straightforward to achieve using the logging package. There are a number of @@ -2165,8 +2165,8 @@ Speaking logging messages ------------------------- There might be situations when it is desirable to have logging messages rendered -in an audible rather than a visible format. This is easy to do if you have text- -to-speech (TTS) functionality available in your system, even if it doesn't have +in an audible rather than a visible format. This is easy to do if you have +text-to-speech (TTS) functionality available in your system, even if it doesn't have a Python binding. Most TTS systems have a command line program you can run, and this can be invoked from a handler using :mod:`subprocess`. It's assumed here that TTS command line programs won't expect to interact with users or take a diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst index a48ae1f..9649b9c 100644 --- a/Doc/howto/unicode.rst +++ b/Doc/howto/unicode.rst @@ -43,9 +43,9 @@ hold values ranging from 0 to 255. ASCII codes only went up to 127, so some machines assigned values between 128 and 255 to accented characters. Different machines had different codes, however, which led to problems exchanging files. Eventually various commonly used sets of values for the 128--255 range emerged. -Some were true standards, defined by the International Standards Organization, -and some were *de facto* conventions that were invented by one company or -another and managed to catch on. +Some were true standards, defined by the International Organization for +Standardization, and some were *de facto* conventions that were invented by one +company or another and managed to catch on. 255 characters aren't very many. For example, you can't fit both the accented characters used in Western Europe and the Cyrillic alphabet used for Russian diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst index 18b5c65..8d383e0 100644 --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -34,8 +34,8 @@ handling common situations - like basic authentication, cookies, proxies and so on. These are provided by objects called handlers and openers. urllib.request supports fetching URLs for many "URL schemes" (identified by the string -before the ":" in URL - for example "ftp" is the URL scheme of -"ftp://python.org/") using their associated network protocols (e.g. FTP, HTTP). +before the ``":"`` in URL - for example ``"ftp"`` is the URL scheme of +``"ftp://python.org/"``) using their associated network protocols (e.g. FTP, HTTP). This tutorial focuses on the most common case, HTTP. For straightforward situations *urlopen* is very easy to use. But as soon as you @@ -511,10 +511,10 @@ than the URL you pass to .add_password() will also match. :: ``top_level_url`` is in fact *either* a full URL (including the 'http:' scheme component and the hostname and optionally the port number) -e.g. "http://example.com/" *or* an "authority" (i.e. the hostname, -optionally including the port number) e.g. "example.com" or "example.com:8080" +e.g. ``"http://example.com/"`` *or* an "authority" (i.e. the hostname, +optionally including the port number) e.g. ``"example.com"`` or ``"example.com:8080"`` (the latter example includes a port number). The authority, if present, must -NOT contain the "userinfo" component - for example "joe:password@example.com" is +NOT contain the "userinfo" component - for example ``"joe:password@example.com"`` is not correct. diff --git a/Doc/includes/setup.py b/Doc/includes/setup.py index b853d23..a38a39d 100644 --- a/Doc/includes/setup.py +++ b/Doc/includes/setup.py @@ -5,4 +5,5 @@ setup(name="noddy", version="1.0", Extension("noddy2", ["noddy2.c"]), Extension("noddy3", ["noddy3.c"]), Extension("noddy4", ["noddy4.c"]), + Extension("shoddy", ["shoddy.c"]), ]) diff --git a/Doc/includes/shoddy.c b/Doc/includes/shoddy.c index 07a2721..0c6d412 100644 --- a/Doc/includes/shoddy.c +++ b/Doc/includes/shoddy.c @@ -31,7 +31,7 @@ Shoddy_init(Shoddy *self, PyObject *args, PyObject *kwds) static PyTypeObject ShoddyType = { - PyObject_HEAD_INIT(NULL) + PyVarObject_HEAD_INIT(NULL, 0) "shoddy.Shoddy", /* tp_name */ sizeof(Shoddy), /* tp_basicsize */ 0, /* tp_itemsize */ diff --git a/Doc/library/2to3.rst b/Doc/library/2to3.rst index ace1bfa..4c9a528 100644 --- a/Doc/library/2to3.rst +++ b/Doc/library/2to3.rst @@ -199,13 +199,6 @@ and off individually. They are described here in more detail. because the :class:`memoryview` API is similar but not exactly the same as that of :class:`buffer`. -.. 2to3fixer:: callable - - Converts ``callable(x)`` to ``isinstance(x, collections.Callable)``, adding - an import to :mod:`collections` if needed. Note ``callable(x)`` has returned - in Python 3.2, so if you do not intend to support Python 3.1, you can disable - this fixer. - .. 2to3fixer:: dict Fixes dictionary iteration methods. :meth:`dict.iteritems` is converted to diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index c6b2bf6..4530304 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -174,7 +174,7 @@ ArgumentParser objects * conflict_handler_ - The strategy for resolving conflicting optionals (usually unnecessary) - * add_help_ - Add a -h/--help option to the parser (default: ``True``) + * add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``) * allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is unambiguous. (default: ``True``) @@ -211,7 +211,7 @@ The help for this program will display ``myprogram.py`` as the program name -h, --help show this help message and exit --foo FOO foo help $ cd .. - $ python subdir\myprogram.py --help + $ python subdir/myprogram.py --help usage: myprogram.py [-h] [--foo FOO] optional arguments: diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst index c0342f7..435eb3b 100644 --- a/Doc/library/asyncio-protocol.rst +++ b/Doc/library/asyncio-protocol.rst @@ -33,7 +33,7 @@ BaseTransport Base class for transports. - .. method:: close(self) + .. method:: close() Close the transport. If the transport has a buffer for outgoing data, buffered data will be flushed asynchronously. No more data @@ -41,7 +41,7 @@ BaseTransport protocol's :meth:`connection_lost` method will be called with :const:`None` as its argument. - .. method:: is_closing(self) + .. method:: is_closing() Return ``True`` if the transport is closing or is closed. @@ -160,11 +160,17 @@ WriteTransport Set the *high*- and *low*-water limits for write flow control. - These two values control when call the protocol's + These two values (measured in number of + bytes) control when the protocol's :meth:`pause_writing` and :meth:`resume_writing` methods are called. If specified, the low-water limit must be less than or equal to the high-water limit. Neither *high* nor *low* can be negative. + :meth:`pause_writing` is called when the buffer size becomes greater + than or equal to the *high* value. If writing has been paused, + :meth:`resume_writing` is called when the buffer size becomes less + than or equal to the *low* value. + The defaults are implementation-specific. If only the high-water limit is given, the low-water limit defaults to an implementation-specific value less than or equal to the @@ -248,7 +254,7 @@ BaseSubprocessTransport if it hasn't returned, similarly to the :attr:`subprocess.Popen.returncode` attribute. - .. method:: kill(self) + .. method:: kill() Kill the subprocess, as in :meth:`subprocess.Popen.kill`. @@ -381,7 +387,7 @@ The following callbacks are called on :class:`Protocol` instances: .. method:: Protocol.eof_received() - Calls when the other end signals it won't send any more data + Called when the other end signals it won't send any more data (for example by calling :meth:`write_eof`, if the other end also uses asyncio). diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst index dc93a74..16ba9a3 100644 --- a/Doc/library/asyncio-subprocess.rst +++ b/Doc/library/asyncio-subprocess.rst @@ -80,7 +80,7 @@ Run subprocesses asynchronously using the :mod:`subprocess` module. however, where :class:`~subprocess.Popen` takes a single argument which is list of strings, :func:`subprocess_exec` takes multiple string arguments. - The *protocol_factory* must instanciate a subclass of the + The *protocol_factory* must instantiate a subclass of the :class:`asyncio.SubprocessProtocol` class. Other parameters: @@ -123,7 +123,7 @@ Run subprocesses asynchronously using the :mod:`subprocess` module. using the platform's "shell" syntax. This is similar to the standard library :class:`subprocess.Popen` class called with ``shell=True``. - The *protocol_factory* must instanciate a subclass of the + The *protocol_factory* must instantiate a subclass of the :class:`asyncio.SubprocessProtocol` class. See :meth:`~AbstractEventLoop.subprocess_exec` for more details about diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 9bff1c4..804f192 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -136,17 +136,6 @@ using the :meth:`sleep` function:: loop.run_until_complete(display_date(loop)) loop.close() -The same coroutine implemented using a generator:: - - @asyncio.coroutine - def display_date(loop): - end_time = loop.time() + 5.0 - while True: - print(datetime.datetime.now()) - if (loop.time() + 1.0) >= end_time: - break - yield from asyncio.sleep(1) - .. seealso:: The :ref:`display the current date with call_later() @@ -309,9 +298,8 @@ Example combining a :class:`Future` and a :ref:`coroutine function import asyncio - @asyncio.coroutine - def slow_operation(future): - yield from asyncio.sleep(1) + async def slow_operation(future): + await asyncio.sleep(1) future.set_result('Future is done!') loop = asyncio.get_event_loop() @@ -341,9 +329,8 @@ flow:: import asyncio - @asyncio.coroutine - def slow_operation(future): - yield from asyncio.sleep(1) + async def slow_operation(future): + await asyncio.sleep(1) future.set_result('Future is done!') def got_result(future): @@ -472,21 +459,20 @@ Example executing 3 tasks (A, B, C) in parallel:: import asyncio - @asyncio.coroutine - def factorial(name, number): + async def factorial(name, number): f = 1 for i in range(2, number+1): print("Task %s: Compute factorial(%s)..." % (name, i)) - yield from asyncio.sleep(1) + await asyncio.sleep(1) f *= i print("Task %s: factorial(%s) = %s" % (name, number, f)) loop = asyncio.get_event_loop() - tasks = [ - asyncio.ensure_future(factorial("A", 2)), - asyncio.ensure_future(factorial("B", 3)), - asyncio.ensure_future(factorial("C", 4))] - loop.run_until_complete(asyncio.gather(*tasks)) + loop.run_until_complete(asyncio.gather( + factorial("A", 2), + factorial("B", 3), + factorial("C", 4), + )) loop.close() Output:: @@ -554,6 +540,11 @@ Task functions .. deprecated:: 3.4.4 +.. function:: wrap_future(future, \*, loop=None) + + Wrap a :class:`concurrent.futures.Future` object in a :class:`Future` + object. + .. function:: gather(\*coros_or_futures, loop=None, return_exceptions=False) Return a future aggregating results from the given coroutine objects or diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst index 080d9d7..ceecf17 100644 --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -237,14 +237,18 @@ The legacy interface: .. function:: decodebytes(s) - decodestring(s) Decode the :term:`bytes-like object` *s*, which must contain one or more lines of base64 encoded data, and return the decoded :class:`bytes`. - ``decodestring`` is a deprecated alias. .. versionadded:: 3.1 +.. function:: decodestring(s) + + Deprecated alias of :func:`decodebytes`. + + .. deprecated:: 3.1 + .. function:: encode(input, output) @@ -257,14 +261,19 @@ The legacy interface: .. function:: encodebytes(s) - encodestring(s) Encode the :term:`bytes-like object` *s*, which can contain arbitrary binary data, and return :class:`bytes` containing the base64-encoded data, with newlines (``b'\n'``) inserted after every 76 bytes of output, and ensuring that there is a trailing newline, as per :rfc:`2045` (MIME). - ``encodestring`` is a deprecated alias. + .. versionadded:: 3.1 + +.. function:: encodestring(s) + + Deprecated alias of :func:`encodebytes`. + + .. deprecated:: 3.1 An example usage of the module: diff --git a/Doc/library/binhex.rst b/Doc/library/binhex.rst index 359ab23..2966e0d 100644 --- a/Doc/library/binhex.rst +++ b/Doc/library/binhex.rst @@ -55,5 +55,3 @@ the source for details. If you code or decode textfiles on non-Macintosh platforms they will still use the old Macintosh newline convention (carriage-return as end of line). -As of this writing, :func:`hexbin` appears to not work in all cases. - diff --git a/Doc/library/cmd.rst b/Doc/library/cmd.rst index f40cfdf..3b4a8ff 100644 --- a/Doc/library/cmd.rst +++ b/Doc/library/cmd.rst @@ -266,10 +266,10 @@ immediate playback:: 'Draw circle with given radius an options extent and steps: CIRCLE 50' circle(*parse(arg)) def do_position(self, arg): - 'Print the current turle position: POSITION' + 'Print the current turtle position: POSITION' print('Current position is %d %d\n' % position()) def do_heading(self, arg): - 'Print the current turle heading in degrees: HEADING' + 'Print the current turtle heading in degrees: HEADING' print('Current heading is %d\n' % (heading(),)) def do_color(self, arg): 'Set the color: COLOR BLUE' diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index d0aa62e..674cb20 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -855,7 +855,7 @@ field names, the method and attribute names start with an underscore. .. versionchanged:: 3.1 Returns an :class:`OrderedDict` instead of a regular :class:`dict`. -.. method:: somenamedtuple._replace(kwargs) +.. method:: somenamedtuple._replace(**kwargs) Return a new instance of the named tuple replacing specified fields with new values:: diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst index 8d141a2..6f1c55e 100644 --- a/Doc/library/configparser.rst +++ b/Doc/library/configparser.rst @@ -34,8 +34,8 @@ can be customized by end users easily. .. seealso:: Module :mod:`shlex` - Support for a creating Unix shell-like mini-languages which can be used - as an alternate format for application configuration files. + Support for creating Unix shell-like mini-languages which can be used as + an alternate format for application configuration files. Module :mod:`json` The json module implements a subset of JavaScript syntax which can also @@ -1161,20 +1161,20 @@ ConfigParser Objects Use :meth:`read_file` instead. .. versionchanged:: 3.2 - :meth:`readfp` now iterates on *f* instead of calling ``f.readline()``. + :meth:`readfp` now iterates on *fp* instead of calling ``fp.readline()``. For existing code calling :meth:`readfp` with arguments which don't support iteration, the following generator may be used as a wrapper around the file-like object:: - def readline_generator(f): - line = f.readline() + def readline_generator(fp): + line = fp.readline() while line: yield line - line = f.readline() + line = fp.readline() - Instead of ``parser.readfp(f)`` use - ``parser.read_file(readline_generator(f))``. + Instead of ``parser.readfp(fp)`` use + ``parser.read_file(readline_generator(fp))``. .. data:: MAX_INTERPOLATION_DEPTH diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst index d0b861d..2041d91 100644 --- a/Doc/library/copy.rst +++ b/Doc/library/copy.rst @@ -47,8 +47,8 @@ copy operations: * Recursive objects (compound objects that, directly or indirectly, contain a reference to themselves) may cause a recursive loop. -* Because deep copy copies *everything* it may copy too much, e.g., - even administrative data structures that should be shared even between copies. +* Because deep copy copies everything it may copy too much, such as data + which is intended to be shared between copies. The :func:`deepcopy` function avoids these problems by: diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst index 7fb4fc8..21353e3 100644 --- a/Doc/library/csv.rst +++ b/Doc/library/csv.rst @@ -390,8 +390,10 @@ Reader objects (:class:`DictReader` instances and objects returned by the .. method:: csvreader.__next__() - Return the next row of the reader's iterable object as a list, parsed according - to the current dialect. Usually you should call this as ``next(reader)``. + Return the next row of the reader's iterable object as a list (if the object + was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` + instance), parsed according to the current dialect. Usually you should call + this as ``next(reader)``. Reader objects have the following public attributes: diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index b25fbbb..97a59a7 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -97,7 +97,7 @@ Functions are accessed as attributes of dll objects:: <_FuncPtr object at 0x...> >>> print(windll.kernel32.MyOwnFunction) # doctest: +WINDOWS Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in File "ctypes.py", line 239, in __getattr__ func = _StdcallFuncPtr(name, self) AttributeError: function 'MyOwnFunction' not found @@ -135,7 +135,7 @@ functions can be accessed by indexing the dll object with the ordinal number:: <_FuncPtr object at 0x...> >>> cdll.kernel32[0] # doctest: +WINDOWS Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in File "ctypes.py", line 310, in __getitem__ func = _StdcallFuncPtr(name, self) AttributeError: function ordinal 0 not found @@ -168,11 +168,11 @@ although an error is raised the function *has* been called:: >>> windll.kernel32.GetModuleHandleA() # doctest: +WINDOWS Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ValueError: Procedure probably called with not enough arguments (4 bytes missing) >>> windll.kernel32.GetModuleHandleA(0, 0) # doctest: +WINDOWS Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ValueError: Procedure probably called with too many arguments (4 bytes in excess) >>> @@ -181,13 +181,13 @@ The same exception is raised when you call an ``stdcall`` function with the >>> cdll.kernel32.GetModuleHandleA(None) # doctest: +WINDOWS Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ValueError: Procedure probably called with not enough arguments (4 bytes missing) >>> >>> windll.msvcrt.printf(b"spam") # doctest: +WINDOWS Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ValueError: Procedure probably called with too many arguments (4 bytes in excess) >>> @@ -200,7 +200,7 @@ argument values:: >>> windll.kernel32.GetModuleHandleA(32) # doctest: +WINDOWS Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in OSError: exception: access violation reading 0x00000020 >>> @@ -284,7 +284,7 @@ the correct type and value:: >>> c_int() c_long(0) >>> c_wchar_p("Hello, World") - c_wchar_p('Hello, World') + c_wchar_p(140018365411392) >>> c_ushort(-3) c_ushort(65533) >>> @@ -309,11 +309,15 @@ bytes objects are immutable):: >>> s = "Hello, World" >>> c_s = c_wchar_p(s) >>> print(c_s) - c_wchar_p('Hello, World') + c_wchar_p(139966785747344) + >>> print(c_s.value) + Hello World >>> c_s.value = "Hi, there" - >>> print(c_s) - c_wchar_p('Hi, there') - >>> print(s) # first object is unchanged + >>> print(c_s) # the memory location has changed + c_wchar_p(139966783348904) + >>> print(c_s.value) + Hi, there + >>> print(s) # first object is unchanged Hello, World >>> @@ -369,7 +373,7 @@ from within *IDLE* or *PythonWin*:: 19 >>> printf(b"%f bottles of beer\n", 42.5) Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ArgumentError: argument 2: exceptions.TypeError: Don't know how to convert parameter 2 >>> @@ -432,7 +436,7 @@ prototype for a C function), and tries to convert the arguments to valid types:: >>> printf(b"%d %d %d", 1, 2, 3) Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ArgumentError: argument 2: exceptions.TypeError: wrong type >>> printf(b"%s %d %f\n", b"X", 2, 3) X 2 3.000000 @@ -482,7 +486,7 @@ single character Python bytes object into a C char:: 'def' >>> strchr(b"abcdef", b"def") Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ArgumentError: argument 2: exceptions.TypeError: one character string expected >>> print(strchr(b"abcdef", b"x")) None @@ -508,7 +512,7 @@ useful to check for error return values and automatically raise an exception:: 486539264 >>> GetModuleHandle("something silly") # doctest: +WINDOWS Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in File "", line 3, in ValidHandle OSError: [Errno 126] The specified module could not be found. >>> @@ -579,7 +583,7 @@ Here is a simple example of a POINT structure, which contains two integers named 0 5 >>> POINT(1, 2, 3) Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ValueError: too many initializers >>> @@ -782,7 +786,7 @@ new type:: >>> PI(42) Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in TypeError: expected c_long instead of int >>> PI(c_int(42)) @@ -858,7 +862,7 @@ but not instances of other types:: >>> bar.values = (c_byte * 4)() Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long instance >>> @@ -909,7 +913,7 @@ work:: ... ("next", POINTER(cell))] ... Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in File "", line 2, in cell NameError: name 'cell' is not defined >>> diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst index d746eaf..668d282 100644 --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -290,8 +290,8 @@ The module :mod:`curses` defines the following functions: .. function:: initscr() - Initialize the library. Return a :class:`WindowObject` which represents the - whole screen. + Initialize the library. Return a :ref:`window ` object + which represents the whole screen. .. note:: @@ -383,8 +383,8 @@ The module :mod:`curses` defines the following functions: .. function:: newwin(nlines, ncols) newwin(nlines, ncols, begin_y, begin_x) - Return a new window, whose left-upper corner is at ``(begin_y, begin_x)``, and - whose height/width is *nlines*/*ncols*. + Return a new :ref:`window `, whose left-upper corner + is at ``(begin_y, begin_x)``, and whose height/width is *nlines*/*ncols*. By default, the window will extend from the specified position to the lower right corner of the screen. @@ -1271,27 +1271,63 @@ The :mod:`curses` module defines the following data members: A string representing the current version of the module. Also available as :const:`__version__`. -Several constants are available to specify character cell attributes: +Some constants are available to specify character cell attributes. +The exact constants available are system dependent. +------------------+-------------------------------+ | Attribute | Meaning | +==================+===============================+ -| ``A_ALTCHARSET`` | Alternate character set mode. | +| ``A_ALTCHARSET`` | Alternate character set mode | +------------------+-------------------------------+ -| ``A_BLINK`` | Blink mode. | +| ``A_BLINK`` | Blink mode | +------------------+-------------------------------+ -| ``A_BOLD`` | Bold mode. | +| ``A_BOLD`` | Bold mode | +------------------+-------------------------------+ -| ``A_DIM`` | Dim mode. | +| ``A_DIM`` | Dim mode | +------------------+-------------------------------+ -| ``A_NORMAL`` | Normal attribute. | +| ``A_INVIS`` | Invisible or blank mode | ++------------------+-------------------------------+ +| ``A_NORMAL`` | Normal attribute | ++------------------+-------------------------------+ +| ``A_PROTECT`` | Protected mode | +------------------+-------------------------------+ | ``A_REVERSE`` | Reverse background and | -| | foreground colors. | +| | foreground colors | ++------------------+-------------------------------+ +| ``A_STANDOUT`` | Standout mode | ++------------------+-------------------------------+ +| ``A_UNDERLINE`` | Underline mode | ++------------------+-------------------------------+ +| ``A_HORIZONTAL`` | Horizontal highlight | ++------------------+-------------------------------+ +| ``A_LEFT`` | Left highlight | ++------------------+-------------------------------+ +| ``A_LOW`` | Low highlight | ++------------------+-------------------------------+ +| ``A_RIGHT`` | Right highlight | ++------------------+-------------------------------+ +| ``A_TOP`` | Top highlight | ++------------------+-------------------------------+ +| ``A_VERTICAL`` | Vertical highlight | ++------------------+-------------------------------+ +| ``A_CHARTEXT`` | Bit-mask to extract a | +| | character | ++------------------+-------------------------------+ + +Several constants are available to extract corresponding attributes returned +by some methods. + ++------------------+-------------------------------+ +| Bit-mask | Meaning | ++==================+===============================+ +| ``A_ATTRIBUTES`` | Bit-mask to extract | +| | attributes | +------------------+-------------------------------+ -| ``A_STANDOUT`` | Standout mode. | +| ``A_CHARTEXT`` | Bit-mask to extract a | +| | character | +------------------+-------------------------------+ -| ``A_UNDERLINE`` | Underline mode. | +| ``A_COLOR`` | Bit-mask to extract | +| | color-pair field information | +------------------+-------------------------------+ Keys are referred to by integer constants with names starting with ``KEY_``. @@ -1443,7 +1479,7 @@ The exact keycaps available are system dependent. +-------------------+--------------------------------------------+ | ``KEY_SEOL`` | Shifted Clear line | +-------------------+--------------------------------------------+ -| ``KEY_SEXIT`` | Shifted Dxit | +| ``KEY_SEXIT`` | Shifted Exit | +-------------------+--------------------------------------------+ | ``KEY_SFIND`` | Shifted Find | +-------------------+--------------------------------------------+ @@ -1679,10 +1715,10 @@ You can instantiate a :class:`Textbox` object as follows: .. class:: Textbox(win) Return a textbox widget object. The *win* argument should be a curses - :class:`WindowObject` in which the textbox is to be contained. The edit cursor - of the textbox is initially located at the upper left hand corner of the - containing window, with coordinates ``(0, 0)``. The instance's - :attr:`stripspaces` flag is initially on. + :ref:`window ` object in which the textbox is to + be contained. The edit cursor of the textbox is initially located at the + upper left hand corner of the containing window, with coordinates ``(0, 0)``. + The instance's :attr:`stripspaces` flag is initially on. :class:`Textbox` objects have the following methods: diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index f86725b..186aab4 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -765,8 +765,59 @@ the more significant byte last. .. opcode:: BUILD_MAP (count) - Pushes a new dictionary object onto the stack. The dictionary is pre-sized - to hold *count* entries. + Pushes a new dictionary object onto the stack. Pops ``2 * count`` items + so that the dictionary holds *count* entries: + ``{..., TOS3: TOS2, TOS1: TOS}``. + + .. versionchanged:: 3.5 + The dictionary is created from stack items instead of creating an + empty dictionary pre-sized to hold *count* items. + + +.. opcode:: BUILD_TUPLE_UNPACK (count) + + Pops *count* iterables from the stack, joins them in a single tuple, + and pushes the result. Implements iterable unpacking in tuple + displays ``(*x, *y, *z)``. + + .. versionadded:: 3.5 + + +.. opcode:: BUILD_LIST_UNPACK (count) + + This is similar to :opcode:`BUILD_TUPLE_UNPACK`, but pushes a list + instead of tuple. Implements iterable unpacking in list + displays ``[*x, *y, *z]``. + + .. versionadded:: 3.5 + + +.. opcode:: BUILD_SET_UNPACK (count) + + This is similar to :opcode:`BUILD_TUPLE_UNPACK`, but pushes a set + instead of tuple. Implements iterable unpacking in set + displays ``{*x, *y, *z}``. + + .. versionadded:: 3.5 + + +.. opcode:: BUILD_MAP_UNPACK (count) + + Pops *count* mappings from the stack, merges them into a single dictionary, + and pushes the result. Implements dictionary unpacking in dictionary + displays ``{**x, **y, **z}``. + + .. versionadded:: 3.5 + + +.. opcode:: BUILD_MAP_UNPACK_WITH_CALL (oparg) + + This is similar to :opcode:`BUILD_MAP_UNPACK`, + but is used for ``f(**x, **y, **z)`` call syntax. The lowest byte of + *oparg* is the count of mappings, the relative position of the + corresponding callable ``f`` is encoded in the second byte of *oparg*. + + .. versionadded:: 3.5 .. opcode:: LOAD_ATTR (namei) diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index 131206d..587a0a0 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -408,7 +408,7 @@ Simple example:: >>> [1, 2, 3].remove(42) Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ValueError: list.remove(x): x not in list That doctest succeeds if :exc:`ValueError` is raised, with the ``list.remove(x): @@ -432,7 +432,7 @@ multi-line detail:: >>> raise ValueError('multi\n line\ndetail') Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ValueError: multi line detail @@ -510,9 +510,9 @@ Option Flags A number of option flags control various aspects of doctest's behavior. Symbolic names for the flags are supplied as module constants, which can be -or'ed together and passed to various functions. The names can also be used in -:ref:`doctest directives `, and may be passed to the -doctest command line interface via the ``-o`` option. +:ref:`bitwise ORed ` together and passed to various functions. +The names can also be used in :ref:`doctest directives `, +and may be passed to the doctest command line interface via the ``-o`` option. .. versionadded:: 3.4 The ``-o`` command line option. @@ -591,7 +591,7 @@ doctest decides whether actual output matches an example's expected output: >>> (1, 2)[3] = 'moo' Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in TypeError: object doesn't support item assignment passes under Python 2.3 and later Python versions with the flag specified, @@ -877,8 +877,9 @@ and :ref:`doctest-simple-testfile`. nothing at the end. In verbose mode, the summary is detailed, else the summary is very brief (in fact, empty if all tests passed). - Optional argument *optionflags* (default value 0) takes the bitwise-or of - option flags. See section :ref:`doctest-options`. + Optional argument *optionflags* (default value 0) takes the + :ref:`bitwise OR ` of option flags. + See section :ref:`doctest-options`. Optional argument *raise_on_error* defaults to false. If true, an exception is raised upon the first failure or unexpected exception in an example. This @@ -1098,18 +1099,19 @@ reporting flags specific to :mod:`unittest` support, via this function: Set the :mod:`doctest` reporting flags to use. - Argument *flags* takes the bitwise-or of option flags. See section - :ref:`doctest-options`. Only "reporting flags" can be used. + Argument *flags* takes the :ref:`bitwise OR ` of option flags. See + section :ref:`doctest-options`. Only "reporting flags" can be used. This is a module-global setting, and affects all future doctests run by module :mod:`unittest`: the :meth:`runTest` method of :class:`DocTestCase` looks at the option flags specified for the test case when the :class:`DocTestCase` instance was constructed. If no reporting flags were specified (which is the typical and expected case), :mod:`doctest`'s :mod:`unittest` reporting flags are - or'ed into the option flags, and the option flags so augmented are passed to the - :class:`DocTestRunner` instance created to run the doctest. If any reporting - flags were specified when the :class:`DocTestCase` instance was constructed, - :mod:`doctest`'s :mod:`unittest` reporting flags are ignored. + :ref:`bitwise ORed ` into the option flags, and the option flags + so augmented are passed to the :class:`DocTestRunner` instance created to + run the doctest. If any reporting flags were specified when the + :class:`DocTestCase` instance was constructed, :mod:`doctest`'s + :mod:`unittest` reporting flags are ignored. The value of the :mod:`unittest` reporting flags in effect before the function was called is returned by the function. diff --git a/Doc/library/email.contentmanager.rst b/Doc/library/email.contentmanager.rst index a9c078b..5302b12 100644 --- a/Doc/library/email.contentmanager.rst +++ b/Doc/library/email.contentmanager.rst @@ -62,7 +62,7 @@ this module. .. class:: EmailMessage(policy=default) If *policy* is specified (it must be an instance of a :mod:`~email.policy` - class) use the rules it specifies to udpate and serialize the representation + class) use the rules it specifies to update and serialize the representation of the message. If *policy* is not set, use the :class:`~email.policy.default` policy, which follows the rules of the email RFCs except for line endings (instead of the RFC mandated ``\r\n``, it uses @@ -108,7 +108,7 @@ this module. the part a candidate match if the value of the header is ``inline``. If none of the candidates matches any of the preferences in - *preferneclist*, return ``None``. + *preferencelist*, return ``None``. Notes: (1) For most applications the only *preferencelist* combinations that really make sense are ``('plain',)``, ``('html', 'plain')``, and the @@ -396,7 +396,7 @@ Currently the email package provides only one concrete content manager, MIME charset name, use the standard charset instead. If *cte* is set, encode the payload using the specified content transfer - encoding, and set the :mailheader:`Content-Transfer-Endcoding` header to + encoding, and set the :mailheader:`Content-Transfer-Encoding` header to that value. For ``str`` objects, if it is not set use heuristics to determine the most compact encoding. Possible values for *cte* are ``quoted-printable``, ``base64``, ``7bit``, ``8bit``, and ``binary``. diff --git a/Doc/library/email.errors.rst b/Doc/library/email.errors.rst index 8470783..b5b78f3 100644 --- a/Doc/library/email.errors.rst +++ b/Doc/library/email.errors.rst @@ -108,9 +108,9 @@ this class is *not* an exception! return false even though its content type claims to be :mimetype:`multipart`. * :class:`InvalidBase64PaddingDefect` -- When decoding a block of base64 - enocded bytes, the padding was not correct. Enough padding is added to + encoded bytes, the padding was not correct. Enough padding is added to perform the decode, but the resulting decoded bytes may be invalid. * :class:`InvalidBase64CharactersDefect` -- When decoding a block of base64 - enocded bytes, characters outside the base64 alphebet were encountered. + encoded bytes, characters outside the base64 alphabet were encountered. The characters are ignored, but the resulting decoded bytes may be invalid. diff --git a/Doc/library/email.message.rst b/Doc/library/email.message.rst index 2907975..3dae8a9 100644 --- a/Doc/library/email.message.rst +++ b/Doc/library/email.message.rst @@ -50,7 +50,7 @@ Here are the methods of the :class:`Message` class: Return the entire message flattened as a string. When optional *unixfrom* is true, the envelope header is included in the returned string. - *unixfrom* defaults to ``False``. For backward compabitility reasons, + *unixfrom* defaults to ``False``. For backward compatibility reasons, *maxheaderlen* defaults to ``0``, so if you want a different value you must override it explicitly (the value specified for *max_line_length* in the policy will be ignored by this method). The *policy* argument may be diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst index 8297dea..bd007c0 100644 --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -203,7 +203,7 @@ Here are the classes: Unless the *_charset* argument is explicitly set to ``None``, the MIMEText object created will have both a :mailheader:`Content-Type` header - with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding` + with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Encoding` header. This means that a subsequent ``set_payload`` call will not result in an encoded payload, even if a charset is passed in the ``set_payload`` command. You can "reset" this behavior by deleting the diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst index 2a6047d..7010091 100644 --- a/Doc/library/email.policy.rst +++ b/Doc/library/email.policy.rst @@ -540,7 +540,7 @@ more closely to the RFCs relevant to their domains. The same as ``SMTP`` except that :attr:`~EmailPolicy.utf8` is ``True``. Useful for serializing messages to a message store without using encoded - words in the headers. Should only be used for SMTP trasmission if the + words in the headers. Should only be used for SMTP transmission if the sender or recipient addresses have non-ASCII characters (the :meth:`smtplib.SMTP.send_message` method handles this automatically). diff --git a/Doc/library/fnmatch.rst b/Doc/library/fnmatch.rst index 9fc9c7c..670b176 100644 --- a/Doc/library/fnmatch.rst +++ b/Doc/library/fnmatch.rst @@ -43,9 +43,8 @@ patterns. .. function:: fnmatch(filename, pattern) Test whether the *filename* string matches the *pattern* string, returning - :const:`True` or :const:`False`. If the operating system is case-insensitive, - then both parameters will be normalized to all lower- or upper-case before - the comparison is performed. :func:`fnmatchcase` can be used to perform a + :const:`True` or :const:`False`. Both parameters are case-normalized + using :func:`os.path.normcase`. :func:`fnmatchcase` can be used to perform a case-sensitive comparison, regardless of whether that's standard for the operating system. @@ -63,7 +62,8 @@ patterns. .. function:: fnmatchcase(filename, pattern) Test whether *filename* matches *pattern*, returning :const:`True` or - :const:`False`; the comparison is case-sensitive. + :const:`False`; the comparison is case-sensitive and does not apply + :func:`os.path.normcase`. .. function:: filter(names, pattern) diff --git a/Doc/library/fpectl.rst b/Doc/library/fpectl.rst index e4b528c..9660716 100644 --- a/Doc/library/fpectl.rst +++ b/Doc/library/fpectl.rst @@ -89,7 +89,7 @@ The following example demonstrates how to start up and test operation of the >>> import math >>> math.exp(1000) Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in FloatingPointError: in math_1 diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst index 1e35f37..f0e19bd 100644 --- a/Doc/library/ftplib.rst +++ b/Doc/library/ftplib.rst @@ -228,7 +228,7 @@ followed by ``lines`` for the text version or ``binary`` for the binary version. Retrieve a file in binary transfer mode. *cmd* should be an appropriate ``RETR`` command: ``'RETR filename'``. The *callback* function is called for - each block of data received, with a single string argument giving the data + each block of data received, with a single bytes argument giving the data block. The optional *blocksize* argument specifies the maximum chunk size to read on the low-level socket object created to do the actual transfer (which will also be the largest size of the data blocks passed to *callback*). A @@ -248,9 +248,9 @@ followed by ``lines`` for the text version or ``binary`` for the binary version. prints the line to ``sys.stdout``. -.. method:: FTP.set_pasv(boolean) +.. method:: FTP.set_pasv(val) - Enable "passive" mode if *boolean* is true, other disable passive mode. + Enable "passive" mode if *val* is true, otherwise disable passive mode. Passive mode is on by default. diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 2f14949..d6fa35a 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -604,7 +604,7 @@ are always available. They are listed here in alphabetical order. .. note:: - For object's with custom :meth:`__hash__` methods, note that :func:`hash` + For objects with custom :meth:`__hash__` methods, note that :func:`hash` truncates the return value based on the bit width of the host machine. See :meth:`__hash__` for details. @@ -1104,7 +1104,7 @@ are always available. They are listed here in alphabetical order. .. function:: print(*objects, sep=' ', end='\\n', file=sys.stdout, flush=False) Print *objects* to the text stream *file*, separated by *sep* and followed - by *end*. *sep*, *end* and *file*, if present, must be given as keyword + by *end*. *sep*, *end*, *file* and *flush*, if present, must be given as keyword arguments. All non-keyword arguments are converted to strings like :func:`str` does and @@ -1233,17 +1233,21 @@ are always available. They are listed here in alphabetical order. .. function:: round(number[, ndigits]) - Return the floating point value *number* rounded to *ndigits* digits after - the decimal point. If *ndigits* is omitted or is ``None``, it returns the - nearest integer to its input. Delegates to ``number.__round__(ndigits)``. + Return *number* rounded to *ndigits* precision after the decimal + point. If *ndigits* is omitted or is ``None``, it returns the + nearest integer to its input. For the built-in types supporting :func:`round`, values are rounded to the closest multiple of 10 to the power minus *ndigits*; if two multiples are equally close, rounding is done toward the even choice (so, for example, both ``round(0.5)`` and ``round(-0.5)`` are ``0``, and ``round(1.5)`` is - ``2``). The return value is an integer if called with one argument, + ``2``). Any integer value is valid for *ndigits* (positive, zero, or + negative). The return value is an integer if called with one argument, otherwise of the same type as *number*. + For a general Python object ``number``, ``round(number, ndigits)`` delegates to + ``number.__round__(ndigits)``. + .. note:: The behavior of :func:`round` for floats can be surprising: for example, diff --git a/Doc/library/gettext.rst b/Doc/library/gettext.rst index 3a87bf5..053d9d3 100644 --- a/Doc/library/gettext.rst +++ b/Doc/library/gettext.rst @@ -48,9 +48,10 @@ class-based API instead. .. function:: bind_textdomain_codeset(domain, codeset=None) - Bind the *domain* to *codeset*, changing the encoding of strings returned by the - :func:`gettext` family of functions. If *codeset* is omitted, then the current - binding is returned. + Bind the *domain* to *codeset*, changing the encoding of byte strings + returned by the :func:`lgettext`, :func:`ldgettext`, :func:`lngettext` + and :func:`ldngettext` functions. + If *codeset* is omitted, then the current binding is returned. .. function:: textdomain(domain=None) @@ -67,28 +68,14 @@ class-based API instead. :func:`_` in the local namespace (see examples below). -.. function:: lgettext(message) - - Equivalent to :func:`gettext`, but the translation is returned in the - preferred system encoding, if no other encoding was explicitly set with - :func:`bind_textdomain_codeset`. - - .. function:: dgettext(domain, message) - Like :func:`gettext`, but look the message up in the specified *domain*. - - -.. function:: ldgettext(domain, message) - - Equivalent to :func:`dgettext`, but the translation is returned in the - preferred system encoding, if no other encoding was explicitly set with - :func:`bind_textdomain_codeset`. + Like :func:`.gettext`, but look the message up in the specified *domain*. .. function:: ngettext(singular, plural, n) - Like :func:`gettext`, but consider plural forms. If a translation is found, + Like :func:`.gettext`, but consider plural forms. If a translation is found, apply the plural formula to *n*, and return the resulting message (some languages have more than two plural forms). If no translation is found, return *singular* if *n* is 1; return *plural* otherwise. @@ -101,24 +88,33 @@ class-based API instead. formulas for a variety of languages. -.. function:: lngettext(singular, plural, n) - - Equivalent to :func:`ngettext`, but the translation is returned in the - preferred system encoding, if no other encoding was explicitly set with - :func:`bind_textdomain_codeset`. - - .. function:: dngettext(domain, singular, plural, n) Like :func:`ngettext`, but look the message up in the specified *domain*. +.. function:: lgettext(message) +.. function:: ldgettext(domain, message) +.. function:: lngettext(singular, plural, n) .. function:: ldngettext(domain, singular, plural, n) - Equivalent to :func:`dngettext`, but the translation is returned in the - preferred system encoding, if no other encoding was explicitly set with + Equivalent to the corresponding functions without the ``l`` prefix + (:func:`.gettext`, :func:`dgettext`, :func:`ngettext` and :func:`dngettext`), + but the translation is returned as a byte string encoded in the preferred + system encoding if no other encoding was explicitly set with :func:`bind_textdomain_codeset`. + .. warning:: + + These functions should be avoided in Python 3, because they return + encoded bytes. It's much better to use alternatives which return + Unicode strings instead, since most Python applications will want to + manipulate human readable text as strings instead of bytes. Further, + it's possible that you may get unexpected Unicode-related exceptions + if there are encoding problems with the translated strings. It is + possible that the ``l*()`` functions will be deprecated in future Python + versions due to their inherent problems and limitations. + Note that GNU :program:`gettext` also defines a :func:`dcgettext` method, but this was deemed not useful and so it is currently unimplemented. @@ -179,8 +175,9 @@ class can also install themselves in the built-in namespace as the function names are cached. The actual class instantiated is either *class_* if provided, otherwise :class:`GNUTranslations`. The class's constructor must take a single :term:`file object` argument. If provided, *codeset* will change - the charset used to encode translated strings in the :meth:`lgettext` and - :meth:`lngettext` methods. + the charset used to encode translated strings in the + :meth:`~NullTranslations.lgettext` and :meth:`~NullTranslations.lngettext` + methods. If multiple files are found, later files are used as fallbacks for earlier ones. To allow setting the fallback, :func:`copy.copy` is used to clone each @@ -250,26 +247,29 @@ are the methods of :class:`NullTranslations`: .. method:: gettext(message) - If a fallback has been set, forward :meth:`gettext` to the fallback. - Otherwise, return the translated message. Overridden in derived classes. - - - .. method:: lgettext(message) - - If a fallback has been set, forward :meth:`lgettext` to the fallback. - Otherwise, return the translated message. Overridden in derived classes. + If a fallback has been set, forward :meth:`.gettext` to the fallback. + Otherwise, return *message*. Overridden in derived classes. .. method:: ngettext(singular, plural, n) If a fallback has been set, forward :meth:`ngettext` to the fallback. - Otherwise, return the translated message. Overridden in derived classes. + Otherwise, return *singular* if *n* is 1; return *plural* otherwise. + Overridden in derived classes. + .. method:: lgettext(message) .. method:: lngettext(singular, plural, n) - If a fallback has been set, forward :meth:`lngettext` to the fallback. - Otherwise, return the translated message. Overridden in derived classes. + Equivalent to :meth:`.gettext` and :meth:`ngettext`, but the translation + is returned as a byte string encoded in the preferred system encoding + if no encoding was explicitly set with :meth:`set_output_charset`. + Overridden in derived classes. + + .. warning:: + + These methods should be avoided in Python 3. See the warning for the + :func:`lgettext` function. .. method:: info() @@ -279,32 +279,28 @@ are the methods of :class:`NullTranslations`: .. method:: charset() - Return the "protected" :attr:`_charset` variable, which is the encoding of - the message catalog file. + Return the encoding of the message catalog file. .. method:: output_charset() - Return the "protected" :attr:`_output_charset` variable, which defines the - encoding used to return translated messages in :meth:`lgettext` and - :meth:`lngettext`. + Return the encoding used to return translated messages in :meth:`.lgettext` + and :meth:`.lngettext`. .. method:: set_output_charset(charset) - Change the "protected" :attr:`_output_charset` variable, which defines the - encoding used to return translated messages. + Change the encoding used to return translated messages. .. method:: install(names=None) - This method installs :meth:`self.gettext` into the built-in namespace, + This method installs :meth:`.gettext` into the built-in namespace, binding it to ``_``. If the *names* parameter is given, it must be a sequence containing the names of functions you want to install in the builtins namespace in - addition to :func:`_`. Supported names are ``'gettext'`` (bound to - :meth:`self.gettext`), ``'ngettext'`` (bound to :meth:`self.ngettext`), + addition to :func:`_`. Supported names are ``'gettext'``, ``'ngettext'``, ``'lgettext'`` and ``'lngettext'``. Note that this is only one way, albeit the most convenient way, to make @@ -349,49 +345,52 @@ If the :file:`.mo` file's magic number is invalid, the major version number is unexpected, or if other problems occur while reading the file, instantiating a :class:`GNUTranslations` class can raise :exc:`OSError`. -The following methods are overridden from the base class implementation: - +.. class:: GNUTranslations -.. method:: GNUTranslations.gettext(message) + The following methods are overridden from the base class implementation: - Look up the *message* id in the catalog and return the corresponding message - string, as a Unicode string. If there is no entry in the catalog for the - *message* id, and a fallback has been set, the look up is forwarded to the - fallback's :meth:`gettext` method. Otherwise, the *message* id is returned. + .. method:: gettext(message) + Look up the *message* id in the catalog and return the corresponding message + string, as a Unicode string. If there is no entry in the catalog for the + *message* id, and a fallback has been set, the look up is forwarded to the + fallback's :meth:`~NullTranslations.gettext` method. Otherwise, the + *message* id is returned. -.. method:: GNUTranslations.lgettext(message) - Equivalent to :meth:`gettext`, but the translation is returned as a - bytestring encoded in the selected output charset, or in the preferred system - encoding if no encoding was explicitly set with :meth:`set_output_charset`. + .. method:: ngettext(singular, plural, n) + Do a plural-forms lookup of a message id. *singular* is used as the message id + for purposes of lookup in the catalog, while *n* is used to determine which + plural form to use. The returned message string is a Unicode string. -.. method:: GNUTranslations.ngettext(singular, plural, n) + If the message id is not found in the catalog, and a fallback is specified, + the request is forwarded to the fallback's :meth:`~NullTranslations.ngettext` + method. Otherwise, when *n* is 1 *singular* is returned, and *plural* is + returned in all other cases. - Do a plural-forms lookup of a message id. *singular* is used as the message id - for purposes of lookup in the catalog, while *n* is used to determine which - plural form to use. The returned message string is a Unicode string. + Here is an example:: - If the message id is not found in the catalog, and a fallback is specified, the - request is forwarded to the fallback's :meth:`ngettext` method. Otherwise, when - *n* is 1 *singular* is returned, and *plural* is returned in all other cases. + n = len(os.listdir('.')) + cat = GNUTranslations(somefile) + message = cat.ngettext( + 'There is %(num)d file in this directory', + 'There are %(num)d files in this directory', + n) % {'num': n} - Here is an example:: - n = len(os.listdir('.')) - cat = GNUTranslations(somefile) - message = cat.ngettext( - 'There is %(num)d file in this directory', - 'There are %(num)d files in this directory', - n) % {'num': n} + .. method:: lgettext(message) + .. method:: lngettext(singular, plural, n) + Equivalent to :meth:`.gettext` and :meth:`.ngettext`, but the translation + is returned as a byte string encoded in the preferred system encoding + if no encoding was explicitly set with + :meth:`~NullTranslations.set_output_charset`. -.. method:: GNUTranslations.lngettext(singular, plural, n) + .. warning:: - Equivalent to :meth:`gettext`, but the translation is returned as a - bytestring encoded in the selected output charset, or in the preferred system - encoding if no encoding was explicitly set with :meth:`set_output_charset`. + These methods should be avoided in Python 3. See the warning for the + :func:`lgettext` function. Solaris message catalog support @@ -509,7 +508,7 @@ module:: import gettext t = gettext.translation('spam', '/usr/share/locale') - _ = t.lgettext + _ = t.gettext Localizing your application diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst index ae7fb97..6e71c8a 100644 --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -105,7 +105,8 @@ of which this module provides three different variants: Contains the output stream for writing a response back to the client. Proper adherence to the HTTP protocol must be used when writing to - this stream. + this stream in order to achieve successful interoperation with HTTP + clients. :class:`BaseHTTPRequestHandler` has the following attributes: diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index a629bc5..80dd6fa 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -244,7 +244,7 @@ Go to File/Line single: stack viewer Debugger (toggle) - When actived, code entered in the Shell or run from an Editor will run + When activated, code entered in the Shell or run from an Editor will run under the debugger. In the Editor, breakpoints can be set with the context menu. This feature is still incomplete and somewhat experimental. @@ -372,7 +372,7 @@ the :kbd:`Command` key on Mac OSX. * :kbd:`C-l` center window around the insertion point - * :kbd:`C-b` go backwards one character without deleting (usually you can + * :kbd:`C-b` go backward one character without deleting (usually you can also use the cursor key for this) * :kbd:`C-f` go forward one character without deleting (usually you can @@ -394,7 +394,7 @@ After a block-opening statement, the next line is indented by 4 spaces (in the Python Shell window by one tab). After certain keywords (break, return etc.) the next line is dedented. In leading indentation, :kbd:`Backspace` deletes up to 4 spaces if they are there. :kbd:`Tab` inserts spaces (in the Python -Shell window one tab), number depends on Indent width. Currently tabs +Shell window one tab), number depends on Indent width. Currently, tabs are restricted to four spaces due to Tcl/Tk limitations. See also the indent/dedent region commands in the edit menu. @@ -418,7 +418,7 @@ If there is only one possible completion for the characters entered, a :kbd:`C-space` will open a completions window. In an empty string, this will contain the files in the current directory. On a blank line, it will contain the built-in and user-defined functions and -classes in the current name spaces, plus any modules imported. If some +classes in the current namespaces, plus any modules imported. If some characters have been entered, the ACW will attempt to be more specific. If a string of characters is typed, the ACW selection will jump to the @@ -557,7 +557,7 @@ IDLE-console differences As much as possible, the result of executing Python code with IDLE is the same as executing the same code in a console window. However, the different -interface and operation occasionally affects visible results. For instance, +interface and operation occasionally affect visible results. For instance, ``sys.modules`` starts with more entries. IDLE also replaces ``sys.stdin``, ``sys.stdout``, and ``sys.stderr`` with @@ -583,7 +583,7 @@ If firewall software complains anyway, you can ignore it. If the attempt to make the socket connection fails, Idle will notify you. Such failures are sometimes transient, but if persistent, the problem -may be either a firewall blocking the connecton or misconfiguration of +may be either a firewall blocking the connection or misconfiguration of a particular system. Until the problem is fixed, one can run Idle with the -n command line switch. @@ -619,14 +619,14 @@ Setting preferences The font preferences, highlighting, keys, and general preferences can be changed via Configure IDLE on the Option menu. Keys can be user defined; -IDLE ships with four built in key sets. In addition a user can create a +IDLE ships with four built-in key sets. In addition, a user can create a custom key set in the Configure IDLE dialog under the keys tab. Extensions ^^^^^^^^^^ -IDLE contains an extension facility. Peferences for extensions can be +IDLE contains an extension facility. Preferences for extensions can be changed with Configure Extensions. See the beginning of config-extensions.def in the idlelib directory for further information. The default extensions are currently: diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 62a3988..16e33f0 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -34,185 +34,198 @@ provided as convenient choices for the second argument to :func:`getmembers`. They also help you determine when you can expect to find the following special attributes: -+-----------+-----------------+---------------------------+ -| Type | Attribute | Description | -+===========+=================+===========================+ -| module | __doc__ | documentation string | -+-----------+-----------------+---------------------------+ -| | __file__ | filename (missing for | -| | | built-in modules) | -+-----------+-----------------+---------------------------+ -| class | __doc__ | documentation string | -+-----------+-----------------+---------------------------+ -| | __name__ | name with which this | -| | | class was defined | -+-----------+-----------------+---------------------------+ -| | __qualname__ | qualified name | -+-----------+-----------------+---------------------------+ -| | __module__ | name of module in which | -| | | this class was defined | -+-----------+-----------------+---------------------------+ -| method | __doc__ | documentation string | -+-----------+-----------------+---------------------------+ -| | __name__ | name with which this | -| | | method was defined | -+-----------+-----------------+---------------------------+ -| | __qualname__ | qualified name | -+-----------+-----------------+---------------------------+ -| | __func__ | function object | -| | | containing implementation | -| | | of method | -+-----------+-----------------+---------------------------+ -| | __self__ | instance to which this | -| | | method is bound, or | -| | | ``None`` | -+-----------+-----------------+---------------------------+ -| function | __doc__ | documentation string | -+-----------+-----------------+---------------------------+ -| | __name__ | name with which this | -| | | function was defined | -+-----------+-----------------+---------------------------+ -| | __qualname__ | qualified name | -+-----------+-----------------+---------------------------+ -| | __code__ | code object containing | -| | | compiled function | -| | | :term:`bytecode` | -+-----------+-----------------+---------------------------+ -| | __defaults__ | tuple of any default | -| | | values for positional or | -| | | keyword parameters | -+-----------+-----------------+---------------------------+ -| | __kwdefaults__ | mapping of any default | -| | | values for keyword-only | -| | | parameters | -+-----------+-----------------+---------------------------+ -| | __globals__ | global namespace in which | -| | | this function was defined | -+-----------+-----------------+---------------------------+ -| | __annotations__ | mapping of parameters | -| | | names to annotations; | -| | | ``"return"`` key is | -| | | reserved for return | -| | | annotations. | -+-----------+-----------------+---------------------------+ -| traceback | tb_frame | frame object at this | -| | | level | -+-----------+-----------------+---------------------------+ -| | tb_lasti | index of last attempted | -| | | instruction in bytecode | -+-----------+-----------------+---------------------------+ -| | tb_lineno | current line number in | -| | | Python source code | -+-----------+-----------------+---------------------------+ -| | tb_next | next inner traceback | -| | | object (called by this | -| | | level) | -+-----------+-----------------+---------------------------+ -| frame | f_back | next outer frame object | -| | | (this frame's caller) | -+-----------+-----------------+---------------------------+ -| | f_builtins | builtins namespace seen | -| | | by this frame | -+-----------+-----------------+---------------------------+ -| | f_code | code object being | -| | | executed in this frame | -+-----------+-----------------+---------------------------+ -| | f_globals | global namespace seen by | -| | | this frame | -+-----------+-----------------+---------------------------+ -| | f_lasti | index of last attempted | -| | | instruction in bytecode | -+-----------+-----------------+---------------------------+ -| | f_lineno | current line number in | -| | | Python source code | -+-----------+-----------------+---------------------------+ -| | f_locals | local namespace seen by | -| | | this frame | -+-----------+-----------------+---------------------------+ -| | f_restricted | 0 or 1 if frame is in | -| | | restricted execution mode | -+-----------+-----------------+---------------------------+ -| | f_trace | tracing function for this | -| | | frame, or ``None`` | -+-----------+-----------------+---------------------------+ -| code | co_argcount | number of arguments (not | -| | | including \* or \*\* | -| | | args) | -+-----------+-----------------+---------------------------+ -| | co_code | string of raw compiled | -| | | bytecode | -+-----------+-----------------+---------------------------+ -| | co_consts | tuple of constants used | -| | | in the bytecode | -+-----------+-----------------+---------------------------+ -| | co_filename | name of file in which | -| | | this code object was | -| | | created | -+-----------+-----------------+---------------------------+ -| | co_firstlineno | number of first line in | -| | | Python source code | -+-----------+-----------------+---------------------------+ -| | co_flags | bitmap of ``CO_*`` flags, | -| | | read more :ref:`here | -| | | `| -+-----------+-----------------+---------------------------+ -| | co_lnotab | encoded mapping of line | -| | | numbers to bytecode | -| | | indices | -+-----------+-----------------+---------------------------+ -| | co_name | name with which this code | -| | | object was defined | -+-----------+-----------------+---------------------------+ -| | co_names | tuple of names of local | -| | | variables | -+-----------+-----------------+---------------------------+ -| | co_nlocals | number of local variables | -+-----------+-----------------+---------------------------+ -| | co_stacksize | virtual machine stack | -| | | space required | -+-----------+-----------------+---------------------------+ -| | co_varnames | tuple of names of | -| | | arguments and local | -| | | variables | -+-----------+-----------------+---------------------------+ -| generator | __name__ | name | -+-----------+-----------------+---------------------------+ -| | __qualname__ | qualified name | -+-----------+-----------------+---------------------------+ -| | gi_frame | frame | -+-----------+-----------------+---------------------------+ -| | gi_running | is the generator running? | -+-----------+-----------------+---------------------------+ -| | gi_code | code | -+-----------+-----------------+---------------------------+ -| | gi_yieldfrom | object being iterated by | -| | | ``yield from``, or | -| | | ``None`` | -+-----------+-----------------+---------------------------+ -| coroutine | __name__ | name | -+-----------+-----------------+---------------------------+ -| | __qualname__ | qualified name | -+-----------+-----------------+---------------------------+ -| | cr_await | object being awaited on, | -| | | or ``None`` | -+-----------+-----------------+---------------------------+ -| | cr_frame | frame | -+-----------+-----------------+---------------------------+ -| | cr_running | is the coroutine running? | -+-----------+-----------------+---------------------------+ -| | cr_code | code | -+-----------+-----------------+---------------------------+ -| builtin | __doc__ | documentation string | -+-----------+-----------------+---------------------------+ -| | __name__ | original name of this | -| | | function or method | -+-----------+-----------------+---------------------------+ -| | __qualname__ | qualified name | -+-----------+-----------------+---------------------------+ -| | __self__ | instance to which a | -| | | method is bound, or | -| | | ``None`` | -+-----------+-----------------+---------------------------+ ++-----------+-------------------+---------------------------+ +| Type | Attribute | Description | ++===========+===================+===========================+ +| module | __doc__ | documentation string | ++-----------+-------------------+---------------------------+ +| | __file__ | filename (missing for | +| | | built-in modules) | ++-----------+-------------------+---------------------------+ +| class | __doc__ | documentation string | ++-----------+-------------------+---------------------------+ +| | __name__ | name with which this | +| | | class was defined | ++-----------+-------------------+---------------------------+ +| | __qualname__ | qualified name | ++-----------+-------------------+---------------------------+ +| | __module__ | name of module in which | +| | | this class was defined | ++-----------+-------------------+---------------------------+ +| method | __doc__ | documentation string | ++-----------+-------------------+---------------------------+ +| | __name__ | name with which this | +| | | method was defined | ++-----------+-------------------+---------------------------+ +| | __qualname__ | qualified name | ++-----------+-------------------+---------------------------+ +| | __func__ | function object | +| | | containing implementation | +| | | of method | ++-----------+-------------------+---------------------------+ +| | __self__ | instance to which this | +| | | method is bound, or | +| | | ``None`` | ++-----------+-------------------+---------------------------+ +| function | __doc__ | documentation string | ++-----------+-------------------+---------------------------+ +| | __name__ | name with which this | +| | | function was defined | ++-----------+-------------------+---------------------------+ +| | __qualname__ | qualified name | ++-----------+-------------------+---------------------------+ +| | __code__ | code object containing | +| | | compiled function | +| | | :term:`bytecode` | ++-----------+-------------------+---------------------------+ +| | __defaults__ | tuple of any default | +| | | values for positional or | +| | | keyword parameters | ++-----------+-------------------+---------------------------+ +| | __kwdefaults__ | mapping of any default | +| | | values for keyword-only | +| | | parameters | ++-----------+-------------------+---------------------------+ +| | __globals__ | global namespace in which | +| | | this function was defined | ++-----------+-------------------+---------------------------+ +| | __annotations__ | mapping of parameters | +| | | names to annotations; | +| | | ``"return"`` key is | +| | | reserved for return | +| | | annotations. | ++-----------+-------------------+---------------------------+ +| traceback | tb_frame | frame object at this | +| | | level | ++-----------+-------------------+---------------------------+ +| | tb_lasti | index of last attempted | +| | | instruction in bytecode | ++-----------+-------------------+---------------------------+ +| | tb_lineno | current line number in | +| | | Python source code | ++-----------+-------------------+---------------------------+ +| | tb_next | next inner traceback | +| | | object (called by this | +| | | level) | ++-----------+-------------------+---------------------------+ +| frame | f_back | next outer frame object | +| | | (this frame's caller) | ++-----------+-------------------+---------------------------+ +| | f_builtins | builtins namespace seen | +| | | by this frame | ++-----------+-------------------+---------------------------+ +| | f_code | code object being | +| | | executed in this frame | ++-----------+-------------------+---------------------------+ +| | f_globals | global namespace seen by | +| | | this frame | ++-----------+-------------------+---------------------------+ +| | f_lasti | index of last attempted | +| | | instruction in bytecode | ++-----------+-------------------+---------------------------+ +| | f_lineno | current line number in | +| | | Python source code | ++-----------+-------------------+---------------------------+ +| | f_locals | local namespace seen by | +| | | this frame | ++-----------+-------------------+---------------------------+ +| | f_restricted | 0 or 1 if frame is in | +| | | restricted execution mode | ++-----------+-------------------+---------------------------+ +| | f_trace | tracing function for this | +| | | frame, or ``None`` | ++-----------+-------------------+---------------------------+ +| code | co_argcount | number of arguments (not | +| | | including keyword only | +| | | arguments, \* or \*\* | +| | | args) | ++-----------+-------------------+---------------------------+ +| | co_code | string of raw compiled | +| | | bytecode | ++-----------+-------------------+---------------------------+ +| | co_cellvars | tuple of names of cell | +| | | variables (referenced by | +| | | containing scopes) | ++-----------+-------------------+---------------------------+ +| | co_consts | tuple of constants used | +| | | in the bytecode | ++-----------+-------------------+---------------------------+ +| | co_filename | name of file in which | +| | | this code object was | +| | | created | ++-----------+-------------------+---------------------------+ +| | co_firstlineno | number of first line in | +| | | Python source code | ++-----------+-------------------+---------------------------+ +| | co_flags | bitmap of ``CO_*`` flags, | +| | | read more :ref:`here | +| | | `| ++-----------+-------------------+---------------------------+ +| | co_lnotab | encoded mapping of line | +| | | numbers to bytecode | +| | | indices | ++-----------+-------------------+---------------------------+ +| | co_freevars | tuple of names of free | +| | | variables (referenced via | +| | | a function's closure) | ++-----------+-------------------+---------------------------+ +| | co_kwonlyargcount | number of keyword only | +| | | arguments (not including | +| | | \*\* arg) | ++-----------+-------------------+---------------------------+ +| | co_name | name with which this code | +| | | object was defined | ++-----------+-------------------+---------------------------+ +| | co_names | tuple of names of local | +| | | variables | ++-----------+-------------------+---------------------------+ +| | co_nlocals | number of local variables | ++-----------+-------------------+---------------------------+ +| | co_stacksize | virtual machine stack | +| | | space required | ++-----------+-------------------+---------------------------+ +| | co_varnames | tuple of names of | +| | | arguments and local | +| | | variables | ++-----------+-------------------+---------------------------+ +| generator | __name__ | name | ++-----------+-------------------+---------------------------+ +| | __qualname__ | qualified name | ++-----------+-------------------+---------------------------+ +| | gi_frame | frame | ++-----------+-------------------+---------------------------+ +| | gi_running | is the generator running? | ++-----------+-------------------+---------------------------+ +| | gi_code | code | ++-----------+-------------------+---------------------------+ +| | gi_yieldfrom | object being iterated by | +| | | ``yield from``, or | +| | | ``None`` | ++-----------+-------------------+---------------------------+ +| coroutine | __name__ | name | ++-----------+-------------------+---------------------------+ +| | __qualname__ | qualified name | ++-----------+-------------------+---------------------------+ +| | cr_await | object being awaited on, | +| | | or ``None`` | ++-----------+-------------------+---------------------------+ +| | cr_frame | frame | ++-----------+-------------------+---------------------------+ +| | cr_running | is the coroutine running? | ++-----------+-------------------+---------------------------+ +| | cr_code | code | ++-----------+-------------------+---------------------------+ +| builtin | __doc__ | documentation string | ++-----------+-------------------+---------------------------+ +| | __name__ | original name of this | +| | | function or method | ++-----------+-------------------+---------------------------+ +| | __qualname__ | qualified name | ++-----------+-------------------+---------------------------+ +| | __self__ | instance to which a | +| | | method is bound, or | +| | | ``None`` | ++-----------+-------------------+---------------------------+ .. versionchanged:: 3.5 @@ -440,7 +453,9 @@ Retrieving source code Return in a single string any lines of comments immediately preceding the object's source code (for a class, function, or method), or at the top of the - Python source file (if the object is a module). + Python source file (if the object is a module). If the object's source code + is unavailable, return ``None``. This could happen if the object has been + defined in C or the interactive shell. .. function:: getfile(object) @@ -875,10 +890,8 @@ Classes and functions are the names of the ``*`` and ``**`` arguments or ``None``. *locals* is the locals dictionary of the given frame. - .. deprecated:: 3.5 - Use :func:`signature` and - :ref:`Signature Object `, which provide a - better introspecting API for callables. + .. note:: + This function was inadvertently marked as deprecated in Python 3.5. .. function:: formatargspec(args[, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations[, formatarg, formatvarargs, formatvarkw, formatvalue, formatreturns, formatannotations]]) @@ -914,10 +927,8 @@ Classes and functions :func:`getargvalues`. The format\* arguments are the corresponding optional formatting functions that are called to turn names and values into strings. - .. deprecated:: 3.5 - Use :func:`signature` and - :ref:`Signature Object `, which provide a - better introspecting API for callables. + .. note:: + This function was inadvertently marked as deprecated in Python 3.5. .. function:: getmro(cls) @@ -1240,6 +1251,10 @@ Code Objects Bit Flags Python code objects have a ``co_flags`` attribute, which is a bitmap of the following flags: +.. data:: CO_OPTIMIZED + + The code object is optimized, using fast locals. + .. data:: CO_NEWLOCALS If set, a new dict will be created for the frame's ``f_locals`` when @@ -1253,6 +1268,10 @@ the following flags: The code object has a variable keyword parameter (``**kwargs``-like). +.. data:: CO_NESTED + + The flag is set when the code object is a nested function. + .. data:: CO_GENERATOR The flag is set when the code object is a generator function, i.e. diff --git a/Doc/library/json.rst b/Doc/library/json.rst index f487535..30c2911 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -485,29 +485,29 @@ Encoders and Decoders Exceptions ---------- -.. exception:: JSONDecodeError(msg, doc, pos, end=None) +.. exception:: JSONDecodeError(msg, doc, pos) - Subclass of :exc:`ValueError` with the following additional attributes: + Subclass of :exc:`ValueError` with the following additional attributes: - .. attribute:: msg + .. attribute:: msg - The unformatted error message. + The unformatted error message. - .. attribute:: doc + .. attribute:: doc - The JSON document being parsed. + The JSON document being parsed. - .. attribute:: pos + .. attribute:: pos - The start index of *doc* where parsing failed. + The start index of *doc* where parsing failed. - .. attribute:: lineno + .. attribute:: lineno - The line corresponding to *pos*. + The line corresponding to *pos*. - .. attribute:: colno + .. attribute:: colno - The column corresponding to *pos*. + The column corresponding to *pos*. .. versionadded:: 3.5 diff --git a/Doc/library/logging.config.rst b/Doc/library/logging.config.rst index a68a890..a7928a0 100644 --- a/Doc/library/logging.config.rst +++ b/Doc/library/logging.config.rst @@ -105,8 +105,8 @@ in :mod:`logging` itself) and defining handlers which are declared either in :param disable_existing_loggers: If specified as ``False``, loggers which exist when this call is made are left enabled. The default is ``True`` because this - enables old behaviour in a backward- - compatible way. This behaviour is to + enables old behaviour in a + backward-compatible way. This behaviour is to disable any existing loggers unless they or their ancestors are explicitly named in the logging configuration. diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst index 0c02d3d..b16eef0 100644 --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -900,8 +900,8 @@ possible, while any potentially slow operations (such as sending an email via .. class:: QueueHandler(queue) Returns a new instance of the :class:`QueueHandler` class. The instance is - initialized with the queue to send messages to. The queue can be any queue- - like object; it's used as-is by the :meth:`enqueue` method, which needs + initialized with the queue to send messages to. The queue can be any + queue-like object; it's used as-is by the :meth:`enqueue` method, which needs to know how to send messages to it. @@ -956,8 +956,8 @@ possible, while any potentially slow operations (such as sending an email via Returns a new instance of the :class:`QueueListener` class. The instance is initialized with the queue to send messages to and a list of handlers which - will handle entries placed on the queue. The queue can be any queue- - like object; it's passed as-is to the :meth:`dequeue` method, which needs + will handle entries placed on the queue. The queue can be any queue-like + object; it's passed as-is to the :meth:`dequeue` method, which needs to know how to get messages from it. If ``respect_handler_level`` is ``True``, a handler's level is respected (compared with the level for the message) when deciding whether to pass messages to that handler; otherwise, the behaviour diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst index 1ffc6ef..d65afc2 100644 --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -49,7 +49,7 @@ For format *version* lower than 3, recursive lists, sets and dictionaries cannot be written (see below). There are functions that read/write files as well as functions operating on -strings. +bytes-like objects. The module defines these functions: @@ -57,9 +57,7 @@ The module defines these functions: .. function:: dump(value, file[, version]) Write the value on the open file. The value must be a supported type. The - file must be an open file object such as ``sys.stdout`` or returned by - :func:`open` or :func:`os.popen`. It must be opened in binary mode (``'wb'`` - or ``'w+b'``). + file must be a writeable :term:`binary file`. If the value has (or contains an object that has) an unsupported type, a :exc:`ValueError` exception is raised --- but garbage data will also be written @@ -74,8 +72,7 @@ The module defines these functions: Read one value from the open file and return it. If no valid value is read (e.g. because the data has a different Python version's incompatible marshal format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. The - file must be an open file object opened in binary mode (``'rb'`` or - ``'r+b'``). + file must be a readable :term:`binary file`. .. note:: @@ -85,7 +82,7 @@ The module defines these functions: .. function:: dumps(value[, version]) - Return the string that would be written to a file by ``dump(value, file)``. The + Return the bytes object that would be written to a file by ``dump(value, file)``. The value must be a supported type. Raise a :exc:`ValueError` exception if value has (or contains an object that has) an unsupported type. @@ -93,11 +90,11 @@ The module defines these functions: (see below). -.. function:: loads(string) +.. function:: loads(bytes) - Convert the string to a value. If no valid value is found, raise - :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. Extra characters in the - string are ignored. + Convert the :term:`bytes-like object` to a value. If no valid value is found, raise + :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. Extra bytes in the + input are ignored. In addition, the following constants are defined: diff --git a/Doc/library/mimetypes.rst b/Doc/library/mimetypes.rst index 464248c..67b7a71 100644 --- a/Doc/library/mimetypes.rst +++ b/Doc/library/mimetypes.rst @@ -186,78 +186,78 @@ than one MIME-type database; it provides an interface similar to the one of the loaded "on top" of the default database. -.. attribute:: MimeTypes.suffix_map + .. attribute:: MimeTypes.suffix_map - Dictionary mapping suffixes to suffixes. This is used to allow recognition of - encoded files for which the encoding and the type are indicated by the same - extension. For example, the :file:`.tgz` extension is mapped to :file:`.tar.gz` - to allow the encoding and type to be recognized separately. This is initially a - copy of the global :data:`suffix_map` defined in the module. + Dictionary mapping suffixes to suffixes. This is used to allow recognition of + encoded files for which the encoding and the type are indicated by the same + extension. For example, the :file:`.tgz` extension is mapped to :file:`.tar.gz` + to allow the encoding and type to be recognized separately. This is initially a + copy of the global :data:`suffix_map` defined in the module. -.. attribute:: MimeTypes.encodings_map + .. attribute:: MimeTypes.encodings_map - Dictionary mapping filename extensions to encoding types. This is initially a - copy of the global :data:`encodings_map` defined in the module. + Dictionary mapping filename extensions to encoding types. This is initially a + copy of the global :data:`encodings_map` defined in the module. -.. attribute:: MimeTypes.types_map + .. attribute:: MimeTypes.types_map - Tuple containing two dictionaries, mapping filename extensions to MIME types: - the first dictionary is for the non-standards types and the second one is for - the standard types. They are initialized by :data:`common_types` and - :data:`types_map`. + Tuple containing two dictionaries, mapping filename extensions to MIME types: + the first dictionary is for the non-standards types and the second one is for + the standard types. They are initialized by :data:`common_types` and + :data:`types_map`. -.. attribute:: MimeTypes.types_map_inv + .. attribute:: MimeTypes.types_map_inv - Tuple containing two dictionaries, mapping MIME types to a list of filename - extensions: the first dictionary is for the non-standards types and the - second one is for the standard types. They are initialized by - :data:`common_types` and :data:`types_map`. + Tuple containing two dictionaries, mapping MIME types to a list of filename + extensions: the first dictionary is for the non-standards types and the + second one is for the standard types. They are initialized by + :data:`common_types` and :data:`types_map`. -.. method:: MimeTypes.guess_extension(type, strict=True) + .. method:: MimeTypes.guess_extension(type, strict=True) - Similar to the :func:`guess_extension` function, using the tables stored as part - of the object. + Similar to the :func:`guess_extension` function, using the tables stored as part + of the object. -.. method:: MimeTypes.guess_type(url, strict=True) + .. method:: MimeTypes.guess_type(url, strict=True) - Similar to the :func:`guess_type` function, using the tables stored as part of - the object. + Similar to the :func:`guess_type` function, using the tables stored as part of + the object. -.. method:: MimeTypes.guess_all_extensions(type, strict=True) + .. method:: MimeTypes.guess_all_extensions(type, strict=True) - Similar to the :func:`guess_all_extensions` function, using the tables stored - as part of the object. + Similar to the :func:`guess_all_extensions` function, using the tables stored + as part of the object. -.. method:: MimeTypes.read(filename, strict=True) + .. method:: MimeTypes.read(filename, strict=True) - Load MIME information from a file named *filename*. This uses :meth:`readfp` to - parse the file. + Load MIME information from a file named *filename*. This uses :meth:`readfp` to + parse the file. - If *strict* is ``True``, information will be added to list of standard types, - else to the list of non-standard types. + If *strict* is ``True``, information will be added to list of standard types, + else to the list of non-standard types. -.. method:: MimeTypes.readfp(fp, strict=True) + .. method:: MimeTypes.readfp(fp, strict=True) - Load MIME type information from an open file *fp*. The file must have the format of - the standard :file:`mime.types` files. + Load MIME type information from an open file *fp*. The file must have the format of + the standard :file:`mime.types` files. - If *strict* is ``True``, information will be added to the list of standard - types, else to the list of non-standard types. + If *strict* is ``True``, information will be added to the list of standard + types, else to the list of non-standard types. -.. method:: MimeTypes.read_windows_registry(strict=True) + .. method:: MimeTypes.read_windows_registry(strict=True) - Load MIME type information from the Windows registry. Availability: Windows. + Load MIME type information from the Windows registry. Availability: Windows. - If *strict* is ``True``, information will be added to the list of standard - types, else to the list of non-standard types. + If *strict* is ``True``, information will be added to the list of standard + types, else to the list of non-standard types. - .. versionadded:: 3.2 + .. versionadded:: 3.2 diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index d45bc20..04ce8d8 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -1018,7 +1018,7 @@ Connection objects are usually created using :func:`Pipe` -- see also .. method:: recv() Return an object sent from the other end of the connection using - :meth:`send`. Blocks until there its something to receive. Raises + :meth:`send`. Blocks until there is something to receive. Raises :exc:`EOFError` if there is nothing left to receive and the other end was closed. diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 5a67f93..3aee501 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2068,7 +2068,7 @@ features: Get the status of a file or a file descriptor. Perform the equivalent of a :c:func:`stat` system call on the given path. *path* may be specified as - either a string or as an open file descriptor. Return a :class:`stat_result` + either a string, a bytes or as an open file descriptor. Return a :class:`stat_result` object. This function normally follows symlinks; to stat a symlink add the argument diff --git a/Doc/library/othergui.rst b/Doc/library/othergui.rst index ee1ce50..d40abe1 100644 --- a/Doc/library/othergui.rst +++ b/Doc/library/othergui.rst @@ -9,14 +9,15 @@ available for Python: .. seealso:: `PyGObject `_ - provides introspection bindings for C libraries using + PyGObject provides introspection bindings for C libraries using `GObject `_. One of these libraries is the `GTK+ 3 `_ widget set. GTK+ comes with many more widgets than Tkinter provides. An online `Python GTK+ 3 Tutorial `_ is available. - `PyGTK `_ provides bindings for an older version + `PyGTK `_ + PyGTK provides bindings for an older version of the library, GTK+ 2. It provides an object oriented interface that is slightly higher level than the C one. There are also bindings to `GNOME `_. An online `tutorial @@ -27,15 +28,10 @@ available for Python: extensive C++ GUI application development framework that is available for Unix, Windows and Mac OS X. :program:`sip` is a tool for generating bindings for C++ libraries as Python classes, and - is specifically designed for Python. The *PyQt3* bindings have a - book, `GUI Programming with Python: QT Edition - `_ by Boudewijn - Rempt. The *PyQt4* bindings also have a book, `Rapid GUI Programming - with Python and Qt `_, by Mark - Summerfield. + is specifically designed for Python. `PySide `_ - is a newer binding to the Qt toolkit, provided by Nokia. + PySide is a newer binding to the Qt toolkit, provided by Nokia. Compared to PyQt, its licensing scheme is friendlier to non-open source applications. @@ -49,9 +45,7 @@ available for Python: documentation and context sensitive help, printing, HTML viewing, low-level device context drawing, drag and drop, system clipboard access, an XML-based resource format and more, including an ever growing library - of user-contributed modules. wxPython has a book, `wxPython in Action - `_, by Noel Rappin and - Robin Dunn. + of user-contributed modules. PyGTK, PyQt, and wxPython, all have a modern look and feel and more widgets than Tkinter. In addition, there are many other GUI toolkits for diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index ba9e547..7bc729c 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -76,7 +76,7 @@ The typical usage to inspect a crashed program is:: >>> import mymodule >>> mymodule.test() Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in File "./mymodule.py", line 4, in test test2() File "./mymodule.py", line 3, in test2 diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst index 959d9b9..5796e3a 100644 --- a/Doc/library/profile.rst +++ b/Doc/library/profile.rst @@ -85,11 +85,11 @@ next line: ``Ordered by: standard name``, indicates that the text string in the far right column was used to sort the output. The column headings include: ncalls - for the number of calls, + for the number of calls. tottime - for the total time spent in the given function (and excluding time made in - calls to sub-functions) + for the total time spent in the given function (and excluding time made in + calls to sub-functions) percall is the quotient of ``tottime`` divided by ``ncalls`` @@ -215,11 +215,11 @@ functions: and gathers profiling statistics from the execution. If no file name is present, then this function automatically creates a :class:`~pstats.Stats` - instance and prints a simple profiling report. If the sort value is specified + instance and prints a simple profiling report. If the sort value is specified, it is passed to this :class:`~pstats.Stats` instance to control how the results are sorted. -.. function:: runctx(command, globals, locals, filename=None) +.. function:: runctx(command, globals, locals, filename=None, sort=-1) This function is similar to :func:`run`, with added arguments to supply the globals and locals dictionaries for the *command* string. This routine @@ -444,9 +444,10 @@ Analysis of the profiler data is done using the :class:`~pstats.Stats` class. significant entries. Initially, the list is taken to be the complete set of profiled functions. Each restriction is either an integer (to select a count of lines), or a decimal fraction between 0.0 and 1.0 inclusive (to - select a percentage of lines), or a regular expression (to pattern match - the standard name that is printed. If several restrictions are provided, - then they are applied sequentially. For example:: + select a percentage of lines), or a string that will interpreted as a + regular expression (to pattern match the standard name that is printed). + If several restrictions are provided, then they are applied sequentially. + For example:: print_stats(.1, 'foo:') diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst index 075a8b5..e43b9ae 100644 --- a/Doc/library/pyexpat.rst +++ b/Doc/library/pyexpat.rst @@ -869,7 +869,7 @@ The ``errors`` module has the following attributes: .. rubric:: Footnotes -.. [#] The encoding string included in XML output should conform to the +.. [1] The encoding string included in XML output should conform to the appropriate standards. For example, "UTF-8" is valid, but "UTF8" is not. See https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl and https://www.iana.org/assignments/character-sets/character-sets.xhtml. diff --git a/Doc/library/quopri.rst b/Doc/library/quopri.rst index ef2b5f2..a3f94a0 100644 --- a/Doc/library/quopri.rst +++ b/Doc/library/quopri.rst @@ -32,8 +32,8 @@ sending a graphics file. .. function:: encode(input, output, quotetabs, header=False) - Encode the contents of the *input* file and write the resulting quoted- - printable data to the *output* file. *input* and *output* must be + Encode the contents of the *input* file and write the resulting quoted-printable + data to the *output* file. *input* and *output* must be :term:`binary file objects `. *quotetabs*, a flag which controls whether to encode embedded spaces and tabs must be provideda and when true it encodes such embedded whitespace, and when false it leaves them unencoded. diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 1ca621e..26d2558 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -42,6 +42,12 @@ module-level functions and methods on that don't require you to compile a regex object first, but miss some fine-tuning parameters. +.. seealso:: + + The third-party `regex `_ module, + which has an API compatible with the standard library :mod:`re` module, + but offers additional functionality and a more thorough Unicode support. + .. _re-syntax: @@ -765,11 +771,22 @@ form. Unmatched groups are replaced with an empty string. -.. function:: escape(string) +.. function:: escape(pattern) - Escape all the characters in pattern except ASCII letters, numbers and ``'_'``. + Escape all the characters in *pattern* except ASCII letters, numbers and ``'_'``. This is useful if you want to match an arbitrary literal string that may - have regular expression metacharacters in it. + have regular expression metacharacters in it. For example:: + + >>> print(re.escape('python.exe')) + python\.exe + + >>> legal_chars = string.ascii_lowercase + string.digits + "!#$%&'*+-.^_`|~:" + >>> print('[%s]+' % re.escape(legal_chars)) + [abcdefghijklmnopqrstuvwxyz0123456789\!\#\$\%\&\'\*\+\-\.\^_\`\|\~\:]+ + + >>> operators = ['+', '-', '*', '/', '**'] + >>> print('|'.join(map(re.escape, sorted(operators, reverse=True)))) + \/|\-|\+|\*\*|\* .. versionchanged:: 3.3 The ``'_'`` character is no longer escaped. @@ -798,15 +815,15 @@ form. .. attribute:: pos - The index of *pattern* where compilation failed. + The index in *pattern* where compilation failed (may be ``None``). .. attribute:: lineno - The line corresponding to *pos*. + The line corresponding to *pos* (may be ``None``). .. attribute:: colno - The column corresponding to *pos*. + The column corresponding to *pos* (may be ``None``). .. versionchanged:: 3.5 Added additional attributes. diff --git a/Doc/library/selectors.rst b/Doc/library/selectors.rst index 1624d88..6d864a8 100644 --- a/Doc/library/selectors.rst +++ b/Doc/library/selectors.rst @@ -68,7 +68,7 @@ constants below: .. class:: SelectorKey A :class:`SelectorKey` is a :class:`~collections.namedtuple` used to - associate a file object to its underlying file decriptor, selected event + associate a file object to its underlying file descriptor, selected event mask and attached data. It is returned by several :class:`BaseSelector` methods. diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index b020bb3..3580811 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -153,7 +153,7 @@ Directory and files operations is true and *src* is a symbolic link, *dst* will be a copy of the file *src* refers to. - :func:`copy` copies the file data and the file's permission + :func:`~shutil.copy` copies the file data and the file's permission mode (see :func:`os.chmod`). Other metadata, like the file's creation and modification times, is not preserved. To preserve all file metadata from the original, use @@ -302,7 +302,7 @@ Directory and files operations *src* and *dst*, and will be used to copy *src* to *dest* if :func:`os.rename` cannot be used. If the source is a directory, :func:`copytree` is called, passing it the :func:`copy_function`. The - default *copy_function* is :func:`copy2`. Using :func:`copy` as the + default *copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the *copy_function* allows the move to succeed when it is not possible to also copy the metadata, at the expense of not copying any of the metadata. diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst index 039b666..46d71de 100644 --- a/Doc/library/signal.rst +++ b/Doc/library/signal.rst @@ -306,8 +306,10 @@ The :mod:`signal` module defines the following functions: a library to wakeup a poll or select call, allowing the signal to be fully processed. - The old wakeup fd is returned. *fd* must be non-blocking. It is up to the - library to remove any bytes before calling poll or select again. + The old wakeup fd is returned (or -1 if file descriptor wakeup was not + enabled). If *fd* is -1, file descriptor wakeup is disabled. + If not -1, *fd* must be non-blocking. It is up to the library to remove + any bytes from *fd* before calling poll or select again. Use for example ``struct.unpack('%uB' % len(data), data)`` to decode the signal numbers list. diff --git a/Doc/library/smtpd.rst b/Doc/library/smtpd.rst index a096de0..4d5a0ce 100644 --- a/Doc/library/smtpd.rst +++ b/Doc/library/smtpd.rst @@ -13,6 +13,12 @@ This module offers several classes to implement SMTP (email) servers. +.. seealso:: + + The `aiosmtpd `_ package is a recommended + replacement for this module. It is based on :mod:`asyncio` and provides a + more straightforward API. :mod:`smtpd` should be considered deprecated. + Several server implementations are present; one is a generic do-nothing implementation, which can be overridden, while the other two offer specific mail-sending strategies. diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index 530000b..f8ba847 100644 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -1288,8 +1288,8 @@ to sockets. to transmit as opposed to sending the file until EOF is reached. File position is updated on return or also in case of error in which case :meth:`file.tell() ` can be used to figure out the number of - bytes which were sent. The socket must be of :const:`SOCK_STREAM` type. Non- - blocking sockets are not supported. + bytes which were sent. The socket must be of :const:`SOCK_STREAM` type. + Non-blocking sockets are not supported. .. versionadded:: 3.5 diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 84a4783..1419ce0 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -633,6 +633,11 @@ Cursor Objects method. For operations other than ``INSERT`` or when :meth:`executemany` is called, :attr:`lastrowid` is set to :const:`None`. + .. attribute:: arraysize + + Read/write attribute that controls the number of rows returned by :meth:`fetchmany`. + The default value is 1 which means a single row would be fetched per call. + .. attribute:: description This read-only attribute provides the column names of the last query. To diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 71cb7f2..3e279e6 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -108,11 +108,11 @@ Notes: (1) This is a short-circuit operator, so it only evaluates the second - argument if the first one is :const:`False`. + argument if the first one is false. (2) This is a short-circuit operator, so it only evaluates the second - argument if the first one is :const:`True`. + argument if the first one is true. (3) ``not`` has a lower priority than non-Boolean operators, so ``not a == b`` is @@ -394,10 +394,12 @@ Bitwise Operations on Integer Types pair: bitwise; operations pair: shifting; operations pair: masking; operations + operator: | operator: ^ operator: & operator: << operator: >> + operator: ~ Bitwise operations only make sense for integers. Negative numbers are treated as their 2's complement value (this assumes that there are enough bits so that @@ -829,7 +831,7 @@ restrictions imposed by *s*. The ``in`` and ``not in`` operations have the same priorities as the comparison operations. The ``+`` (concatenation) and ``*`` (repetition) -operations have the same priority as the corresponding numeric operations. +operations have the same priority as the corresponding numeric operations. [3]_ .. index:: triple: operations on; sequence; types @@ -1714,10 +1716,10 @@ expression support in the :mod:`re` module). .. method:: str.join(iterable) - Return a string which is the concatenation of the strings in the - :term:`iterable` *iterable*. A :exc:`TypeError` will be raised if there are - any non-string values in *iterable*, including :class:`bytes` objects. The - separator between elements is the string providing this method. + Return a string which is the concatenation of the strings in *iterable*. + A :exc:`TypeError` will be raised if there are any non-string values in + *iterable*, including :class:`bytes` objects. The separator between + elements is the string providing this method. .. method:: str.ljust(width[, fillchar]) @@ -2533,11 +2535,11 @@ arbitrary binary data. bytearray.join(iterable) Return a bytes or bytearray object which is the concatenation of the - binary data sequences in the :term:`iterable` *iterable*. A - :exc:`TypeError` will be raised if there are any values in *iterable* - that are not :term:`bytes-like objects `, including - :class:`str` objects. The separator between elements is the contents - of the bytes or bytearray object providing this method. + binary data sequences in *iterable*. A :exc:`TypeError` will be raised + if there are any values in *iterable* that are not :term:`bytes-like + objects `, including :class:`str` objects. The + separator between elements is the contents of the bytes or + bytearray object providing this method. .. staticmethod:: bytes.maketrans(from, to) @@ -3973,9 +3975,7 @@ The constructors for both classes work the same: Note, the *elem* argument to the :meth:`__contains__`, :meth:`remove`, and :meth:`discard` methods may be a set. To support searching for an equivalent - frozenset, the *elem* set is temporarily mutated during the search and then - restored. During the search, the *elem* set should not be read or mutated - since it does not have a meaningful value. + frozenset, a temporary one is created from *elem*. .. _typesmapping: diff --git a/Doc/library/sunau.rst b/Doc/library/sunau.rst index 1ecc7a7..c8357e4 100644 --- a/Doc/library/sunau.rst +++ b/Doc/library/sunau.rst @@ -118,7 +118,7 @@ AU_read objects, as returned by :func:`.open` above, have the following methods: .. method:: AU_read.getnchannels() - Returns number of audio channels (1 for mone, 2 for stereo). + Returns number of audio channels (1 for mono, 2 for stereo). .. method:: AU_read.getsampwidth() diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index d28ea5d..c2a1109 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1220,7 +1220,7 @@ always available. | | * ``None`` if this information is unknown | +------------------+---------------------------------------------------------+ | :const:`version` | Name and version of the thread library. It is a string, | - | | or ``None`` if these informations are unknown. | + | | or ``None`` if this information is unknown. | +------------------+---------------------------------------------------------+ .. versionadded:: 3.3 diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst index 02aaab3..4cbe239 100644 --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -255,7 +255,6 @@ You can use :mod:`sysconfig` as a script with Python's *-m* option: AIX_GENUINE_CPLUSPLUS = "0" AR = "ar" ARFLAGS = "rc" - ASDLGEN = "./Parser/asdl_c.py" ... This call will print in the standard output the information returned by diff --git a/Doc/library/tabnanny.rst b/Doc/library/tabnanny.rst index 1edb0fb..dfe688a 100644 --- a/Doc/library/tabnanny.rst +++ b/Doc/library/tabnanny.rst @@ -48,14 +48,14 @@ described below. .. exception:: NannyNag - Raised by :func:`tokeneater` if detecting an ambiguous indent. Captured and + Raised by :func:`process_tokens` if detecting an ambiguous indent. Captured and handled in :func:`check`. -.. function:: tokeneater(type, token, start, end, line) +.. function:: process_tokens(tokens) - This function is used by :func:`check` as a callback parameter to the function - :func:`tokenize.tokenize`. + This function is used by :func:`check` to process tokens generated by the + :mod:`tokenize` module. .. XXX document errprint, format_witnesses, Whitespace, check_equal, indents, reset_globals diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst index 665261f..c59aca1 100644 --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -245,12 +245,12 @@ The module uses a global variable to store the name of the directory used for temporary files returned by :func:`gettempdir`. It can be set directly to override the selection process, but this is discouraged. All functions in this module take a *dir* argument which can be used -to specify the directory and this is the recommend approach. +to specify the directory and this is the recommended approach. .. data:: tempdir When set to a value other than ``None``, this variable defines the - default value for the *dir* argument to all the functions defined in this + default value for the *dir* argument to the functions defined in this module. If ``tempdir`` is unset or ``None`` at any call to any of the above diff --git a/Doc/library/test.rst b/Doc/library/test.rst index 59577f0..2777128 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -570,7 +570,8 @@ The :mod:`test.support` module defines the following functions: def load_tests(*args): return load_package_tests(os.path.dirname(__file__), *args) -.. function:: detect_api_mismatch(ref_api, other_api, *, ignore=()): + +.. function:: detect_api_mismatch(ref_api, other_api, *, ignore=()) Returns the set of attributes, functions or methods of *ref_api* not found on *other_api*, except for a defined list of items to be diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 2792dfd..cda859f 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -371,8 +371,9 @@ All methods are executed atomically. lock, subsequent attempts to acquire it block, until it is released; any thread may release it. - .. versionchanged:: 3.3 - Changed from a factory function to a class. + Note that ``Lock`` is actually a factory function which returns an instance + of the most efficient version of the concrete Lock class that is supported + by the platform. .. method:: acquire(blocking=True, timeout=-1) diff --git a/Doc/library/time.rst b/Doc/library/time.rst index e6626f2..92e7ce0 100644 --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -17,11 +17,23 @@ semantics of these functions varies among platforms. An explanation of some terminology and conventions is in order. +.. _epoch: + .. index:: single: epoch -* The :dfn:`epoch` is the point where the time starts. On January 1st of that - year, at 0 hours, the "time since the epoch" is zero. For Unix, the epoch is - 1970. To find out what the epoch is, look at ``gmtime(0)``. +* The :dfn:`epoch` is the point where the time starts, and is platform + dependent. For Unix, the epoch is January 1, 1970, 00:00:00 (UTC). + To find out what the epoch is on a given platform, look at + ``time.gmtime(0)``. + +.. _leap seconds: https://en.wikipedia.org/wiki/Leap_second + +.. index:: seconds since the epoch + +* The term :dfn:`seconds since the epoch` refers to the total number + of elapsed seconds since the epoch, typically excluding + `leap seconds`_. Leap seconds are excluded from this total on all + POSIX-compliant platforms. .. index:: single: Year 2038 @@ -463,7 +475,7 @@ The module defines the following functions and data items: (2) The range really is ``0`` to ``61``; value ``60`` is valid in - timestamps representing leap seconds and value ``61`` is supported + timestamps representing `leap seconds`_ and value ``61`` is supported for historical reasons. (3) @@ -572,12 +584,28 @@ The module defines the following functions and data items: .. function:: time() - Return the time in seconds since the epoch as a floating point number. + Return the time in seconds since the epoch_ as a floating point + number. The specific date of the epoch and the handling of + `leap seconds`_ is platform dependent. + On Windows and most Unix systems, the epoch is January 1, 1970, + 00:00:00 (UTC) and leap seconds are not counted towards the time + in seconds since the epoch. This is commonly referred to as + `Unix time `_. + To find out what the epoch is on a given platform, look at + ``gmtime(0)``. + Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a - lower value than a previous call if the system clock has been set back between - the two calls. + lower value than a previous call if the system clock has been set back + between the two calls. + + The number returned by :func:`.time` may be converted into a more common + time format (i.e. year, month, day, hour, etc...) in UTC by passing it to + :func:`gmtime` function or in local time by passing it to the + :func:`localtime` function. In both cases a + :class:`struct_time` object is returned, from which the components + of the calendar date may be accessed as attributes. .. data:: timezone diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 3c1d9bb..fc052f2 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -45,9 +45,9 @@ The module defines the following functions: * if *tb* is not ``None``, it prints a header ``Traceback (most recent call last):`` * it prints the exception *etype* and *value* after the stack trace - * if *etype* is :exc:`SyntaxError` and *value* has the appropriate format, it - prints the line where the syntax error occurred with a caret indicating the - approximate position of the error. + * if *type(value)* is :exc:`SyntaxError` and *value* has the appropriate + format, it prints the line where the syntax error occurred with a caret + indicating the approximate position of the error. The optional *limit* argument has the same meaning as for :func:`print_tb`. If *chain* is true (the default), then chained exceptions (the @@ -55,6 +55,9 @@ The module defines the following functions: printed as well, like the interpreter itself does when printing an unhandled exception. + .. versionchanged:: 3.5 + The *etype* argument is ignored and inferred from the type of *value*. + .. function:: print_exc(limit=None, file=None, chain=True) @@ -131,6 +134,9 @@ The module defines the following functions: containing internal newlines. When these lines are concatenated and printed, exactly the same text is printed as does :func:`print_exception`. + .. versionchanged:: 3.5 + The *etype* argument is ignored and inferred from the type of *value*. + .. function:: format_exc(limit=None, chain=True) @@ -358,6 +364,7 @@ exception and traceback: print("*** print_tb:") traceback.print_tb(exc_traceback, limit=1, file=sys.stdout) print("*** print_exception:") + # exc_type below is ignored on 3.5 and later traceback.print_exception(exc_type, exc_value, exc_traceback, limit=2, file=sys.stdout) print("*** print_exc:") @@ -367,6 +374,7 @@ exception and traceback: print(formatted_lines[0]) print(formatted_lines[-1]) print("*** format_exception:") + # exc_type below is ignored on 3.5 and later print(repr(traceback.format_exception(exc_type, exc_value, exc_traceback))) print("*** extract_tb:") diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index 1986972..2b5d3e5 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -1797,7 +1797,7 @@ Input methods :param prompt: string Pop up a dialog window for input of a string. Parameter title is - the title of the dialog window, propmt is a text mostly describing + the title of the dialog window, prompt is a text mostly describing what information to input. Return the string input. If the dialog is canceled, return ``None``. :: @@ -2368,7 +2368,7 @@ The demo scripts are: | wikipedia | a pattern from the wikipedia | :func:`clone`, | | | article on turtle graphics | :func:`undo` | +----------------+------------------------------+-----------------------+ -| yingyang | another elementary example | :func:`circle` | +| yinyang | another elementary example | :func:`circle` | +----------------+------------------------------+-----------------------+ Have fun! diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 923cbb8..adaad29 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -299,7 +299,7 @@ comparable for equality. The :data:`Any` type ---------------------- +-------------------- A special kind of type is :data:`Any`. A static type checker will treat every type as being compatible with :data:`Any` and :data:`Any` as being @@ -557,6 +557,12 @@ The module defines the following classes, functions and decorators: As a shorthand for this type, :class:`bytes` can be used to annotate arguments of any of the types mentioned above. +.. class:: Deque(deque, MutableSequence[T]) + + A generic version of :class:`collections.deque`. + + .. versionadded:: 3.5.4 + .. class:: List(list, MutableSequence[T]) Generic version of :class:`list`. @@ -621,7 +627,7 @@ The module defines the following classes, functions and decorators: .. class:: AsyncIterator(AsyncIterable[T_co]) - A generic version of :class:`collections.abc.AsyncIterator`. + A generic version of :class:`collections.abc.AsyncIterator`. .. class:: Dict(dict, MutableMapping[KT, VT]) @@ -666,6 +672,39 @@ The module defines the following classes, functions and decorators: yield start start += 1 +.. class:: AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra]) + + An async generator can be annotated by the generic type + ``AsyncGenerator[YieldType, SendType]``. For example:: + + async def echo_round() -> AsyncGenerator[int, float]: + sent = yield 0 + while sent >= 0.0: + rounded = await round(sent) + sent = yield rounded + + Unlike normal generators, async generators cannot return a value, so there + is no ``ReturnType`` type parameter. As with :class:`Generator`, the + ``SendType`` behaves contravariantly. + + If your generator will only yield values, set the ``SendType`` to + ``None``:: + + async def infinite_stream(start: int) -> AsyncGenerator[int, None]: + while True: + yield start + start = await increment(start) + + Alternatively, annotate your generator as having a return type of + either ``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``:: + + async def infinite_stream(start: int) -> AsyncIterator[int]: + while True: + yield start + start = await increment(start) + + .. versionadded:: 3.5.4 + .. class:: Text ``Text`` is an alias for ``str``. It is provided to supply a forward @@ -822,7 +861,7 @@ The module defines the following classes, functions and decorators: Union[int, str] == Union[str, int] - * When a class and its subclass are present, the former is skipped, e.g.:: + * When a class and its subclass are present, the latter is skipped, e.g.:: Union[int, object] == object @@ -924,5 +963,10 @@ The module defines the following classes, functions and decorators: if TYPE_CHECKING: import expensive_mod - def fun(): - local_var: expensive_mod.some_type = other_fun() + def fun(arg: 'expensive_mod.SomeType') -> None: + local_var: expensive_mod.AnotherType = other_fun() + + Note that the first type annotation must be enclosed in quotes, making it a + "forward reference", to hide the ``expensive_mod`` reference from the + interpreter runtime. Type annotations for local variables are not + evaluated, so the second annotation does not need to be enclosed in quotes. diff --git a/Doc/library/unicodedata.rst b/Doc/library/unicodedata.rst index 6cd8132..51b0b66 100644 --- a/Doc/library/unicodedata.rst +++ b/Doc/library/unicodedata.rst @@ -158,7 +158,7 @@ Examples: 9 >>> unicodedata.decimal('a') Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in ValueError: not a decimal >>> unicodedata.category('A') # 'L'etter, 'u'ppercase 'Lu' diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index ef30c01..1169f0b 100644 --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -275,14 +275,14 @@ the *new_callable* argument to :func:`patch`. .. method:: assert_called_once_with(*args, **kwargs) - Assert that the mock was called exactly once and with the specified - arguments. + Assert that the mock was called exactly once and that that call was + with the specified arguments. >>> mock = Mock(return_value=None) >>> mock('foo', bar='baz') >>> mock.assert_called_once_with('foo', bar='baz') - >>> mock('foo', bar='baz') - >>> mock.assert_called_once_with('foo', bar='baz') + >>> mock('other', bar='values') + >>> mock.assert_called_once_with('other', bar='values') Traceback (most recent call last): ... AssertionError: Expected 'mock' to be called once. Called 2 times. @@ -294,7 +294,8 @@ the *new_callable* argument to :func:`patch`. The assert passes if the mock has *ever* been called, unlike :meth:`assert_called_with` and :meth:`assert_called_once_with` that - only pass if the call is the most recent one. + only pass if the call is the most recent one, and in the case of + :meth:`assert_called_once_with` it must also be the only call. >>> mock = Mock(return_value=None) >>> mock(1, 2, arg='thing') @@ -1795,6 +1796,9 @@ sentinel the same attribute will always return the same object. The objects returned have a sensible repr so that test failure messages are readable. + The ``sentinel`` attributes don't preserve their identity when they are + :mod:`copied ` or :mod:`pickled `. + Sometimes when testing you need to test that a specific object is passed as an argument to another method, or returned. It can be common to create named sentinel objects to test this. :data:`sentinel` provides a convenient way of diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index ac1224c..2790762 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -1170,6 +1170,9 @@ Test cases :meth:`.assertRegex`. .. versionadded:: 3.2 :meth:`.assertNotRegex`. + .. versionadded:: 3.5 + The name ``assertNotRegexpMatches`` is a deprecated alias + for :meth:`.assertNotRegex`. .. method:: assertCountEqual(first, second, msg=None) @@ -1435,9 +1438,9 @@ For historical reasons, some of the :class:`TestCase` methods had one or more aliases that are now deprecated. The following table lists the correct names along with their deprecated aliases: - ============================== ====================== ====================== + ============================== ====================== ======================= Method Name Deprecated alias Deprecated alias - ============================== ====================== ====================== + ============================== ====================== ======================= :meth:`.assertEqual` failUnlessEqual assertEquals :meth:`.assertNotEqual` failIfEqual assertNotEquals :meth:`.assertTrue` failUnless assert\_ @@ -1446,8 +1449,9 @@ along with their deprecated aliases: :meth:`.assertAlmostEqual` failUnlessAlmostEqual assertAlmostEquals :meth:`.assertNotAlmostEqual` failIfAlmostEqual assertNotAlmostEquals :meth:`.assertRegex` assertRegexpMatches + :meth:`.assertNotRegex` assertNotRegexpMatches :meth:`.assertRaisesRegex` assertRaisesRegexp - ============================== ====================== ====================== + ============================== ====================== ======================= .. deprecated:: 3.1 the fail* aliases listed in the second column. @@ -1455,8 +1459,9 @@ along with their deprecated aliases: the assert* aliases listed in the third column. .. deprecated:: 3.2 ``assertRegexpMatches`` and ``assertRaisesRegexp`` have been renamed to - :meth:`.assertRegex` and :meth:`.assertRaisesRegex` - + :meth:`.assertRegex` and :meth:`.assertRaisesRegex`. + .. deprecated:: 3.5 + the ``assertNotRegexpMatches`` name in favor of :meth:`.assertNotRegex`. .. _testsuite-objects: @@ -1465,7 +1470,7 @@ Grouping tests .. class:: TestSuite(tests=()) - This class represents an aggregation of individual tests cases and test suites. + This class represents an aggregation of individual test cases and test suites. The class presents the interface needed by the test runner to allow it to be run as any other test case. Running a :class:`TestSuite` instance is the same as iterating over the suite, running each test individually. @@ -1573,7 +1578,7 @@ Loading and running tests .. method:: loadTestsFromTestCase(testCaseClass) - Return a suite of all tests cases contained in the :class:`TestCase`\ -derived + Return a suite of all test cases contained in the :class:`TestCase`\ -derived :class:`testCaseClass`. A test case instance is created for each method named by @@ -1585,7 +1590,7 @@ Loading and running tests .. method:: loadTestsFromModule(module, pattern=None) - Return a suite of all tests cases contained in the given module. This + Return a suite of all test cases contained in the given module. This method searches *module* for classes derived from :class:`TestCase` and creates an instance of the class for each test method defined for the class. @@ -1615,7 +1620,7 @@ Loading and running tests .. method:: loadTestsFromName(name, module=None) - Return a suite of all tests cases given a string specifier. + Return a suite of all test cases given a string specifier. The specifier *name* is a "dotted name" that may resolve either to a module, a test case class, a test method within a test case class, a @@ -1637,11 +1642,11 @@ Loading and running tests The method optionally resolves *name* relative to the given *module*. - .. versionchanged:: 3.5 - If an :exc:`ImportError` or :exc:`AttributeError` occurs while traversing - *name* then a synthetic test that raises that error when run will be - returned. These errors are included in the errors accumulated by - self.errors. + .. versionchanged:: 3.5 + If an :exc:`ImportError` or :exc:`AttributeError` occurs while traversing + *name* then a synthetic test that raises that error when run will be + returned. These errors are included in the errors accumulated by + self.errors. .. method:: loadTestsFromNames(names, module=None) diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 499b211..6f722a8 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -117,6 +117,9 @@ or on combining URL components into a URL string. See section :ref:`urlparse-result-object` for more information on the result object. + Unmatched square brackets in the :attr:`netloc` attribute will raise a + :exc:`ValueError`. + .. versionchanged:: 3.2 Added IPv6 URL parsing capabilities. @@ -230,6 +233,9 @@ or on combining URL components into a URL string. See section :ref:`urlparse-result-object` for more information on the result object. + Unmatched square brackets in the :attr:`netloc` attribute will raise a + :exc:`ValueError`. + .. function:: urlunsplit(parts) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 618c69d..63530e1 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -173,15 +173,15 @@ The :mod:`urllib.request` module defines the following functions: If both lowercase and uppercase environment variables exist (and disagree), lowercase is preferred. - .. note:: + .. note:: - If the environment variable ``REQUEST_METHOD`` is set, which usually - indicates your script is running in a CGI environment, the environment - variable ``HTTP_PROXY`` (uppercase ``_PROXY``) will be ignored. This is - because that variable can be injected by a client using the "Proxy:" HTTP - header. If you need to use an HTTP proxy in a CGI environment, either use - ``ProxyHandler`` explicitly, or make sure the variable name is in - lowercase (or at least the ``_proxy`` suffix). + If the environment variable ``REQUEST_METHOD`` is set, which usually + indicates your script is running in a CGI environment, the environment + variable ``HTTP_PROXY`` (uppercase ``_PROXY``) will be ignored. This is + because that variable can be injected by a client using the "Proxy:" HTTP + header. If you need to use an HTTP proxy in a CGI environment, either use + ``ProxyHandler`` explicitly, or make sure the variable name is in + lowercase (or at least the ``_proxy`` suffix). The following classes are provided: @@ -1388,48 +1388,48 @@ some point in the future. :class:`URLopener` objects will raise an :exc:`OSError` exception if the server returns an error code. - .. method:: open(fullurl, data=None) + .. method:: open(fullurl, data=None) - Open *fullurl* using the appropriate protocol. This method sets up cache and - proxy information, then calls the appropriate open method with its input - arguments. If the scheme is not recognized, :meth:`open_unknown` is called. - The *data* argument has the same meaning as the *data* argument of - :func:`urlopen`. + Open *fullurl* using the appropriate protocol. This method sets up cache and + proxy information, then calls the appropriate open method with its input + arguments. If the scheme is not recognized, :meth:`open_unknown` is called. + The *data* argument has the same meaning as the *data* argument of + :func:`urlopen`. - .. method:: open_unknown(fullurl, data=None) + .. method:: open_unknown(fullurl, data=None) - Overridable interface to open unknown URL types. + Overridable interface to open unknown URL types. - .. method:: retrieve(url, filename=None, reporthook=None, data=None) + .. method:: retrieve(url, filename=None, reporthook=None, data=None) - Retrieves the contents of *url* and places it in *filename*. The return value - is a tuple consisting of a local filename and either an - :class:`email.message.Message` object containing the response headers (for remote - URLs) or ``None`` (for local URLs). The caller must then open and read the - contents of *filename*. If *filename* is not given and the URL refers to a - local file, the input filename is returned. If the URL is non-local and - *filename* is not given, the filename is the output of :func:`tempfile.mktemp` - with a suffix that matches the suffix of the last path component of the input - URL. If *reporthook* is given, it must be a function accepting three numeric - parameters: A chunk number, the maximum size chunks are read in and the total size of the download - (-1 if unknown). It will be called once at the start and after each chunk of data is read from the - network. *reporthook* is ignored for local URLs. + Retrieves the contents of *url* and places it in *filename*. The return value + is a tuple consisting of a local filename and either an + :class:`email.message.Message` object containing the response headers (for remote + URLs) or ``None`` (for local URLs). The caller must then open and read the + contents of *filename*. If *filename* is not given and the URL refers to a + local file, the input filename is returned. If the URL is non-local and + *filename* is not given, the filename is the output of :func:`tempfile.mktemp` + with a suffix that matches the suffix of the last path component of the input + URL. If *reporthook* is given, it must be a function accepting three numeric + parameters: A chunk number, the maximum size chunks are read in and the total size of the download + (-1 if unknown). It will be called once at the start and after each chunk of data is read from the + network. *reporthook* is ignored for local URLs. - If the *url* uses the :file:`http:` scheme identifier, the optional *data* - argument may be given to specify a ``POST`` request (normally the request type - is ``GET``). The *data* argument must in standard - :mimetype:`application/x-www-form-urlencoded` format; see the - :func:`urllib.parse.urlencode` function. + If the *url* uses the :file:`http:` scheme identifier, the optional *data* + argument may be given to specify a ``POST`` request (normally the request type + is ``GET``). The *data* argument must in standard + :mimetype:`application/x-www-form-urlencoded` format; see the + :func:`urllib.parse.urlencode` function. - .. attribute:: version + .. attribute:: version - Variable that specifies the user agent of the opener object. To get - :mod:`urllib` to tell servers that it is a particular user agent, set this in a - subclass as a class variable or in the constructor before calling the base - constructor. + Variable that specifies the user agent of the opener object. To get + :mod:`urllib` to tell servers that it is a particular user agent, set this in a + subclass as a class variable or in the constructor before calling the base + constructor. .. class:: FancyURLopener(...) diff --git a/Doc/library/uuid.rst b/Doc/library/uuid.rst index 91dbca2..edbf832 100644 --- a/Doc/library/uuid.rst +++ b/Doc/library/uuid.rst @@ -111,7 +111,7 @@ random UUID. .. attribute:: UUID.variant The UUID variant, which determines the internal layout of the UUID. This will be - one of the integer constants :const:`RESERVED_NCS`, :const:`RFC_4122`, + one of the constants :const:`RESERVED_NCS`, :const:`RFC_4122`, :const:`RESERVED_MICROSOFT`, or :const:`RESERVED_FUTURE`. diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst index e289b97..b02a006 100644 --- a/Doc/library/weakref.rst +++ b/Doc/library/weakref.rst @@ -166,8 +166,8 @@ Extension types can easily be made to support weak references; see performed by the program during iteration may cause items in the dictionary to vanish "by magic" (as a side effect of garbage collection). -:class:`WeakKeyDictionary` objects have the following additional methods. These -expose the internal references directly. The references are not guaranteed to +:class:`WeakKeyDictionary` objects have an additional method that +exposes the internal references directly. The references are not guaranteed to be "live" at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the keys around longer @@ -192,9 +192,9 @@ than needed. by the program during iteration may cause items in the dictionary to vanish "by magic" (as a side effect of garbage collection). -:class:`WeakValueDictionary` objects have the following additional methods. -These method have the same issues as the and :meth:`keyrefs` method of -:class:`WeakKeyDictionary` objects. +:class:`WeakValueDictionary` objects have an additional method that has the +same issues as the :meth:`keyrefs` method of :class:`WeakKeyDictionary` +objects. .. method:: WeakValueDictionary.valuerefs() diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst index 2e9e814..40470e8 100644 --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -248,7 +248,7 @@ utility to most DOM users. .. rubric:: Footnotes -.. [#] The encoding name included in the XML output should conform to +.. [1] The encoding name included in the XML output should conform to the appropriate standards. For example, "UTF-8" is valid, but "UTF8" is not valid in an XML document's declaration, even though Python accepts it as an encoding name. diff --git a/Doc/library/xml.dom.pulldom.rst b/Doc/library/xml.dom.pulldom.rst index b502554..5c0f469 100644 --- a/Doc/library/xml.dom.pulldom.rst +++ b/Doc/library/xml.dom.pulldom.rst @@ -108,7 +108,7 @@ DOMEventStream Objects :class:`xml.dom.minidom.Element` if event equals :data:`START_ELEMENT` or :data:`END_ELEMENT` or :class:`xml.dom.minidom.Text` if event equals :data:`CHARACTERS`. - The current node does not contain informations about its children, unless + The current node does not contain information about its children, unless :func:`expandNode` is called. .. method:: expandNode(node) diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst index b54eace..7d814ad 100644 --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -1192,7 +1192,7 @@ Exceptions .. rubric:: Footnotes -.. [#] The encoding string included in XML output should conform to the +.. [1] The encoding string included in XML output should conform to the appropriate standards. For example, "UTF-8" is valid, but "UTF8" is not. See https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl and https://www.iana.org/assignments/character-sets/character-sets.xhtml. diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index d144ae3..629b7ed 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -418,12 +418,12 @@ The :class:`PyZipFile` constructor takes the same parameters as the added to the archive, compiling if necessary. If *pathname* is a file, the filename must end with :file:`.py`, and - just the (corresponding :file:`\*.py[co]`) file is added at the top level + just the (corresponding :file:`\*.pyc`) file is added at the top level (no path information). If *pathname* is a file that does not end with :file:`.py`, a :exc:`RuntimeError` will be raised. If it is a directory, and the directory is not a package directory, then all the files - :file:`\*.py[co]` are added at the top level. If the directory is a - package directory, then all :file:`\*.py[co]` are added under the package + :file:`\*.pyc` are added at the top level. If the directory is a + package directory, then all :file:`\*.pyc` are added under the package name as a file path, and if any subdirectories are package directories, all of these are added recursively. diff --git a/Doc/library/zipimport.rst b/Doc/library/zipimport.rst index 46b8c24..eaae2bb 100644 --- a/Doc/library/zipimport.rst +++ b/Doc/library/zipimport.rst @@ -9,7 +9,7 @@ -------------- This module adds the ability to import Python modules (:file:`\*.py`, -:file:`\*.py[co]`) and packages from ZIP-format archives. It is usually not +:file:`\*.pyc`) and packages from ZIP-format archives. It is usually not needed to use the :mod:`zipimport` module explicitly; it is automatically used by the built-in :keyword:`import` mechanism for :data:`sys.path` items that are paths to ZIP archives. diff --git a/Doc/make.bat b/Doc/make.bat index 5ab8085..740f148 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -86,7 +86,7 @@ goto end :build if NOT "%PAPER%" == "" ( - set SPHINXOPTS=-D latex_paper_size=%PAPER% %SPHINXOPTS% + set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS% ) cmd /C %SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . %BUILDDIR%\%* diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 2f5625b..d015da2 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -765,9 +765,9 @@ Custom classes Special attributes: :attr:`~definition.__name__` is the class name; :attr:`__module__` is the module name in which the class was defined; :attr:`~object.__dict__` is the dictionary containing the class's namespace; :attr:`~class.__bases__` is a - tuple (possibly a singleton) containing the base classes, in the - order of their occurrence in the base class list; :attr:`__doc__` is the - class's documentation string, or ``None`` if undefined. + tuple containing the base classes, in the order of their occurrence in the + base class list; :attr:`__doc__` is the class's documentation string, or + ``None`` if undefined. Class instances .. index:: @@ -1088,9 +1088,9 @@ Basic customization (usually an instance of *cls*). Typical implementations create a new instance of the class by invoking the - superclass's :meth:`__new__` method using ``super(currentclass, - cls).__new__(cls[, ...])`` with appropriate arguments and then modifying the - newly-created instance as necessary before returning it. + superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` + with appropriate arguments and then modifying the newly-created instance + as necessary before returning it. If :meth:`__new__` returns an instance of *cls*, then the new instance's :meth:`__init__` method will be invoked like ``__init__(self[, ...])``, where @@ -1114,7 +1114,7 @@ Basic customization class constructor expression. If a base class has an :meth:`__init__` method, the derived class's :meth:`__init__` method, if any, must explicitly call it to ensure proper initialization of the base class part of the - instance; for example: ``BaseClass.__init__(self, [args...])``. + instance; for example: ``super().__init__([args...])``. Because :meth:`__new__` and :meth:`__init__` work together in constructing objects (:meth:`__new__` to create it, and :meth:`__init__` to customize it), @@ -1538,8 +1538,8 @@ Class Binding ``A.__dict__['x'].__get__(None, A)``. Super Binding - If ``a`` is an instance of :class:`super`, then the binding ``super(B, - obj).m()`` searches ``obj.__class__.__mro__`` for the base class ``A`` + If ``a`` is an instance of :class:`super`, then the binding ``super(B, obj).m()`` + searches ``obj.__class__.__mro__`` for the base class ``A`` immediately preceding ``B`` and then invokes the descriptor with the call: ``A.__dict__['m'].__get__(obj, obj.__class__)``. @@ -1887,6 +1887,14 @@ through the container; for mappings, :meth:`__iter__` should be the same as :meth:`__bool__` method and whose :meth:`__len__` method returns zero is considered to be false in a Boolean context. + .. impl-detail:: + + In CPython, the length is required to be at most :attr:`sys.maxsize`. + If the length is larger than :attr:`!sys.maxsize` some features (such as + :func:`len`) may raise :exc:`OverflowError`. To prevent raising + :exc:`!OverflowError` by truth value testing, an object must define a + :meth:`__bool__` method. + .. method:: object.__length_hint__(self) @@ -1897,6 +1905,7 @@ through the container; for mappings, :meth:`__iter__` should be the same as .. versionadded:: 3.4 + .. note:: Slicing is done exclusively with the following three methods. A call like :: diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst index 5f1ea92..f0dbbd1 100644 --- a/Doc/reference/executionmodel.rst +++ b/Doc/reference/executionmodel.rst @@ -194,12 +194,6 @@ This means that the following code will print 42:: i = 42 f() -There are several cases where Python statements are illegal when used in -conjunction with nested scopes that contain free variables. - -If a variable is referenced in an enclosing scope, it is illegal to delete the -name. An error will be reported at compile time. - .. XXX from * also invalid with relative imports (at least currently) The :func:`eval` and :func:`exec` functions do not have access to the full diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 9792399..437a350 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -745,7 +745,7 @@ keyword arguments (and any ``**expression`` arguments -- see below). So:: 2 1 >>> f(a=1, *(2,)) Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in TypeError: f() got multiple values for keyword argument 'a' >>> f(1, *(2,)) 1 2 @@ -1195,7 +1195,7 @@ built-in types. true). * Mappings (instances of :class:`dict`) compare equal if and only if they have - equal `(key, value)` pairs. Equality comparison of the keys and elements + equal `(key, value)` pairs. Equality comparison of the keys and values enforces reflexivity. Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`. @@ -1255,6 +1255,10 @@ some consistency rules, if possible: sequences, but not to sets or mappings). See also the :func:`~functools.total_ordering` decorator. +* The :func:`hash` result should be consistent with equality. + Objects that are equal should either have the same hash value, + or be marked as unhashable. + Python does not enforce these consistency rules. In fact, the not-a-number values are an example for not following these rules. @@ -1267,28 +1271,29 @@ Membership test operations -------------------------- The operators :keyword:`in` and :keyword:`not in` test for membership. ``x in -s`` evaluates to true if *x* is a member of *s*, and false otherwise. ``x not -in s`` returns the negation of ``x in s``. All built-in sequences and set types -support this as well as dictionary, for which :keyword:`in` tests whether the -dictionary has a given key. For container types such as list, tuple, set, -frozenset, dict, or collections.deque, the expression ``x in y`` is equivalent +s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` otherwise. +``x not in s`` returns the negation of ``x in s``. All built-in sequences and +set types support this as well as dictionary, for which :keyword:`in` tests +whether the dictionary has a given key. For container types such as list, tuple, +set, frozenset, dict, or collections.deque, the expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``. -For the string and bytes types, ``x in y`` is true if and only if *x* is a +For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty strings are always considered to be a substring of any other string, so ``"" in "abc"`` will return ``True``. For user-defined classes which define the :meth:`__contains__` method, ``x in -y`` is true if and only if ``y.__contains__(x)`` is true. +y`` returns ``True`` if ``y.__contains__(x)`` returns a true value, and +``False`` otherwise. For user-defined classes which do not define :meth:`__contains__` but do define -:meth:`__iter__`, ``x in y`` is true if some value ``z`` with ``x == z`` is +:meth:`__iter__`, ``x in y`` is ``True`` if some value ``z`` with ``x == z`` is produced while iterating over ``y``. If an exception is raised during the iteration, it is as if :keyword:`in` raised that exception. Lastly, the old-style iteration protocol is tried: if a class defines -:meth:`__getitem__`, ``x in y`` is true if and only if there is a non-negative +:meth:`__getitem__`, ``x in y`` is ``True`` if and only if there is a non-negative integer index *i* such that ``x == y[i]``, and all lower integer indices do not raise :exc:`IndexError` exception. (If any other exception is raised, it is as if :keyword:`in` raised that exception). diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst index 64302b8..a981b87 100644 --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -431,7 +431,7 @@ on the module object. If the method returns ``None``, the import machinery will create the new module itself. .. versionadded:: 3.4 - The create_module() method of loaders. + The :meth:`~importlib.abc.Loader.create_module` method of loaders. .. versionchanged:: 3.4 The :meth:`~importlib.abc.Loader.load_module` method was replaced by diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst index d403c4d..35c8239 100644 --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -872,7 +872,7 @@ definition, function definition, or :keyword:`import` statement. builtin: eval builtin: compile -**Programmer's note:** the :keyword:`global` is a directive to the parser. It +**Programmer's note:** :keyword:`global` is a directive to the parser. It applies only to code parsed at the same time as the :keyword:`global` statement. In particular, a :keyword:`global` statement contained in a string or code object supplied to the built-in :func:`exec` function does not affect the code diff --git a/Doc/tools/extensions/patchlevel.py b/Doc/tools/extensions/patchlevel.py index bca2eb8..919ba4a 100644 --- a/Doc/tools/extensions/patchlevel.py +++ b/Doc/tools/extensions/patchlevel.py @@ -10,6 +10,8 @@ :license: Python license. """ +from __future__ import print_function + import os import re import sys @@ -61,8 +63,8 @@ def get_version_info(): return get_header_version_info('.') except (IOError, OSError): version, release = get_sys_version_info() - print >>sys.stderr, 'Can\'t get version info from Include/patchlevel.h, ' \ - 'using version of this interpreter (%s).' % release + print('Can\'t get version info from Include/patchlevel.h, ' \ + 'using version of this interpreter (%s).' % release, file=sys.stderr) return version, release if __name__ == '__main__': diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py index 6311283..f25c4bc 100644 --- a/Doc/tools/extensions/pyspecific.py +++ b/Doc/tools/extensions/pyspecific.py @@ -15,6 +15,7 @@ from os import path from time import asctime from pprint import pformat from docutils.io import StringOutput +from docutils.parsers.rst import Directive from docutils.utils import new_document from docutils import nodes, utils @@ -22,7 +23,6 @@ from docutils import nodes, utils from sphinx import addnodes from sphinx.builders import Builder from sphinx.util.nodes import split_explicit_title -from sphinx.util.compat import Directive from sphinx.writers.html import HTMLTranslator from sphinx.writers.text import TextWriter from sphinx.writers.latex import LaTeXTranslator @@ -34,7 +34,7 @@ import suspicious ISSUE_URI = 'https://bugs.python.org/issue%s' -SOURCE_URI = 'https://hg.python.org/cpython/file/3.5/%s' +SOURCE_URI = 'https://github.com/python/cpython/tree/3.5/%s' # monkey-patch reST parser to disable alphabetic and roman enumerated lists from docutils.parsers.rst.states import Body @@ -79,7 +79,7 @@ LaTeXTranslator.depart_literal_block = new_depart_literal_block def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): issue = utils.unescape(text) - text = 'issue ' + issue + text = 'bpo-' + issue refnode = nodes.reference(text, text, refuri=ISSUE_URI % issue) return [refnode], [] @@ -225,7 +225,7 @@ class DeprecatedRemoved(Directive): # Support for including Misc/NEWS -issue_re = re.compile('([Ii])ssue #([0-9]+)') +issue_re = re.compile('(?:[Ii]ssue #|bpo-)([0-9]+)') whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$") @@ -253,7 +253,7 @@ class MiscNews(Directive): text = 'The NEWS file is not available.' node = nodes.strong(text, text) return [node] - content = issue_re.sub(r'`\1ssue #\2 `__', + content = issue_re.sub(r'`bpo-\1 `__', content) content = whatsnew_re.sub(r'\1', content) # remove first 3 lines as they are the main heading diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv index dba93bf..8883f53 100644 --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -82,7 +82,7 @@ howto/pyporting,,::,Programming Language :: Python :: 2 howto/pyporting,,::,Programming Language :: Python :: 3 howto/regex,,::, howto/regex,,:foo,(?:foo) -howto/urllib2,,:password,"for example ""joe:password@example.com""" +howto/urllib2,,:password,"""joe:password@example.com""" library/audioop,,:ipos,"# factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)]," library/bisect,32,:hi,all(val >= x for val in a[i:hi]) library/bisect,42,:hi,all(val > x for val in a[i:hi]) @@ -272,8 +272,10 @@ whatsnew/3.2,,:feed,>>> urllib.parse.urlparse('http://[dead:beef:cafe:5417:affe: whatsnew/3.2,,:gz,">>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:" whatsnew/3.2,,:location,zope9-location = ${zope9:location} whatsnew/3.2,,:prefix,zope-conf = ${custom:prefix}/etc/zope.conf -whatsnew/changelog,,:gz,": TarFile opened with external fileobj and ""w:gz"" mode didn't" -whatsnew/changelog,,::,": Use ""127.0.0.1"" or ""::1"" instead of ""localhost"" as much as" +whatsnew/changelog,,:gz,": TarFile opened with external fileobj and " +whatsnew/changelog,,::,::1 +library/re,,`,!#$%&'*+-.^_`|~: +library/re,,`,\!\#\$\%\&\'\*\+\-\.\^_\`\|\~\: library/tarfile,149,:xz,'x:xz' library/xml.etree.elementtree,290,:sometag,prefix:sometag library/xml.etree.elementtree,301,:fictional,">> m[::2].tolist() library/sys,,`,# ``wrapper`` creates a ``wrap(coro)`` coroutine: tutorial/venv,77,:c7b9645a6f35,"Python 3.4.3+ (3.4:c7b9645a6f35+, May 22 2015, 09:31:25)" diff --git a/Doc/tools/templates/customsourcelink.html b/Doc/tools/templates/customsourcelink.html index 243d810..71d0bba 100644 --- a/Doc/tools/templates/customsourcelink.html +++ b/Doc/tools/templates/customsourcelink.html @@ -3,8 +3,11 @@

{{ _('This Page') }}

{%- endif %} diff --git a/Doc/tools/templates/download.html b/Doc/tools/templates/download.html index de84ae3..d49ebdd 100644 --- a/Doc/tools/templates/download.html +++ b/Doc/tools/templates/download.html @@ -18,23 +18,23 @@ in the table are the size of the download files in megabytes.

- - + + - - + + - - + + - - + + - +
FormatPacked as .zipPacked as .tar.bz2
PDF (US-Letter paper size)Download (ca. 8 MB)Download (ca. 8 MB)Download (ca. 13 MB)Download (ca. 13 MB)
PDF (A4 paper size)Download (ca. 8 MB)Download (ca. 8 MB)Download (ca. 13 MB)Download (ca. 13 MB)
HTMLDownload (ca. 6 MB)Download (ca. 4 MB)Download (ca. 9 MB)Download (ca. 6 MB)
Plain TextDownload (ca. 2 MB)Download (ca. 1.5 MB)Download (ca. 3 MB)Download (ca. 2 MB)
EPUBDownload (ca. 4.5 MB)Download (ca. 5.5 MB)
@@ -42,7 +42,7 @@ in the table are the size of the download files in megabytes.

These archives contain all the content in the documentation.

HTML Help (.chm) files are made available in the "Windows" section -on the Python +on the Python download page.

diff --git a/Doc/tools/templates/indexcontent.html b/Doc/tools/templates/indexcontent.html index 1076c1f..d795c0a 100644 --- a/Doc/tools/templates/indexcontent.html +++ b/Doc/tools/templates/indexcontent.html @@ -1,5 +1,12 @@ -{% extends "defindex.html" %} -{% block tables %} +{% extends "layout.html" %} +{%- block htmltitle -%} +{{ shorttitle }} +{%- endblock -%} +{% block body %} +

{{ docstitle|e }}

+

+ {% trans %}Welcome! This is the documentation for Python {{ release }}.{% endtrans %} +

{% trans %}Parts of the documentation:{% endtrans %}

diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html index 5c180e7..640d8b3 100644 --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -38,6 +38,7 @@ {% endblock %} {% block extrahead %} + {% if builder != "htmlhelp" %} {% if not embedded %}{% endif %} {% if versionswitcher is defined and not embedded %}{% endif %} diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index e134d5d..073444c 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -784,7 +784,7 @@ using the :func:`next` built-in function; this example shows how it all works:: 'c' >>> next(it) Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in next(it) StopIteration diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index 12989b2..6af7282 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -154,7 +154,7 @@ Later we will see more functions that return iterables and take iterables as arg :keyword:`break` and :keyword:`continue` Statements, and :keyword:`else` Clauses on Loops ========================================================================================= -The :keyword:`break` statement, like in C, breaks out of the smallest enclosing +The :keyword:`break` statement, like in C, breaks out of the innermost enclosing :keyword:`for` or :keyword:`while` loop. Loop statements may have an ``else`` clause; it is executed when the loop @@ -472,7 +472,7 @@ Here's an example that fails due to this restriction:: ... >>> function(0, a=0) Traceback (most recent call last): - File "", line 1, in ? + File "", line 1, in TypeError: function() got multiple values for keyword argument 'a' When a final formal parameter of the form ``**name`` is present, it receives a diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index b39bdf4..1a73ac9 100644 --- a/Doc/tutorial/datastructures.rst +++ b/Doc/tutorial/datastructures.rst @@ -22,11 +22,11 @@ objects: Add an item to the end of the list. Equivalent to ``a[len(a):] = [x]``. -.. method:: list.extend(L) +.. method:: list.extend(iterable) :noindex: - Extend the list by appending all the items in the given list. Equivalent to - ``a[len(a):] = L``. + Extend the list by appending all the items from the iterable. Equivalent to + ``a[len(a):] = iterable``. .. method:: list.insert(i, x) @@ -60,11 +60,16 @@ objects: Remove all items from the list. Equivalent to ``del a[:]``. -.. method:: list.index(x) +.. method:: list.index(x[, start[, end]]) :noindex: - Return the index in the list of the first item whose value is *x*. It is an - error if there is no such item. + Return zero-based index in the list of the first item whose value is *x*. + Raises a :exc:`ValueError` if there is no such item. + + The optional arguments *start* and *end* are interpreted as in the slice + notation and are used to limit the search to a particular subsequence of + the list. The returned index is computed relative to the beginning of the full + sequence rather than the *start* argument. .. method:: list.count(x) @@ -94,28 +99,26 @@ objects: An example that uses most of the list methods:: - >>> a = [66.25, 333, 333, 1, 1234.5] - >>> print(a.count(333), a.count(66.25), a.count('x')) - 2 1 0 - >>> a.insert(2, -1) - >>> a.append(333) - >>> a - [66.25, 333, -1, 333, 1, 1234.5, 333] - >>> a.index(333) - 1 - >>> a.remove(333) - >>> a - [66.25, -1, 333, 1, 1234.5, 333] - >>> a.reverse() - >>> a - [333, 1234.5, 1, 333, -1, 66.25] - >>> a.sort() - >>> a - [-1, 1, 66.25, 333, 333, 1234.5] - >>> a.pop() - 1234.5 - >>> a - [-1, 1, 66.25, 333, 333] + >>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana'] + >>> fruits.count('apple') + 2 + >>> fruits.count('tangerine') + 0 + >>> fruits.index('banana') + 3 + >>> fruits.index('banana', 4) # Find next banana starting a position 4 + 6 + >>> fruits.reverse() + >>> fruits + ['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange'] + >>> fruits.append('grape') + >>> fruits + ['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape'] + >>> fruits.sort() + >>> fruits + ['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear'] + >>> fruits.pop() + 'pear' You might have noticed that methods like ``insert``, ``remove`` or ``sort`` that only modify the list have no return value printed -- they return the default @@ -258,7 +261,7 @@ it must be parenthesized. :: [(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25)] >>> # the tuple must be parenthesized, otherwise an error is raised >>> [x, x**2 for x in range(6)] - File "", line 1, in ? + File "", line 1, in [x, x**2 for x in range(6)] ^ SyntaxError: invalid syntax diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst index dd9c7cd..32cb578 100644 --- a/Doc/tutorial/inputoutput.rst +++ b/Doc/tutorial/inputoutput.rst @@ -261,6 +261,35 @@ to file data is fine for text files, but will corrupt binary data like that in :file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode when reading and writing such files. +It is good practice to use the :keyword:`with` keyword when dealing +with file objects. The advantage is that the file is properly closed +after its suite finishes, even if an exception is raised at some +point. Using :keyword:`with` is also much shorter than writing +equivalent :keyword:`try`\ -\ :keyword:`finally` blocks:: + + >>> with open('workfile') as f: + ... read_data = f.read() + >>> f.closed + True + +If you're not using the :keyword:`with` keyword, then you should call +``f.close()`` to close the file and immediately free up any system +resources used by it. If you don't explicitly close a file, Python's +garbage collector will eventually destroy the object and close the +open file for you, but the file may stay open for a while. Another +risk is that different Python implementations will do this clean-up at +different times. + +After a file object is closed, either by a :keyword:`with` statement +or by calling ``f.close()``, attempts to use the file object will +automatically fail. :: + + >>> f.close() + >>> f.read() + Traceback (most recent call last): + File "", line 1, in + ValueError: I/O operation on closed file + .. _tut-filemethods: @@ -353,27 +382,6 @@ to the very file end with ``seek(0, 2)``) and the only valid *offset* values are those returned from the ``f.tell()``, or zero. Any other *offset* value produces undefined behaviour. - -When you're done with a file, call ``f.close()`` to close it and free up any -system resources taken up by the open file. After calling ``f.close()``, -attempts to use the file object will automatically fail. :: - - >>> f.close() - >>> f.read() - Traceback (most recent call last): - File "", line 1, in ? - ValueError: I/O operation on closed file - -It is good practice to use the :keyword:`with` keyword when dealing with file -objects. This has the advantage that the file is properly closed after its -suite finishes, even if an exception is raised on the way. It is also much -shorter than writing equivalent :keyword:`try`\ -\ :keyword:`finally` blocks:: - - >>> with open('workfile', 'r') as f: - ... read_data = f.read() - >>> f.closed - True - File objects have some additional methods, such as :meth:`~file.isatty` and :meth:`~file.truncate` which are less frequently used; consult the Library Reference for a complete guide to file objects. @@ -411,6 +419,7 @@ sent over a network connection to some distant machine. If you have an object ``x``, you can view its JSON string representation with a simple line of code:: + >>> import json >>> json.dumps([1, 'simple', 'list']) '[1, "simple", "list"]' diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst index 2140329..85ba896 100644 --- a/Doc/tutorial/introduction.rst +++ b/Doc/tutorial/introduction.rst @@ -100,10 +100,8 @@ give you an error:: There is full support for floating point; operators with mixed type operands convert the integer operand to floating point:: - >>> 3 * 3.75 / 1.5 - 7.5 - >>> 7.0 / 2 - 3.5 + >>> 4 * 3.75 - 1 + 14.0 In interactive mode, the last printed expression is assigned to the variable ``_``. This means that when you are using Python as a desk calculator, it is @@ -356,7 +354,7 @@ The built-in function :func:`len` returns the length of a string:: Information about string formatting with :meth:`str.format`. :ref:`old-string-formatting` - The old formatting operations invoked when strings and Unicode strings are + The old formatting operations invoked when strings are the left operand of the ``%`` operator are described in more detail here. diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 6117796..906d31f 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -518,8 +518,8 @@ conflict. .. envvar:: PYTHONDONTWRITEBYTECODE - If this is set to a non-empty string, Python won't try to write ``.pyc`` or - ``.pyo`` files on the import of source modules. This is equivalent to + If this is set to a non-empty string, Python won't try to write ``.pyc`` + files on the import of source modules. This is equivalent to specifying the :option:`-B` option. diff --git a/Doc/using/index.rst b/Doc/using/index.rst index 502afa9..a643e04 100644 --- a/Doc/using/index.rst +++ b/Doc/using/index.rst @@ -6,7 +6,7 @@ This part of the documentation is devoted to general information on the setup -of the Python environment on different platform, the invocation of the +of the Python environment on different platforms, the invocation of the interpreter and things that make working with Python easier. diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index a4a6a30..1db8607 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -517,9 +517,9 @@ Shebang Lines If the first line of a script file starts with ``#!``, it is known as a "shebang" line. Linux and other Unix like operating systems have native -support for such lines and are commonly used on such systems to indicate how -a script should be executed. This launcher allows the same facilities to be -using with Python scripts on Windows and the examples above demonstrate their +support for such lines and they are commonly used on such systems to indicate +how a script should be executed. This launcher allows the same facilities to +be used with Python scripts on Windows and the examples above demonstrate their use. To allow shebang lines in Python scripts to be portable between Unix and diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst index 010a007..5cbf501 100644 --- a/Doc/whatsnew/2.0.rst +++ b/Doc/whatsnew/2.0.rst @@ -145,8 +145,8 @@ strings. Unicode uses 16-bit numbers to represent characters instead of the 8-bit number used by ASCII, meaning that 65,536 distinct characters can be supported. -The final interface for Unicode support was arrived at through countless often- -stormy discussions on the python-dev mailing list, and mostly implemented by +The final interface for Unicode support was arrived at through countless +often-stormy discussions on the python-dev mailing list, and mostly implemented by Marc-André Lemburg, based on a Unicode string type implementation by Fredrik Lundh. A detailed explanation of the interface was written up as :pep:`100`, "Python Unicode Integration". This article will simply cover the most @@ -885,8 +885,8 @@ interfaces for processing XML have become common: SAX2 (version 2 of the Simple API for XML) provides an event-driven interface with some similarities to :mod:`xmllib`, and the DOM (Document Object Model) provides a tree-based interface, transforming an XML document into a tree of nodes that can be -traversed and modified. Python 2.0 includes a SAX2 interface and a stripped- -down DOM interface as part of the :mod:`xml` package. Here we will give a brief +traversed and modified. Python 2.0 includes a SAX2 interface and a stripped-down +DOM interface as part of the :mod:`xml` package. Here we will give a brief overview of these new interfaces; consult the Python documentation or the source code for complete details. The Python XML SIG is also working on improved documentation. diff --git a/Doc/whatsnew/2.1.rst b/Doc/whatsnew/2.1.rst index 00151d7..ad4c6d5 100644 --- a/Doc/whatsnew/2.1.rst +++ b/Doc/whatsnew/2.1.rst @@ -159,8 +159,8 @@ precede any statement that will result in bytecodes being produced. PEP 207: Rich Comparisons ========================= -In earlier versions, Python's support for implementing comparisons on user- -defined classes and extension types was quite simple. Classes could implement a +In earlier versions, Python's support for implementing comparisons on user-defined +classes and extension types was quite simple. Classes could implement a :meth:`__cmp__` method that was given two instances of a class, and could only return 0 if they were equal or +1 or -1 if they weren't; the method couldn't raise an exception or return anything other than a Boolean value. Users of @@ -465,11 +465,11 @@ Windows being the primary examples; on these systems, it's impossible to distinguish the filenames ``FILE.PY`` and ``file.py``, even though they do store the file's name in its original case (they're case-preserving, too). -In Python 2.1, the :keyword:`import` statement will work to simulate case- -sensitivity on case-insensitive platforms. Python will now search for the first +In Python 2.1, the :keyword:`import` statement will work to simulate case-sensitivity +on case-insensitive platforms. Python will now search for the first case-sensitive match by default, raising an :exc:`ImportError` if no such file -is found, so ``import file`` will not import a module named ``FILE.PY``. Case- -insensitive matching can be requested by setting the :envvar:`PYTHONCASEOK` +is found, so ``import file`` will not import a module named ``FILE.PY``. +Case-insensitive matching can be requested by setting the :envvar:`PYTHONCASEOK` environment variable before starting the Python interpreter. .. ====================================================================== @@ -481,8 +481,8 @@ PEP 217: Interactive Display Hook When using the Python interpreter interactively, the output of commands is displayed using the built-in :func:`repr` function. In Python 2.1, the variable :func:`sys.displayhook` can be set to a callable object which will be called -instead of :func:`repr`. For example, you can set it to a special pretty- -printing function:: +instead of :func:`repr`. For example, you can set it to a special +pretty-printing function:: >>> # Create a recursive data structure ... L = [1,2,3] diff --git a/Doc/whatsnew/2.2.rst b/Doc/whatsnew/2.2.rst index 5f28c29..a0bb81a 100644 --- a/Doc/whatsnew/2.2.rst +++ b/Doc/whatsnew/2.2.rst @@ -962,8 +962,8 @@ New and Improved Modules * The new :mod:`hmac` module implements the HMAC algorithm described by :rfc:`2104`. (Contributed by Gerhard Häring.) -* Several functions that originally returned lengthy tuples now return pseudo- - sequences that still behave like tuples but also have mnemonic attributes such +* Several functions that originally returned lengthy tuples now return + pseudo-sequences that still behave like tuples but also have mnemonic attributes such as memberst_mtime or :attr:`tm_year`. The enhanced functions include :func:`stat`, :func:`fstat`, :func:`statvfs`, and :func:`fstatvfs` in the :mod:`os` module, and :func:`localtime`, :func:`gmtime`, and :func:`strptime` in @@ -1141,8 +1141,8 @@ Some of the more notable changes are: The most significant change is the ability to build Python as a framework, enabled by supplying the :option:`!--enable-framework` option to the configure - script when compiling Python. According to Jack Jansen, "This installs a self- - contained Python installation plus the OS X framework "glue" into + script when compiling Python. According to Jack Jansen, "This installs a + self-contained Python installation plus the OS X framework "glue" into :file:`/Library/Frameworks/Python.framework` (or another location of choice). For now there is little immediate added benefit to this (actually, there is the disadvantage that you have to change your PATH to be able to find Python), but diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst index 93930b8..cebfb21 100644 --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -86,8 +86,8 @@ The union and intersection of sets can be computed with the :meth:`union` and It's also possible to take the symmetric difference of two sets. This is the set of all elements in the union that aren't in the intersection. Another way of putting it is that the symmetric difference contains all elements that are in -exactly one set. Again, there's an alternative notation (``^``), and an in- -place version with the ungainly name :meth:`symmetric_difference_update`. :: +exactly one set. Again, there's an alternative notation (``^``), and an +in-place version with the ungainly name :meth:`symmetric_difference_update`. :: >>> S1 = sets.Set([1,2,3,4]) >>> S2 = sets.Set([3,4,5,6]) @@ -288,8 +288,8 @@ use characters outside of the usual alphanumerics. PEP 273: Importing Modules from ZIP Archives ============================================ -The new :mod:`zipimport` module adds support for importing modules from a ZIP- -format archive. You don't need to import the module explicitly; it will be +The new :mod:`zipimport` module adds support for importing modules from a +ZIP-format archive. You don't need to import the module explicitly; it will be automatically imported if a ZIP archive's filename is added to ``sys.path``. For example: @@ -375,8 +375,8 @@ PEP 278: Universal Newline Support ================================== The three major operating systems used today are Microsoft Windows, Apple's -Macintosh OS, and the various Unix derivatives. A minor irritation of cross- -platform work is that these three platforms all use different characters to +Macintosh OS, and the various Unix derivatives. A minor irritation of +cross-platform work is that these three platforms all use different characters to mark the ends of lines in text files. Unix uses the linefeed (ASCII character 10), MacOS uses the carriage return (ASCII character 13), and Windows uses a two-character sequence of a carriage return plus a newline. diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst index 8db90cc..7c125ff 100644 --- a/Doc/whatsnew/2.4.rst +++ b/Doc/whatsnew/2.4.rst @@ -517,8 +517,8 @@ Sometimes you can see this inaccuracy when the number is printed:: >>> 1.1 1.1000000000000001 -The inaccuracy isn't always visible when you print the number because the FP-to- -decimal-string conversion is provided by the C library, and most C libraries try +The inaccuracy isn't always visible when you print the number because the +FP-to-decimal-string conversion is provided by the C library, and most C libraries try to produce sensible output. Even if it's not displayed, however, the inaccuracy is still there and subsequent operations can magnify the error. @@ -595,8 +595,8 @@ exponent:: ... decimal.InvalidOperation: x ** (non-integer) -You can combine :class:`Decimal` instances with integers, but not with floating- -point numbers:: +You can combine :class:`Decimal` instances with integers, but not with +floating-point numbers:: >>> a + 4 Decimal("39.72") @@ -684,8 +684,8 @@ includes a quick-start tutorial and a reference. Raymond Hettinger, Aahz, and Tim Peters. http://www.lahey.com/float.htm - The article uses Fortran code to illustrate many of the problems that floating- - point inaccuracy can cause. + The article uses Fortran code to illustrate many of the problems that + floating-point inaccuracy can cause. http://speleotrove.com/decimal/ A description of a decimal-based representation. This representation is being @@ -741,8 +741,8 @@ functions in Python's implementation required that the numeric locale remain set to the ``'C'`` locale. Often this was because the code was using the C library's :c:func:`atof` function. -Not setting the numeric locale caused trouble for extensions that used third- -party C libraries, however, because they wouldn't have the correct locale set. +Not setting the numeric locale caused trouble for extensions that used third-party +C libraries, however, because they wouldn't have the correct locale set. The motivating example was GTK+, whose user interface widgets weren't displaying numbers in the current locale. @@ -918,8 +918,8 @@ Here are all of the changes that Python 2.4 makes to the core Python language. (Contributed by Raymond Hettinger.) -* Encountering a failure while importing a module no longer leaves a partially- - initialized module object in ``sys.modules``. The incomplete module object left +* Encountering a failure while importing a module no longer leaves a partially-initialized + module object in ``sys.modules``. The incomplete module object left behind would fool further imports of the same module into succeeding, leading to confusing errors. (Fixed by Tim Peters.) @@ -1028,8 +1028,8 @@ complete list of changes, or look through the CVS logs for all the details. previous ones left off. (Implemented by Walter Dörwald.) * There is a new :mod:`collections` module for various specialized collection - datatypes. Currently it contains just one type, :class:`deque`, a double- - ended queue that supports efficiently adding and removing elements from either + datatypes. Currently it contains just one type, :class:`deque`, a double-ended + queue that supports efficiently adding and removing elements from either end:: >>> from collections import deque @@ -1485,8 +1485,8 @@ Some of the changes to Python's build process and to the C API are: intended as an aid to people developing the Python core. Providing :option:`!--enable-profiling` to the :program:`configure` script will let you profile the interpreter with :program:`gprof`, and providing the - :option:`!--with-tsc` switch enables profiling using the Pentium's Time-Stamp- - Counter register. Note that the :option:`!--with-tsc` switch is slightly + :option:`!--with-tsc` switch enables profiling using the Pentium's + Time-Stamp-Counter register. Note that the :option:`!--with-tsc` switch is slightly misnamed, because the profiling feature also works on the PowerPC platform, though that processor architecture doesn't call that register "the TSC register". (Contributed by Jeremy Hylton.) @@ -1540,8 +1540,8 @@ code: * The :mod:`tarfile` module now generates GNU-format tar files by default. -* Encountering a failure while importing a module no longer leaves a partially- - initialized module object in ``sys.modules``. +* Encountering a failure while importing a module no longer leaves a + partially-initialized module object in ``sys.modules``. * :const:`None` is now a constant; code that binds a new value to the name ``None`` is now a syntax error. diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst index db8f9df..4d48291 100644 --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -157,8 +157,8 @@ Here's a small but realistic example:: server_log = functools.partial(log, subsystem='server') server_log('Unable to open socket') -Here's another example, from a program that uses PyGTK. Here a context- -sensitive pop-up menu is being constructed dynamically. The callback provided +Here's another example, from a program that uses PyGTK. Here a context-sensitive +pop-up menu is being constructed dynamically. The callback provided for the menu option is a partially applied version of the :meth:`open_item` method, where the first argument has been provided. :: @@ -171,8 +171,8 @@ method, where the first argument has been provided. :: popup_menu.append( ("Open", open_func, 1) ) Another function in the :mod:`functools` module is the -``update_wrapper(wrapper, wrapped)`` function that helps you write well- -behaved decorators. :func:`update_wrapper` copies the name, module, and +``update_wrapper(wrapper, wrapped)`` function that helps you write +well-behaved decorators. :func:`update_wrapper` copies the name, module, and docstring attribute to a wrapper function so that tracebacks inside the wrapped function are easier to understand. For example, you might write:: @@ -297,8 +297,8 @@ can't protect against having your submodule's name being used for a new module added in a future version of Python. In Python 2.5, you can switch :keyword:`import`'s behaviour to absolute imports -using a ``from __future__ import absolute_import`` directive. This absolute- -import behaviour will become the default in a future version (probably Python +using a ``from __future__ import absolute_import`` directive. This absolute-import +behaviour will become the default in a future version (probably Python 2.7). Once absolute imports are the default, ``import string`` will always find the standard library's version. It's suggested that users should begin using absolute imports as much as possible, so it's preferable to begin writing @@ -602,8 +602,8 @@ be used with the ':keyword:`with`' statement. File objects are one example:: ... more processing code ... After this statement has executed, the file object in *f* will have been -automatically closed, even if the :keyword:`for` loop raised an exception part- -way through the block. +automatically closed, even if the :keyword:`for` loop raised an exception +part-way through the block. .. note:: @@ -1558,8 +1558,8 @@ complete list of changes, or look through the SVN logs for all the details. You can also pack and unpack data to and from buffer objects directly using the ``pack_into(buffer, offset, v1, v2, ...)`` and ``unpack_from(buffer, - offset)`` methods. This lets you store data directly into an array or a memory- - mapped file. + offset)`` methods. This lets you store data directly into an array or a + memory-mapped file. (:class:`Struct` objects were implemented by Bob Ippolito at the NeedForSpeed sprint. Support for buffer objects was added by Martin Blais, also at the @@ -2281,8 +2281,8 @@ Acknowledgements The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this article: Georg Brandl, -Nick Coghlan, Phillip J. Eby, Lars Gustäbel, Raymond Hettinger, Ralf W. Grosse- -Kunstleve, Kent Johnson, Iain Lowe, Martin von Löwis, Fredrik Lundh, Andrew +Nick Coghlan, Phillip J. Eby, Lars Gustäbel, Raymond Hettinger, Ralf W. +Grosse-Kunstleve, Kent Johnson, Iain Lowe, Martin von Löwis, Fredrik Lundh, Andrew McNamara, Skip Montanaro, Gustavo Niemeyer, Paul Prescod, James Pryor, Mike Rovner, Scott Weikart, Barry Warsaw, Thomas Wouters. diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index 4fc0c36..cc2fa3d 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -290,8 +290,8 @@ be used with the ':keyword:`with`' statement. File objects are one example:: ... more processing code ... After this statement has executed, the file object in *f* will have been -automatically closed, even if the :keyword:`for` loop raised an exception part- -way through the block. +automatically closed, even if the :keyword:`for` loop raised an exception +part-way through the block. .. note:: diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst index ab61d7a..39b6ee5 100644 --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -2327,11 +2327,12 @@ The :func:`inspect.getargspec` function is deprecated and scheduled to be removed in Python 3.6. (See :issue:`20438` for details.) The :mod:`inspect` :func:`~inspect.getfullargspec`, -:func:`~inspect.getargvalues`, :func:`~inspect.getcallargs`, -:func:`~inspect.getargvalues`, :func:`~inspect.formatargspec`, and -:func:`~inspect.formatargvalues` functions are deprecated in favor of -the :func:`inspect.signature` API. -(Contributed by Yury Selivanov in :issue:`20438`.) +:func:`~inspect.getcallargs`, and :func:`~inspect.formatargspec` functions are +deprecated in favor of the :func:`inspect.signature` API. (Contributed by Yury +Selivanov in :issue:`20438`.) + +:func:`~inspect.getargvalues` and :func:`~inspect.formatargvalues` functions +were inadvertently marked as deprecated with the release of Python 3.5.0. Use of :const:`re.LOCALE` flag with str patterns or :const:`re.ASCII` is now deprecated. (Contributed by Serhiy Storchaka in :issue:`22407`.) diff --git a/Doc/whatsnew/changelog.rst b/Doc/whatsnew/changelog.rst index 67a12f3..b435614 100644 --- a/Doc/whatsnew/changelog.rst +++ b/Doc/whatsnew/changelog.rst @@ -4,4 +4,4 @@ Changelog +++++++++ -.. miscnews:: ../../Misc/NEWS +.. miscnews:: ../build/NEWS diff --git a/Include/ceval.h b/Include/ceval.h index b5373a9..3f84b06 100644 --- a/Include/ceval.h +++ b/Include/ceval.h @@ -203,6 +203,7 @@ PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void); #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); +PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *); PyAPI_FUNC(void) _PyEval_SignalAsyncExc(void); #endif diff --git a/Include/dictobject.h b/Include/dictobject.h index e0e1c26..17e12c0 100644 --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -102,6 +102,7 @@ PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp); Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys); Py_ssize_t _PyDict_SizeOf(PyDictObject *); PyObject *_PyDict_Pop(PyDictObject *, PyObject *, PyObject *); +PyObject *_PyDict_Pop_KnownHash(PyDictObject *, PyObject *, Py_hash_t, PyObject *); PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *); #define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL) diff --git a/Include/modsupport.h b/Include/modsupport.h index 829aaf8..6d4b6dc 100644 --- a/Include/modsupport.h +++ b/Include/modsupport.h @@ -29,18 +29,18 @@ PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...); PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...); PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, const char *, char **, ...); +PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list); +PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *, + const char *, char **, va_list); +#endif PyAPI_FUNC(int) PyArg_ValidateKeywordArguments(PyObject *); PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...); PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...); PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...); -#endif + #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw); PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args); - -PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list); -PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *, - const char *, char **, va_list); #endif PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list); diff --git a/Include/patchlevel.h b/Include/patchlevel.h index 77e7249..e8bb027 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -18,12 +18,12 @@ /*--start constants--*/ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 5 -#define PY_MICRO_VERSION 3 +#define PY_MICRO_VERSION 4 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.5.3" +#define PY_VERSION "3.5.4" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index ccdebe2..1c5f7a6 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -69,8 +69,8 @@ PyAPI_FUNC(const char *) Py_GetCopyright(void); PyAPI_FUNC(const char *) Py_GetCompiler(void); PyAPI_FUNC(const char *) Py_GetBuildInfo(void); #ifndef Py_LIMITED_API -PyAPI_FUNC(const char *) _Py_hgidentifier(void); -PyAPI_FUNC(const char *) _Py_hgversion(void); +PyAPI_FUNC(const char *) _Py_gitidentifier(void); +PyAPI_FUNC(const char *) _Py_gitversion(void); #endif /* Internal -- various one-time initializations */ diff --git a/Include/sliceobject.h b/Include/sliceobject.h index 26370e0..579ac07 100644 --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -41,8 +41,23 @@ PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length, PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length, - Py_ssize_t *start, Py_ssize_t *stop, - Py_ssize_t *step, Py_ssize_t *slicelength); + Py_ssize_t *start, Py_ssize_t *stop, + Py_ssize_t *step, Py_ssize_t *slicelength); + +#if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100 +#ifdef Py_LIMITED_API +#define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ + PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \ + ((*(slicelen) = 0), -1) : \ + ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ + 0)) +#endif +PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); +PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length, + Py_ssize_t *start, Py_ssize_t *stop, + Py_ssize_t step); +#endif #ifdef __cplusplus } diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 9308a6a..f0ececc 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -764,23 +764,27 @@ PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4( exception set. */ PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode); +#ifndef Py_LIMITED_API /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer. If the wchar_t/Py_UNICODE representation is not yet available, this function will calculate it. */ -#ifndef Py_LIMITED_API PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( PyObject *unicode /* Unicode object */ ); -#endif + +/* Similar to PyUnicode_AsUnicode(), but raises a ValueError if the string + contains null characters. */ +PyAPI_FUNC(const Py_UNICODE *) _PyUnicode_AsUnicode( + PyObject *unicode /* Unicode object */ + ); /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer and save the length at size. If the wchar_t/Py_UNICODE representation is not yet available, this function will calculate it. */ -#ifndef Py_LIMITED_API PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize( PyObject *unicode, /* Unicode object */ Py_ssize_t *size /* location where to save the length */ @@ -1054,6 +1058,12 @@ PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString( ); #ifndef Py_LIMITED_API +/* Similar to PyUnicode_AsWideCharString(unicode, NULL), but check if + the string contains null characters. */ +PyAPI_FUNC(wchar_t*) _PyUnicode_AsWideCharString( + PyObject *unicode /* Unicode object */ + ); + PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *s, unsigned int kind); #endif @@ -1570,50 +1580,41 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( This codec uses mappings to encode and decode characters. - Decoding mappings must map single string characters to single - Unicode characters, integers (which are then interpreted as Unicode - ordinals) or None (meaning "undefined mapping" and causing an - error). - - Encoding mappings must map single Unicode characters to single - string characters, integers (which are then interpreted as Latin-1 - ordinals) or None (meaning "undefined mapping" and causing an - error). + Decoding mappings must map byte ordinals (integers in the range from 0 to + 255) to Unicode strings, integers (which are then interpreted as Unicode + ordinals) or None. Unmapped data bytes (ones which cause a LookupError) + as well as mapped to None, 0xFFFE or '\ufffe' are treated as "undefined + mapping" and cause an error. - If a character lookup fails with a LookupError, the character is - copied as-is meaning that its ordinal value will be interpreted as - Unicode or Latin-1 ordinal resp. Because of this mappings only need - to contain those mappings which map characters to different code - points. + Encoding mappings must map Unicode ordinal integers to bytes objects, + integers in the range from 0 to 255 or None. Unmapped character + ordinals (ones which cause a LookupError) as well as mapped to + None are treated as "undefined mapping" and cause an error. */ PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( const char *string, /* Encoded string */ Py_ssize_t length, /* size of string */ - PyObject *mapping, /* character mapping - (char ordinal -> unicode ordinal) */ + PyObject *mapping, /* decoding mapping */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( PyObject *unicode, /* Unicode object */ - PyObject *mapping /* character mapping - (unicode ordinal -> char ordinal) */ + PyObject *mapping /* encoding mapping */ ); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( const Py_UNICODE *data, /* Unicode char buffer */ Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - PyObject *mapping, /* character mapping - (unicode ordinal -> char ordinal) */ + PyObject *mapping, /* encoding mapping */ const char *errors /* error handling */ ); PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap( PyObject *unicode, /* Unicode object */ - PyObject *mapping, /* character mapping - (unicode ordinal -> char ordinal) */ + PyObject *mapping, /* encoding mapping */ const char *errors /* error handling */ ); #endif @@ -1622,8 +1623,8 @@ PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap( character mapping table to it and return the resulting Unicode object. - The mapping table must map Unicode ordinal integers to Unicode - ordinal integers or None (causing deletion of the character). + The mapping table must map Unicode ordinal integers to Unicode strings, + Unicode ordinal integers or None (causing deletion of the character). Mapping tables may be dictionaries or sequences. Unmapped character ordinals (ones which cause a LookupError) are left untouched and @@ -1915,8 +1916,8 @@ PyAPI_FUNC(PyObject*) PyUnicode_RSplit( /* Translate a string by applying a character mapping table to it and return the resulting Unicode object. - The mapping table must map Unicode ordinal integers to Unicode - ordinal integers or None (causing deletion of the character). + The mapping table must map Unicode ordinal integers to Unicode strings, + Unicode ordinal integers or None (causing deletion of the character). Mapping tables may be dictionaries or sequences. Unmapped character ordinals (ones which cause a LookupError) are left untouched and @@ -2272,6 +2273,10 @@ PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy( PyAPI_FUNC(int) _PyUnicode_CheckConsistency( PyObject *op, int check_content); +#elif !defined(NDEBUG) +/* For asserts that call _PyUnicode_CheckConsistency(), which would + * otherwise be a problem when building with asserts but without Py_DEBUG. */ +#define _PyUnicode_CheckConsistency(op, check_content) PyUnicode_Check(op) #endif /* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/ diff --git a/LICENSE b/LICENSE index f5d0b39..529349e 100644 --- a/LICENSE +++ b/LICENSE @@ -13,12 +13,11 @@ software. In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same -year, the PythonLabs team moved to Digital Creations (now Zope -Corporation, see http://www.zope.com). In 2001, the Python Software -Foundation (PSF, see http://www.python.org/psf/) was formed, a -non-profit organization created specifically to own Python-related -Intellectual Property. Zope Corporation is a sponsoring member of -the PSF. +year, the PythonLabs team moved to Digital Creations, which became +Zope Corporation. In 2001, the Python Software Foundation (PSF, see +https://www.python.org/psf/) was formed, a non-profit organization +created specifically to own Python-related Intellectual Property. +Zope Corporation was a sponsoring member of the PSF. All Python releases are Open Source (see http://www.opensource.org for the Open Source Definition). Historically, most, but not all, Python diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py index 13fcd8b..03d36c9 100644 --- a/Lib/_osx_support.py +++ b/Lib/_osx_support.py @@ -210,7 +210,7 @@ def _remove_universal_flags(_config_vars): # Do not alter a config var explicitly overridden by env var if cv in _config_vars and cv not in os.environ: flags = _config_vars[cv] - flags = re.sub('-arch\s+\w+\s', ' ', flags, re.ASCII) + flags = re.sub(r'-arch\s+\w+\s', ' ', flags, flags=re.ASCII) flags = re.sub('-isysroot [^ \t]*', ' ', flags) _save_modified_value(_config_vars, cv, flags) diff --git a/Lib/aifc.py b/Lib/aifc.py index 7ebdbeb..d5764a3 100644 --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -294,6 +294,8 @@ class Aifc_read: # _ssnd_chunk -- instantiation of a chunk class for the SSND chunk # _framesize -- size of one frame in the file + _file = None # Set here since __del__ checks it + def initfp(self, file): self._version = 0 self._convert = None @@ -335,9 +337,15 @@ class Aifc_read: def __init__(self, f): if isinstance(f, str): - f = builtins.open(f, 'rb') - # else, assume it is an open file object already - self.initfp(f) + file_object = builtins.open(f, 'rb') + try: + self.initfp(file_object) + except: + file_object.close() + raise + else: + # assume it is an open file object already + self.initfp(f) def __enter__(self): return self @@ -532,18 +540,23 @@ class Aifc_write: # _datalength -- the size of the audio samples written to the header # _datawritten -- the size of the audio samples actually written + _file = None # Set here since __del__ checks it + def __init__(self, f): if isinstance(f, str): - filename = f - f = builtins.open(f, 'wb') - else: - # else, assume it is an open file object already - filename = '???' - self.initfp(f) - if filename[-5:] == '.aiff': - self._aifc = 0 + file_object = builtins.open(f, 'wb') + try: + self.initfp(file_object) + except: + file_object.close() + raise + + # treat .aiff file extensions as non-compressed audio + if f.endswith('.aiff'): + self._aifc = 0 else: - self._aifc = 1 + # assume it is an open file object already + self.initfp(f) def initfp(self, file): self._file = file diff --git a/Lib/argparse.py b/Lib/argparse.py index 9a06719..0d881b8 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -176,7 +176,7 @@ class HelpFormatter(object): self._root_section = self._Section(self, None) self._current_section = self._root_section - self._whitespace_matcher = _re.compile(r'\s+') + self._whitespace_matcher = _re.compile(r'\s+', _re.ASCII) self._long_break_matcher = _re.compile(r'\n\n\n+') # =============================== diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 50153f8..26a6f1e 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -459,7 +459,8 @@ class BaseEventLoop(events.AbstractEventLoop): # local task. future.exception() raise - future.remove_done_callback(_run_until_complete_cb) + finally: + future.remove_done_callback(_run_until_complete_cb) if not future.done(): raise RuntimeError('Event loop stopped before Future completed.') diff --git a/Lib/asyncio/coroutines.py b/Lib/asyncio/coroutines.py index 5bdeceb..488e423 100644 --- a/Lib/asyncio/coroutines.py +++ b/Lib/asyncio/coroutines.py @@ -197,7 +197,7 @@ def coroutine(func): """ if _inspect_iscoroutinefunction(func): # In Python 3.5 that's all we need to do for coroutines - # defiend with "async def". + # defined with "async def". # Wrapping in CoroWrapper will happen via # 'sys.set_coroutine_wrapper' function. return func diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py index 28a45fc..e85634e 100644 --- a/Lib/asyncio/events.py +++ b/Lib/asyncio/events.py @@ -11,6 +11,7 @@ __all__ = ['AbstractEventLoopPolicy', import functools import inspect +import os import reprlib import socket import subprocess @@ -611,6 +612,9 @@ _lock = threading.Lock() # A TLS for the running event loop, used by _get_running_loop. class _RunningLoop(threading.local): _loop = None + _pid = None + + _running_loop = _RunningLoop() @@ -620,7 +624,9 @@ def _get_running_loop(): This is a low-level function intended to be used by event loops. This function is thread-specific. """ - return _running_loop._loop + running_loop = _running_loop._loop + if running_loop is not None and _running_loop._pid == os.getpid(): + return running_loop def _set_running_loop(loop): @@ -629,6 +635,7 @@ def _set_running_loop(loop): This is a low-level function intended to be used by event loops. This function is thread-specific. """ + _running_loop._pid = os.getpid() _running_loop._loop = loop diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index 9ca8d84..60b0d31 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -240,6 +240,7 @@ class Future: change the future's state to cancelled, schedule the callbacks and return True. """ + self._log_traceback = False if self._state != _PENDING: return False self._state = _CANCELLED diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py index deefc93..9266183 100644 --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -176,6 +176,10 @@ class Lock(_ContextManagerMixin): yield from fut self._locked = True return True + except futures.CancelledError: + if not self._locked: + self._wake_up_first() + raise finally: self._waiters.remove(fut) @@ -192,14 +196,17 @@ class Lock(_ContextManagerMixin): """ if self._locked: self._locked = False - # Wake up the first waiter who isn't cancelled. - for fut in self._waiters: - if not fut.done(): - fut.set_result(True) - break + self._wake_up_first() else: raise RuntimeError('Lock is not acquired.') + def _wake_up_first(self): + """Wake up the first waiter who isn't cancelled.""" + for fut in self._waiters: + if not fut.done(): + fut.set_result(True) + break + class Event: """Asynchronous equivalent to threading.Event. diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index fef3205..13a885c 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -231,8 +231,9 @@ class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, def write(self, data): if not isinstance(data, (bytes, bytearray, memoryview)): - raise TypeError('data argument must be byte-ish (%r)', - type(data)) + msg = ("data argument must be a bytes-like object, not '%s'" % + type(data).__name__) + raise TypeError(msg) if self._eof_written: raise RuntimeError('write_eof() already called') diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index c2c4b95..61d478e 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -542,14 +542,19 @@ class SSLProtocol(protocols.Protocol): def _get_extra_info(self, name, default=None): if name in self._extra: return self._extra[name] - else: + elif self._transport is not None: return self._transport.get_extra_info(name, default) + else: + return default def _start_shutdown(self): if self._in_shutdown: return - self._in_shutdown = True - self._write_appdata(b'') + if self._in_handshake: + self._abort() + else: + self._in_shutdown = True + self._write_appdata(b'') def _write_appdata(self, data): self._write_backlog.append((data, 0)) @@ -680,12 +685,14 @@ class SSLProtocol(protocols.Protocol): self._transport._force_close(exc) def _finalize(self): + self._sslpipe = None + if self._transport is not None: self._transport.close() def _abort(self): - if self._transport is not None: - try: + try: + if self._transport is not None: self._transport.abort() - finally: - self._finalize() + finally: + self._finalize() diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py index b2f5304..4c85466 100644 --- a/Lib/asyncio/subprocess.py +++ b/Lib/asyncio/subprocess.py @@ -24,6 +24,8 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, self._limit = limit self.stdin = self.stdout = self.stderr = None self._transport = None + self._process_exited = False + self._pipe_fds = [] def __repr__(self): info = [self.__class__.__name__] @@ -43,12 +45,14 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, self.stdout = streams.StreamReader(limit=self._limit, loop=self._loop) self.stdout.set_transport(stdout_transport) + self._pipe_fds.append(1) stderr_transport = transport.get_pipe_transport(2) if stderr_transport is not None: self.stderr = streams.StreamReader(limit=self._limit, loop=self._loop) self.stderr.set_transport(stderr_transport) + self._pipe_fds.append(2) stdin_transport = transport.get_pipe_transport(0) if stdin_transport is not None: @@ -86,9 +90,18 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, else: reader.set_exception(exc) + if fd in self._pipe_fds: + self._pipe_fds.remove(fd) + self._maybe_close_transport() + def process_exited(self): - self._transport.close() - self._transport = None + self._process_exited = True + self._maybe_close_transport() + + def _maybe_close_transport(self): + if len(self._pipe_fds) == 0 and self._process_exited: + self._transport.close() + self._transport = None class Process: diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 8852aa5..6c43e68 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -208,6 +208,7 @@ class Task(futures.Future): terminates with a CancelledError exception (even if cancel() was not called). """ + self._log_traceback = False if self.done(): return False if self._fut_waiter is not None: @@ -240,7 +241,12 @@ class Task(futures.Future): else: result = coro.throw(exc) except StopIteration as exc: - self.set_result(exc.value) + if self._must_cancel: + # Task is cancelled right before coro stops. + self._must_cancel = False + self.set_exception(futures.CancelledError()) + else: + self.set_result(exc.value) except futures.CancelledError: super().cancel() # I.e., Future.cancel(self). except Exception as exc: @@ -535,7 +541,8 @@ def async_(coro_or_future, *, loop=None): """ warnings.warn("asyncio.async() function is deprecated, use ensure_future()", - DeprecationWarning) + DeprecationWarning, + stacklevel=2) return ensure_future(coro_or_future, loop=loop) @@ -564,7 +571,8 @@ def ensure_future(coro_or_future, *, loop=None): elif compat.PY35 and inspect.isawaitable(coro_or_future): return ensure_future(_wrap_awaitable(coro_or_future), loop=loop) else: - raise TypeError('A Future, a coroutine or an awaitable is required') + raise TypeError('An asyncio.Future, a coroutine or an awaitable is ' + 'required') @coroutine diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py index 9d32822..a1686c5 100644 --- a/Lib/asyncio/test_utils.py +++ b/Lib/asyncio/test_utils.py @@ -33,6 +33,7 @@ from . import selectors from . import tasks from .coroutines import coroutine from .log import logger +from test import support if sys.platform == 'win32': # pragma: no cover @@ -449,12 +450,16 @@ class TestCase(unittest.TestCase): self.set_event_loop(loop) return loop + def unpatch_get_running_loop(self): + events._get_running_loop = self._get_running_loop + def setUp(self): self._get_running_loop = events._get_running_loop events._get_running_loop = lambda: None + self._thread_cleanup = support.threading_setup() def tearDown(self): - events._get_running_loop = self._get_running_loop + self.unpatch_get_running_loop() events.set_event_loop(None) @@ -462,6 +467,10 @@ class TestCase(unittest.TestCase): # in an except block of a generator self.assertEqual(sys.exc_info(), (None, None, None)) + self.doCleanups() + support.threading_cleanup(*self._thread_cleanup) + support.reap_children() + if not compat.PY34: # Python 3.3 compatibility def subTest(self, *args, **kwargs): diff --git a/Lib/base64.py b/Lib/base64.py index adaec1d..0dc64cf 100755 --- a/Lib/base64.py +++ b/Lib/base64.py @@ -542,7 +542,8 @@ def encodebytes(s): def encodestring(s): """Legacy alias of encodebytes().""" import warnings - warnings.warn("encodestring() is a deprecated alias, use encodebytes()", + warnings.warn("encodestring() is a deprecated alias since 3.1, " + "use encodebytes()", DeprecationWarning, 2) return encodebytes(s) @@ -555,7 +556,8 @@ def decodebytes(s): def decodestring(s): """Legacy alias of decodebytes().""" import warnings - warnings.warn("decodestring() is a deprecated alias, use decodebytes()", + warnings.warn("decodestring() is a deprecated alias since Python 3.1, " + "use decodebytes()", DeprecationWarning, 2) return decodebytes(s) diff --git a/Lib/contextlib.py b/Lib/contextlib.py index d44edd6..5371a9f 100644 --- a/Lib/contextlib.py +++ b/Lib/contextlib.py @@ -65,7 +65,7 @@ class _GeneratorContextManager(ContextDecorator): try: next(self.gen) except StopIteration: - return + return False else: raise RuntimeError("generator didn't stop") else: @@ -75,20 +75,19 @@ class _GeneratorContextManager(ContextDecorator): value = type() try: self.gen.throw(type, value, traceback) - raise RuntimeError("generator didn't stop after throw()") except StopIteration as exc: # Suppress StopIteration *unless* it's the same exception that # was passed to throw(). This prevents a StopIteration # raised inside the "with" statement from being suppressed. return exc is not value except RuntimeError as exc: - # Don't re-raise the passed in exception. (issue27112) + # Don't re-raise the passed in exception. (issue27122) if exc is value: return False # Likewise, avoid suppressing if a StopIteration exception # was passed to throw() and later wrapped into a RuntimeError # (see PEP 479). - if exc.__cause__ is value: + if type is StopIteration and exc.__cause__ is value: return False raise except: @@ -99,8 +98,10 @@ class _GeneratorContextManager(ContextDecorator): # fixes the impedance mismatch between the throw() protocol # and the __exit__() protocol. # - if sys.exc_info()[1] is not value: - raise + if sys.exc_info()[1] is value: + return False + raise + raise RuntimeError("generator didn't stop after throw()") def contextmanager(func): diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index 0d86078..1469b8b 100644 --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -327,6 +327,10 @@ class CDLL(object): """ _func_flags_ = _FUNCFLAG_CDECL _func_restype_ = c_int + # default values for repr + _name = '' + _handle = 0 + _FuncPtr = None def __init__(self, name, mode=DEFAULT_MODE, handle=None, use_errno=False, diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks.py index 8eac58f..f622093 100644 --- a/Lib/ctypes/test/test_callbacks.py +++ b/Lib/ctypes/test/test_callbacks.py @@ -244,6 +244,7 @@ class SampleCallbacksTestCase(unittest.TestCase): def test_callback_large_struct(self): class Check: pass + # This should mirror the structure in Modules/_ctypes/_ctypes_test.c class X(Structure): _fields_ = [ ('first', c_ulong), @@ -255,6 +256,11 @@ class SampleCallbacksTestCase(unittest.TestCase): check.first = s.first check.second = s.second check.third = s.third + # See issue #29565. + # The structure should be passed by value, so + # any changes to it should not be reflected in + # the value passed + s.first = s.second = s.third = 0x0badf00d check = Check() s = X() @@ -275,6 +281,11 @@ class SampleCallbacksTestCase(unittest.TestCase): self.assertEqual(check.first, 0xdeadbeef) self.assertEqual(check.second, 0xcafebabe) self.assertEqual(check.third, 0x0bad1dea) + # See issue #29565. + # Ensure that the original struct is unchanged. + self.assertEqual(s.first, check.first) + self.assertEqual(s.second, check.second) + self.assertEqual(s.third, check.third) ################################################################ diff --git a/Lib/ctypes/test/test_loading.py b/Lib/ctypes/test/test_loading.py index 28468c1..3de457f 100644 --- a/Lib/ctypes/test/test_loading.py +++ b/Lib/ctypes/test/test_loading.py @@ -64,6 +64,8 @@ class LoaderTest(unittest.TestCase): windll["kernel32"].GetModuleHandleW windll.LoadLibrary("kernel32").GetModuleHandleW WinDLL("kernel32").GetModuleHandleW + # embedded null character + self.assertRaises(ValueError, windll.LoadLibrary, "kernel32\0") elif os.name == "ce": windll.coredll.GetModuleHandleW windll["coredll"].GetModuleHandleW diff --git a/Lib/ctypes/test/test_slicing.py b/Lib/ctypes/test/test_slicing.py index 240dc0c..a3932f1 100644 --- a/Lib/ctypes/test/test_slicing.py +++ b/Lib/ctypes/test/test_slicing.py @@ -134,7 +134,7 @@ class SlicesTestCase(unittest.TestCase): dll.my_wcsdup.restype = POINTER(c_wchar) dll.my_wcsdup.argtypes = POINTER(c_wchar), dll.my_free.restype = None - res = dll.my_wcsdup(s) + res = dll.my_wcsdup(s[:-1]) self.assertEqual(res[:len(s)], s) self.assertEqual(res[:len(s):], s) self.assertEqual(res[len(s)-1:-1:-1], s[::-1]) @@ -153,7 +153,7 @@ class SlicesTestCase(unittest.TestCase): dll.my_wcsdup.restype = POINTER(c_long) else: self.skipTest('Pointers to c_wchar are not supported') - res = dll.my_wcsdup(s) + res = dll.my_wcsdup(s[:-1]) tmpl = list(range(ord("a"), ord("z")+1)) self.assertEqual(res[:len(s)-1], tmpl) self.assertEqual(res[:len(s)-1:], tmpl) diff --git a/Lib/ctypes/test/test_structures.py b/Lib/ctypes/test/test_structures.py index c4a651c..2e9fc7c 100644 --- a/Lib/ctypes/test/test_structures.py +++ b/Lib/ctypes/test/test_structures.py @@ -2,7 +2,8 @@ import unittest from ctypes import * from ctypes.test import need_symbol from struct import calcsize -import _testcapi +import _ctypes_test +import test.support class SubclassesTest(unittest.TestCase): def test_subclass(self): @@ -201,7 +202,10 @@ class StructureTestCase(unittest.TestCase): "_pack_": -1} self.assertRaises(ValueError, type(Structure), "X", (Structure,), d) + @test.support.cpython_only + def test_packed_c_limits(self): # Issue 15989 + import _testcapi d = {"_fields_": [("a", c_byte)], "_pack_": _testcapi.INT_MAX + 1} self.assertRaises(ValueError, type(Structure), "X", (Structure,), d) @@ -394,6 +398,28 @@ class StructureTestCase(unittest.TestCase): (1, 0, 0, 0, 0, 0)) self.assertRaises(TypeError, lambda: Z(1, 2, 3, 4, 5, 6, 7)) + def test_pass_by_value(self): + # This should mirror the structure in Modules/_ctypes/_ctypes_test.c + class X(Structure): + _fields_ = [ + ('first', c_ulong), + ('second', c_ulong), + ('third', c_ulong), + ] + + s = X() + s.first = 0xdeadbeef + s.second = 0xcafebabe + s.third = 0x0bad1dea + dll = CDLL(_ctypes_test.__file__) + func = dll._testfunc_large_struct_update_value + func.argtypes = (X,) + func.restype = None + func(s) + self.assertEqual(s.first, 0xdeadbeef) + self.assertEqual(s.second, 0xcafebabe) + self.assertEqual(s.third, 0x0bad1dea) + class PointerMemberTestCase(unittest.TestCase): def test(self): diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 573724d..bd19ebf 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -93,14 +93,11 @@ def get_python_inc(plat_specific=0, prefix=None): # the build directory may not be the source directory, we # must use "srcdir" from the makefile to find the "Include" # directory. - base = _sys_home or project_base if plat_specific: - return base - if _sys_home: - incdir = os.path.join(_sys_home, get_config_var('AST_H_DIR')) + return _sys_home or project_base else: incdir = os.path.join(get_config_var('srcdir'), 'Include') - return os.path.normpath(incdir) + return os.path.normpath(incdir) python_dir = 'python' + get_python_version() + build_flags return os.path.join(prefix, "include", python_dir) elif os.name == "nt": diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py index f3df564..ce13227 100644 --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -37,6 +37,13 @@ class BuildExtTestCase(TempdirManager, from distutils.command import build_ext build_ext.USER_BASE = site.USER_BASE + # bpo-30132: On Windows, a .pdb file may be created in the current + # working directory. Create a temporary working directory to cleanup + # everything at the end of the test. + self.temp_cwd = support.temp_cwd() + self.temp_cwd.__enter__() + self.addCleanup(self.temp_cwd.__exit__, None, None, None) + def build_ext(self, *args, **kwargs): return build_ext(*args, **kwargs) diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index 5df9511..37a9fbc 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -341,9 +341,7 @@ class TokenList(list): # avoid infinite recursion. ws = part.pop_leading_fws() if ws is not None: - # Peel off the leading whitespace and make it sticky, to - # avoid infinite recursion. - folded.stickyspace = str(part.pop(0)) + folded.stickyspace = str(ws) if folded.append_if_fits(part): continue if part.has_fws: diff --git a/Lib/email/_policybase.py b/Lib/email/_policybase.py index c0d98a4..7326d3a 100644 --- a/Lib/email/_policybase.py +++ b/Lib/email/_policybase.py @@ -357,8 +357,12 @@ class Compat32(Policy): # Assume it is a Header-like object. h = value if h is not None: - parts.append(h.encode(linesep=self.linesep, - maxlinelen=self.max_line_length)) + # The Header class interprets a value of None for maxlinelen as the + # default value of 78, as recommended by RFC 2822. + maxlinelen = 0 + if self.max_line_length is not None: + maxlinelen = self.max_line_length + parts.append(h.encode(linesep=self.linesep, maxlinelen=maxlinelen)) parts.append(self.linesep) return ''.join(parts) diff --git a/Lib/email/architecture.rst b/Lib/email/architecture.rst index 78572ae..fcd10bd 100644 --- a/Lib/email/architecture.rst +++ b/Lib/email/architecture.rst @@ -66,7 +66,7 @@ data payloads. Message Lifecycle ----------------- -The general lifecyle of a message is: +The general lifecycle of a message is: Creation A `Message` object can be created by a Parser, or it can be diff --git a/Lib/ftplib.py b/Lib/ftplib.py index c416d85..2416fc6 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -187,6 +187,8 @@ class FTP: # Internal: send one line to the server, appending CRLF def putline(self, line): + if '\r' in line or '\n' in line: + raise ValueError('an illegal newline character should not be contained') line = line + CRLF if self.debugging > 1: print('*put*', self.sanitize(line)) diff --git a/Lib/getpass.py b/Lib/getpass.py index be51121..36e17e4 100644 --- a/Lib/getpass.py +++ b/Lib/getpass.py @@ -7,7 +7,6 @@ GetPassWarning - This UserWarning is issued when getpass() cannot prevent echoing of the password contents while reading. On Windows, the msvcrt module will be used. -On the Mac EasyDialogs.AskPassword is used, if available. """ diff --git a/Lib/gettext.py b/Lib/gettext.py index 57d2c74..6b215af 100644 --- a/Lib/gettext.py +++ b/Lib/gettext.py @@ -270,7 +270,9 @@ class NullTranslations: def lgettext(self, message): if self._fallback: return self._fallback.lgettext(message) - return message + if self._output_charset: + return message.encode(self._output_charset) + return message.encode(locale.getpreferredencoding()) def ngettext(self, msgid1, msgid2, n): if self._fallback: @@ -284,9 +286,12 @@ class NullTranslations: if self._fallback: return self._fallback.lngettext(msgid1, msgid2, n) if n == 1: - return msgid1 + tmsg = msgid1 else: - return msgid2 + tmsg = msgid2 + if self._output_charset: + return tmsg.encode(self._output_charset) + return tmsg.encode(locale.getpreferredencoding()) def info(self): return self._info @@ -368,7 +373,7 @@ class GNUTranslations(NullTranslations): if mlen == 0: # Catalog description lastk = None - for b_item in tmsg.split('\n'.encode("ascii")): + for b_item in tmsg.split(b'\n'): item = b_item.decode().strip() if not item: continue @@ -416,7 +421,7 @@ class GNUTranslations(NullTranslations): if tmsg is missing: if self._fallback: return self._fallback.lgettext(message) - return message + tmsg = message if self._output_charset: return tmsg.encode(self._output_charset) return tmsg.encode(locale.getpreferredencoding()) @@ -424,16 +429,16 @@ class GNUTranslations(NullTranslations): def lngettext(self, msgid1, msgid2, n): try: tmsg = self._catalog[(msgid1, self.plural(n))] - if self._output_charset: - return tmsg.encode(self._output_charset) - return tmsg.encode(locale.getpreferredencoding()) except KeyError: if self._fallback: return self._fallback.lngettext(msgid1, msgid2, n) if n == 1: - return msgid1 + tmsg = msgid1 else: - return msgid2 + tmsg = msgid2 + if self._output_charset: + return tmsg.encode(self._output_charset) + return tmsg.encode(locale.getpreferredencoding()) def gettext(self, message): missing = object() @@ -573,11 +578,11 @@ def dgettext(domain, message): return t.gettext(message) def ldgettext(domain, message): + codeset = _localecodesets.get(domain) try: - t = translation(domain, _localedirs.get(domain, None), - codeset=_localecodesets.get(domain)) + t = translation(domain, _localedirs.get(domain, None), codeset=codeset) except OSError: - return message + return message.encode(codeset or locale.getpreferredencoding()) return t.lgettext(message) def dngettext(domain, msgid1, msgid2, n): @@ -592,14 +597,15 @@ def dngettext(domain, msgid1, msgid2, n): return t.ngettext(msgid1, msgid2, n) def ldngettext(domain, msgid1, msgid2, n): + codeset = _localecodesets.get(domain) try: - t = translation(domain, _localedirs.get(domain, None), - codeset=_localecodesets.get(domain)) + t = translation(domain, _localedirs.get(domain, None), codeset=codeset) except OSError: if n == 1: - return msgid1 + tmsg = msgid1 else: - return msgid2 + tmsg = msgid2 + return tmsg.encode(codeset or locale.getpreferredencoding()) return t.lngettext(msgid1, msgid2, n) def gettext(message): diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 9944da3..8613536 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -25,9 +25,9 @@ from idlelib import help # The default tab setting for a Text widget, in average-width characters. TK_TABWIDTH_DEFAULT = 8 - _py_version = ' (%s)' % platform.python_version() + def _sphinx_version(): "Format sys.version_info to produce the Sphinx version string used to install the chm docs" major, minor, micro, level, serial = sys.version_info @@ -92,11 +92,12 @@ class EditorWindow(object): from idlelib.Percolator import Percolator from idlelib.ColorDelegator import ColorDelegator, color_config from idlelib.UndoDelegator import UndoDelegator - from idlelib.IOBinding import IOBinding, filesystemencoding, encoding + from idlelib.IOBinding import IOBinding, encoding from idlelib import Bindings from tkinter import Toplevel from idlelib.MultiStatusBar import MultiStatusBar + filesystemencoding = sys.getfilesystemencoding() # for file names help_url = None def __init__(self, flist=None, filename=None, key=None, root=None): @@ -1686,5 +1687,8 @@ def _editor_window(parent): # htest # # edit.text.bind("<>", edit.close_event) if __name__ == '__main__': + import unittest + unittest.main('idlelib.idle_test.test_editor', verbosity=2, exit=False) + from idlelib.idle_test.htest import run run(_editor_window) diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index 84f39a2..efd0d5e 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -10,57 +10,60 @@ import tkinter.filedialog as tkFileDialog import tkinter.messagebox as tkMessageBox from tkinter.simpledialog import askstring +import idlelib from idlelib.configHandler import idleConf - -# Try setting the locale, so that we can find out -# what encoding to use -try: - import locale - locale.setlocale(locale.LC_CTYPE, "") -except (ImportError, locale.Error): - pass - -# Encoding for file names -filesystemencoding = sys.getfilesystemencoding() ### currently unused - -locale_encoding = 'ascii' -if sys.platform == 'win32': - # On Windows, we could use "mbcs". However, to give the user - # a portable encoding name, we need to find the code page - try: - locale_encoding = locale.getdefaultlocale()[1] - codecs.lookup(locale_encoding) - except LookupError: - pass +if idlelib.testing: # Set True by test.test_idle to avoid setlocale. + encoding = 'utf-8' else: + # Try setting the locale, so that we can find out + # what encoding to use try: - # Different things can fail here: the locale module may not be - # loaded, it may not offer nl_langinfo, or CODESET, or the - # resulting codeset may be unknown to Python. We ignore all - # these problems, falling back to ASCII - locale_encoding = locale.nl_langinfo(locale.CODESET) - if locale_encoding is None or locale_encoding is '': - # situation occurs on Mac OS X - locale_encoding = 'ascii' - codecs.lookup(locale_encoding) - except (NameError, AttributeError, LookupError): - # Try getdefaultlocale: it parses environment variables, - # which may give a clue. Unfortunately, getdefaultlocale has - # bugs that can cause ValueError. + import locale + locale.setlocale(locale.LC_CTYPE, "") + except (ImportError, locale.Error): + pass + + locale_decode = 'ascii' + if sys.platform == 'win32': + # On Windows, we could use "mbcs". However, to give the user + # a portable encoding name, we need to find the code page try: locale_encoding = locale.getdefaultlocale()[1] + codecs.lookup(locale_encoding) + except LookupError: + pass + else: + try: + # Different things can fail here: the locale module may not be + # loaded, it may not offer nl_langinfo, or CODESET, or the + # resulting codeset may be unknown to Python. We ignore all + # these problems, falling back to ASCII + locale_encoding = locale.nl_langinfo(locale.CODESET) if locale_encoding is None or locale_encoding is '': # situation occurs on Mac OS X locale_encoding = 'ascii' codecs.lookup(locale_encoding) - except (ValueError, LookupError): - pass + except (NameError, AttributeError, LookupError): + # Try getdefaultlocale: it parses environment variables, + # which may give a clue. Unfortunately, getdefaultlocale has + # bugs that can cause ValueError. + try: + locale_encoding = locale.getdefaultlocale()[1] + if locale_encoding is None or locale_encoding is '': + # situation occurs on Mac OS X + locale_encoding = 'ascii' + codecs.lookup(locale_encoding) + except (ValueError, LookupError): + pass -locale_encoding = locale_encoding.lower() + locale_encoding = locale_encoding.lower() -encoding = locale_encoding ### KBK 07Sep07 This is used all over IDLE, check! - ### 'encoding' is used below in encode(), check! + encoding = locale_encoding + # Encoding is used in multiple files; locale_encoding nowhere. + # The only use of 'encoding' below is in _decode as initial value + # of deprecated block asking user for encoding. + # Perhaps use elsewhere should be reviewed. coding_re = re.compile(r'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)', re.ASCII) blank_re = re.compile(r'^[ \t\f]*(?:[#\r\n]|$)', re.ASCII) @@ -301,7 +304,7 @@ class IOBinding: "The file's encoding is invalid for Python 3.x.\n" "IDLE will convert it to UTF-8.\n" "What is the current encoding of the file?", - initialvalue = locale_encoding, + initialvalue = encoding, parent = self.editwin.text) if enc: @@ -561,5 +564,8 @@ def _io_binding(parent): # htest # IOBinding(editwin) if __name__ == "__main__": + import unittest + unittest.main('idlelib.idle_test.test_iomenu', verbosity=2, exit=False) + from idlelib.idle_test.htest import run run(_io_binding) diff --git a/Lib/idlelib/__init__.py b/Lib/idlelib/__init__.py index 711f61b..208ced1 100644 --- a/Lib/idlelib/__init__.py +++ b/Lib/idlelib/__init__.py @@ -6,3 +6,4 @@ Use the files named idle.* to start Idle. The other files are private implementations. Their details are subject to change. See PEP 434 for more. Import them at your own risk. """ +testing = False # Set True by test.test_idle. diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index ffc03c4..f10cd34 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -90,7 +90,7 @@

25.5. IDLE¶

-

Source code: Lib/idlelib/

+

Source code: Lib/idlelib/


IDLE is Python’s Integrated Development and Learning Environment.

IDLE has the following features:

diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 2f7e933..ef2c6f8 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -310,9 +310,12 @@ class IMAP4: self.file.close() try: self.sock.shutdown(socket.SHUT_RDWR) - except OSError as e: - # The server might already have closed the connection - if e.errno != errno.ENOTCONN: + except OSError as exc: + # The server might already have closed the connection. + # On Windows, this may result in WSAEINVAL (error 10022): + # An invalid operation was attempted. + if (exc.errno != errno.ENOTCONN + and getattr(exc, 'winerror', 0) != 10022): raise finally: self.sock.close() diff --git a/Lib/imp.py b/Lib/imp.py index e264391..af0790f 100644 --- a/Lib/imp.py +++ b/Lib/imp.py @@ -203,8 +203,9 @@ def load_package(name, path): extensions = (machinery.SOURCE_SUFFIXES[:] + machinery.BYTECODE_SUFFIXES[:]) for extension in extensions: - path = os.path.join(path, '__init__'+extension) - if os.path.exists(path): + init_path = os.path.join(path, '__init__' + extension) + if os.path.exists(init_path): + path = init_path break else: raise ValueError('{!r} is not a package'.format(path)) diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py index b6a9f82..8b11d22 100644 --- a/Lib/importlib/__init__.py +++ b/Lib/importlib/__init__.py @@ -136,7 +136,7 @@ def reload(module): """ if not module or not isinstance(module, types.ModuleType): - raise TypeError("reload() argument must be module") + raise TypeError("reload() argument must be a module") try: name = module.__spec__.name except AttributeError: diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 9eecbfe..02fe05b 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -925,10 +925,9 @@ def _sanity_check(name, package, level): if level > 0: if not isinstance(package, str): raise TypeError('__package__ not set to a string') - elif package not in sys.modules: - msg = ('Parent module {!r} not loaded, cannot perform relative ' - 'import') - raise SystemError(msg.format(package)) + elif not package: + raise ImportError('attempted relative import with no known parent ' + 'package') if not name and level == 0: raise ValueError('Empty module name') diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index e54d691..506bb33 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -230,7 +230,7 @@ _code_type = type(_write_atomic.__code__) # Python 3.5b1 3330 (PEP 448: Additional Unpacking Generalizations) # Python 3.5b2 3340 (fix dictionary display evaluation order #11205) # Python 3.5b2 3350 (add GET_YIELD_FROM_ITER opcode #24400) -# Python 3.5.2 3351 (fix BUILD_MAP_UNPACK_WITH_CALL opcode #27286) +# Python 3.5.3 3351 (fix BUILD_MAP_UNPACK_WITH_CALL opcode #27286) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -242,6 +242,28 @@ _code_type = type(_write_atomic.__code__) MAGIC_NUMBER = (3351).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c +# Issue #29537: handle issue27286 bytecode incompatibility +# +# The magic number bump in Python 3.5.3 for issue27286 turned out to create +# significant backwards compatibility problems for redistributors and +# other folks that rely on the bytecode format remaining stable within a +# given maintenance release series. See http://bugs.python.org/issue29514 +# for more discussion of the problems that the original change caused. +# +# The _BACKCOMPAT_MAGIC_NUMBER below and any other changes marked with +# "Issue #29537" comments allow Python 3.5.4+ to load bytecode files with both +# the original 3.5.0 magic number and those with the updated magic number used +# since 3.5.3. +# +# This is expected to be a one-off change used solely to restore legacy +# bytecode compatibility within the 3.5.x series, so it avoids any changes +# that would prompt a rebuild of C extension modules. +# +if _RAW_MAGIC_NUMBER != 168627479: + _msg = 'Magic number mismatch (the issue27286 workaround is for 3.5 only)' + raise SystemError(_msg) +_BACKCOMPAT_MAGIC_NUMBER = (3350).to_bytes(2, 'little') + b'\r\n' + _PYCACHE = '__pycache__' _OPT = 'opt-' @@ -446,7 +468,9 @@ def _validate_bytecode_header(data, source_stats=None, name=None, path=None): magic = data[:4] raw_timestamp = data[4:8] raw_size = data[8:12] - if magic != MAGIC_NUMBER: + if (magic != MAGIC_NUMBER + # Issue #29537: handle issue27286 bytecode incompatibility + and magic != _BACKCOMPAT_MAGIC_NUMBER): message = 'bad magic number in {!r}: {!r}'.format(name, magic) _verbose_message('{}', message) raise ImportError(message, **exc_details) diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py index e1fa07a..a15cf00 100644 --- a/Lib/importlib/util.py +++ b/Lib/importlib/util.py @@ -4,7 +4,7 @@ from ._bootstrap import module_from_spec from ._bootstrap import _resolve_name from ._bootstrap import spec_from_loader from ._bootstrap import _find_spec -from ._bootstrap_external import MAGIC_NUMBER +from ._bootstrap_external import MAGIC_NUMBER, _BACKCOMPAT_MAGIC_NUMBER from ._bootstrap_external import cache_from_source from ._bootstrap_external import decode_source from ._bootstrap_external import source_from_cache diff --git a/Lib/inspect.py b/Lib/inspect.py index 6b9e0b0..424c945 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -241,18 +241,24 @@ def iscode(object): """Return true if the object is a code object. Code objects provide these attributes: - co_argcount number of arguments (not including * or ** args) - co_code string of raw compiled bytecode - co_consts tuple of constants used in the bytecode - co_filename name of file in which this code object was created - co_firstlineno number of first line in Python source code - co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg - co_lnotab encoded mapping of line numbers to bytecode indices - co_name name with which this code object was defined - co_names tuple of names of local variables - co_nlocals number of local variables - co_stacksize virtual machine stack space required - co_varnames tuple of names of arguments and local variables""" + co_argcount number of arguments (not including *, ** args + or keyword only arguments) + co_code string of raw compiled bytecode + co_cellvars tuple of names of cell variables + co_consts tuple of constants used in the bytecode + co_filename name of file in which this code object was created + co_firstlineno number of first line in Python source code + co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg + | 16=nested | 32=generator | 64=nofree | 128=coroutine + | 256=iterable_coroutine + co_freevars tuple of names of free variables + co_kwonlyargcount number of keyword only arguments (not including ** arg) + co_lnotab encoded mapping of line numbers to bytecode indices + co_name name with which this code object was defined + co_names tuple of names of local variables + co_nlocals number of local variables + co_stacksize virtual machine stack space required + co_varnames tuple of names of arguments and local variables""" return isinstance(object, types.CodeType) def isbuiltin(object): @@ -1416,7 +1422,6 @@ def getframeinfo(frame, context=1): except OSError: lines = index = None else: - start = max(start, 0) start = max(0, min(start, len(lines) - context)) lines = lines[start:start+context] index = lineno - 1 - start @@ -2215,11 +2220,16 @@ def _signature_from_callable(obj, *, sigcls=sigcls) sig = _signature_get_partial(wrapped_sig, partialmethod, (None,)) - first_wrapped_param = tuple(wrapped_sig.parameters.values())[0] - new_params = (first_wrapped_param,) + tuple(sig.parameters.values()) - - return sig.replace(parameters=new_params) + if first_wrapped_param.kind is Parameter.VAR_POSITIONAL: + # First argument of the wrapped callable is `*args`, as in + # `partialmethod(lambda *args)`. + return sig + else: + sig_params = tuple(sig.parameters.values()) + assert first_wrapped_param is not sig_params[0] + new_params = (first_wrapped_param,) + sig_params + return sig.replace(parameters=new_params) if isfunction(obj) or _signature_is_functionlike(obj): # If it's a pure Python function, or an object that is duck type diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py index 1f90058..35ca38e 100644 --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -1410,7 +1410,8 @@ class IPv4Interface(IPv4Address): if address_less is NotImplemented: return NotImplemented try: - return self.network < other.network + return (self.network < other.network or + self.network == other.network and address_less) except AttributeError: # We *do* allow addresses and interfaces to be sorted. The # unassociated address is considered less than all interfaces. @@ -2100,7 +2101,8 @@ class IPv6Interface(IPv6Address): if address_less is NotImplemented: return NotImplemented try: - return self.network < other.network + return (self.network < other.network or + self.network == other.network and address_less) except AttributeError: # We *do* allow addresses and interfaces to be sorted. The # unassociated address is considered less than all interfaces. diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py index 1118b0e..ca2c611 100644 --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -76,7 +76,7 @@ Specializing JSON object encoding:: >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] - ... raise TypeError(repr(o) + " is not JSON serializable") + ... raise TypeError(repr(obj) + " is not JSON serializable") ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 22744e1..6455f39 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -129,9 +129,14 @@ def getLevelName(level): Otherwise, the string "Level %s" % level is returned. """ - # See Issues #22386 and #27937 for why it's this way - return (_levelToName.get(level) or _nameToLevel.get(level) or - "Level %s" % level) + # See Issues #22386, #27937 and #29220 for why it's this way + result = _levelToName.get(level) + if result is not None: + return result + result = _nameToLevel.get(level) + if result is not None: + return result + return "Level %s" % level def addLevelName(level, levelName): """ diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index c39a56f..b9d6e37 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -803,16 +803,38 @@ class SysLogHandler(logging.Handler): if isinstance(address, str): self.unixsocket = True - self._connect_unixsocket(address) + # Syslog server may be unavailable during handler initialisation. + # C's openlog() function also ignores connection errors. + # Moreover, we ignore these errors while logging, so it not worse + # to ignore it also here. + try: + self._connect_unixsocket(address) + except OSError: + pass else: self.unixsocket = False if socktype is None: socktype = socket.SOCK_DGRAM - self.socket = socket.socket(socket.AF_INET, socktype) - if socktype == socket.SOCK_STREAM: - self.socket.connect(address) + host, port = address + ress = socket.getaddrinfo(host, port, 0, socktype) + if not ress: + raise OSError("getaddrinfo returns an empty list") + for res in ress: + af, socktype, proto, _, sa = res + err = sock = None + try: + sock = socket.socket(af, socktype, proto) + if socktype == socket.SOCK_STREAM: + sock.connect(sa) + break + except OSError as exc: + err = exc + if sock is not None: + sock.close() + if err is not None: + raise err + self.socket = sock self.socktype = socktype - self.formatter = None def _connect_unixsocket(self, address): use_socktype = self.socktype @@ -851,7 +873,7 @@ class SysLogHandler(logging.Handler): priority = self.priority_names[priority] return (facility << 3) | priority - def close (self): + def close(self): """ Closes the socket. """ diff --git a/Lib/multiprocessing/forkserver.py b/Lib/multiprocessing/forkserver.py index ad01ede..1b4c7cb 100644 --- a/Lib/multiprocessing/forkserver.py +++ b/Lib/multiprocessing/forkserver.py @@ -149,8 +149,15 @@ def main(listener_fd, alive_r, preload, main_path=None, sys_path=None): util._close_stdin() - # ignoring SIGCHLD means no need to reap zombie processes - handler = signal.signal(signal.SIGCHLD, signal.SIG_IGN) + # ignoring SIGCHLD means no need to reap zombie processes; + # letting SIGINT through avoids KeyboardInterrupt tracebacks + handlers = { + signal.SIGCHLD: signal.SIG_IGN, + signal.SIGINT: signal.SIG_DFL, + } + old_handlers = {sig: signal.signal(sig, val) + for (sig, val) in handlers.items()} + with socket.socket(socket.AF_UNIX, fileno=listener_fd) as listener, \ selectors.DefaultSelector() as selector: _forkserver._forkserver_address = listener.getsockname() @@ -175,7 +182,7 @@ def main(listener_fd, alive_r, preload, main_path=None, sys_path=None): code = 1 if os.fork() == 0: try: - _serve_one(s, listener, alive_r, handler) + _serve_one(s, listener, alive_r, old_handlers) except Exception: sys.excepthook(*sys.exc_info()) sys.stderr.flush() @@ -186,11 +193,12 @@ def main(listener_fd, alive_r, preload, main_path=None, sys_path=None): if e.errno != errno.ECONNABORTED: raise -def _serve_one(s, listener, alive_r, handler): - # close unnecessary stuff and reset SIGCHLD handler +def _serve_one(s, listener, alive_r, handlers): + # close unnecessary stuff and reset signal handlers listener.close() os.close(alive_r) - signal.signal(signal.SIGCHLD, handler) + for sig, val in handlers.items(): + signal.signal(sig, val) # receive fds from parent process fds = reduction.recvfds(s, MAXFDS_TO_SEND + 1) diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py index 6d25469..789488f 100644 --- a/Lib/multiprocessing/pool.py +++ b/Lib/multiprocessing/pool.py @@ -118,7 +118,7 @@ def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None, try: result = (True, func(*args, **kwds)) except Exception as e: - if wrap_exception: + if wrap_exception and func is not _helper_reraises_exception: e = ExceptionWithTraceback(e, e.__traceback__) result = (False, e) try: @@ -128,9 +128,15 @@ def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None, util.debug("Possible encoding error while sending result: %s" % ( wrapped)) put((job, i, (False, wrapped))) + + task = job = result = func = args = kwds = None completed += 1 util.debug('worker exiting after %d tasks' % completed) +def _helper_reraises_exception(ex): + 'Pickle-able helper function for use by _guarded_task_generation.' + raise ex + # # Class representing a process pool # @@ -275,6 +281,17 @@ class Pool(object): return self._map_async(func, iterable, starmapstar, chunksize, callback, error_callback) + def _guarded_task_generation(self, result_job, func, iterable): + '''Provides a generator of tasks for imap and imap_unordered with + appropriate handling for iterables which throw exceptions during + iteration.''' + try: + i = -1 + for i, x in enumerate(iterable): + yield (result_job, i, func, (x,), {}) + except Exception as e: + yield (result_job, i+1, _helper_reraises_exception, (e,), {}) + def imap(self, func, iterable, chunksize=1): ''' Equivalent of `map()` -- can be MUCH slower than `Pool.map()`. @@ -283,15 +300,23 @@ class Pool(object): raise ValueError("Pool not running") if chunksize == 1: result = IMapIterator(self._cache) - self._taskqueue.put((((result._job, i, func, (x,), {}) - for i, x in enumerate(iterable)), result._set_length)) + self._taskqueue.put( + ( + self._guarded_task_generation(result._job, func, iterable), + result._set_length + )) return result else: assert chunksize > 1 task_batches = Pool._get_tasks(func, iterable, chunksize) result = IMapIterator(self._cache) - self._taskqueue.put((((result._job, i, mapstar, (x,), {}) - for i, x in enumerate(task_batches)), result._set_length)) + self._taskqueue.put( + ( + self._guarded_task_generation(result._job, + mapstar, + task_batches), + result._set_length + )) return (item for chunk in result for item in chunk) def imap_unordered(self, func, iterable, chunksize=1): @@ -302,15 +327,23 @@ class Pool(object): raise ValueError("Pool not running") if chunksize == 1: result = IMapUnorderedIterator(self._cache) - self._taskqueue.put((((result._job, i, func, (x,), {}) - for i, x in enumerate(iterable)), result._set_length)) + self._taskqueue.put( + ( + self._guarded_task_generation(result._job, func, iterable), + result._set_length + )) return result else: assert chunksize > 1 task_batches = Pool._get_tasks(func, iterable, chunksize) result = IMapUnorderedIterator(self._cache) - self._taskqueue.put((((result._job, i, mapstar, (x,), {}) - for i, x in enumerate(task_batches)), result._set_length)) + self._taskqueue.put( + ( + self._guarded_task_generation(result._job, + mapstar, + task_batches), + result._set_length + )) return (item for chunk in result for item in chunk) def apply_async(self, func, args=(), kwds={}, callback=None, @@ -321,7 +354,7 @@ class Pool(object): if self._state != RUN: raise ValueError("Pool not running") result = ApplyResult(self._cache, callback, error_callback) - self._taskqueue.put(([(result._job, None, func, args, kwds)], None)) + self._taskqueue.put(([(result._job, 0, func, args, kwds)], None)) return result def map_async(self, func, iterable, chunksize=None, callback=None, @@ -352,8 +385,14 @@ class Pool(object): task_batches = Pool._get_tasks(func, iterable, chunksize) result = MapResult(self._cache, chunksize, len(iterable), callback, error_callback=error_callback) - self._taskqueue.put((((result._job, i, mapper, (x,), {}) - for i, x in enumerate(task_batches)), None)) + self._taskqueue.put( + ( + self._guarded_task_generation(result._job, + mapper, + task_batches), + None + ) + ) return result @staticmethod @@ -375,37 +414,32 @@ class Pool(object): for taskseq, set_length in iter(taskqueue.get, None): task = None - i = -1 try: - for i, task in enumerate(taskseq): + # iterating taskseq cannot fail + for task in taskseq: if thread._state: util.debug('task handler found thread._state != RUN') break try: put(task) except Exception as e: - job, ind = task[:2] + job, idx = task[:2] try: - cache[job]._set(ind, (False, e)) + cache[job]._set(idx, (False, e)) except KeyError: pass else: if set_length: util.debug('doing set_length()') - set_length(i+1) + idx = task[1] if task else -1 + set_length(idx + 1) continue break - except Exception as ex: - job, ind = task[:2] if task else (0, 0) - if job in cache: - cache[job]._set(ind + 1, (False, ex)) - if set_length: - util.debug('doing set_length()') - set_length(i+1) + finally: + task = taskseq = job = None else: util.debug('task handler got sentinel') - try: # tell result handler to finish when cache is empty util.debug('task handler sending sentinel to result handler') @@ -445,6 +479,7 @@ class Pool(object): cache[job]._set(i, obj) except KeyError: pass + task = job = obj = None while cache and thread._state != TERMINATE: try: @@ -461,6 +496,7 @@ class Pool(object): cache[job]._set(i, obj) except KeyError: pass + task = job = obj = None if hasattr(outqueue, '_reader'): util.debug('ensuring that outqueue is not full') diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py index bca8b7a..f9c2270 100644 --- a/Lib/multiprocessing/process.py +++ b/Lib/multiprocessing/process.py @@ -104,6 +104,9 @@ class BaseProcess(object): _cleanup() self._popen = self._Popen(self) self._sentinel = self._popen.sentinel + # Avoid a refcycle if the target function holds an indirect + # reference to the process object (see bpo-30775) + del self._target, self._args, self._kwargs _children.add(self) def terminate(self): diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py index 786a303..e6fe5be 100644 --- a/Lib/multiprocessing/queues.py +++ b/Lib/multiprocessing/queues.py @@ -169,14 +169,7 @@ class Queue(object): self._thread.start() debug('... done self._thread.start()') - # On process exit we will wait for data to be flushed to pipe. - # - # However, if this process created the queue then all - # processes which use the queue will be descendants of this - # process. Therefore waiting for the queue to be flushed - # is pointless once all the child processes have been joined. - created_by_this_process = (self._opid == os.getpid()) - if not self._joincancelled and not created_by_this_process: + if not self._joincancelled: self._jointhread = Finalize( self._thread, Queue._finalize_join, [weakref.ref(self._thread)], @@ -221,8 +214,8 @@ class Queue(object): else: wacquire = None - try: - while 1: + while 1: + try: nacquire() try: if not buffer: @@ -249,21 +242,19 @@ class Queue(object): wrelease() except IndexError: pass - except Exception as e: - if ignore_epipe and getattr(e, 'errno', 0) == errno.EPIPE: - return - # Since this runs in a daemon thread the resources it uses - # may be become unusable while the process is cleaning up. - # We ignore errors which happen after the process has - # started to cleanup. - try: + except Exception as e: + if ignore_epipe and getattr(e, 'errno', 0) == errno.EPIPE: + return + # Since this runs in a daemon thread the resources it uses + # may be become unusable while the process is cleaning up. + # We ignore errors which happen after the process has + # started to cleanup. if is_exiting(): info('error in queue thread: %s', e) + return else: import traceback traceback.print_exc() - except Exception: - pass _sentinel = object() @@ -337,6 +328,7 @@ class SimpleQueue(object): def __setstate__(self, state): (self._reader, self._writer, self._rlock, self._wlock) = state + self._poll = self._reader.poll def get(self): with self._rlock: diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index 1a2c0db..b490caa 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -241,20 +241,28 @@ def _run_finalizers(minpriority=None): return if minpriority is None: - f = lambda p : p[0][0] is not None + f = lambda p : p[0] is not None else: - f = lambda p : p[0][0] is not None and p[0][0] >= minpriority - - items = [x for x in list(_finalizer_registry.items()) if f(x)] - items.sort(reverse=True) - - for key, finalizer in items: - sub_debug('calling %s', finalizer) - try: - finalizer() - except Exception: - import traceback - traceback.print_exc() + f = lambda p : p[0] is not None and p[0] >= minpriority + + # Careful: _finalizer_registry may be mutated while this function + # is running (either by a GC run or by another thread). + + # list(_finalizer_registry) should be atomic, while + # list(_finalizer_registry.items()) is not. + keys = [key for key in list(_finalizer_registry) if f(key)] + keys.sort(reverse=True) + + for key in keys: + finalizer = _finalizer_registry.get(key) + # key may have been removed from the registry + if finalizer is not None: + sub_debug('calling %s', finalizer) + try: + finalizer() + except Exception: + import traceback + traceback.print_exc() if minpriority is None: _finalizer_registry.clear() @@ -386,7 +394,7 @@ def _close_stdin(): def spawnv_passfds(path, args, passfds): import _posixsubprocess - passfds = sorted(passfds) + passfds = tuple(sorted(map(int, passfds))) errpipe_read, errpipe_write = os.pipe() try: return _posixsubprocess.fork_exec( diff --git a/Lib/os.py b/Lib/os.py index 011285e..b1add54 100644 --- a/Lib/os.py +++ b/Lib/os.py @@ -741,7 +741,9 @@ class _Environ(MutableMapping): raise KeyError(key) from None def __iter__(self): - for key in self._data: + # list() from dict object is an atomic operation + keys = list(self._data) + for key in keys: yield self.decodekey(key) def __len__(self): diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 1480e2f..29914b9 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -1207,25 +1207,23 @@ class Path(PurePath): os.close(fd) def mkdir(self, mode=0o777, parents=False, exist_ok=False): + """ + Create a new directory at this given path. + """ if self._closed: self._raise_closed() - if not parents: - try: - self._accessor.mkdir(self, mode) - except FileExistsError: - if not exist_ok or not self.is_dir(): - raise - else: - try: - self._accessor.mkdir(self, mode) - except FileExistsError: - if not exist_ok or not self.is_dir(): - raise - except OSError as e: - if e.errno != ENOENT: - raise - self.parent.mkdir(parents=True) - self._accessor.mkdir(self, mode) + try: + self._accessor.mkdir(self, mode) + except FileNotFoundError: + if not parents or self.parent == self: + raise + self.parent.mkdir(parents=True, exist_ok=True) + self.mkdir(mode, parents=False, exist_ok=exist_ok) + except OSError: + # Cannot rely on checking for EEXIST, since the operating system + # could give priority to other errors like EACCES or EROFS + if not exist_ok or not self.is_dir(): + raise def chmod(self, mode): """ diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py index 81d418d..9d1879a 100644 --- a/Lib/pkgutil.py +++ b/Lib/pkgutil.py @@ -37,7 +37,10 @@ def read_code(stream): import marshal magic = stream.read(4) - if magic != importlib.util.MAGIC_NUMBER: + if (magic != importlib.util.MAGIC_NUMBER + # Issue #29537: handle issue27286 bytecode incompatibility + # See Lib/importlib/_bootstrap_external.py + and magic != importlib.util._BACKCOMPAT_MAGIC_NUMBER): return None stream.read(8) # Skip timestamp and size diff --git a/Lib/platform.py b/Lib/platform.py index 3e726a7..d3ed5bf 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1199,7 +1199,9 @@ def _sys_version(sys_version=None): elif buildtime: builddate = builddate + ' ' + buildtime - if hasattr(sys, '_mercurial'): + if hasattr(sys, '_git'): + _, branch, revision = sys._git + elif hasattr(sys, '_mercurial'): _, branch, revision = sys._mercurial elif hasattr(sys, 'subversion'): # sys.subversion was added in Python 2.5 diff --git a/Lib/poplib.py b/Lib/poplib.py index f672390..516b6f0 100644 --- a/Lib/poplib.py +++ b/Lib/poplib.py @@ -288,9 +288,12 @@ class POP3: if sock is not None: try: sock.shutdown(socket.SHUT_RDWR) - except OSError as e: - # The server might already have closed the connection - if e.errno != errno.ENOTCONN: + except OSError as exc: + # The server might already have closed the connection. + # On Windows, this may result in WSAEINVAL (error 10022): + # An invalid operation was attempted. + if (exc.errno != errno.ENOTCONN + and getattr(exc, 'winerror', 0) != 10022): raise finally: sock.close() diff --git a/Lib/pstats.py b/Lib/pstats.py index d861413..2c5bf98 100644 --- a/Lib/pstats.py +++ b/Lib/pstats.py @@ -48,11 +48,14 @@ class Stats: printed. The sort_stats() method now processes some additional options (i.e., in - addition to the old -1, 0, 1, or 2). It takes an arbitrary number of - quoted strings to select the sort order. For example sort_stats('time', - 'name') sorts on the major key of 'internal function time', and on the - minor key of 'the name of the function'. Look at the two tables in - sort_stats() and get_sort_arg_defs(self) for more examples. + addition to the old -1, 0, 1, or 2 that are respectively interpreted as + 'stdname', 'calls', 'time', and 'cumulative'). It takes an arbitrary number + of quoted strings to select the sort order. + + For example sort_stats('time', 'name') sorts on the major key of 'internal + function time', and on the minor key of 'the name of the function'. Look at + the two tables in sort_stats() and get_sort_arg_defs(self) for more + examples. All methods return self, so you can string together commands like: Stats('foo', 'goo').strip_dirs().sort_stats('calls').\ diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 0d0d0ab..729efba 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -289,7 +289,12 @@ def importfile(path): """Import a Python source file or compiled file given its path.""" magic = importlib.util.MAGIC_NUMBER with open(path, 'rb') as file: - is_bytecode = magic == file.read(len(magic)) + first_bytes = file.read(len(magic)) + is_bytecode = first_bytes in (magic, + # Issue #29537: handle issue27286 + # bytecode incompatibility + # See Lib/importlib/_bootstrap_external.py + importlib.util._BACKCOMPAT_MAGIC_NUMBER) filename = os.path.basename(path) name, ext = os.path.splitext(filename) if is_bytecode: diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 141a999..5728e73 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Sun Jan 1 22:05:59 2017 +# Autogenerated by Sphinx on Mon Aug 7 00:56:27 2017 topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (starred_expression | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" [target_list] "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for\n*attributeref*, *subscription*, and *slicing*.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is empty: The object must also be an empty\n iterable.\n\n* If the target list is a single target in parentheses: The object\n is assigned to that target.\n\n* If the target list is a comma-separated list of targets, or a\n single target in square brackets: The object must be an iterable\n with the same number of items as there are targets in the target\n list, and the items are assigned, from left to right, to the\n corresponding targets.\n\n * If the target list contains one target prefixed with an\n asterisk, called a "starred" target: The object must be an\n iterable with at least as many items as there are targets in the\n target list, minus one. The first items of the iterable are\n assigned, from left to right, to the targets before the starred\n target. The final items of the iterable are assigned to the\n targets after the starred target. A list of the remaining items\n in the iterable is then assigned to the starred target (the list\n can be empty).\n\n * Else: The object must be an iterable with the same number of\n items as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" or "nonlocal" statement\n in the current code block: the name is bound to the object in the\n current local namespace.\n\n * Otherwise: the name is bound to the object in the global\n namespace or the outer namespace determined by "nonlocal",\n respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, "IndexError" is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the "__setitem__()" method is called with\n appropriate arguments.\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to integers. If\n either bound is negative, the sequence\'s length is added to it. The\n resulting bounds are clipped to lie between zero and the sequence\'s\n length, inclusive. Finally, the sequence object is asked to replace\n the slice with the items of the assigned sequence. The length of\n the slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the target\n sequence allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nAlthough the definition of assignment implies that overlaps between\nthe left-hand side and the right-hand side are \'simultaneous\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables occur left-to-right, sometimes\nresulting in confusion. For instance, the following program prints\n"[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2 # i is updated, then x[i] is updated\n print(x)\n\nSee also: **PEP 3132** - Extended Iterable Unpacking\n\n The specification for the "*target" feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions of the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nUnlike normal assignments, augmented assignments evaluate the left-\nhand side *before* evaluating the right-hand side. For example, "a[i]\n+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and performs\nthe addition, and lastly, it writes the result back to "a[i]".\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n', 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n', @@ -16,37 +16,37 @@ topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert 'booleans': u'\nBoolean operations\n******************\n\n or_test ::= and_test | or_test "or" and_test\n and_test ::= not_test | and_test "and" not_test\n not_test ::= comparison | "not" not_test\n\nIn the context of Boolean operations, and also when expressions are\nused by control flow statements, the following values are interpreted\nas false: "False", "None", numeric zero of all types, and empty\nstrings and containers (including strings, tuples, lists,\ndictionaries, sets and frozensets). All other values are interpreted\nas true. User-defined objects can customize their truth value by\nproviding a "__bool__()" method.\n\nThe operator "not" yields "True" if its argument is false, "False"\notherwise.\n\nThe expression "x and y" first evaluates *x*; if *x* is false, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\nThe expression "x or y" first evaluates *x*; if *x* is true, its value\nis returned; otherwise, *y* is evaluated and the resulting value is\nreturned.\n\n(Note that neither "and" nor "or" restrict the value and type they\nreturn to "False" and "True", but rather return the last evaluated\nargument. This is sometimes useful, e.g., if "s" is a string that\nshould be replaced by a default value if it is empty, the expression\n"s or \'foo\'" yields the desired value. Because "not" has to create a\nnew value, it returns a boolean value regardless of the type of its\nargument (for example, "not \'foo\'" produces "False" rather than "\'\'".)\n', 'break': u'\nThe "break" statement\n*********************\n\n break_stmt ::= "break"\n\n"break" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition within that\nloop.\n\nIt terminates the nearest enclosing loop, skipping the optional "else"\nclause if the loop has one.\n\nIf a "for" loop is terminated by "break", the loop control target\nkeeps its current value.\n\nWhen "break" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nloop.\n', 'callable-types': u'\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n', - 'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\n call ::= primary "(" [argument_list [","] | comprehension] ")"\n argument_list ::= positional_arguments ["," starred_and_keywords]\n ["," keywords_arguments]\n | starred_and_keywords ["," keywords_arguments]\n | keywords_arguments\n positional_arguments ::= ["*"] expression ("," ["*"] expression)*\n starred_and_keywords ::= ("*" expression | keyword_item)\n ("," "*" expression | "," keyword_item)*\n keywords_arguments ::= (keyword_item | "**" expression)\n ("," keyword_item | "," "**" expression)*\n keyword_item ::= identifier "=" expression\n\nAn optional trailing comma may be present after the positional and\nkeyword arguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and all objects having a\n"__call__()" method are callable). All argument expressions are\nevaluated before the call is attempted. Please refer to section\n*Function definitions* for the syntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a "TypeError" exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is "None", it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a "TypeError"\nexception is raised. Otherwise, the list of filled slots is used as\nthe argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use "PyArg_ParseTuple()" to parse\ntheir arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "*identifier" is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "**identifier" is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax "*expression" appears in the function call, "expression"\nmust evaluate to an *iterable*. Elements from these iterables are\ntreated as if they were additional positional arguments. For the call\n"f(x1, x2, *y, x3, x4)", if *y* evaluates to a sequence *y1*, ...,\n*yM*, this is equivalent to a call with M+4 positional arguments *x1*,\n*x2*, *y1*, ..., *yM*, *x3*, *x4*.\n\nA consequence of this is that although the "*expression" syntax may\nappear *after* explicit keyword arguments, it is processed *before*\nthe keyword arguments (and any "**expression" arguments -- see below).\nSo:\n\n >>> def f(a, b):\n ... print(a, b)\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the "*expression" syntax\nto be used in the same call, so in practice this confusion does not\narise.\n\nIf the syntax "**expression" appears in the function call,\n"expression" must evaluate to a *mapping*, the contents of which are\ntreated as additional keyword arguments. If a keyword is already\npresent (as an explicit keyword argument, or from another unpacking),\na "TypeError" exception is raised.\n\nFormal parameters using the syntax "*identifier" or "**identifier"\ncannot be used as positional argument slots or as keyword argument\nnames.\n\nChanged in version 3.5: Function calls accept any number of "*" and\n"**" unpackings, positional arguments may follow iterable unpackings\n("*"), and keyword arguments may follow dictionary unpackings ("**").\nOriginally proposed by **PEP 448**.\n\nA call always returns some value, possibly "None", unless it raises an\nexception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a "return"\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a "__call__()" method; the effect is then the\n same as if that method was called.\n', + 'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\n call ::= primary "(" [argument_list [","] | comprehension] ")"\n argument_list ::= positional_arguments ["," starred_and_keywords]\n ["," keywords_arguments]\n | starred_and_keywords ["," keywords_arguments]\n | keywords_arguments\n positional_arguments ::= ["*"] expression ("," ["*"] expression)*\n starred_and_keywords ::= ("*" expression | keyword_item)\n ("," "*" expression | "," keyword_item)*\n keywords_arguments ::= (keyword_item | "**" expression)\n ("," keyword_item | "," "**" expression)*\n keyword_item ::= identifier "=" expression\n\nAn optional trailing comma may be present after the positional and\nkeyword arguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and all objects having a\n"__call__()" method are callable). All argument expressions are\nevaluated before the call is attempted. Please refer to section\n*Function definitions* for the syntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a "TypeError" exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is "None", it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a "TypeError"\nexception is raised. Otherwise, the list of filled slots is used as\nthe argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use "PyArg_ParseTuple()" to parse\ntheir arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "*identifier" is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "**identifier" is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax "*expression" appears in the function call, "expression"\nmust evaluate to an *iterable*. Elements from these iterables are\ntreated as if they were additional positional arguments. For the call\n"f(x1, x2, *y, x3, x4)", if *y* evaluates to a sequence *y1*, ...,\n*yM*, this is equivalent to a call with M+4 positional arguments *x1*,\n*x2*, *y1*, ..., *yM*, *x3*, *x4*.\n\nA consequence of this is that although the "*expression" syntax may\nappear *after* explicit keyword arguments, it is processed *before*\nthe keyword arguments (and any "**expression" arguments -- see below).\nSo:\n\n >>> def f(a, b):\n ... print(a, b)\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the "*expression" syntax\nto be used in the same call, so in practice this confusion does not\narise.\n\nIf the syntax "**expression" appears in the function call,\n"expression" must evaluate to a *mapping*, the contents of which are\ntreated as additional keyword arguments. If a keyword is already\npresent (as an explicit keyword argument, or from another unpacking),\na "TypeError" exception is raised.\n\nFormal parameters using the syntax "*identifier" or "**identifier"\ncannot be used as positional argument slots or as keyword argument\nnames.\n\nChanged in version 3.5: Function calls accept any number of "*" and\n"**" unpackings, positional arguments may follow iterable unpackings\n("*"), and keyword arguments may follow dictionary unpackings ("**").\nOriginally proposed by **PEP 448**.\n\nA call always returns some value, possibly "None", unless it raises an\nexception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a "return"\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a "__call__()" method; the effect is then the\n same as if that method was called.\n', 'class': u'\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class "object"; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis roughly equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result is then bound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with "self.name = value". Both class and\ninstance attributes are accessible through the notation ""self.name"",\nand an instance attribute hides a class attribute with the same name\nwhen accessed in this way. Class attributes can be used as defaults\nfor instance attributes, but using mutable values there can lead to\nunexpected results. *Descriptors* can be used to create instance\nvariables with different implementation details.\n\nSee also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n Class Decorators\n', - 'comparisons': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\n\nValue comparisons\n=================\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects do not need to have the same type.\n\nChapter *Objects, values and types* states that objects have a value\n(in addition to type and identity). The value of an object is a\nrather abstract notion in Python: For example, there is no canonical\naccess method for an object\'s value. Also, there is no requirement\nthat the value of an object should be constructed in a particular way,\ne.g. comprised of all its data attributes. Comparison operators\nimplement a particular notion of what the value of an object is. One\ncan think of them as defining the value of an object indirectly, by\nmeans of their comparison implementation.\n\nBecause all types are (direct or indirect) subtypes of "object", they\ninherit the default comparison behavior from "object". Types can\ncustomize their comparison behavior by implementing *rich comparison\nmethods* like "__lt__()", described in *Basic customization*.\n\nThe default behavior for equality comparison ("==" and "!=") is based\non the identity of the objects. Hence, equality comparison of\ninstances with the same identity results in equality, and equality\ncomparison of instances with different identities results in\ninequality. A motivation for this default behavior is the desire that\nall objects should be reflexive (i.e. "x is y" implies "x == y").\n\nA default order comparison ("<", ">", "<=", and ">=") is not provided;\nan attempt raises "TypeError". A motivation for this default behavior\nis the lack of a similar invariant as for equality.\n\nThe behavior of the default equality comparison, that instances with\ndifferent identities are always unequal, may be in contrast to what\ntypes will need that have a sensible definition of object value and\nvalue-based equality. Such types will need to customize their\ncomparison behavior, and in fact, a number of built-in types have done\nthat.\n\nThe following list describes the comparison behavior of the most\nimportant built-in types.\n\n* Numbers of built-in numeric types (*Numeric Types --- int, float,\n complex*) and of the standard library types "fractions.Fraction" and\n "decimal.Decimal" can be compared within and across their types,\n with the restriction that complex numbers do not support order\n comparison. Within the limits of the types involved, they compare\n mathematically (algorithmically) correct without loss of precision.\n\n The not-a-number values "float(\'NaN\')" and "Decimal(\'NaN\')" are\n special. They are identical to themselves ("x is x" is true) but\n are not equal to themselves ("x == x" is false). Additionally,\n comparing any number to a not-a-number value will return "False".\n For example, both "3 < float(\'NaN\')" and "float(\'NaN\') < 3" will\n return "False".\n\n* Binary sequences (instances of "bytes" or "bytearray") can be\n compared within and across their types. They compare\n lexicographically using the numeric values of their elements.\n\n* Strings (instances of "str") compare lexicographically using the\n numerical Unicode code points (the result of the built-in function\n "ord()") of their characters. [3]\n\n Strings and binary sequences cannot be directly compared.\n\n* Sequences (instances of "tuple", "list", or "range") can be\n compared only within each of their types, with the restriction that\n ranges do not support order comparison. Equality comparison across\n these types results in unequality, and ordering comparison across\n these types raises "TypeError".\n\n Sequences compare lexicographically using comparison of\n corresponding elements, whereby reflexivity of the elements is\n enforced.\n\n In enforcing reflexivity of elements, the comparison of collections\n assumes that for a collection element "x", "x == x" is always true.\n Based on that assumption, element identity is compared first, and\n element comparison is performed only for distinct elements. This\n approach yields the same result as a strict element comparison\n would, if the compared elements are reflexive. For non-reflexive\n elements, the result is different than for strict element\n comparison, and may be surprising: The non-reflexive not-a-number\n values for example result in the following comparison behavior when\n used in a list:\n\n >>> nan = float(\'NaN\')\n >>> nan is nan\n True\n >>> nan == nan\n False <-- the defined non-reflexive behavior of NaN\n >>> [nan] == [nan]\n True <-- list enforces reflexivity and tests identity first\n\n Lexicographical comparison between built-in collections works as\n follows:\n\n * For two collections to compare equal, they must be of the same\n type, have the same length, and each pair of corresponding\n elements must compare equal (for example, "[1,2] == (1,2)" is\n false because the type is not the same).\n\n * Collections that support order comparison are ordered the same\n as their first unequal elements (for example, "[1,2,x] <= [1,2,y]"\n has the same value as "x <= y"). If a corresponding element does\n not exist, the shorter collection is ordered first (for example,\n "[1,2] < [1,2,3]" is true).\n\n* Mappings (instances of "dict") compare equal if and only if they\n have equal *(key, value)* pairs. Equality comparison of the keys and\n elements enforces reflexivity.\n\n Order comparisons ("<", ">", "<=", and ">=") raise "TypeError".\n\n* Sets (instances of "set" or "frozenset") can be compared within\n and across their types.\n\n They define order comparison operators to mean subset and superset\n tests. Those relations do not define total orderings (for example,\n the two sets "{1,2}" and "{2,3}" are not equal, nor subsets of one\n another, nor supersets of one another). Accordingly, sets are not\n appropriate arguments for functions which depend on total ordering\n (for example, "min()", "max()", and "sorted()" produce undefined\n results given a list of sets as inputs).\n\n Comparison of sets enforces reflexivity of its elements.\n\n* Most other built-in types have no comparison methods implemented,\n so they inherit the default comparison behavior.\n\nUser-defined classes that customize their comparison behavior should\nfollow some consistency rules, if possible:\n\n* Equality comparison should be reflexive. In other words, identical\n objects should compare equal:\n\n "x is y" implies "x == y"\n\n* Comparison should be symmetric. In other words, the following\n expressions should have the same result:\n\n "x == y" and "y == x"\n\n "x != y" and "y != x"\n\n "x < y" and "y > x"\n\n "x <= y" and "y >= x"\n\n* Comparison should be transitive. The following (non-exhaustive)\n examples illustrate that:\n\n "x > y and y > z" implies "x > z"\n\n "x < y and y <= z" implies "x < z"\n\n* Inverse comparison should result in the boolean negation. In other\n words, the following expressions should have the same result:\n\n "x == y" and "not x != y"\n\n "x < y" and "not x >= y" (for total ordering)\n\n "x > y" and "not x <= y" (for total ordering)\n\n The last two expressions apply to totally ordered collections (e.g.\n to sequences, but not to sets or mappings). See also the\n "total_ordering()" decorator.\n\nPython does not enforce these consistency rules. In fact, the\nnot-a-number values are an example for not following these rules.\n\n\nMembership test operations\n==========================\n\nThe operators "in" and "not in" test for membership. "x in s"\nevaluates to true if *x* is a member of *s*, and false otherwise. "x\nnot in s" returns the negation of "x in s". All built-in sequences\nand set types support this as well as dictionary, for which "in" tests\nwhether the dictionary has a given key. For container types such as\nlist, tuple, set, frozenset, dict, or collections.deque, the\nexpression "x in y" is equivalent to "any(x is e or x == e for e in\ny)".\n\nFor the string and bytes types, "x in y" is true if and only if *x* is\na substring of *y*. An equivalent test is "y.find(x) != -1". Empty\nstrings are always considered to be a substring of any other string,\nso """ in "abc"" will return "True".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\n\nIdentity comparisons\n====================\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. Object identity\nis determined using the "id()" function. "x is not y" yields the\ninverse truth value. [4]\n', + 'comparisons': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\n\nValue comparisons\n=================\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects do not need to have the same type.\n\nChapter *Objects, values and types* states that objects have a value\n(in addition to type and identity). The value of an object is a\nrather abstract notion in Python: For example, there is no canonical\naccess method for an object\'s value. Also, there is no requirement\nthat the value of an object should be constructed in a particular way,\ne.g. comprised of all its data attributes. Comparison operators\nimplement a particular notion of what the value of an object is. One\ncan think of them as defining the value of an object indirectly, by\nmeans of their comparison implementation.\n\nBecause all types are (direct or indirect) subtypes of "object", they\ninherit the default comparison behavior from "object". Types can\ncustomize their comparison behavior by implementing *rich comparison\nmethods* like "__lt__()", described in *Basic customization*.\n\nThe default behavior for equality comparison ("==" and "!=") is based\non the identity of the objects. Hence, equality comparison of\ninstances with the same identity results in equality, and equality\ncomparison of instances with different identities results in\ninequality. A motivation for this default behavior is the desire that\nall objects should be reflexive (i.e. "x is y" implies "x == y").\n\nA default order comparison ("<", ">", "<=", and ">=") is not provided;\nan attempt raises "TypeError". A motivation for this default behavior\nis the lack of a similar invariant as for equality.\n\nThe behavior of the default equality comparison, that instances with\ndifferent identities are always unequal, may be in contrast to what\ntypes will need that have a sensible definition of object value and\nvalue-based equality. Such types will need to customize their\ncomparison behavior, and in fact, a number of built-in types have done\nthat.\n\nThe following list describes the comparison behavior of the most\nimportant built-in types.\n\n* Numbers of built-in numeric types (*Numeric Types --- int, float,\n complex*) and of the standard library types "fractions.Fraction" and\n "decimal.Decimal" can be compared within and across their types,\n with the restriction that complex numbers do not support order\n comparison. Within the limits of the types involved, they compare\n mathematically (algorithmically) correct without loss of precision.\n\n The not-a-number values "float(\'NaN\')" and "Decimal(\'NaN\')" are\n special. They are identical to themselves ("x is x" is true) but\n are not equal to themselves ("x == x" is false). Additionally,\n comparing any number to a not-a-number value will return "False".\n For example, both "3 < float(\'NaN\')" and "float(\'NaN\') < 3" will\n return "False".\n\n* Binary sequences (instances of "bytes" or "bytearray") can be\n compared within and across their types. They compare\n lexicographically using the numeric values of their elements.\n\n* Strings (instances of "str") compare lexicographically using the\n numerical Unicode code points (the result of the built-in function\n "ord()") of their characters. [3]\n\n Strings and binary sequences cannot be directly compared.\n\n* Sequences (instances of "tuple", "list", or "range") can be\n compared only within each of their types, with the restriction that\n ranges do not support order comparison. Equality comparison across\n these types results in unequality, and ordering comparison across\n these types raises "TypeError".\n\n Sequences compare lexicographically using comparison of\n corresponding elements, whereby reflexivity of the elements is\n enforced.\n\n In enforcing reflexivity of elements, the comparison of collections\n assumes that for a collection element "x", "x == x" is always true.\n Based on that assumption, element identity is compared first, and\n element comparison is performed only for distinct elements. This\n approach yields the same result as a strict element comparison\n would, if the compared elements are reflexive. For non-reflexive\n elements, the result is different than for strict element\n comparison, and may be surprising: The non-reflexive not-a-number\n values for example result in the following comparison behavior when\n used in a list:\n\n >>> nan = float(\'NaN\')\n >>> nan is nan\n True\n >>> nan == nan\n False <-- the defined non-reflexive behavior of NaN\n >>> [nan] == [nan]\n True <-- list enforces reflexivity and tests identity first\n\n Lexicographical comparison between built-in collections works as\n follows:\n\n * For two collections to compare equal, they must be of the same\n type, have the same length, and each pair of corresponding\n elements must compare equal (for example, "[1,2] == (1,2)" is\n false because the type is not the same).\n\n * Collections that support order comparison are ordered the same\n as their first unequal elements (for example, "[1,2,x] <= [1,2,y]"\n has the same value as "x <= y"). If a corresponding element does\n not exist, the shorter collection is ordered first (for example,\n "[1,2] < [1,2,3]" is true).\n\n* Mappings (instances of "dict") compare equal if and only if they\n have equal *(key, value)* pairs. Equality comparison of the keys and\n values enforces reflexivity.\n\n Order comparisons ("<", ">", "<=", and ">=") raise "TypeError".\n\n* Sets (instances of "set" or "frozenset") can be compared within\n and across their types.\n\n They define order comparison operators to mean subset and superset\n tests. Those relations do not define total orderings (for example,\n the two sets "{1,2}" and "{2,3}" are not equal, nor subsets of one\n another, nor supersets of one another). Accordingly, sets are not\n appropriate arguments for functions which depend on total ordering\n (for example, "min()", "max()", and "sorted()" produce undefined\n results given a list of sets as inputs).\n\n Comparison of sets enforces reflexivity of its elements.\n\n* Most other built-in types have no comparison methods implemented,\n so they inherit the default comparison behavior.\n\nUser-defined classes that customize their comparison behavior should\nfollow some consistency rules, if possible:\n\n* Equality comparison should be reflexive. In other words, identical\n objects should compare equal:\n\n "x is y" implies "x == y"\n\n* Comparison should be symmetric. In other words, the following\n expressions should have the same result:\n\n "x == y" and "y == x"\n\n "x != y" and "y != x"\n\n "x < y" and "y > x"\n\n "x <= y" and "y >= x"\n\n* Comparison should be transitive. The following (non-exhaustive)\n examples illustrate that:\n\n "x > y and y > z" implies "x > z"\n\n "x < y and y <= z" implies "x < z"\n\n* Inverse comparison should result in the boolean negation. In other\n words, the following expressions should have the same result:\n\n "x == y" and "not x != y"\n\n "x < y" and "not x >= y" (for total ordering)\n\n "x > y" and "not x <= y" (for total ordering)\n\n The last two expressions apply to totally ordered collections (e.g.\n to sequences, but not to sets or mappings). See also the\n "total_ordering()" decorator.\n\n* The "hash()" result should be consistent with equality. Objects\n that are equal should either have the same hash value, or be marked\n as unhashable.\n\nPython does not enforce these consistency rules. In fact, the\nnot-a-number values are an example for not following these rules.\n\n\nMembership test operations\n==========================\n\nThe operators "in" and "not in" test for membership. "x in s"\nevaluates to "True" if *x* is a member of *s*, and "False" otherwise.\n"x not in s" returns the negation of "x in s". All built-in sequences\nand set types support this as well as dictionary, for which "in" tests\nwhether the dictionary has a given key. For container types such as\nlist, tuple, set, frozenset, dict, or collections.deque, the\nexpression "x in y" is equivalent to "any(x is e or x == e for e in\ny)".\n\nFor the string and bytes types, "x in y" is "True" if and only if *x*\nis a substring of *y*. An equivalent test is "y.find(x) != -1".\nEmpty strings are always considered to be a substring of any other\nstring, so """ in "abc"" will return "True".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" returns "True" if "y.__contains__(x)" returns a true value, and\n"False" otherwise.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is "True" if some value "z" with "x ==\nz" is produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is "True" if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\n\nIdentity comparisons\n====================\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. Object identity\nis determined using the "id()" function. "x is not y" yields the\ninverse truth value. [4]\n', 'compound': u'\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe "if", "while" and "for" statements implement traditional control\nflow constructs. "try" specifies exception handlers and/or cleanup\ncode for a group of statements, while the "with" statement allows the\nexecution of initialization and finalization code around a block of\ncode. Function and class definitions are also syntactically compound\nstatements.\n\nA compound statement consists of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of a suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which "if" clause a following "else" clause would belong:\n\n if test1: if test2: print(x)\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n"print()" calls are executed:\n\n if x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n | async_with_stmt\n | async_for_stmt\n | async_funcdef\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a "NEWLINE" possibly followed by a\n"DEDENT". Also note that optional continuation clauses always begin\nwith a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling "else"\' problem is solved in Python by\nrequiring nested "if" statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe "if" statement\n==================\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n\n\nThe "while" statement\n=====================\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n\n\nThe "for" statement\n===================\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order returned by the iterator. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a "StopIteration" exception),\nthe suite in the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there is no next\nitem.\n\nThe for-loop makes assignments to the variables(s) in the target list.\nThis overwrites all previous assignments to those variables including\nthose made in the suite of the for-loop:\n\n for i in range(10):\n print(i)\n i = 5 # this will not affect the for-loop\n # because i will be overwritten with the next\n # index in the range\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, they will not have been assigned to at\nall by the loop. Hint: the built-in function "range()" returns an\niterator of integers suitable to emulate the effect of Pascal\'s "for i\n:= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe "try" statement\n===================\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the "as" keyword in that except clause, if\npresent, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using "as target", it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the "sys" module and can be accessed via\n"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting of the\nexception class, the exception instance and a traceback object (see\nsection *The standard type hierarchy*) identifying the point in the\nprogram where the exception occurred. "sys.exc_info()" values are\nrestored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception it is re-raised at the end of the "finally"\nclause. If the "finally" clause raises another exception, the saved\nexception is set as the context of the new exception. If the "finally"\nclause executes a "return" or "break" statement, the saved exception\nis discarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the "raise" statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe "with" statement\n====================\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also: **PEP 343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n | "*" [parameter] ("," defparameter)* ["," "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis roughly equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nexcept that the original function is not temporarily bound to the name\n"func".\n\nWhen one or more *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the ""*"" must also have a default value --- this\nis a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated from left to right when the\nfunction definition is executed.** This means that the expression is\nevaluated once, when the function is defined, and that the same "pre-\ncomputed" value is used for each call. This is especially important\nto understand when a default parameter is a mutable object, such as a\nlist or a dictionary: if the function modifies the object (e.g. by\nappending an item to a list), the default value is in effect modified.\nThis is generally not what was intended. A way around this is to use\n"None" as the default, and explicitly test for it in the body of the\nfunction, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n""*identifier"" is present, it is initialized to a tuple receiving any\nexcess positional parameters, defaulting to the empty tuple. If the\nform ""**identifier"" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after ""*"" or ""*identifier"" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "": expression"" following\nthe parameter name. Any parameter may have an annotation even those\nof the form "*identifier" or "**identifier". Functions may have\n"return" annotation of the form ""-> expression"" after the parameter\nlist. These annotations can be any valid Python expression and are\nevaluated when the function definition is executed. Annotations may\nbe evaluated in a different order than they appear in the source code.\nThe presence of annotations does not change the semantics of a\nfunction. The annotation values are available as values of a\ndictionary keyed by the parameters\' names in the "__annotations__"\nattribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section *Lambdas*. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nstatement executed inside a function definition defines a local\nfunction that can be returned or passed around. Free variables used\nin the nested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\nSee also: **PEP 3107** - Function Annotations\n\n The original specification for function annotations.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class "object"; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis roughly equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result is then bound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with "self.name = value". Both class and\ninstance attributes are accessible through the notation ""self.name"",\nand an instance attribute hides a class attribute with the same name\nwhen accessed in this way. Class attributes can be used as defaults\nfor instance attributes, but using mutable values there can lead to\nunexpected results. *Descriptors* can be used to create instance\nvariables with different implementation details.\n\nSee also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n Class Decorators\n\n\nCoroutines\n==========\n\nNew in version 3.5.\n\n\nCoroutine function definition\n-----------------------------\n\n async_funcdef ::= [decorators] "async" "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n\nExecution of Python coroutines can be suspended and resumed at many\npoints (see *coroutine*). In the body of a coroutine, any "await" and\n"async" identifiers become reserved keywords; "await" expressions,\n"async for" and "async with" can only be used in coroutine bodies.\n\nFunctions defined with "async def" syntax are always coroutine\nfunctions, even if they do not contain "await" or "async" keywords.\n\nIt is a "SyntaxError" to use "yield" expressions in "async def"\ncoroutines.\n\nAn example of a coroutine function:\n\n async def func(param1, param2):\n do_stuff()\n await some_coroutine()\n\n\nThe "async for" statement\n-------------------------\n\n async_for_stmt ::= "async" for_stmt\n\nAn *asynchronous iterable* is able to call asynchronous code in its\n*iter* implementation, and *asynchronous iterator* can call\nasynchronous code in its *next* method.\n\nThe "async for" statement allows convenient iteration over\nasynchronous iterators.\n\nThe following code:\n\n async for TARGET in ITER:\n BLOCK\n else:\n BLOCK2\n\nIs semantically equivalent to:\n\n iter = (ITER)\n iter = type(iter).__aiter__(iter)\n running = True\n while running:\n try:\n TARGET = await type(iter).__anext__(iter)\n except StopAsyncIteration:\n running = False\n else:\n BLOCK\n else:\n BLOCK2\n\nSee also "__aiter__()" and "__anext__()" for details.\n\nIt is a "SyntaxError" to use "async for" statement outside of an\n"async def" function.\n\n\nThe "async with" statement\n--------------------------\n\n async_with_stmt ::= "async" with_stmt\n\nAn *asynchronous context manager* is a *context manager* that is able\nto suspend execution in its *enter* and *exit* methods.\n\nThe following code:\n\n async with EXPR as VAR:\n BLOCK\n\nIs semantically equivalent to:\n\n mgr = (EXPR)\n aexit = type(mgr).__aexit__\n aenter = type(mgr).__aenter__(mgr)\n exc = True\n\n VAR = await aenter\n try:\n BLOCK\n except:\n if not await aexit(mgr, *sys.exc_info()):\n raise\n else:\n await aexit(mgr, None, None, None)\n\nSee also "__aenter__()" and "__aexit__()" for details.\n\nIt is a "SyntaxError" to use "async with" statement outside of an\n"async def" function.\n\nSee also: **PEP 492** - Coroutines with async and await syntax\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n there is a "finally" clause which happens to raise another\n exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n an exception or the execution of a "return", "continue", or\n "break" statement.\n\n[3] A string literal appearing as the first statement in the\n function body is transformed into the function\'s "__doc__"\n attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s "__doc__" item and\n therefore the class\'s *docstring*.\n', 'context-managers': u'\nWith Statement Context Managers\n*******************************\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section *The with\nstatement*), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n', 'continue': u'\nThe "continue" statement\n************************\n\n continue_stmt ::= "continue"\n\n"continue" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition or "finally"\nclause within that loop. It continues with the next cycle of the\nnearest enclosing loop.\n\nWhen "continue" passes control out of a "try" statement with a\n"finally" clause, that "finally" clause is executed before really\nstarting the next loop cycle.\n', 'conversions': u'\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," this means\nthat the operator implementation for built-in types works as follows:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the\n other is converted to floating point;\n\n* otherwise, both must be integers and no conversion is necessary.\n\nSome additional rules apply for certain operators (e.g., a string as a\nleft argument to the \'%\' operator). Extensions must define their own\nconversion behavior.\n', - 'customization': u'\nBasic customization\n*******************\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customize\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_info()[2]" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the second can be resolved by freeing the reference to the\n traceback object when it is no longer useful, and the third can\n be resolved by storing "None" in "sys.last_traceback". Circular\n references which are garbage are detected and cleaned up when the\n cyclic garbage collector is enabled (it\'s on by default). Refer\n to the documentation for the "gc" module for more information\n about this topic.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function to compute the "official"\n string representation of an object. If at all possible, this\n should look like a valid Python expression that could be used to\n recreate an object with the same value (given an appropriate\n environment). If this is not possible, a string of the form\n "<...some useful description...>" should be returned. The return\n value must be a string object. If a class defines "__repr__()" but\n not "__str__()", then "__repr__()" is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by "str(object)" and the built-in functions "format()" and\n "print()" to compute the "informal" or nicely printable string\n representation of an object. The return value must be a *string*\n object.\n\n This method differs from "object.__repr__()" in that there is no\n expectation that "__str__()" return a valid Python expression: a\n more convenient or concise representation can be used.\n\n The default implementation defined by the built-in type "object"\n calls "object.__repr__()".\n\nobject.__bytes__(self)\n\n Called by "bytes()" to compute a byte-string representation of an\n object. This should return a "bytes" object.\n\nobject.__format__(self, format_spec)\n\n Called by the "format()" built-in function (and by extension, the\n "str.format()" method of class "str") to produce a "formatted"\n string representation of an object. The "format_spec" argument is a\n string that contains a description of the formatting options\n desired. The interpretation of the "format_spec" argument is up to\n the type implementing "__format__()", however most classes will\n either delegate formatting to one of the built-in types, or use a\n similar formatting option syntax.\n\n See *Format Specification Mini-Language* for a description of the\n standard formatting syntax.\n\n The return value must be a string object.\n\n Changed in version 3.4: The __format__ method of "object" itself\n raises a "TypeError" if passed any non-empty string.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n These are the so-called "rich comparison" methods. The\n correspondence between operator symbols and method names is as\n follows: "xy" calls\n "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n By default, "__ne__()" delegates to "__eq__()" and inverts the\n result unless it is "NotImplemented". There are no other implied\n relationships among the comparison operators, for example, the\n truth of "(x.__hash__".\n\n If a class that does not override "__eq__()" wishes to suppress\n hash support, it should include "__hash__ = None" in the class\n definition. A class which defines its own "__hash__()" that\n explicitly raises a "TypeError" would be incorrectly identified as\n hashable by an "isinstance(obj, collections.Hashable)" call.\n\n Note: By default, the "__hash__()" values of str, bytes and\n datetime objects are "salted" with an unpredictable random value.\n Although they remain constant within an individual Python\n process, they are not predictable between repeated invocations of\n Python.This is intended to provide protection against a denial-\n of-service caused by carefully-chosen inputs that exploit the\n worst case performance of a dict insertion, O(n^2) complexity.\n See http://www.ocert.org/advisories/ocert-2011-003.html for\n details.Changing hash values affects the iteration order of\n dicts, sets and other mappings. Python has never made guarantees\n about this ordering (and it typically varies between 32-bit and\n 64-bit builds).See also "PYTHONHASHSEED".\n\n Changed in version 3.3: Hash randomization is enabled by default.\n\nobject.__bool__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True". When this method is not\n defined, "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__bool__()", all its instances are\n considered true.\n', - 'debugger': u'\n"pdb" --- The Python Debugger\n*****************************\n\n**Source code:** Lib/pdb.py\n\n======================================================================\n\nThe module "pdb" defines an interactive source code debugger for\nPython programs. It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame. It also supports post-mortem debugging\nand can be called under program control.\n\nThe debugger is extensible -- it is actually defined as the class\n"Pdb". This is currently undocumented but easily understood by reading\nthe source. The extension interface uses the modules "bdb" and "cmd".\n\nThe debugger\'s prompt is "(Pdb)". Typical usage to run a program under\ncontrol of the debugger is:\n\n >>> import pdb\n >>> import mymodule\n >>> pdb.run(\'mymodule.test()\')\n > (0)?()\n (Pdb) continue\n > (1)?()\n (Pdb) continue\n NameError: \'spam\'\n > (1)?()\n (Pdb)\n\nChanged in version 3.3: Tab-completion via the "readline" module is\navailable for commands and command arguments, e.g. the current global\nand local names are offered as arguments of the "p" command.\n\n"pdb.py" can also be invoked as a script to debug other scripts. For\nexample:\n\n python3 -m pdb myscript.py\n\nWhen invoked as a script, pdb will automatically enter post-mortem\ndebugging if the program being debugged exits abnormally. After post-\nmortem debugging (or after normal exit of the program), pdb will\nrestart the program. Automatic restarting preserves pdb\'s state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program\'s exit.\n\nNew in version 3.2: "pdb.py" now accepts a "-c" option that executes\ncommands as if given in a ".pdbrc" file, see *Debugger Commands*.\n\nThe typical usage to break into the debugger from a running program is\nto insert\n\n import pdb; pdb.set_trace()\n\nat the location you want to break into the debugger. You can then\nstep through the code following this statement, and continue running\nwithout the debugger using the "continue" command.\n\nThe typical usage to inspect a crashed program is:\n\n >>> import pdb\n >>> import mymodule\n >>> mymodule.test()\n Traceback (most recent call last):\n File "", line 1, in ?\n File "./mymodule.py", line 4, in test\n test2()\n File "./mymodule.py", line 3, in test2\n print(spam)\n NameError: spam\n >>> pdb.pm()\n > ./mymodule.py(3)test2()\n -> print(spam)\n (Pdb)\n\nThe module defines the following functions; each enters the debugger\nin a slightly different way:\n\npdb.run(statement, globals=None, locals=None)\n\n Execute the *statement* (given as a string or a code object) under\n debugger control. The debugger prompt appears before any code is\n executed; you can set breakpoints and type "continue", or you can\n step through the statement using "step" or "next" (all these\n commands are explained below). The optional *globals* and *locals*\n arguments specify the environment in which the code is executed; by\n default the dictionary of the module "__main__" is used. (See the\n explanation of the built-in "exec()" or "eval()" functions.)\n\npdb.runeval(expression, globals=None, locals=None)\n\n Evaluate the *expression* (given as a string or a code object)\n under debugger control. When "runeval()" returns, it returns the\n value of the expression. Otherwise this function is similar to\n "run()".\n\npdb.runcall(function, *args, **kwds)\n\n Call the *function* (a function or method object, not a string)\n with the given arguments. When "runcall()" returns, it returns\n whatever the function call returned. The debugger prompt appears\n as soon as the function is entered.\n\npdb.set_trace()\n\n Enter the debugger at the calling stack frame. This is useful to\n hard-code a breakpoint at a given point in a program, even if the\n code is not otherwise being debugged (e.g. when an assertion\n fails).\n\npdb.post_mortem(traceback=None)\n\n Enter post-mortem debugging of the given *traceback* object. If no\n *traceback* is given, it uses the one of the exception that is\n currently being handled (an exception must be being handled if the\n default is to be used).\n\npdb.pm()\n\n Enter post-mortem debugging of the traceback found in\n "sys.last_traceback".\n\nThe "run*" functions and "set_trace()" are aliases for instantiating\nthe "Pdb" class and calling the method of the same name. If you want\nto access further features, you have to do this yourself:\n\nclass class pdb.Pdb(completekey=\'tab\', stdin=None, stdout=None, skip=None, nosigint=False)\n\n "Pdb" is the debugger class.\n\n The *completekey*, *stdin* and *stdout* arguments are passed to the\n underlying "cmd.Cmd" class; see the description there.\n\n The *skip* argument, if given, must be an iterable of glob-style\n module name patterns. The debugger will not step into frames that\n originate in a module that matches one of these patterns. [1]\n\n By default, Pdb sets a handler for the SIGINT signal (which is sent\n when the user presses "Ctrl-C" on the console) when you give a\n "continue" command. This allows you to break into the debugger\n again by pressing "Ctrl-C". If you want Pdb not to touch the\n SIGINT handler, set *nosigint* to true.\n\n Example call to enable tracing with *skip*:\n\n import pdb; pdb.Pdb(skip=[\'django.*\']).set_trace()\n\n New in version 3.1: The *skip* argument.\n\n New in version 3.2: The *nosigint* argument. Previously, a SIGINT\n handler was never set by Pdb.\n\n run(statement, globals=None, locals=None)\n runeval(expression, globals=None, locals=None)\n runcall(function, *args, **kwds)\n set_trace()\n\n See the documentation for the functions explained above.\n\n\nDebugger Commands\n=================\n\nThe commands recognized by the debugger are listed below. Most\ncommands can be abbreviated to one or two letters as indicated; e.g.\n"h(elp)" means that either "h" or "help" can be used to enter the help\ncommand (but not "he" or "hel", nor "H" or "Help" or "HELP").\nArguments to commands must be separated by whitespace (spaces or\ntabs). Optional arguments are enclosed in square brackets ("[]") in\nthe command syntax; the square brackets must not be typed.\nAlternatives in the command syntax are separated by a vertical bar\n("|").\n\nEntering a blank line repeats the last command entered. Exception: if\nthe last command was a "list" command, the next 11 lines are listed.\n\nCommands that the debugger doesn\'t recognize are assumed to be Python\nstatements and are executed in the context of the program being\ndebugged. Python statements can also be prefixed with an exclamation\npoint ("!"). This is a powerful way to inspect the program being\ndebugged; it is even possible to change a variable or call a function.\nWhen an exception occurs in such a statement, the exception name is\nprinted but the debugger\'s state is not changed.\n\nThe debugger supports *aliases*. Aliases can have parameters which\nallows one a certain level of adaptability to the context under\nexamination.\n\nMultiple commands may be entered on a single line, separated by ";;".\n(A single ";" is not used as it is the separator for multiple commands\nin a line that is passed to the Python parser.) No intelligence is\napplied to separating the commands; the input is split at the first\n";;" pair, even if it is in the middle of a quoted string.\n\nIf a file ".pdbrc" exists in the user\'s home directory or in the\ncurrent directory, it is read in and executed as if it had been typed\nat the debugger prompt. This is particularly useful for aliases. If\nboth files exist, the one in the home directory is read first and\naliases defined there can be overridden by the local file.\n\nChanged in version 3.2: ".pdbrc" can now contain commands that\ncontinue debugging, such as "continue" or "next". Previously, these\ncommands had no effect.\n\nh(elp) [command]\n\n Without argument, print the list of available commands. With a\n *command* as argument, print help about that command. "help pdb"\n displays the full documentation (the docstring of the "pdb"\n module). Since the *command* argument must be an identifier, "help\n exec" must be entered to get help on the "!" command.\n\nw(here)\n\n Print a stack trace, with the most recent frame at the bottom. An\n arrow indicates the current frame, which determines the context of\n most commands.\n\nd(own) [count]\n\n Move the current frame *count* (default one) levels down in the\n stack trace (to a newer frame).\n\nu(p) [count]\n\n Move the current frame *count* (default one) levels up in the stack\n trace (to an older frame).\n\nb(reak) [([filename:]lineno | function) [, condition]]\n\n With a *lineno* argument, set a break there in the current file.\n With a *function* argument, set a break at the first executable\n statement within that function. The line number may be prefixed\n with a filename and a colon, to specify a breakpoint in another\n file (probably one that hasn\'t been loaded yet). The file is\n searched on "sys.path". Note that each breakpoint is assigned a\n number to which all the other breakpoint commands refer.\n\n If a second argument is present, it is an expression which must\n evaluate to true before the breakpoint is honored.\n\n Without argument, list all breaks, including for each breakpoint,\n the number of times that breakpoint has been hit, the current\n ignore count, and the associated condition if any.\n\ntbreak [([filename:]lineno | function) [, condition]]\n\n Temporary breakpoint, which is removed automatically when it is\n first hit. The arguments are the same as for "break".\n\ncl(ear) [filename:lineno | bpnumber [bpnumber ...]]\n\n With a *filename:lineno* argument, clear all the breakpoints at\n this line. With a space separated list of breakpoint numbers, clear\n those breakpoints. Without argument, clear all breaks (but first\n ask confirmation).\n\ndisable [bpnumber [bpnumber ...]]\n\n Disable the breakpoints given as a space separated list of\n breakpoint numbers. Disabling a breakpoint means it cannot cause\n the program to stop execution, but unlike clearing a breakpoint, it\n remains in the list of breakpoints and can be (re-)enabled.\n\nenable [bpnumber [bpnumber ...]]\n\n Enable the breakpoints specified.\n\nignore bpnumber [count]\n\n Set the ignore count for the given breakpoint number. If count is\n omitted, the ignore count is set to 0. A breakpoint becomes active\n when the ignore count is zero. When non-zero, the count is\n decremented each time the breakpoint is reached and the breakpoint\n is not disabled and any associated condition evaluates to true.\n\ncondition bpnumber [condition]\n\n Set a new *condition* for the breakpoint, an expression which must\n evaluate to true before the breakpoint is honored. If *condition*\n is absent, any existing condition is removed; i.e., the breakpoint\n is made unconditional.\n\ncommands [bpnumber]\n\n Specify a list of commands for breakpoint number *bpnumber*. The\n commands themselves appear on the following lines. Type a line\n containing just "end" to terminate the commands. An example:\n\n (Pdb) commands 1\n (com) p some_variable\n (com) end\n (Pdb)\n\n To remove all commands from a breakpoint, type commands and follow\n it immediately with "end"; that is, give no commands.\n\n With no *bpnumber* argument, commands refers to the last breakpoint\n set.\n\n You can use breakpoint commands to start your program up again.\n Simply use the continue command, or step, or any other command that\n resumes execution.\n\n Specifying any command resuming execution (currently continue,\n step, next, return, jump, quit and their abbreviations) terminates\n the command list (as if that command was immediately followed by\n end). This is because any time you resume execution (even with a\n simple next or step), you may encounter another breakpoint\u2014which\n could have its own command list, leading to ambiguities about which\n list to execute.\n\n If you use the \'silent\' command in the command list, the usual\n message about stopping at a breakpoint is not printed. This may be\n desirable for breakpoints that are to print a specific message and\n then continue. If none of the other commands print anything, you\n see no sign that the breakpoint was reached.\n\ns(tep)\n\n Execute the current line, stop at the first possible occasion\n (either in a function that is called or on the next line in the\n current function).\n\nn(ext)\n\n Continue execution until the next line in the current function is\n reached or it returns. (The difference between "next" and "step"\n is that "step" stops inside a called function, while "next"\n executes called functions at (nearly) full speed, only stopping at\n the next line in the current function.)\n\nunt(il) [lineno]\n\n Without argument, continue execution until the line with a number\n greater than the current one is reached.\n\n With a line number, continue execution until a line with a number\n greater or equal to that is reached. In both cases, also stop when\n the current frame returns.\n\n Changed in version 3.2: Allow giving an explicit line number.\n\nr(eturn)\n\n Continue execution until the current function returns.\n\nc(ont(inue))\n\n Continue execution, only stop when a breakpoint is encountered.\n\nj(ump) lineno\n\n Set the next line that will be executed. Only available in the\n bottom-most frame. This lets you jump back and execute code again,\n or jump forward to skip code that you don\'t want to run.\n\n It should be noted that not all jumps are allowed -- for instance\n it is not possible to jump into the middle of a "for" loop or out\n of a "finally" clause.\n\nl(ist) [first[, last]]\n\n List source code for the current file. Without arguments, list 11\n lines around the current line or continue the previous listing.\n With "." as argument, list 11 lines around the current line. With\n one argument, list 11 lines around at that line. With two\n arguments, list the given range; if the second argument is less\n than the first, it is interpreted as a count.\n\n The current line in the current frame is indicated by "->". If an\n exception is being debugged, the line where the exception was\n originally raised or propagated is indicated by ">>", if it differs\n from the current line.\n\n New in version 3.2: The ">>" marker.\n\nll | longlist\n\n List all source code for the current function or frame.\n Interesting lines are marked as for "list".\n\n New in version 3.2.\n\na(rgs)\n\n Print the argument list of the current function.\n\np expression\n\n Evaluate the *expression* in the current context and print its\n value.\n\n Note: "print()" can also be used, but is not a debugger command\n --- this executes the Python "print()" function.\n\npp expression\n\n Like the "p" command, except the value of the expression is pretty-\n printed using the "pprint" module.\n\nwhatis expression\n\n Print the type of the *expression*.\n\nsource expression\n\n Try to get source code for the given object and display it.\n\n New in version 3.2.\n\ndisplay [expression]\n\n Display the value of the expression if it changed, each time\n execution stops in the current frame.\n\n Without expression, list all display expressions for the current\n frame.\n\n New in version 3.2.\n\nundisplay [expression]\n\n Do not display the expression any more in the current frame.\n Without expression, clear all display expressions for the current\n frame.\n\n New in version 3.2.\n\ninteract\n\n Start an interactive interpreter (using the "code" module) whose\n global namespace contains all the (global and local) names found in\n the current scope.\n\n New in version 3.2.\n\nalias [name [command]]\n\n Create an alias called *name* that executes *command*. The command\n must *not* be enclosed in quotes. Replaceable parameters can be\n indicated by "%1", "%2", and so on, while "%*" is replaced by all\n the parameters. If no command is given, the current alias for\n *name* is shown. If no arguments are given, all aliases are listed.\n\n Aliases may be nested and can contain anything that can be legally\n typed at the pdb prompt. Note that internal pdb commands *can* be\n overridden by aliases. Such a command is then hidden until the\n alias is removed. Aliasing is recursively applied to the first\n word of the command line; all other words in the line are left\n alone.\n\n As an example, here are two useful aliases (especially when placed\n in the ".pdbrc" file):\n\n # Print instance variables (usage "pi classInst")\n alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])\n # Print instance variables in self\n alias ps pi self\n\nunalias name\n\n Delete the specified alias.\n\n! statement\n\n Execute the (one-line) *statement* in the context of the current\n stack frame. The exclamation point can be omitted unless the first\n word of the statement resembles a debugger command. To set a\n global variable, you can prefix the assignment command with a\n "global" statement on the same line, e.g.:\n\n (Pdb) global list_options; list_options = [\'-l\']\n (Pdb)\n\nrun [args ...]\nrestart [args ...]\n\n Restart the debugged Python program. If an argument is supplied,\n it is split with "shlex" and the result is used as the new\n "sys.argv". History, breakpoints, actions and debugger options are\n preserved. "restart" is an alias for "run".\n\nq(uit)\n\n Quit from the debugger. The program being executed is aborted.\n\n-[ Footnotes ]-\n\n[1] Whether a frame is considered to originate in a certain module\n is determined by the "__name__" in the frame globals.\n', + 'customization': u'\nBasic customization\n*******************\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super().__new__(cls[, ...])" with appropriate arguments and then\n modifying the newly-created instance as necessary before returning\n it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "super().__init__([args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customize\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_info()[2]" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the second can be resolved by freeing the reference to the\n traceback object when it is no longer useful, and the third can\n be resolved by storing "None" in "sys.last_traceback". Circular\n references which are garbage are detected and cleaned up when the\n cyclic garbage collector is enabled (it\'s on by default). Refer\n to the documentation for the "gc" module for more information\n about this topic.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function to compute the "official"\n string representation of an object. If at all possible, this\n should look like a valid Python expression that could be used to\n recreate an object with the same value (given an appropriate\n environment). If this is not possible, a string of the form\n "<...some useful description...>" should be returned. The return\n value must be a string object. If a class defines "__repr__()" but\n not "__str__()", then "__repr__()" is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by "str(object)" and the built-in functions "format()" and\n "print()" to compute the "informal" or nicely printable string\n representation of an object. The return value must be a *string*\n object.\n\n This method differs from "object.__repr__()" in that there is no\n expectation that "__str__()" return a valid Python expression: a\n more convenient or concise representation can be used.\n\n The default implementation defined by the built-in type "object"\n calls "object.__repr__()".\n\nobject.__bytes__(self)\n\n Called by "bytes()" to compute a byte-string representation of an\n object. This should return a "bytes" object.\n\nobject.__format__(self, format_spec)\n\n Called by the "format()" built-in function (and by extension, the\n "str.format()" method of class "str") to produce a "formatted"\n string representation of an object. The "format_spec" argument is a\n string that contains a description of the formatting options\n desired. The interpretation of the "format_spec" argument is up to\n the type implementing "__format__()", however most classes will\n either delegate formatting to one of the built-in types, or use a\n similar formatting option syntax.\n\n See *Format Specification Mini-Language* for a description of the\n standard formatting syntax.\n\n The return value must be a string object.\n\n Changed in version 3.4: The __format__ method of "object" itself\n raises a "TypeError" if passed any non-empty string.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n These are the so-called "rich comparison" methods. The\n correspondence between operator symbols and method names is as\n follows: "xy" calls\n "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n By default, "__ne__()" delegates to "__eq__()" and inverts the\n result unless it is "NotImplemented". There are no other implied\n relationships among the comparison operators, for example, the\n truth of "(x.__hash__".\n\n If a class that does not override "__eq__()" wishes to suppress\n hash support, it should include "__hash__ = None" in the class\n definition. A class which defines its own "__hash__()" that\n explicitly raises a "TypeError" would be incorrectly identified as\n hashable by an "isinstance(obj, collections.Hashable)" call.\n\n Note: By default, the "__hash__()" values of str, bytes and\n datetime objects are "salted" with an unpredictable random value.\n Although they remain constant within an individual Python\n process, they are not predictable between repeated invocations of\n Python.This is intended to provide protection against a denial-\n of-service caused by carefully-chosen inputs that exploit the\n worst case performance of a dict insertion, O(n^2) complexity.\n See http://www.ocert.org/advisories/ocert-2011-003.html for\n details.Changing hash values affects the iteration order of\n dicts, sets and other mappings. Python has never made guarantees\n about this ordering (and it typically varies between 32-bit and\n 64-bit builds).See also "PYTHONHASHSEED".\n\n Changed in version 3.3: Hash randomization is enabled by default.\n\nobject.__bool__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True". When this method is not\n defined, "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__bool__()", all its instances are\n considered true.\n', + 'debugger': u'\n"pdb" --- The Python Debugger\n*****************************\n\n**Source code:** Lib/pdb.py\n\n======================================================================\n\nThe module "pdb" defines an interactive source code debugger for\nPython programs. It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame. It also supports post-mortem debugging\nand can be called under program control.\n\nThe debugger is extensible -- it is actually defined as the class\n"Pdb". This is currently undocumented but easily understood by reading\nthe source. The extension interface uses the modules "bdb" and "cmd".\n\nThe debugger\'s prompt is "(Pdb)". Typical usage to run a program under\ncontrol of the debugger is:\n\n >>> import pdb\n >>> import mymodule\n >>> pdb.run(\'mymodule.test()\')\n > (0)?()\n (Pdb) continue\n > (1)?()\n (Pdb) continue\n NameError: \'spam\'\n > (1)?()\n (Pdb)\n\nChanged in version 3.3: Tab-completion via the "readline" module is\navailable for commands and command arguments, e.g. the current global\nand local names are offered as arguments of the "p" command.\n\n"pdb.py" can also be invoked as a script to debug other scripts. For\nexample:\n\n python3 -m pdb myscript.py\n\nWhen invoked as a script, pdb will automatically enter post-mortem\ndebugging if the program being debugged exits abnormally. After post-\nmortem debugging (or after normal exit of the program), pdb will\nrestart the program. Automatic restarting preserves pdb\'s state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program\'s exit.\n\nNew in version 3.2: "pdb.py" now accepts a "-c" option that executes\ncommands as if given in a ".pdbrc" file, see *Debugger Commands*.\n\nThe typical usage to break into the debugger from a running program is\nto insert\n\n import pdb; pdb.set_trace()\n\nat the location you want to break into the debugger. You can then\nstep through the code following this statement, and continue running\nwithout the debugger using the "continue" command.\n\nThe typical usage to inspect a crashed program is:\n\n >>> import pdb\n >>> import mymodule\n >>> mymodule.test()\n Traceback (most recent call last):\n File "", line 1, in \n File "./mymodule.py", line 4, in test\n test2()\n File "./mymodule.py", line 3, in test2\n print(spam)\n NameError: spam\n >>> pdb.pm()\n > ./mymodule.py(3)test2()\n -> print(spam)\n (Pdb)\n\nThe module defines the following functions; each enters the debugger\nin a slightly different way:\n\npdb.run(statement, globals=None, locals=None)\n\n Execute the *statement* (given as a string or a code object) under\n debugger control. The debugger prompt appears before any code is\n executed; you can set breakpoints and type "continue", or you can\n step through the statement using "step" or "next" (all these\n commands are explained below). The optional *globals* and *locals*\n arguments specify the environment in which the code is executed; by\n default the dictionary of the module "__main__" is used. (See the\n explanation of the built-in "exec()" or "eval()" functions.)\n\npdb.runeval(expression, globals=None, locals=None)\n\n Evaluate the *expression* (given as a string or a code object)\n under debugger control. When "runeval()" returns, it returns the\n value of the expression. Otherwise this function is similar to\n "run()".\n\npdb.runcall(function, *args, **kwds)\n\n Call the *function* (a function or method object, not a string)\n with the given arguments. When "runcall()" returns, it returns\n whatever the function call returned. The debugger prompt appears\n as soon as the function is entered.\n\npdb.set_trace()\n\n Enter the debugger at the calling stack frame. This is useful to\n hard-code a breakpoint at a given point in a program, even if the\n code is not otherwise being debugged (e.g. when an assertion\n fails).\n\npdb.post_mortem(traceback=None)\n\n Enter post-mortem debugging of the given *traceback* object. If no\n *traceback* is given, it uses the one of the exception that is\n currently being handled (an exception must be being handled if the\n default is to be used).\n\npdb.pm()\n\n Enter post-mortem debugging of the traceback found in\n "sys.last_traceback".\n\nThe "run*" functions and "set_trace()" are aliases for instantiating\nthe "Pdb" class and calling the method of the same name. If you want\nto access further features, you have to do this yourself:\n\nclass class pdb.Pdb(completekey=\'tab\', stdin=None, stdout=None, skip=None, nosigint=False)\n\n "Pdb" is the debugger class.\n\n The *completekey*, *stdin* and *stdout* arguments are passed to the\n underlying "cmd.Cmd" class; see the description there.\n\n The *skip* argument, if given, must be an iterable of glob-style\n module name patterns. The debugger will not step into frames that\n originate in a module that matches one of these patterns. [1]\n\n By default, Pdb sets a handler for the SIGINT signal (which is sent\n when the user presses "Ctrl-C" on the console) when you give a\n "continue" command. This allows you to break into the debugger\n again by pressing "Ctrl-C". If you want Pdb not to touch the\n SIGINT handler, set *nosigint* to true.\n\n Example call to enable tracing with *skip*:\n\n import pdb; pdb.Pdb(skip=[\'django.*\']).set_trace()\n\n New in version 3.1: The *skip* argument.\n\n New in version 3.2: The *nosigint* argument. Previously, a SIGINT\n handler was never set by Pdb.\n\n run(statement, globals=None, locals=None)\n runeval(expression, globals=None, locals=None)\n runcall(function, *args, **kwds)\n set_trace()\n\n See the documentation for the functions explained above.\n\n\nDebugger Commands\n=================\n\nThe commands recognized by the debugger are listed below. Most\ncommands can be abbreviated to one or two letters as indicated; e.g.\n"h(elp)" means that either "h" or "help" can be used to enter the help\ncommand (but not "he" or "hel", nor "H" or "Help" or "HELP").\nArguments to commands must be separated by whitespace (spaces or\ntabs). Optional arguments are enclosed in square brackets ("[]") in\nthe command syntax; the square brackets must not be typed.\nAlternatives in the command syntax are separated by a vertical bar\n("|").\n\nEntering a blank line repeats the last command entered. Exception: if\nthe last command was a "list" command, the next 11 lines are listed.\n\nCommands that the debugger doesn\'t recognize are assumed to be Python\nstatements and are executed in the context of the program being\ndebugged. Python statements can also be prefixed with an exclamation\npoint ("!"). This is a powerful way to inspect the program being\ndebugged; it is even possible to change a variable or call a function.\nWhen an exception occurs in such a statement, the exception name is\nprinted but the debugger\'s state is not changed.\n\nThe debugger supports *aliases*. Aliases can have parameters which\nallows one a certain level of adaptability to the context under\nexamination.\n\nMultiple commands may be entered on a single line, separated by ";;".\n(A single ";" is not used as it is the separator for multiple commands\nin a line that is passed to the Python parser.) No intelligence is\napplied to separating the commands; the input is split at the first\n";;" pair, even if it is in the middle of a quoted string.\n\nIf a file ".pdbrc" exists in the user\'s home directory or in the\ncurrent directory, it is read in and executed as if it had been typed\nat the debugger prompt. This is particularly useful for aliases. If\nboth files exist, the one in the home directory is read first and\naliases defined there can be overridden by the local file.\n\nChanged in version 3.2: ".pdbrc" can now contain commands that\ncontinue debugging, such as "continue" or "next". Previously, these\ncommands had no effect.\n\nh(elp) [command]\n\n Without argument, print the list of available commands. With a\n *command* as argument, print help about that command. "help pdb"\n displays the full documentation (the docstring of the "pdb"\n module). Since the *command* argument must be an identifier, "help\n exec" must be entered to get help on the "!" command.\n\nw(here)\n\n Print a stack trace, with the most recent frame at the bottom. An\n arrow indicates the current frame, which determines the context of\n most commands.\n\nd(own) [count]\n\n Move the current frame *count* (default one) levels down in the\n stack trace (to a newer frame).\n\nu(p) [count]\n\n Move the current frame *count* (default one) levels up in the stack\n trace (to an older frame).\n\nb(reak) [([filename:]lineno | function) [, condition]]\n\n With a *lineno* argument, set a break there in the current file.\n With a *function* argument, set a break at the first executable\n statement within that function. The line number may be prefixed\n with a filename and a colon, to specify a breakpoint in another\n file (probably one that hasn\'t been loaded yet). The file is\n searched on "sys.path". Note that each breakpoint is assigned a\n number to which all the other breakpoint commands refer.\n\n If a second argument is present, it is an expression which must\n evaluate to true before the breakpoint is honored.\n\n Without argument, list all breaks, including for each breakpoint,\n the number of times that breakpoint has been hit, the current\n ignore count, and the associated condition if any.\n\ntbreak [([filename:]lineno | function) [, condition]]\n\n Temporary breakpoint, which is removed automatically when it is\n first hit. The arguments are the same as for "break".\n\ncl(ear) [filename:lineno | bpnumber [bpnumber ...]]\n\n With a *filename:lineno* argument, clear all the breakpoints at\n this line. With a space separated list of breakpoint numbers, clear\n those breakpoints. Without argument, clear all breaks (but first\n ask confirmation).\n\ndisable [bpnumber [bpnumber ...]]\n\n Disable the breakpoints given as a space separated list of\n breakpoint numbers. Disabling a breakpoint means it cannot cause\n the program to stop execution, but unlike clearing a breakpoint, it\n remains in the list of breakpoints and can be (re-)enabled.\n\nenable [bpnumber [bpnumber ...]]\n\n Enable the breakpoints specified.\n\nignore bpnumber [count]\n\n Set the ignore count for the given breakpoint number. If count is\n omitted, the ignore count is set to 0. A breakpoint becomes active\n when the ignore count is zero. When non-zero, the count is\n decremented each time the breakpoint is reached and the breakpoint\n is not disabled and any associated condition evaluates to true.\n\ncondition bpnumber [condition]\n\n Set a new *condition* for the breakpoint, an expression which must\n evaluate to true before the breakpoint is honored. If *condition*\n is absent, any existing condition is removed; i.e., the breakpoint\n is made unconditional.\n\ncommands [bpnumber]\n\n Specify a list of commands for breakpoint number *bpnumber*. The\n commands themselves appear on the following lines. Type a line\n containing just "end" to terminate the commands. An example:\n\n (Pdb) commands 1\n (com) p some_variable\n (com) end\n (Pdb)\n\n To remove all commands from a breakpoint, type commands and follow\n it immediately with "end"; that is, give no commands.\n\n With no *bpnumber* argument, commands refers to the last breakpoint\n set.\n\n You can use breakpoint commands to start your program up again.\n Simply use the continue command, or step, or any other command that\n resumes execution.\n\n Specifying any command resuming execution (currently continue,\n step, next, return, jump, quit and their abbreviations) terminates\n the command list (as if that command was immediately followed by\n end). This is because any time you resume execution (even with a\n simple next or step), you may encounter another breakpoint\u2014which\n could have its own command list, leading to ambiguities about which\n list to execute.\n\n If you use the \'silent\' command in the command list, the usual\n message about stopping at a breakpoint is not printed. This may be\n desirable for breakpoints that are to print a specific message and\n then continue. If none of the other commands print anything, you\n see no sign that the breakpoint was reached.\n\ns(tep)\n\n Execute the current line, stop at the first possible occasion\n (either in a function that is called or on the next line in the\n current function).\n\nn(ext)\n\n Continue execution until the next line in the current function is\n reached or it returns. (The difference between "next" and "step"\n is that "step" stops inside a called function, while "next"\n executes called functions at (nearly) full speed, only stopping at\n the next line in the current function.)\n\nunt(il) [lineno]\n\n Without argument, continue execution until the line with a number\n greater than the current one is reached.\n\n With a line number, continue execution until a line with a number\n greater or equal to that is reached. In both cases, also stop when\n the current frame returns.\n\n Changed in version 3.2: Allow giving an explicit line number.\n\nr(eturn)\n\n Continue execution until the current function returns.\n\nc(ont(inue))\n\n Continue execution, only stop when a breakpoint is encountered.\n\nj(ump) lineno\n\n Set the next line that will be executed. Only available in the\n bottom-most frame. This lets you jump back and execute code again,\n or jump forward to skip code that you don\'t want to run.\n\n It should be noted that not all jumps are allowed -- for instance\n it is not possible to jump into the middle of a "for" loop or out\n of a "finally" clause.\n\nl(ist) [first[, last]]\n\n List source code for the current file. Without arguments, list 11\n lines around the current line or continue the previous listing.\n With "." as argument, list 11 lines around the current line. With\n one argument, list 11 lines around at that line. With two\n arguments, list the given range; if the second argument is less\n than the first, it is interpreted as a count.\n\n The current line in the current frame is indicated by "->". If an\n exception is being debugged, the line where the exception was\n originally raised or propagated is indicated by ">>", if it differs\n from the current line.\n\n New in version 3.2: The ">>" marker.\n\nll | longlist\n\n List all source code for the current function or frame.\n Interesting lines are marked as for "list".\n\n New in version 3.2.\n\na(rgs)\n\n Print the argument list of the current function.\n\np expression\n\n Evaluate the *expression* in the current context and print its\n value.\n\n Note: "print()" can also be used, but is not a debugger command\n --- this executes the Python "print()" function.\n\npp expression\n\n Like the "p" command, except the value of the expression is pretty-\n printed using the "pprint" module.\n\nwhatis expression\n\n Print the type of the *expression*.\n\nsource expression\n\n Try to get source code for the given object and display it.\n\n New in version 3.2.\n\ndisplay [expression]\n\n Display the value of the expression if it changed, each time\n execution stops in the current frame.\n\n Without expression, list all display expressions for the current\n frame.\n\n New in version 3.2.\n\nundisplay [expression]\n\n Do not display the expression any more in the current frame.\n Without expression, clear all display expressions for the current\n frame.\n\n New in version 3.2.\n\ninteract\n\n Start an interactive interpreter (using the "code" module) whose\n global namespace contains all the (global and local) names found in\n the current scope.\n\n New in version 3.2.\n\nalias [name [command]]\n\n Create an alias called *name* that executes *command*. The command\n must *not* be enclosed in quotes. Replaceable parameters can be\n indicated by "%1", "%2", and so on, while "%*" is replaced by all\n the parameters. If no command is given, the current alias for\n *name* is shown. If no arguments are given, all aliases are listed.\n\n Aliases may be nested and can contain anything that can be legally\n typed at the pdb prompt. Note that internal pdb commands *can* be\n overridden by aliases. Such a command is then hidden until the\n alias is removed. Aliasing is recursively applied to the first\n word of the command line; all other words in the line are left\n alone.\n\n As an example, here are two useful aliases (especially when placed\n in the ".pdbrc" file):\n\n # Print instance variables (usage "pi classInst")\n alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])\n # Print instance variables in self\n alias ps pi self\n\nunalias name\n\n Delete the specified alias.\n\n! statement\n\n Execute the (one-line) *statement* in the context of the current\n stack frame. The exclamation point can be omitted unless the first\n word of the statement resembles a debugger command. To set a\n global variable, you can prefix the assignment command with a\n "global" statement on the same line, e.g.:\n\n (Pdb) global list_options; list_options = [\'-l\']\n (Pdb)\n\nrun [args ...]\nrestart [args ...]\n\n Restart the debugged Python program. If an argument is supplied,\n it is split with "shlex" and the result is used as the new\n "sys.argv". History, breakpoints, actions and debugger options are\n preserved. "restart" is an alias for "run".\n\nq(uit)\n\n Quit from the debugger. The program being executed is aborted.\n\n-[ Footnotes ]-\n\n[1] Whether a frame is considered to originate in a certain module\n is determined by the "__name__" in the frame globals.\n', 'del': u'\nThe "del" statement\n*******************\n\n del_stmt ::= "del" target_list\n\nDeletion is recursively defined very similar to the way assignment is\ndefined. Rather than spelling it out in full details, here are some\nhints.\n\nDeletion of a target list recursively deletes each target, from left\nto right.\n\nDeletion of a name removes the binding of that name from the local or\nglobal namespace, depending on whether the name occurs in a "global"\nstatement in the same code block. If the name is unbound, a\n"NameError" exception will be raised.\n\nDeletion of attribute references, subscriptions and slicings is passed\nto the primary object involved; deletion of a slicing is in general\nequivalent to assignment of an empty slice of the right type (but even\nthis is determined by the sliced object).\n\nChanged in version 3.2: Previously it was illegal to delete a name\nfrom the local namespace if it occurs as a free variable in a nested\nblock.\n', 'dict': u'\nDictionary displays\n*******************\n\nA dictionary display is a possibly empty series of key/datum pairs\nenclosed in curly braces:\n\n dict_display ::= "{" [key_datum_list | dict_comprehension] "}"\n key_datum_list ::= key_datum ("," key_datum)* [","]\n key_datum ::= expression ":" expression | "**" or_expr\n dict_comprehension ::= expression ":" expression comp_for\n\nA dictionary display yields a new dictionary object.\n\nIf a comma-separated sequence of key/datum pairs is given, they are\nevaluated from left to right to define the entries of the dictionary:\neach key object is used as a key into the dictionary to store the\ncorresponding datum. This means that you can specify the same key\nmultiple times in the key/datum list, and the final dictionary\'s value\nfor that key will be the last one given.\n\nA double asterisk "**" denotes *dictionary unpacking*. Its operand\nmust be a *mapping*. Each mapping item is added to the new\ndictionary. Later values replace values already set by earlier\nkey/datum pairs and earlier dictionary unpackings.\n\nNew in version 3.5: Unpacking into dictionary displays, originally\nproposed by **PEP 448**.\n\nA dict comprehension, in contrast to list and set comprehensions,\nneeds two expressions separated with a colon followed by the usual\n"for" and "if" clauses. When the comprehension is run, the resulting\nkey and value elements are inserted in the new dictionary in the order\nthey are produced.\n\nRestrictions on the types of the key values are listed earlier in\nsection *The standard type hierarchy*. (To summarize, the key type\nshould be *hashable*, which excludes all mutable objects.) Clashes\nbetween duplicate keys are not detected; the last datum (textually\nrightmost in the display) stored for a given key value prevails.\n', - 'dynamic-features': u'\nInteraction with dynamic features\n*********************************\n\nName resolution of free variables occurs at runtime, not at compile\ntime. This means that the following code will print 42:\n\n i = 10\n def f():\n print(i)\n i = 42\n f()\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', + 'dynamic-features': u'\nInteraction with dynamic features\n*********************************\n\nName resolution of free variables occurs at runtime, not at compile\ntime. This means that the following code will print 42:\n\n i = 10\n def f():\n print(i)\n i = 42\n f()\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', 'else': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n', 'exceptions': u'\nExceptions\n**********\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nNote: Exception messages are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section *The try\nstatement* and "raise" statement in section *The raise statement*.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', - 'execmodel': u'\nExecution model\n***************\n\n\nStructure of a program\n======================\n\nA Python program is constructed from code blocks. A *block* is a piece\nof Python program text that is executed as a unit. The following are\nblocks: a module, a function body, and a class definition. Each\ncommand typed interactively is a block. A script file (a file given\nas standard input to the interpreter or specified as a command line\nargument to the interpreter) is a code block. A script command (a\ncommand specified on the interpreter command line with the \'**-c**\'\noption) is a code block. The string argument passed to the built-in\nfunctions "eval()" and "exec()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\n\nNaming and binding\n==================\n\n\nBinding of names\n----------------\n\n*Names* refer to objects. Names are introduced by name binding\noperations.\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, or after\n"as" in a "with" statement or "except" clause. The "import" statement\nof the form "from ... import *" binds all names defined in the\nimported module, except those beginning with an underscore. This form\nmay only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name).\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name is bound in a block, it is a local variable of that block,\nunless declared as "nonlocal" or "global". If a name is bound at the\nmodule level, it is a global variable. (The variables of the module\ncode block are local and global.) If a variable is used in a code\nblock but not defined there, it is a *free variable*.\n\nEach occurrence of a name in the program text refers to the *binding*\nof that name established by the following name resolution rules.\n\n\nResolution of names\n-------------------\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name.\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nWhen a name is not found at all, a "NameError" exception is raised. If\nthe current scope is a function scope, and the name refers to a local\nvariable that has not yet been bound to a value at the point where the\nname is used, an "UnboundLocalError" exception is raised.\n"UnboundLocalError" is a subclass of "NameError".\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the "global" statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "builtins". The global namespace is searched first. If\nthe name is not found there, the builtins namespace is searched. The\n"global" statement must precede all uses of the name.\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nThe "nonlocal" statement causes corresponding names to refer to\npreviously bound variables in the nearest enclosing function scope.\n"SyntaxError" is raised at compile time if the given name does not\nexist in any enclosing function scope.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nClass definition blocks and arguments to "exec()" and "eval()" are\nspecial in the context of name resolution. A class definition is an\nexecutable statement that may use and define names. These references\nfollow the normal rules for name resolution with an exception that\nunbound local variables are looked up in the global namespace. The\nnamespace of the class definition becomes the attribute dictionary of\nthe class. The scope of names defined in a class block is limited to\nthe class block; it does not extend to the code blocks of methods --\nthis includes comprehensions and generator expressions since they are\nimplemented using a function scope. This means that the following\nwill fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\n\nBuiltins and restricted execution\n---------------------------------\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "builtins"; when in any\nother module, "__builtins__" is an alias for the dictionary of the\n"builtins" module itself. "__builtins__" can be set to a user-created\ndictionary to create a weak form of restricted execution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "builtins" module and modify its attributes appropriately.\n\n\nInteraction with dynamic features\n---------------------------------\n\nName resolution of free variables occurs at runtime, not at compile\ntime. This means that the following code will print 42:\n\n i = 10\n def f():\n print(i)\n i = 42\n f()\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nNote: Exception messages are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section *The try\nstatement* and "raise" statement in section *The raise statement*.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', + 'execmodel': u'\nExecution model\n***************\n\n\nStructure of a program\n======================\n\nA Python program is constructed from code blocks. A *block* is a piece\nof Python program text that is executed as a unit. The following are\nblocks: a module, a function body, and a class definition. Each\ncommand typed interactively is a block. A script file (a file given\nas standard input to the interpreter or specified as a command line\nargument to the interpreter) is a code block. A script command (a\ncommand specified on the interpreter command line with the \'**-c**\'\noption) is a code block. The string argument passed to the built-in\nfunctions "eval()" and "exec()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\n\nNaming and binding\n==================\n\n\nBinding of names\n----------------\n\n*Names* refer to objects. Names are introduced by name binding\noperations.\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, or after\n"as" in a "with" statement or "except" clause. The "import" statement\nof the form "from ... import *" binds all names defined in the\nimported module, except those beginning with an underscore. This form\nmay only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name).\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name is bound in a block, it is a local variable of that block,\nunless declared as "nonlocal" or "global". If a name is bound at the\nmodule level, it is a global variable. (The variables of the module\ncode block are local and global.) If a variable is used in a code\nblock but not defined there, it is a *free variable*.\n\nEach occurrence of a name in the program text refers to the *binding*\nof that name established by the following name resolution rules.\n\n\nResolution of names\n-------------------\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name.\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nWhen a name is not found at all, a "NameError" exception is raised. If\nthe current scope is a function scope, and the name refers to a local\nvariable that has not yet been bound to a value at the point where the\nname is used, an "UnboundLocalError" exception is raised.\n"UnboundLocalError" is a subclass of "NameError".\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the "global" statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "builtins". The global namespace is searched first. If\nthe name is not found there, the builtins namespace is searched. The\n"global" statement must precede all uses of the name.\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nThe "nonlocal" statement causes corresponding names to refer to\npreviously bound variables in the nearest enclosing function scope.\n"SyntaxError" is raised at compile time if the given name does not\nexist in any enclosing function scope.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nClass definition blocks and arguments to "exec()" and "eval()" are\nspecial in the context of name resolution. A class definition is an\nexecutable statement that may use and define names. These references\nfollow the normal rules for name resolution with an exception that\nunbound local variables are looked up in the global namespace. The\nnamespace of the class definition becomes the attribute dictionary of\nthe class. The scope of names defined in a class block is limited to\nthe class block; it does not extend to the code blocks of methods --\nthis includes comprehensions and generator expressions since they are\nimplemented using a function scope. This means that the following\nwill fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\n\nBuiltins and restricted execution\n---------------------------------\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "builtins"; when in any\nother module, "__builtins__" is an alias for the dictionary of the\n"builtins" module itself. "__builtins__" can be set to a user-created\ndictionary to create a weak form of restricted execution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "builtins" module and modify its attributes appropriately.\n\n\nInteraction with dynamic features\n---------------------------------\n\nName resolution of free variables occurs at runtime, not at compile\ntime. This means that the following code will print 42:\n\n i = 10\n def f():\n print(i)\n i = 42\n f()\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nNote: Exception messages are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section *The try\nstatement* and "raise" statement in section *The raise statement*.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', 'exprlists': u'\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n starred_list ::= starred_item ( "," starred_item )* [","]\n starred_expression ::= expression | ( starred_item "," )* [starred_item]\n starred_item ::= expression | "*" or_expr\n\nExcept when part of a list or set display, an expression list\ncontaining at least one comma yields a tuple. The length of the tuple\nis the number of expressions in the list. The expressions are\nevaluated from left to right.\n\nAn asterisk "*" denotes *iterable unpacking*. Its operand must be an\n*iterable*. The iterable is expanded into a sequence of items, which\nare included in the new tuple, list, or set, at the site of the\nunpacking.\n\nNew in version 3.5: Iterable unpacking in expression lists, originally\nproposed by **PEP 448**.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: "()".)\n', 'floating': u'\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\n floatnumber ::= pointfloat | exponentfloat\n pointfloat ::= [intpart] fraction | intpart "."\n exponentfloat ::= (intpart | pointfloat) exponent\n intpart ::= digit+\n fraction ::= "." digit+\n exponent ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts are always interpreted using\nradix 10. For example, "077e010" is legal, and denotes the same number\nas "77e10". The allowed range of floating point literals is\nimplementation-dependent. Some examples of floating point literals:\n\n 3.14 10. .001 1e100 3.14e-10 0e0\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator "-" and the\nliteral "1".\n', 'for': u'\nThe "for" statement\n*******************\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order returned by the iterator. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a "StopIteration" exception),\nthe suite in the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there is no next\nitem.\n\nThe for-loop makes assignments to the variables(s) in the target list.\nThis overwrites all previous assignments to those variables including\nthose made in the suite of the for-loop:\n\n for i in range(10):\n print(i)\n i = 5 # this will not affect the for-loop\n # because i will be overwritten with the next\n # index in the range\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, they will not have been assigned to at\nall by the loop. Hint: the built-in function "range()" returns an\niterator of integers suitable to emulate the effect of Pascal\'s "for i\n:= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n', 'formatstrings': u'\nFormat String Syntax\n********************\n\nThe "str.format()" method and the "Formatter" class share the same\nsyntax for format strings (although in the case of "Formatter",\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n"{}". Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n"{{" and "}}".\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\n field_name ::= arg_name ("." attribute_name | "[" element_index "]")*\n arg_name ::= [identifier | integer]\n attribute_name ::= identifier\n element_index ::= integer | index_string\n index_string ::= +\n conversion ::= "r" | "s" | "a"\n format_spec ::= \n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a *conversion* field, which is\npreceded by an exclamation point "\'!\'", and a *format_spec*, which is\npreceded by a colon "\':\'". These specify a non-default format for the\nreplacement value.\n\nSee also the *Format Specification Mini-Language* section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword. If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument. If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings "\'10\'" or\n"\':-]\'") within a format string. The *arg_name* can be followed by any\nnumber of index or attribute expressions. An expression of the form\n"\'.name\'" selects the named attribute using "getattr()", while an\nexpression of the form "\'[index]\'" does an index lookup using\n"__getitem__()".\n\nChanged in version 3.1: The positional argument specifiers can be\nomitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "Bring me a {}" # Implicitly references the first positional argument\n "From {} to {}" # Same as "From {0} to {1}"\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the "__format__()"\nmethod of the value itself. However, in some cases it is desirable to\nforce a type to be formatted as a string, overriding its own\ndefinition of formatting. By converting the value to a string before\ncalling "__format__()", the normal formatting logic is bypassed.\n\nThree conversion flags are currently supported: "\'!s\'" which calls\n"str()" on the value, "\'!r\'" which calls "repr()" and "\'!a\'" which\ncalls "ascii()".\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n "More {!a}" # Calls ascii() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields may contain a field name,\nconversion flag and format specification, but deeper nesting is not\nallowed. The replacement fields within the format_spec are\nsubstituted before the *format_spec* string is interpreted. This\nallows the formatting of a value to be dynamically specified.\n\nSee the *Format examples* section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see *Format String Syntax*). They can also be passed directly to the\nbuilt-in "format()" function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string ("""") produces\nthe same result as if you had called "str()" on the value. A non-empty\nformat string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\n fill ::= \n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nIf a valid *align* value is specified, it can be preceded by a *fill*\ncharacter that can be any character and defaults to a space if\nomitted. It is not possible to use a literal curly brace (""{"" or\n""}"") as the *fill* character when using the "str.format()" method.\nHowever, it is possible to insert a curly brace with a nested\nreplacement field. This limitation doesn\'t affect the "format()"\nfunction.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'<\'" | Forces the field to be left-aligned within the available |\n | | space (this is the default for most objects). |\n +-----------+------------------------------------------------------------+\n | "\'>\'" | Forces the field to be right-aligned within the available |\n | | space (this is the default for numbers). |\n +-----------+------------------------------------------------------------+\n | "\'=\'" | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. It becomes the default when \'0\' |\n | | immediately precedes the field width. |\n +-----------+------------------------------------------------------------+\n | "\'^\'" | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'+\'" | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | "\'-\'" | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\nThe "\'#\'" option causes the "alternate form" to be used for the\nconversion. The alternate form is defined differently for different\ntypes. This option is only valid for integer, float, complex and\nDecimal types. For integers, when binary, octal, or hexadecimal output\nis used, this option adds the prefix respective "\'0b\'", "\'0o\'", or\n"\'0x\'" to the output value. For floats, complex and Decimal the\nalternate form causes the result of the conversion to always contain a\ndecimal-point character, even if no digits follow it. Normally, a\ndecimal-point character appears in the result of these conversions\nonly if a digit follows it. In addition, for "\'g\'" and "\'G\'"\nconversions, trailing zeros are not removed from the result.\n\nThe "\',\'" option signals the use of a comma for a thousands separator.\nFor a locale aware separator, use the "\'n\'" integer presentation type\ninstead.\n\nChanged in version 3.1: Added the "\',\'" option (see also **PEP 378**).\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nWhen no explicit alignment is given, preceding the *width* field by a\nzero ("\'0\'") character enables sign-aware zero-padding for numeric\ntypes. This is equivalent to a *fill* character of "\'0\'" with an\n*alignment* type of "\'=\'".\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with "\'f\'" and "\'F\'", or before and after the decimal point\nfor a floating point value formatted with "\'g\'" or "\'G\'". For non-\nnumber types the field indicates the maximum field size - in other\nwords, how many characters will be used from the field content. The\n*precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'s\'" | String format. This is the default type for strings and |\n | | may be omitted. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'s\'". |\n +-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'b\'" | Binary format. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | "\'c\'" | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | "\'d\'" | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | "\'o\'" | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | "\'x\'" | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'X\'" | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'d\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'d\'". |\n +-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except "\'n\'"\nand "None"). When doing so, "float()" is used to convert the integer\nto a floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'e\'" | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'E\'" | Exponent notation. Same as "\'e\'" except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | "\'f\'" | Fixed point. Displays the number as a fixed-point number. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'F\'" | Fixed point. Same as "\'f\'", but converts "nan" to "NAN" |\n | | and "inf" to "INF". |\n +-----------+------------------------------------------------------------+\n | "\'g\'" | General format. For a given precision "p >= 1", this |\n | | rounds the number to "p" significant digits and then |\n | | formats the result in either fixed-point format or in |\n | | scientific notation, depending on its magnitude. The |\n | | precise rules are as follows: suppose that the result |\n | | formatted with presentation type "\'e\'" and precision "p-1" |\n | | would have exponent "exp". Then if "-4 <= exp < p", the |\n | | number is formatted with presentation type "\'f\'" and |\n | | precision "p-1-exp". Otherwise, the number is formatted |\n | | with presentation type "\'e\'" and precision "p-1". In both |\n | | cases insignificant trailing zeros are removed from the |\n | | significand, and the decimal point is also removed if |\n | | there are no remaining digits following it. Positive and |\n | | negative infinity, positive and negative zero, and nans, |\n | | are formatted as "inf", "-inf", "0", "-0" and "nan" |\n | | respectively, regardless of the precision. A precision of |\n | | "0" is treated as equivalent to a precision of "1". The |\n | | default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'G\'" | General format. Same as "\'g\'" except switches to "\'E\'" if |\n | | the number gets too large. The representations of infinity |\n | | and NaN are uppercased, too. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'g\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | "\'%\'" | Percentage. Multiplies the number by 100 and displays in |\n | | fixed ("\'f\'") format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | Similar to "\'g\'", except that fixed-point notation, when |\n | | used, has at least one digit past the decimal point. The |\n | | default precision is as high as needed to represent the |\n | | particular value. The overall effect is to match the |\n | | output of "str()" as altered by the other format |\n | | modifiers. |\n +-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the "str.format()" syntax and\ncomparison with the old "%"-formatting.\n\nIn most of the cases the syntax is similar to the old "%"-formatting,\nwith the addition of the "{}" and with ":" used instead of "%". For\nexample, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n >>> \'{0}, {1}, {2}\'.format(\'a\', \'b\', \'c\')\n \'a, b, c\'\n >>> \'{}, {}, {}\'.format(\'a\', \'b\', \'c\') # 3.1+ only\n \'a, b, c\'\n >>> \'{2}, {1}, {0}\'.format(\'a\', \'b\', \'c\')\n \'c, b, a\'\n >>> \'{2}, {1}, {0}\'.format(*\'abc\') # unpacking argument sequence\n \'c, b, a\'\n >>> \'{0}{1}{0}\'.format(\'abra\', \'cad\') # arguments\' indices can be repeated\n \'abracadabra\'\n\nAccessing arguments by name:\n\n >>> \'Coordinates: {latitude}, {longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n \'Coordinates: 37.24N, -115.81W\'\n >>> coord = {\'latitude\': \'37.24N\', \'longitude\': \'-115.81W\'}\n >>> \'Coordinates: {latitude}, {longitude}\'.format(**coord)\n \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\' attributes:\n\n >>> c = 3-5j\n >>> (\'The complex number {0} is formed from the real part {0.real} \'\n ... \'and the imaginary part {0.imag}.\').format(c)\n \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n >>> class Point:\n ... def __init__(self, x, y):\n ... self.x, self.y = x, y\n ... def __str__(self):\n ... return \'Point({self.x}, {self.y})\'.format(self=self)\n ...\n >>> str(Point(4, 2))\n \'Point(4, 2)\'\n\nAccessing arguments\' items:\n\n >>> coord = (3, 5)\n >>> \'X: {0[0]}; Y: {0[1]}\'.format(coord)\n \'X: 3; Y: 5\'\n\nReplacing "%s" and "%r":\n\n >>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\', \'test2\')\n "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n >>> \'{:<30}\'.format(\'left aligned\')\n \'left aligned \'\n >>> \'{:>30}\'.format(\'right aligned\')\n \' right aligned\'\n >>> \'{:^30}\'.format(\'centered\')\n \' centered \'\n >>> \'{:*^30}\'.format(\'centered\') # use \'*\' as a fill char\n \'***********centered***********\'\n\nReplacing "%+f", "%-f", and "% f" and specifying a sign:\n\n >>> \'{:+f}; {:+f}\'.format(3.14, -3.14) # show it always\n \'+3.140000; -3.140000\'\n >>> \'{: f}; {: f}\'.format(3.14, -3.14) # show a space for positive numbers\n \' 3.140000; -3.140000\'\n >>> \'{:-f}; {:-f}\'.format(3.14, -3.14) # show only the minus -- same as \'{:f}; {:f}\'\n \'3.140000; -3.140000\'\n\nReplacing "%x" and "%o" and converting the value to different bases:\n\n >>> # format also supports binary numbers\n >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42)\n \'int: 42; hex: 2a; oct: 52; bin: 101010\'\n >>> # with 0x, 0o, or 0b as prefix:\n >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)\n \'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n >>> \'{:,}\'.format(1234567890)\n \'1,234,567,890\'\n\nExpressing a percentage:\n\n >>> points = 19\n >>> total = 22\n >>> \'Correct answers: {:.2%}\'.format(points/total)\n \'Correct answers: 86.36%\'\n\nUsing type-specific formatting:\n\n >>> import datetime\n >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n >>> \'{:%Y-%m-%d %H:%M:%S}\'.format(d)\n \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n >>> for align, text in zip(\'<^>\', [\'left\', \'center\', \'right\']):\n ... \'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n ...\n \'left<<<<<<<<<<<<\'\n \'^^^^^center^^^^^\'\n \'>>>>>>>>>>>right\'\n >>>\n >>> octets = [192, 168, 0, 1]\n >>> \'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n \'C0A80001\'\n >>> int(_, 16)\n 3232235521\n >>>\n >>> width = 5\n >>> for num in range(5,12): #doctest: +NORMALIZE_WHITESPACE\n ... for base in \'dXob\':\n ... print(\'{0:{width}{base}}\'.format(num, base=base, width=width), end=\' \')\n ... print()\n ...\n 5 5 5 101\n 6 6 6 110\n 7 7 7 111\n 8 8 10 1000\n 9 9 11 1001\n 10 A 12 1010\n 11 B 13 1011\n', 'function': u'\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n | "*" [parameter] ("," defparameter)* ["," "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis roughly equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nexcept that the original function is not temporarily bound to the name\n"func".\n\nWhen one or more *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the ""*"" must also have a default value --- this\nis a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated from left to right when the\nfunction definition is executed.** This means that the expression is\nevaluated once, when the function is defined, and that the same "pre-\ncomputed" value is used for each call. This is especially important\nto understand when a default parameter is a mutable object, such as a\nlist or a dictionary: if the function modifies the object (e.g. by\nappending an item to a list), the default value is in effect modified.\nThis is generally not what was intended. A way around this is to use\n"None" as the default, and explicitly test for it in the body of the\nfunction, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n""*identifier"" is present, it is initialized to a tuple receiving any\nexcess positional parameters, defaulting to the empty tuple. If the\nform ""**identifier"" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after ""*"" or ""*identifier"" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "": expression"" following\nthe parameter name. Any parameter may have an annotation even those\nof the form "*identifier" or "**identifier". Functions may have\n"return" annotation of the form ""-> expression"" after the parameter\nlist. These annotations can be any valid Python expression and are\nevaluated when the function definition is executed. Annotations may\nbe evaluated in a different order than they appear in the source code.\nThe presence of annotations does not change the semantics of a\nfunction. The annotation values are available as values of a\ndictionary keyed by the parameters\' names in the "__annotations__"\nattribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section *Lambdas*. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nstatement executed inside a function definition defines a local\nfunction that can be returned or passed around. Free variables used\nin the nested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\nSee also: **PEP 3107** - Function Annotations\n\n The original specification for function annotations.\n', - 'global': u'\nThe "global" statement\n**********************\n\n global_stmt ::= "global" identifier ("," identifier)*\n\nThe "global" statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without "global", although free variables may refer to\nglobals without being declared global.\n\nNames listed in a "global" statement must not be used in the same code\nblock textually preceding that "global" statement.\n\nNames listed in a "global" statement must not be defined as formal\nparameters or in a "for" loop control target, "class" definition,\nfunction definition, or "import" statement.\n\n**CPython implementation detail:** The current implementation does not\nenforce the two restrictions, but programs should not abuse this\nfreedom, as future implementations may enforce them or silently change\nthe meaning of the program.\n\n**Programmer\'s note:** the "global" is a directive to the parser. It\napplies only to code parsed at the same time as the "global"\nstatement. In particular, a "global" statement contained in a string\nor code object supplied to the built-in "exec()" function does not\naffect the code block *containing* the function call, and code\ncontained in such a string is unaffected by "global" statements in the\ncode containing the function call. The same applies to the "eval()"\nand "compile()" functions.\n', + 'global': u'\nThe "global" statement\n**********************\n\n global_stmt ::= "global" identifier ("," identifier)*\n\nThe "global" statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without "global", although free variables may refer to\nglobals without being declared global.\n\nNames listed in a "global" statement must not be used in the same code\nblock textually preceding that "global" statement.\n\nNames listed in a "global" statement must not be defined as formal\nparameters or in a "for" loop control target, "class" definition,\nfunction definition, or "import" statement.\n\n**CPython implementation detail:** The current implementation does not\nenforce the two restrictions, but programs should not abuse this\nfreedom, as future implementations may enforce them or silently change\nthe meaning of the program.\n\n**Programmer\'s note:** "global" is a directive to the parser. It\napplies only to code parsed at the same time as the "global"\nstatement. In particular, a "global" statement contained in a string\nor code object supplied to the built-in "exec()" function does not\naffect the code block *containing* the function call, and code\ncontained in such a string is unaffected by "global" statements in the\ncode containing the function call. The same applies to the "eval()"\nand "compile()" functions.\n', 'id-classes': u'\nReserved classes of identifiers\n*******************************\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "builtins" module. When not\n in interactive mode, "_" has no special meaning and is not defined.\n See section *The import statement*.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the *Special method names* section\n and elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n', 'identifiers': u'\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions.\n\nThe syntax of identifiers in Python is based on the Unicode standard\nannex UAX-31, with elaboration and changes as defined below; see also\n**PEP 3131** for further details.\n\nWithin the ASCII range (U+0001..U+007F), the valid characters for\nidentifiers are the same as in Python 2.x: the uppercase and lowercase\nletters "A" through "Z", the underscore "_" and, except for the first\ncharacter, the digits "0" through "9".\n\nPython 3.0 introduces additional characters from outside the ASCII\nrange (see **PEP 3131**). For these characters, the classification\nuses the version of the Unicode Character Database as included in the\n"unicodedata" module.\n\nIdentifiers are unlimited in length. Case is significant.\n\n identifier ::= xid_start xid_continue*\n id_start ::= \n id_continue ::= \n xid_start ::= \n xid_continue ::= \n\nThe Unicode category codes mentioned above stand for:\n\n* *Lu* - uppercase letters\n\n* *Ll* - lowercase letters\n\n* *Lt* - titlecase letters\n\n* *Lm* - modifier letters\n\n* *Lo* - other letters\n\n* *Nl* - letter numbers\n\n* *Mn* - nonspacing marks\n\n* *Mc* - spacing combining marks\n\n* *Nd* - decimal numbers\n\n* *Pc* - connector punctuations\n\n* *Other_ID_Start* - explicit list of characters in PropList.txt to\n support backwards compatibility\n\n* *Other_ID_Continue* - likewise\n\nAll identifiers are converted into the normal form NFKC while parsing;\ncomparison of identifiers is based on NFKC.\n\nA non-normative HTML file listing all valid identifier characters for\nUnicode 4.1 can be found at https://www.dcl.hpi.uni-\npotsdam.de/home/loewis/table-3131.html.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\n False class finally is return\n None continue for lambda try\n True def from nonlocal while\n and del global not with\n as elif if or yield\n assert else import pass\n break except in raise\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "builtins" module. When not\n in interactive mode, "_" has no special meaning and is not defined.\n See section *The import statement*.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the *Special method names* section\n and elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n', 'if': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n', 'imaginary': u'\nImaginary literals\n******************\n\nImaginary literals are described by the following lexical definitions:\n\n imagnumber ::= (floatnumber | intpart) ("j" | "J")\n\nAn imaginary literal yields a complex number with a real part of 0.0.\nComplex numbers are represented as a pair of floating point numbers\nand have the same restrictions on their range. To create a complex\nnumber with a nonzero real part, add a floating point number to it,\ne.g., "(3+4j)". Some examples of imaginary literals:\n\n 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n', 'import': u'\nThe "import" statement\n**********************\n\n import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n | "from" relative_module "import" identifier ["as" name]\n ( "," identifier ["as" name] )*\n | "from" relative_module "import" "(" identifier ["as" name]\n ( "," identifier ["as" name] )* [","] ")"\n | "from" module "import" "*"\n module ::= (identifier ".")* identifier\n relative_module ::= "."* module | "."+\n name ::= identifier\n\nThe basic import statement (no "from" clause) is executed in two\nsteps:\n\n1. find a module, loading and initializing it if necessary\n\n2. define a name or names in the local namespace for the scope\n where the "import" statement occurs.\n\nWhen the statement contains multiple clauses (separated by commas) the\ntwo steps are carried out separately for each clause, just as though\nthe clauses had been separated out into individual import statements.\n\nThe details of the first step, finding and loading modules are\ndescribed in greater detail in the section on the *import system*,\nwhich also describes the various types of packages and modules that\ncan be imported, as well as all the hooks that can be used to\ncustomize the import system. Note that failures in this step may\nindicate either that the module could not be located, *or* that an\nerror occurred while initializing the module, which includes execution\nof the module\'s code.\n\nIf the requested module is retrieved successfully, it will be made\navailable in the local namespace in one of three ways:\n\n* If the module name is followed by "as", then the name following\n "as" is bound directly to the imported module.\n\n* If no other name is specified, and the module being imported is a\n top level module, the module\'s name is bound in the local namespace\n as a reference to the imported module\n\n* If the module being imported is *not* a top level module, then the\n name of the top level package that contains the module is bound in\n the local namespace as a reference to the top level package. The\n imported module must be accessed using its full qualified name\n rather than directly\n\nThe "from" form uses a slightly more complex process:\n\n1. find the module specified in the "from" clause, loading and\n initializing it if necessary;\n\n2. for each of the identifiers specified in the "import" clauses:\n\n 1. check if the imported module has an attribute by that name\n\n 2. if not, attempt to import a submodule with that name and then\n check the imported module again for that attribute\n\n 3. if the attribute is not found, "ImportError" is raised.\n\n 4. otherwise, a reference to that value is stored in the local\n namespace, using the name in the "as" clause if it is present,\n otherwise using the attribute name\n\nExamples:\n\n import foo # foo imported and bound locally\n import foo.bar.baz # foo.bar.baz imported, foo bound locally\n import foo.bar.baz as fbb # foo.bar.baz imported and bound as fbb\n from foo.bar import baz # foo.bar.baz imported and bound as baz\n from foo import attr # foo imported and foo.attr bound as attr\n\nIf the list of identifiers is replaced by a star ("\'*\'"), all public\nnames defined in the module are bound in the local namespace for the\nscope where the "import" statement occurs.\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named "__all__"; if defined, it must\nbe a sequence of strings which are names defined or imported by that\nmodule. The names given in "__all__" are all considered public and\nare required to exist. If "__all__" is not defined, the set of public\nnames includes all names found in the module\'s namespace which do not\nbegin with an underscore character ("\'_\'"). "__all__" should contain\nthe entire public API. It is intended to avoid accidentally exporting\nitems that are not part of the API (such as library modules which were\nimported and used within the module).\n\nThe wild card form of import --- "from module import *" --- is only\nallowed at the module level. Attempting to use it in class or\nfunction definitions will raise a "SyntaxError".\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after "from" you\ncan specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n"from . import mod" from a module in the "pkg" package then you will\nend up importing "pkg.mod". If you execute "from ..subpkg2 import mod"\nfrom within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\nspecification for relative imports is contained within **PEP 328**.\n\n"importlib.import_module()" is provided to support applications that\ndetermine dynamically the modules to be loaded.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python where the feature\nbecomes standard.\n\nThe future statement is intended to ease migration to future versions\nof Python that introduce incompatible changes to the language. It\nallows use of the new features on a per-module basis before the\nrelease in which the feature becomes standard.\n\n future_statement ::= "from" "__future__" "import" feature ["as" name]\n ("," feature ["as" name])*\n | "from" "__future__" "import" "(" feature ["as" name]\n ("," feature ["as" name])* [","] ")"\n feature ::= identifier\n name ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 3.0 are "absolute_import",\n"division", "generators", "unicode_literals", "print_function",\n"nested_scopes" and "with_statement". They are all redundant because\nthey are always enabled, and only kept for backwards compatibility.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module "__future__", described later, and it will\nbe imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by calls to the built-in functions "exec()" and\n"compile()" that occur in a module "M" containing a future statement\nwill, by default, use the new syntax or semantics associated with the\nfuture statement. This can be controlled by optional arguments to\n"compile()" --- see the documentation of that function for details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the *-i* option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also: **PEP 236** - Back to the __future__\n\n The original proposal for the __future__ mechanism.\n', - 'in': u'\nMembership test operations\n**************************\n\nThe operators "in" and "not in" test for membership. "x in s"\nevaluates to true if *x* is a member of *s*, and false otherwise. "x\nnot in s" returns the negation of "x in s". All built-in sequences\nand set types support this as well as dictionary, for which "in" tests\nwhether the dictionary has a given key. For container types such as\nlist, tuple, set, frozenset, dict, or collections.deque, the\nexpression "x in y" is equivalent to "any(x is e or x == e for e in\ny)".\n\nFor the string and bytes types, "x in y" is true if and only if *x* is\na substring of *y*. An equivalent test is "y.find(x) != -1". Empty\nstrings are always considered to be a substring of any other string,\nso """ in "abc"" will return "True".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n', + 'in': u'\nMembership test operations\n**************************\n\nThe operators "in" and "not in" test for membership. "x in s"\nevaluates to "True" if *x* is a member of *s*, and "False" otherwise.\n"x not in s" returns the negation of "x in s". All built-in sequences\nand set types support this as well as dictionary, for which "in" tests\nwhether the dictionary has a given key. For container types such as\nlist, tuple, set, frozenset, dict, or collections.deque, the\nexpression "x in y" is equivalent to "any(x is e or x == e for e in\ny)".\n\nFor the string and bytes types, "x in y" is "True" if and only if *x*\nis a substring of *y*. An equivalent test is "y.find(x) != -1".\nEmpty strings are always considered to be a substring of any other\nstring, so """ in "abc"" will return "True".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" returns "True" if "y.__contains__(x)" returns a true value, and\n"False" otherwise.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is "True" if some value "z" with "x ==\nz" is produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is "True" if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n', 'integers': u'\nInteger literals\n****************\n\nInteger literals are described by the following lexical definitions:\n\n integer ::= decimalinteger | octinteger | hexinteger | bininteger\n decimalinteger ::= nonzerodigit digit* | "0"+\n nonzerodigit ::= "1"..."9"\n digit ::= "0"..."9"\n octinteger ::= "0" ("o" | "O") octdigit+\n hexinteger ::= "0" ("x" | "X") hexdigit+\n bininteger ::= "0" ("b" | "B") bindigit+\n octdigit ::= "0"..."7"\n hexdigit ::= digit | "a"..."f" | "A"..."F"\n bindigit ::= "0" | "1"\n\nThere is no limit for the length of integer literals apart from what\ncan be stored in available memory.\n\nNote that leading zeros in a non-zero decimal number are not allowed.\nThis is for disambiguation with C-style octal literals, which Python\nused before version 3.0.\n\nSome examples of integer literals:\n\n 7 2147483647 0o177 0b100110111\n 3 79228162514264337593543950336 0o377 0xdeadbeef\n', 'lambda': u'\nLambdas\n*******\n\n lambda_expr ::= "lambda" [parameter_list]: expression\n lambda_expr_nocond ::= "lambda" [parameter_list]: expression_nocond\n\nLambda expressions (sometimes called lambda forms) are used to create\nanonymous functions. The expression "lambda arguments: expression"\nyields a function object. The unnamed object behaves like a function\nobject defined with:\n\n def (arguments):\n return expression\n\nSee section *Function definitions* for the syntax of parameter lists.\nNote that functions created with lambda expressions cannot contain\nstatements or annotations.\n', 'lists': u'\nList displays\n*************\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\n list_display ::= "[" [starred_list | comprehension] "]"\n\nA list display yields a new list object, the contents being specified\nby either a list of expressions or a comprehension. When a comma-\nseparated list of expressions is supplied, its elements are evaluated\nfrom left to right and placed into the list object in that order.\nWhen a comprehension is supplied, the list is constructed from the\nelements resulting from the comprehension.\n', - 'naming': u'\nNaming and binding\n******************\n\n\nBinding of names\n================\n\n*Names* refer to objects. Names are introduced by name binding\noperations.\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, or after\n"as" in a "with" statement or "except" clause. The "import" statement\nof the form "from ... import *" binds all names defined in the\nimported module, except those beginning with an underscore. This form\nmay only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name).\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name is bound in a block, it is a local variable of that block,\nunless declared as "nonlocal" or "global". If a name is bound at the\nmodule level, it is a global variable. (The variables of the module\ncode block are local and global.) If a variable is used in a code\nblock but not defined there, it is a *free variable*.\n\nEach occurrence of a name in the program text refers to the *binding*\nof that name established by the following name resolution rules.\n\n\nResolution of names\n===================\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name.\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nWhen a name is not found at all, a "NameError" exception is raised. If\nthe current scope is a function scope, and the name refers to a local\nvariable that has not yet been bound to a value at the point where the\nname is used, an "UnboundLocalError" exception is raised.\n"UnboundLocalError" is a subclass of "NameError".\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the "global" statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "builtins". The global namespace is searched first. If\nthe name is not found there, the builtins namespace is searched. The\n"global" statement must precede all uses of the name.\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nThe "nonlocal" statement causes corresponding names to refer to\npreviously bound variables in the nearest enclosing function scope.\n"SyntaxError" is raised at compile time if the given name does not\nexist in any enclosing function scope.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nClass definition blocks and arguments to "exec()" and "eval()" are\nspecial in the context of name resolution. A class definition is an\nexecutable statement that may use and define names. These references\nfollow the normal rules for name resolution with an exception that\nunbound local variables are looked up in the global namespace. The\nnamespace of the class definition becomes the attribute dictionary of\nthe class. The scope of names defined in a class block is limited to\nthe class block; it does not extend to the code blocks of methods --\nthis includes comprehensions and generator expressions since they are\nimplemented using a function scope. This means that the following\nwill fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\n\nBuiltins and restricted execution\n=================================\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "builtins"; when in any\nother module, "__builtins__" is an alias for the dictionary of the\n"builtins" module itself. "__builtins__" can be set to a user-created\ndictionary to create a weak form of restricted execution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "builtins" module and modify its attributes appropriately.\n\n\nInteraction with dynamic features\n=================================\n\nName resolution of free variables occurs at runtime, not at compile\ntime. This means that the following code will print 42:\n\n i = 10\n def f():\n print(i)\n i = 42\n f()\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', + 'naming': u'\nNaming and binding\n******************\n\n\nBinding of names\n================\n\n*Names* refer to objects. Names are introduced by name binding\noperations.\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, or after\n"as" in a "with" statement or "except" clause. The "import" statement\nof the form "from ... import *" binds all names defined in the\nimported module, except those beginning with an underscore. This form\nmay only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name).\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name is bound in a block, it is a local variable of that block,\nunless declared as "nonlocal" or "global". If a name is bound at the\nmodule level, it is a global variable. (The variables of the module\ncode block are local and global.) If a variable is used in a code\nblock but not defined there, it is a *free variable*.\n\nEach occurrence of a name in the program text refers to the *binding*\nof that name established by the following name resolution rules.\n\n\nResolution of names\n===================\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name.\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nWhen a name is not found at all, a "NameError" exception is raised. If\nthe current scope is a function scope, and the name refers to a local\nvariable that has not yet been bound to a value at the point where the\nname is used, an "UnboundLocalError" exception is raised.\n"UnboundLocalError" is a subclass of "NameError".\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the "global" statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "builtins". The global namespace is searched first. If\nthe name is not found there, the builtins namespace is searched. The\n"global" statement must precede all uses of the name.\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nThe "nonlocal" statement causes corresponding names to refer to\npreviously bound variables in the nearest enclosing function scope.\n"SyntaxError" is raised at compile time if the given name does not\nexist in any enclosing function scope.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nClass definition blocks and arguments to "exec()" and "eval()" are\nspecial in the context of name resolution. A class definition is an\nexecutable statement that may use and define names. These references\nfollow the normal rules for name resolution with an exception that\nunbound local variables are looked up in the global namespace. The\nnamespace of the class definition becomes the attribute dictionary of\nthe class. The scope of names defined in a class block is limited to\nthe class block; it does not extend to the code blocks of methods --\nthis includes comprehensions and generator expressions since they are\nimplemented using a function scope. This means that the following\nwill fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\n\nBuiltins and restricted execution\n=================================\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "builtins"; when in any\nother module, "__builtins__" is an alias for the dictionary of the\n"builtins" module itself. "__builtins__" can be set to a user-created\ndictionary to create a weak form of restricted execution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "builtins" module and modify its attributes appropriately.\n\n\nInteraction with dynamic features\n=================================\n\nName resolution of free variables occurs at runtime, not at compile\ntime. This means that the following code will print 42:\n\n i = 10\n def f():\n print(i)\n i = 42\n f()\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', 'nonlocal': u'\nThe "nonlocal" statement\n************************\n\n nonlocal_stmt ::= "nonlocal" identifier ("," identifier)*\n\nThe "nonlocal" statement causes the listed identifiers to refer to\npreviously bound variables in the nearest enclosing scope excluding\nglobals. This is important because the default behavior for binding is\nto search the local namespace first. The statement allows\nencapsulated code to rebind variables outside of the local scope\nbesides the global (module) scope.\n\nNames listed in a "nonlocal" statement, unlike those listed in a\n"global" statement, must refer to pre-existing bindings in an\nenclosing scope (the scope in which a new binding should be created\ncannot be determined unambiguously).\n\nNames listed in a "nonlocal" statement must not collide with pre-\nexisting bindings in the local scope.\n\nSee also: **PEP 3104** - Access to Names in Outer Scopes\n\n The specification for the "nonlocal" statement.\n', 'numbers': u'\nNumeric literals\n****************\n\nThere are three types of numeric literals: integers, floating point\nnumbers, and imaginary numbers. There are no complex literals\n(complex numbers can be formed by adding a real number and an\nimaginary number).\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator \'"-"\' and the\nliteral "1".\n', 'numeric-types': u'\nEmulating numeric types\n***********************\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__matmul__(self, other)\nobject.__truediv__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|"). For instance, to\n evaluate the expression "x + y", where *x* is an instance of a\n class that has an "__add__()" method, "x.__add__(y)" is called.\n The "__divmod__()" method should be the equivalent to using\n "__floordiv__()" and "__mod__()"; it should not be related to\n "__truediv__()". Note that "__pow__()" should be defined to accept\n an optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rmatmul__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|") with reflected (swapped)\n operands. These functions are only called if the left operand does\n not support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__imatmul__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "@=", "/=", "//=", "%=", "**=",\n "<<=", ">>=", "&=", "^=", "|="). These methods should attempt to\n do the operation in-place (modifying *self*) and return the result\n (which could be, but does not have to be, *self*). If a specific\n method is not defined, the augmented assignment falls back to the\n normal methods. For instance, if *x* is an instance of a class\n with an "__iadd__()" method, "x += y" is equivalent to "x =\n x.__iadd__(y)" . Otherwise, "x.__add__(y)" and "y.__radd__(x)" are\n considered, as with the evaluation of "x + y". In certain\n situations, augmented assignment can result in unexpected errors\n (see *Why does a_tuple[i] += [\'item\'] raise an exception when the\n addition works?*), but this behavior is in fact part of the data\n model.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__float__(self)\nobject.__round__(self[, n])\n\n Called to implement the built-in functions "complex()", "int()",\n "float()" and "round()". Should return a value of the appropriate\n type.\n\nobject.__index__(self)\n\n Called to implement "operator.index()", and whenever Python needs\n to losslessly convert the numeric object to an integer object (such\n as in slicing, or in the built-in "bin()", "hex()" and "oct()"\n functions). Presence of this method indicates that the numeric\n object is an integer type. Must return an integer.\n\n Note: In order to have a coherent integer type class, when\n "__index__()" is defined "__int__()" should also be defined, and\n both should return the same value.\n', @@ -56,22 +56,22 @@ topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert 'power': u'\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\n power ::= ( await_expr | primary ) ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): "-1**2" results in "-1".\n\nThe power operator has the same semantics as the built-in "pow()"\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type, and the result is of that type.\n\nFor int operands, the result has the same type as the operands unless\nthe second argument is negative; in that case, all arguments are\nconverted to float and a float result is delivered. For example,\n"10**2" returns "100", but "10**-2" returns "0.01".\n\nRaising "0.0" to a negative power results in a "ZeroDivisionError".\nRaising a negative number to a fractional power results in a "complex"\nnumber. (In earlier versions it raised a "ValueError".)\n', 'raise': u'\nThe "raise" statement\n*********************\n\n raise_stmt ::= "raise" [expression ["from" expression]]\n\nIf no expressions are present, "raise" re-raises the last exception\nthat was active in the current scope. If no exception is active in\nthe current scope, a "RuntimeError" exception is raised indicating\nthat this is an error.\n\nOtherwise, "raise" evaluates the first expression as the exception\nobject. It must be either a subclass or an instance of\n"BaseException". If it is a class, the exception instance will be\nobtained when needed by instantiating the class with no arguments.\n\nThe *type* of the exception is the exception instance\'s class, the\n*value* is the instance itself.\n\nA traceback object is normally created automatically when an exception\nis raised and attached to it as the "__traceback__" attribute, which\nis writable. You can create an exception and set your own traceback in\none step using the "with_traceback()" exception method (which returns\nthe same exception instance, with its traceback set to its argument),\nlike so:\n\n raise Exception("foo occurred").with_traceback(tracebackobj)\n\nThe "from" clause is used for exception chaining: if given, the second\n*expression* must be another exception class or instance, which will\nthen be attached to the raised exception as the "__cause__" attribute\n(which is writable). If the raised exception is not handled, both\nexceptions will be printed:\n\n >>> try:\n ... print(1 / 0)\n ... except Exception as exc:\n ... raise RuntimeError("Something bad happened") from exc\n ...\n Traceback (most recent call last):\n File "", line 2, in \n ZeroDivisionError: int division or modulo by zero\n\n The above exception was the direct cause of the following exception:\n\n Traceback (most recent call last):\n File "", line 4, in \n RuntimeError: Something bad happened\n\nA similar mechanism works implicitly if an exception is raised inside\nan exception handler or a "finally" clause: the previous exception is\nthen attached as the new exception\'s "__context__" attribute:\n\n >>> try:\n ... print(1 / 0)\n ... except:\n ... raise RuntimeError("Something bad happened")\n ...\n Traceback (most recent call last):\n File "", line 2, in \n ZeroDivisionError: int division or modulo by zero\n\n During handling of the above exception, another exception occurred:\n\n Traceback (most recent call last):\n File "", line 4, in \n RuntimeError: Something bad happened\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information about handling exceptions is in section\n*The try statement*.\n', 'return': u'\nThe "return" statement\n**********************\n\n return_stmt ::= "return" [expression_list]\n\n"return" may only occur syntactically nested in a function definition,\nnot within a nested class definition.\n\nIf an expression list is present, it is evaluated, else "None" is\nsubstituted.\n\n"return" leaves the current function call with the expression list (or\n"None") as return value.\n\nWhen "return" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nfunction.\n\nIn a generator function, the "return" statement indicates that the\ngenerator is done and will cause "StopIteration" to be raised. The\nreturned value (if any) is used as an argument to construct\n"StopIteration" and becomes the "StopIteration.value" attribute.\n', - 'sequence-types': u'\nEmulating container types\n*************************\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "get()", "clear()",\n"setdefault()", "pop()", "popitem()", "copy()", and "update()"\nbehaving similar to those for Python\'s standard dictionary objects.\nThe "collections" module provides a "MutableMapping" abstract base\nclass to help create those methods from a base set of "__getitem__()",\n"__setitem__()", "__delitem__()", and "keys()". Mutable sequences\nshould provide methods "append()", "count()", "index()", "extend()",\n"insert()", "pop()", "remove()", "reverse()" and "sort()", like Python\nstandard list objects. Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning\nrepetition) by defining the methods "__add__()", "__radd__()",\n"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" described\nbelow; they should not define other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should search the mapping\'s keys; for sequences, it\nshould search through the values. It is further recommended that both\nmappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "keys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__bool__()" method and whose "__len__()" method\n returns zero is considered to be false in a Boolean context.\n\nobject.__length_hint__(self)\n\n Called to implement "operator.length_hint()". Should return an\n estimated length for the object (which may be greater or less than\n the actual length). The length must be an integer ">=" 0. This\n method is purely an optimization and is never required for\n correctness.\n\n New in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\n A call like\n\n a[1:2] = b\n\n is translated to\n\n a[slice(1, 2, None)] = b\n\n and so forth. Missing slice items are always filled in with "None".\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see *this section in the\n language reference*.\n', + 'sequence-types': u'\nEmulating container types\n*************************\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "get()", "clear()",\n"setdefault()", "pop()", "popitem()", "copy()", and "update()"\nbehaving similar to those for Python\'s standard dictionary objects.\nThe "collections" module provides a "MutableMapping" abstract base\nclass to help create those methods from a base set of "__getitem__()",\n"__setitem__()", "__delitem__()", and "keys()". Mutable sequences\nshould provide methods "append()", "count()", "index()", "extend()",\n"insert()", "pop()", "remove()", "reverse()" and "sort()", like Python\nstandard list objects. Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning\nrepetition) by defining the methods "__add__()", "__radd__()",\n"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" described\nbelow; they should not define other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should search the mapping\'s keys; for sequences, it\nshould search through the values. It is further recommended that both\nmappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "keys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__bool__()" method and whose "__len__()" method\n returns zero is considered to be false in a Boolean context.\n\n **CPython implementation detail:** In CPython, the length is\n required to be at most "sys.maxsize". If the length is larger than\n "sys.maxsize" some features (such as "len()") may raise\n "OverflowError". To prevent raising "OverflowError" by truth value\n testing, an object must define a "__bool__()" method.\n\nobject.__length_hint__(self)\n\n Called to implement "operator.length_hint()". Should return an\n estimated length for the object (which may be greater or less than\n the actual length). The length must be an integer ">=" 0. This\n method is purely an optimization and is never required for\n correctness.\n\n New in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\n A call like\n\n a[1:2] = b\n\n is translated to\n\n a[slice(1, 2, None)] = b\n\n and so forth. Missing slice items are always filled in with "None".\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see *this section in the\n language reference*.\n', 'shifting': u'\nShifting operations\n*******************\n\nThe shifting operations have lower priority than the arithmetic\noperations:\n\n shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n\nThese operators accept integers as arguments. They shift the first\nargument to the left or right by the number of bits given by the\nsecond argument.\n\nA right shift by *n* bits is defined as floor division by "pow(2,n)".\nA left shift by *n* bits is defined as multiplication with "pow(2,n)".\n\nNote: In the current implementation, the right-hand operand is\n required to be at most "sys.maxsize". If the right-hand operand is\n larger than "sys.maxsize" an "OverflowError" exception is raised.\n', 'slicings': u'\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list). Slicings may be used as expressions or as\ntargets in assignment or "del" statements. The syntax for a slicing:\n\n slicing ::= primary "[" slice_list "]"\n slice_list ::= slice_item ("," slice_item)* [","]\n slice_item ::= expression | proper_slice\n proper_slice ::= [lower_bound] ":" [upper_bound] [ ":" [stride] ]\n lower_bound ::= expression\n upper_bound ::= expression\n stride ::= expression\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing. Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice).\n\nThe semantics for a slicing are as follows. The primary is indexed\n(using the same "__getitem__()" method as normal subscription) with a\nkey that is constructed from the slice list, as follows. If the slice\nlist contains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key. The conversion of a slice item that is an\nexpression is that expression. The conversion of a proper slice is a\nslice object (see section *The standard type hierarchy*) whose\n"start", "stop" and "step" attributes are the values of the\nexpressions given as lower bound, upper bound and stride,\nrespectively, substituting "None" for missing expressions.\n', 'specialattrs': u'\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant. Some of these are not reported\nby the "dir()" built-in function.\n\nobject.__dict__\n\n A dictionary or other mapping object used to store an object\'s\n (writable) attributes.\n\ninstance.__class__\n\n The class to which a class instance belongs.\n\nclass.__bases__\n\n The tuple of base classes of a class object.\n\ndefinition.__name__\n\n The name of the class, function, method, descriptor, or generator\n instance.\n\ndefinition.__qualname__\n\n The *qualified name* of the class, function, method, descriptor, or\n generator instance.\n\n New in version 3.3.\n\nclass.__mro__\n\n This attribute is a tuple of classes that are considered when\n looking for base classes during method resolution.\n\nclass.mro()\n\n This method can be overridden by a metaclass to customize the\n method resolution order for its instances. It is called at class\n instantiation, and its result is stored in "__mro__".\n\nclass.__subclasses__()\n\n Each class keeps a list of weak references to its immediate\n subclasses. This method returns a list of all those references\n still alive. Example:\n\n >>> int.__subclasses__()\n []\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found\n in the Python Reference Manual (*Basic customization*).\n\n[2] As a consequence, the list "[1, 2]" is considered equal to\n "[1.0, 2.0]", and similarly for tuples.\n\n[3] They must have since the parser can\'t tell the type of the\n operands.\n\n[4] Cased characters are those with general category property\n being one of "Lu" (Letter, uppercase), "Ll" (Letter, lowercase),\n or "Lt" (Letter, titlecase).\n\n[5] To format only a tuple you should therefore provide a\n singleton tuple whose only element is the tuple to be formatted.\n', - 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "type(x).__getitem__(x, i)".\nExcept where mentioned, attempts to execute an operation raise an\nexception when no appropriate method is defined (typically\n"AttributeError" or "TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customize\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_info()[2]" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the second can be resolved by freeing the reference to the\n traceback object when it is no longer useful, and the third can\n be resolved by storing "None" in "sys.last_traceback". Circular\n references which are garbage are detected and cleaned up when the\n cyclic garbage collector is enabled (it\'s on by default). Refer\n to the documentation for the "gc" module for more information\n about this topic.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function to compute the "official"\n string representation of an object. If at all possible, this\n should look like a valid Python expression that could be used to\n recreate an object with the same value (given an appropriate\n environment). If this is not possible, a string of the form\n "<...some useful description...>" should be returned. The return\n value must be a string object. If a class defines "__repr__()" but\n not "__str__()", then "__repr__()" is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by "str(object)" and the built-in functions "format()" and\n "print()" to compute the "informal" or nicely printable string\n representation of an object. The return value must be a *string*\n object.\n\n This method differs from "object.__repr__()" in that there is no\n expectation that "__str__()" return a valid Python expression: a\n more convenient or concise representation can be used.\n\n The default implementation defined by the built-in type "object"\n calls "object.__repr__()".\n\nobject.__bytes__(self)\n\n Called by "bytes()" to compute a byte-string representation of an\n object. This should return a "bytes" object.\n\nobject.__format__(self, format_spec)\n\n Called by the "format()" built-in function (and by extension, the\n "str.format()" method of class "str") to produce a "formatted"\n string representation of an object. The "format_spec" argument is a\n string that contains a description of the formatting options\n desired. The interpretation of the "format_spec" argument is up to\n the type implementing "__format__()", however most classes will\n either delegate formatting to one of the built-in types, or use a\n similar formatting option syntax.\n\n See *Format Specification Mini-Language* for a description of the\n standard formatting syntax.\n\n The return value must be a string object.\n\n Changed in version 3.4: The __format__ method of "object" itself\n raises a "TypeError" if passed any non-empty string.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n These are the so-called "rich comparison" methods. The\n correspondence between operator symbols and method names is as\n follows: "xy" calls\n "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n By default, "__ne__()" delegates to "__eq__()" and inverts the\n result unless it is "NotImplemented". There are no other implied\n relationships among the comparison operators, for example, the\n truth of "(x.__hash__".\n\n If a class that does not override "__eq__()" wishes to suppress\n hash support, it should include "__hash__ = None" in the class\n definition. A class which defines its own "__hash__()" that\n explicitly raises a "TypeError" would be incorrectly identified as\n hashable by an "isinstance(obj, collections.Hashable)" call.\n\n Note: By default, the "__hash__()" values of str, bytes and\n datetime objects are "salted" with an unpredictable random value.\n Although they remain constant within an individual Python\n process, they are not predictable between repeated invocations of\n Python.This is intended to provide protection against a denial-\n of-service caused by carefully-chosen inputs that exploit the\n worst case performance of a dict insertion, O(n^2) complexity.\n See http://www.ocert.org/advisories/ocert-2011-003.html for\n details.Changing hash values affects the iteration order of\n dicts, sets and other mappings. Python has never made guarantees\n about this ordering (and it typically varies between 32-bit and\n 64-bit builds).See also "PYTHONHASHSEED".\n\n Changed in version 3.3: Hash randomization is enabled by default.\n\nobject.__bool__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True". When this method is not\n defined, "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__bool__()", all its instances are\n considered true.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control over attribute access.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See *Special method lookup*.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should call the base class method with the same name, for example,\n "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\nobject.__dir__(self)\n\n Called when "dir()" is called on the object. A sequence must be\n returned. "dir()" converts the returned sequence to a list and\n sorts it.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\nThe attribute "__objclass__" is interpreted by the "inspect" module as\nspecifying the class where this object was defined (setting this\nappropriately can assist in runtime introspection of dynamic class\nattributes). For callables, it may indicate that an instance of the\ngiven type (or a subclass) is expected or required as the first\npositional argument (for example, CPython sets this attribute for\nunbound methods that are implemented in C).\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to an object instance, "a.x" is transformed into the\n call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a class, "A.x" is transformed into the call:\n "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of classes have a dictionary for attribute\nstorage. This wastes space for objects having very few instance\nvariables. The space consumption can become acute when creating large\nnumbers of instances.\n\nThe default can be overridden by defining *__slots__* in a class\ndefinition. The *__slots__* declaration takes a sequence of instance\nvariables and reserves just enough space in each instance to hold a\nvalue for each variable. Space is saved because *__dict__* is not\ncreated for each instance.\n\nobject.__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. *__slots__*\n reserves space for the declared variables and prevents the\n automatic creation of *__dict__* and *__weakref__* for each\n instance.\n\n\nNotes on using *__slots__*\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "int", "bytes" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, classes are constructed using "type()". The class body is\nexecuted in a new namespace and the class name is bound locally to the\nresult of "type(name, bases, namespace)".\n\nThe class creation process can be customized by passing the\n"metaclass" keyword argument in the class definition line, or by\ninheriting from an existing class that included such an argument. In\nthe following example, both "MyClass" and "MySubclass" are instances\nof "Meta":\n\n class Meta(type):\n pass\n\n class MyClass(metaclass=Meta):\n pass\n\n class MySubclass(MyClass):\n pass\n\nAny other keyword arguments that are specified in the class definition\nare passed through to all metaclass operations described below.\n\nWhen a class definition is executed, the following steps occur:\n\n* the appropriate metaclass is determined\n\n* the class namespace is prepared\n\n* the class body is executed\n\n* the class object is created\n\n\nDetermining the appropriate metaclass\n-------------------------------------\n\nThe appropriate metaclass for a class definition is determined as\nfollows:\n\n* if no bases and no explicit metaclass are given, then "type()" is\n used\n\n* if an explicit metaclass is given and it is *not* an instance of\n "type()", then it is used directly as the metaclass\n\n* if an instance of "type()" is given as the explicit metaclass, or\n bases are defined, then the most derived metaclass is used\n\nThe most derived metaclass is selected from the explicitly specified\nmetaclass (if any) and the metaclasses (i.e. "type(cls)") of all\nspecified base classes. The most derived metaclass is one which is a\nsubtype of *all* of these candidate metaclasses. If none of the\ncandidate metaclasses meets that criterion, then the class definition\nwill fail with "TypeError".\n\n\nPreparing the class namespace\n-----------------------------\n\nOnce the appropriate metaclass has been identified, then the class\nnamespace is prepared. If the metaclass has a "__prepare__" attribute,\nit is called as "namespace = metaclass.__prepare__(name, bases,\n**kwds)" (where the additional keyword arguments, if any, come from\nthe class definition).\n\nIf the metaclass has no "__prepare__" attribute, then the class\nnamespace is initialised as an empty "dict()" instance.\n\nSee also: **PEP 3115** - Metaclasses in Python 3000\n\n Introduced the "__prepare__" namespace hook\n\n\nExecuting the class body\n------------------------\n\nThe class body is executed (approximately) as "exec(body, globals(),\nnamespace)". The key difference from a normal call to "exec()" is that\nlexical scoping allows the class body (including any methods) to\nreference names from the current and outer scopes when the class\ndefinition occurs inside a function.\n\nHowever, even when the class definition occurs inside the function,\nmethods defined inside the class still cannot see names defined at the\nclass scope. Class variables must be accessed through the first\nparameter of instance or class methods, and cannot be accessed at all\nfrom static methods.\n\n\nCreating the class object\n-------------------------\n\nOnce the class namespace has been populated by executing the class\nbody, the class object is created by calling "metaclass(name, bases,\nnamespace, **kwds)" (the additional keywords passed here are the same\nas those passed to "__prepare__").\n\nThis class object is the one that will be referenced by the zero-\nargument form of "super()". "__class__" is an implicit closure\nreference created by the compiler if any methods in a class body refer\nto either "__class__" or "super". This allows the zero argument form\nof "super()" to correctly identify the class being defined based on\nlexical scoping, while the class or instance that was used to make the\ncurrent call is identified based on the first argument passed to the\nmethod.\n\nAfter the class object is created, it is passed to the class\ndecorators included in the class definition (if any) and the resulting\nobject is bound in the local namespace as the defined class.\n\nWhen a new class is created by "type.__new__", the object provided as\nthe namespace parameter is copied to a standard Python dictionary and\nthe original object is discarded. The new copy becomes the "__dict__"\nattribute of the class object.\n\nSee also: **PEP 3135** - New super\n\n Describes the implicit "__class__" closure reference\n\n\nMetaclass example\n-----------------\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored include logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\nHere is an example of a metaclass that uses an\n"collections.OrderedDict" to remember the order that class variables\nare defined:\n\n class OrderedClass(type):\n\n @classmethod\n def __prepare__(metacls, name, bases, **kwds):\n return collections.OrderedDict()\n\n def __new__(cls, name, bases, namespace, **kwds):\n result = type.__new__(cls, name, bases, dict(namespace))\n result.members = tuple(namespace)\n return result\n\n class A(metaclass=OrderedClass):\n def one(self): pass\n def two(self): pass\n def three(self): pass\n def four(self): pass\n\n >>> A.members\n (\'__module__\', \'one\', \'two\', \'three\', \'four\')\n\nWhen the class definition for *A* gets executed, the process begins\nwith calling the metaclass\'s "__prepare__()" method which returns an\nempty "collections.OrderedDict". That mapping records the methods and\nattributes of *A* as they are defined within the body of the class\nstatement. Once those definitions are executed, the ordered dictionary\nis fully populated and the metaclass\'s "__new__()" method gets\ninvoked. That method builds the new type and it saves the ordered\ndictionary keys in an attribute called "members".\n\n\nCustomizing instance and subclass checks\n========================================\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n "isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n "issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also: **PEP 3119** - Introducing Abstract Base Classes\n\n Includes the specification for customizing "isinstance()" and\n "issubclass()" behavior through "__instancecheck__()" and\n "__subclasscheck__()", with motivation for this functionality in\n the context of adding Abstract Base Classes (see the "abc"\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "get()", "clear()",\n"setdefault()", "pop()", "popitem()", "copy()", and "update()"\nbehaving similar to those for Python\'s standard dictionary objects.\nThe "collections" module provides a "MutableMapping" abstract base\nclass to help create those methods from a base set of "__getitem__()",\n"__setitem__()", "__delitem__()", and "keys()". Mutable sequences\nshould provide methods "append()", "count()", "index()", "extend()",\n"insert()", "pop()", "remove()", "reverse()" and "sort()", like Python\nstandard list objects. Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning\nrepetition) by defining the methods "__add__()", "__radd__()",\n"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" described\nbelow; they should not define other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should search the mapping\'s keys; for sequences, it\nshould search through the values. It is further recommended that both\nmappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "keys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__bool__()" method and whose "__len__()" method\n returns zero is considered to be false in a Boolean context.\n\nobject.__length_hint__(self)\n\n Called to implement "operator.length_hint()". Should return an\n estimated length for the object (which may be greater or less than\n the actual length). The length must be an integer ">=" 0. This\n method is purely an optimization and is never required for\n correctness.\n\n New in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\n A call like\n\n a[1:2] = b\n\n is translated to\n\n a[slice(1, 2, None)] = b\n\n and so forth. Missing slice items are always filled in with "None".\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see *this section in the\n language reference*.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__matmul__(self, other)\nobject.__truediv__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|"). For instance, to\n evaluate the expression "x + y", where *x* is an instance of a\n class that has an "__add__()" method, "x.__add__(y)" is called.\n The "__divmod__()" method should be the equivalent to using\n "__floordiv__()" and "__mod__()"; it should not be related to\n "__truediv__()". Note that "__pow__()" should be defined to accept\n an optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rmatmul__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|") with reflected (swapped)\n operands. These functions are only called if the left operand does\n not support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__imatmul__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "@=", "/=", "//=", "%=", "**=",\n "<<=", ">>=", "&=", "^=", "|="). These methods should attempt to\n do the operation in-place (modifying *self*) and return the result\n (which could be, but does not have to be, *self*). If a specific\n method is not defined, the augmented assignment falls back to the\n normal methods. For instance, if *x* is an instance of a class\n with an "__iadd__()" method, "x += y" is equivalent to "x =\n x.__iadd__(y)" . Otherwise, "x.__add__(y)" and "y.__radd__(x)" are\n considered, as with the evaluation of "x + y". In certain\n situations, augmented assignment can result in unexpected errors\n (see *Why does a_tuple[i] += [\'item\'] raise an exception when the\n addition works?*), but this behavior is in fact part of the data\n model.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__float__(self)\nobject.__round__(self[, n])\n\n Called to implement the built-in functions "complex()", "int()",\n "float()" and "round()". Should return a value of the appropriate\n type.\n\nobject.__index__(self)\n\n Called to implement "operator.index()", and whenever Python needs\n to losslessly convert the numeric object to an integer object (such\n as in slicing, or in the built-in "bin()", "hex()" and "oct()"\n functions). Presence of this method indicates that the numeric\n object is an integer type. Must return an integer.\n\n Note: In order to have a coherent integer type class, when\n "__index__()" is defined "__int__()" should also be defined, and\n both should return the same value.\n\n\nWith Statement Context Managers\n===============================\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section *The with\nstatement*), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nSpecial method lookup\n=====================\n\nFor custom classes, implicit invocations of special methods are only\nguaranteed to work correctly if defined on an object\'s type, not in\nthe object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception:\n\n >>> class C:\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print("Metaclass getattribute invoked")\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object, metaclass=Meta):\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print("Class getattribute invoked")\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n', - 'string-methods': u'\nString Methods\n**************\n\nStrings implement all of the *common* sequence operations, along with\nthe additional methods described below.\n\nStrings also support two styles of string formatting, one providing a\nlarge degree of flexibility and customization (see "str.format()",\n*Format String Syntax* and *Custom String Formatting*) and the other\nbased on C "printf" style formatting that handles a narrower range of\ntypes and is slightly harder to use correctly, but is often faster for\nthe cases it can handle (*printf-style String Formatting*).\n\nThe *Text Processing Services* section of the standard library covers\na number of other modules that provide various text related utilities\n(including regular expression support in the "re" module).\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\nstr.casefold()\n\n Return a casefolded copy of the string. Casefolded strings may be\n used for caseless matching.\n\n Casefolding is similar to lowercasing but more aggressive because\n it is intended to remove all case distinctions in a string. For\n example, the German lowercase letter "\'\xdf\'" is equivalent to ""ss"".\n Since it is already lowercase, "lower()" would do nothing to "\'\xdf\'";\n "casefold()" converts it to ""ss"".\n\n The casefolding algorithm is described in section 3.13 of the\n Unicode Standard.\n\n New in version 3.3.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is an ASCII space). The\n original string is returned if *width* is less than or equal to\n "len(s)".\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.encode(encoding="utf-8", errors="strict")\n\n Return an encoded version of the string as a bytes object. Default\n encoding is "\'utf-8\'". *errors* may be given to set a different\n error handling scheme. The default for *errors* is "\'strict\'",\n meaning that encoding errors raise a "UnicodeError". Other possible\n values are "\'ignore\'", "\'replace\'", "\'xmlcharrefreplace\'",\n "\'backslashreplace\'" and any other name registered via\n "codecs.register_error()", see section *Error Handlers*. For a list\n of possible encodings, see section *Standard Encodings*.\n\n Changed in version 3.1: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\nstr.expandtabs(tabsize=8)\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found within the slice "s[start:end]". Optional arguments *start*\n and *end* are interpreted as in slice notation. Return "-1" if\n *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\nstr.format_map(mapping)\n\n Similar to "str.format(**mapping)", except that "mapping" is used\n directly and not copied to a "dict". This is useful if for example\n "mapping" is a dict subclass:\n\n >>> class Default(dict):\n ... def __missing__(self, key):\n ... return key\n ...\n >>> \'{name} was born in {country}\'.format_map(Default(name=\'Guido\'))\n \'Guido was born in country\'\n\n New in version 3.2.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise. A character "c"\n is alphanumeric if one of the following returns "True":\n "c.isalpha()", "c.isdecimal()", "c.isdigit()", or "c.isnumeric()".\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise. Alphabetic\n characters are those characters defined in the Unicode character\n database as "Letter", i.e., those with general category property\n being one of "Lm", "Lt", "Lu", "Ll", or "Lo". Note that this is\n different from the "Alphabetic" property defined in the Unicode\n Standard.\n\nstr.isdecimal()\n\n Return true if all characters in the string are decimal characters\n and there is at least one character, false otherwise. Decimal\n characters are those that can be used to form numbers in base 10,\n e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a decimal character\n is a character in the Unicode General Category "Nd".\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise. Digits include decimal\n characters and digits that need special handling, such as the\n compatibility superscript digits. This covers digits which cannot\n be used to form numbers in base 10, like the Kharosthi numbers.\n Formally, a digit is a character that has the property value\n Numeric_Type=Digit or Numeric_Type=Decimal.\n\nstr.isidentifier()\n\n Return true if the string is a valid identifier according to the\n language definition, section *Identifiers and keywords*.\n\n Use "keyword.iskeyword()" to test for reserved identifiers such as\n "def" and "class".\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\nstr.isnumeric()\n\n Return true if all characters in the string are numeric characters,\n and there is at least one character, false otherwise. Numeric\n characters include digit characters, and all characters that have\n the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION\n ONE FIFTH. Formally, numeric characters are those with the\n property value Numeric_Type=Digit, Numeric_Type=Decimal or\n Numeric_Type=Numeric.\n\nstr.isprintable()\n\n Return true if all characters in the string are printable or the\n string is empty, false otherwise. Nonprintable characters are\n those characters defined in the Unicode character database as\n "Other" or "Separator", excepting the ASCII space (0x20) which is\n considered printable. (Note that printable characters in this\n context are those which should not be escaped when "repr()" is\n invoked on a string. It has no bearing on the handling of strings\n written to "sys.stdout" or "sys.stderr".)\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise. Whitespace\n characters are those characters defined in the Unicode character\n database as "Other" or "Separator" and those with bidirectional\n property being one of "WS", "B", or "S".\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. A "TypeError" will be raised if there are\n any non-string values in *iterable*, including "bytes" objects.\n The separator between elements is the string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n The lowercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nstatic str.maketrans(x[, y[, z]])\n\n This static method returns a translation table usable for\n "str.translate()".\n\n If there is only one argument, it must be a dictionary mapping\n Unicode ordinals (integers) or characters (strings of length 1) to\n Unicode ordinals, strings (of arbitrary lengths) or "None".\n Character keys will then be converted to ordinals.\n\n If there are two arguments, they must be strings of equal length,\n and in the resulting dictionary, each character in x will be mapped\n to the character at the same position in y. If there is a third\n argument, it must be a string, whose characters will be mapped to\n "None" in the result.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\nstr.rsplit(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nstr.split(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n For example:\n\n >>> \'1,2,3\'.split(\',\')\n [\'1\', \'2\', \'3\']\n >>> \'1,2,3\'.split(\',\', maxsplit=1)\n [\'1\', \'2,3\']\n >>> \'1,2,,3,\'.split(\',\')\n [\'1\', \'2\', \'\', \'3\', \'\']\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example:\n\n >>> \'1 2 3\'.split()\n [\'1\', \'2\', \'3\']\n >>> \'1 2 3\'.split(maxsplit=1)\n [\'1\', \'2 3\']\n >>> \' 1 2 3 \'.split()\n [\'1\', \'2\', \'3\']\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n This method splits on the following line boundaries. In\n particular, the boundaries are a superset of *universal newlines*.\n\n +-------------------------+-------------------------------+\n | Representation | Description |\n +=========================+===============================+\n | "\\n" | Line Feed |\n +-------------------------+-------------------------------+\n | "\\r" | Carriage Return |\n +-------------------------+-------------------------------+\n | "\\r\\n" | Carriage Return + Line Feed |\n +-------------------------+-------------------------------+\n | "\\v" or "\\x0b" | Line Tabulation |\n +-------------------------+-------------------------------+\n | "\\f" or "\\x0c" | Form Feed |\n +-------------------------+-------------------------------+\n | "\\x1c" | File Separator |\n +-------------------------+-------------------------------+\n | "\\x1d" | Group Separator |\n +-------------------------+-------------------------------+\n | "\\x1e" | Record Separator |\n +-------------------------+-------------------------------+\n | "\\x85" | Next Line (C1 Control Code) |\n +-------------------------+-------------------------------+\n | "\\u2028" | Line Separator |\n +-------------------------+-------------------------------+\n | "\\u2029" | Paragraph Separator |\n +-------------------------+-------------------------------+\n\n Changed in version 3.2: "\\v" and "\\f" added to list of line\n boundaries.\n\n For example:\n\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()\n [\'ab c\', \'\', \'de fg\', \'kl\']\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines(keepends=True)\n [\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line:\n\n >>> "".splitlines()\n []\n >>> "One line\\n".splitlines()\n [\'One line\']\n\n For comparison, "split(\'\\n\')" gives:\n\n >>> \'\'.split(\'\\n\')\n [\'\']\n >>> \'Two lines\\n\'.split(\'\\n\')\n [\'Two lines\', \'\']\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n The outermost leading and trailing *chars* argument values are\n stripped from the string. Characters are removed from the leading\n end until reaching a string character that is not contained in the\n set of characters in *chars*. A similar action takes place on the\n trailing end. For example:\n\n >>> comment_string = \'#....... Section 3.2.1 Issue #32 .......\'\n >>> comment_string.strip(\'.#! \')\n \'Section 3.2.1 Issue #32\'\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa. Note that it is not necessarily true that\n "s.swapcase().swapcase() == s".\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n For example:\n\n >>> \'Hello world\'.title()\n \'Hello World\'\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\nstr.translate(table)\n\n Return a copy of the string in which each character has been mapped\n through the given translation table. The table must be an object\n that implements indexing via "__getitem__()", typically a *mapping*\n or *sequence*. When indexed by a Unicode ordinal (an integer), the\n table object can do any of the following: return a Unicode ordinal\n or a string, to map the character to one or more other characters;\n return "None", to delete the character from the return string; or\n raise a "LookupError" exception, to map the character to itself.\n\n You can use "str.maketrans()" to create a translation map from\n character-to-character mappings in different formats.\n\n See also the "codecs" module for a more flexible approach to custom\n character mappings.\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n The uppercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.zfill(width)\n\n Return a copy of the string left filled with ASCII "\'0\'" digits to\n make a string of length *width*. A leading sign prefix\n ("\'+\'"/"\'-\'") is handled by inserting the padding *after* the sign\n character rather than before. The original string is returned if\n *width* is less than or equal to "len(s)".\n\n For example:\n\n >>> "42".zfill(5)\n \'00042\'\n >>> "-42".zfill(5)\n \'-0042\'\n', + 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "type(x).__getitem__(x, i)".\nExcept where mentioned, attempts to execute an operation raise an\nexception when no appropriate method is defined (typically\n"AttributeError" or "TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super().__new__(cls[, ...])" with appropriate arguments and then\n modifying the newly-created instance as necessary before returning\n it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "super().__init__([args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customize\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_info()[2]" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the second can be resolved by freeing the reference to the\n traceback object when it is no longer useful, and the third can\n be resolved by storing "None" in "sys.last_traceback". Circular\n references which are garbage are detected and cleaned up when the\n cyclic garbage collector is enabled (it\'s on by default). Refer\n to the documentation for the "gc" module for more information\n about this topic.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function to compute the "official"\n string representation of an object. If at all possible, this\n should look like a valid Python expression that could be used to\n recreate an object with the same value (given an appropriate\n environment). If this is not possible, a string of the form\n "<...some useful description...>" should be returned. The return\n value must be a string object. If a class defines "__repr__()" but\n not "__str__()", then "__repr__()" is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by "str(object)" and the built-in functions "format()" and\n "print()" to compute the "informal" or nicely printable string\n representation of an object. The return value must be a *string*\n object.\n\n This method differs from "object.__repr__()" in that there is no\n expectation that "__str__()" return a valid Python expression: a\n more convenient or concise representation can be used.\n\n The default implementation defined by the built-in type "object"\n calls "object.__repr__()".\n\nobject.__bytes__(self)\n\n Called by "bytes()" to compute a byte-string representation of an\n object. This should return a "bytes" object.\n\nobject.__format__(self, format_spec)\n\n Called by the "format()" built-in function (and by extension, the\n "str.format()" method of class "str") to produce a "formatted"\n string representation of an object. The "format_spec" argument is a\n string that contains a description of the formatting options\n desired. The interpretation of the "format_spec" argument is up to\n the type implementing "__format__()", however most classes will\n either delegate formatting to one of the built-in types, or use a\n similar formatting option syntax.\n\n See *Format Specification Mini-Language* for a description of the\n standard formatting syntax.\n\n The return value must be a string object.\n\n Changed in version 3.4: The __format__ method of "object" itself\n raises a "TypeError" if passed any non-empty string.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n These are the so-called "rich comparison" methods. The\n correspondence between operator symbols and method names is as\n follows: "xy" calls\n "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n By default, "__ne__()" delegates to "__eq__()" and inverts the\n result unless it is "NotImplemented". There are no other implied\n relationships among the comparison operators, for example, the\n truth of "(x.__hash__".\n\n If a class that does not override "__eq__()" wishes to suppress\n hash support, it should include "__hash__ = None" in the class\n definition. A class which defines its own "__hash__()" that\n explicitly raises a "TypeError" would be incorrectly identified as\n hashable by an "isinstance(obj, collections.Hashable)" call.\n\n Note: By default, the "__hash__()" values of str, bytes and\n datetime objects are "salted" with an unpredictable random value.\n Although they remain constant within an individual Python\n process, they are not predictable between repeated invocations of\n Python.This is intended to provide protection against a denial-\n of-service caused by carefully-chosen inputs that exploit the\n worst case performance of a dict insertion, O(n^2) complexity.\n See http://www.ocert.org/advisories/ocert-2011-003.html for\n details.Changing hash values affects the iteration order of\n dicts, sets and other mappings. Python has never made guarantees\n about this ordering (and it typically varies between 32-bit and\n 64-bit builds).See also "PYTHONHASHSEED".\n\n Changed in version 3.3: Hash randomization is enabled by default.\n\nobject.__bool__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True". When this method is not\n defined, "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__bool__()", all its instances are\n considered true.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control over attribute access.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See *Special method lookup*.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should call the base class method with the same name, for example,\n "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\nobject.__dir__(self)\n\n Called when "dir()" is called on the object. A sequence must be\n returned. "dir()" converts the returned sequence to a list and\n sorts it.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\nThe attribute "__objclass__" is interpreted by the "inspect" module as\nspecifying the class where this object was defined (setting this\nappropriately can assist in runtime introspection of dynamic class\nattributes). For callables, it may indicate that an instance of the\ngiven type (or a subclass) is expected or required as the first\npositional argument (for example, CPython sets this attribute for\nunbound methods that are implemented in C).\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to an object instance, "a.x" is transformed into the\n call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a class, "A.x" is transformed into the call:\n "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of classes have a dictionary for attribute\nstorage. This wastes space for objects having very few instance\nvariables. The space consumption can become acute when creating large\nnumbers of instances.\n\nThe default can be overridden by defining *__slots__* in a class\ndefinition. The *__slots__* declaration takes a sequence of instance\nvariables and reserves just enough space in each instance to hold a\nvalue for each variable. Space is saved because *__dict__* is not\ncreated for each instance.\n\nobject.__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. *__slots__*\n reserves space for the declared variables and prevents the\n automatic creation of *__dict__* and *__weakref__* for each\n instance.\n\n\nNotes on using *__slots__*\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "int", "bytes" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, classes are constructed using "type()". The class body is\nexecuted in a new namespace and the class name is bound locally to the\nresult of "type(name, bases, namespace)".\n\nThe class creation process can be customized by passing the\n"metaclass" keyword argument in the class definition line, or by\ninheriting from an existing class that included such an argument. In\nthe following example, both "MyClass" and "MySubclass" are instances\nof "Meta":\n\n class Meta(type):\n pass\n\n class MyClass(metaclass=Meta):\n pass\n\n class MySubclass(MyClass):\n pass\n\nAny other keyword arguments that are specified in the class definition\nare passed through to all metaclass operations described below.\n\nWhen a class definition is executed, the following steps occur:\n\n* the appropriate metaclass is determined\n\n* the class namespace is prepared\n\n* the class body is executed\n\n* the class object is created\n\n\nDetermining the appropriate metaclass\n-------------------------------------\n\nThe appropriate metaclass for a class definition is determined as\nfollows:\n\n* if no bases and no explicit metaclass are given, then "type()" is\n used\n\n* if an explicit metaclass is given and it is *not* an instance of\n "type()", then it is used directly as the metaclass\n\n* if an instance of "type()" is given as the explicit metaclass, or\n bases are defined, then the most derived metaclass is used\n\nThe most derived metaclass is selected from the explicitly specified\nmetaclass (if any) and the metaclasses (i.e. "type(cls)") of all\nspecified base classes. The most derived metaclass is one which is a\nsubtype of *all* of these candidate metaclasses. If none of the\ncandidate metaclasses meets that criterion, then the class definition\nwill fail with "TypeError".\n\n\nPreparing the class namespace\n-----------------------------\n\nOnce the appropriate metaclass has been identified, then the class\nnamespace is prepared. If the metaclass has a "__prepare__" attribute,\nit is called as "namespace = metaclass.__prepare__(name, bases,\n**kwds)" (where the additional keyword arguments, if any, come from\nthe class definition).\n\nIf the metaclass has no "__prepare__" attribute, then the class\nnamespace is initialised as an empty "dict()" instance.\n\nSee also: **PEP 3115** - Metaclasses in Python 3000\n\n Introduced the "__prepare__" namespace hook\n\n\nExecuting the class body\n------------------------\n\nThe class body is executed (approximately) as "exec(body, globals(),\nnamespace)". The key difference from a normal call to "exec()" is that\nlexical scoping allows the class body (including any methods) to\nreference names from the current and outer scopes when the class\ndefinition occurs inside a function.\n\nHowever, even when the class definition occurs inside the function,\nmethods defined inside the class still cannot see names defined at the\nclass scope. Class variables must be accessed through the first\nparameter of instance or class methods, and cannot be accessed at all\nfrom static methods.\n\n\nCreating the class object\n-------------------------\n\nOnce the class namespace has been populated by executing the class\nbody, the class object is created by calling "metaclass(name, bases,\nnamespace, **kwds)" (the additional keywords passed here are the same\nas those passed to "__prepare__").\n\nThis class object is the one that will be referenced by the zero-\nargument form of "super()". "__class__" is an implicit closure\nreference created by the compiler if any methods in a class body refer\nto either "__class__" or "super". This allows the zero argument form\nof "super()" to correctly identify the class being defined based on\nlexical scoping, while the class or instance that was used to make the\ncurrent call is identified based on the first argument passed to the\nmethod.\n\nAfter the class object is created, it is passed to the class\ndecorators included in the class definition (if any) and the resulting\nobject is bound in the local namespace as the defined class.\n\nWhen a new class is created by "type.__new__", the object provided as\nthe namespace parameter is copied to a standard Python dictionary and\nthe original object is discarded. The new copy becomes the "__dict__"\nattribute of the class object.\n\nSee also: **PEP 3135** - New super\n\n Describes the implicit "__class__" closure reference\n\n\nMetaclass example\n-----------------\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored include logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\nHere is an example of a metaclass that uses an\n"collections.OrderedDict" to remember the order that class variables\nare defined:\n\n class OrderedClass(type):\n\n @classmethod\n def __prepare__(metacls, name, bases, **kwds):\n return collections.OrderedDict()\n\n def __new__(cls, name, bases, namespace, **kwds):\n result = type.__new__(cls, name, bases, dict(namespace))\n result.members = tuple(namespace)\n return result\n\n class A(metaclass=OrderedClass):\n def one(self): pass\n def two(self): pass\n def three(self): pass\n def four(self): pass\n\n >>> A.members\n (\'__module__\', \'one\', \'two\', \'three\', \'four\')\n\nWhen the class definition for *A* gets executed, the process begins\nwith calling the metaclass\'s "__prepare__()" method which returns an\nempty "collections.OrderedDict". That mapping records the methods and\nattributes of *A* as they are defined within the body of the class\nstatement. Once those definitions are executed, the ordered dictionary\nis fully populated and the metaclass\'s "__new__()" method gets\ninvoked. That method builds the new type and it saves the ordered\ndictionary keys in an attribute called "members".\n\n\nCustomizing instance and subclass checks\n========================================\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n "isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n "issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also: **PEP 3119** - Introducing Abstract Base Classes\n\n Includes the specification for customizing "isinstance()" and\n "issubclass()" behavior through "__instancecheck__()" and\n "__subclasscheck__()", with motivation for this functionality in\n the context of adding Abstract Base Classes (see the "abc"\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "get()", "clear()",\n"setdefault()", "pop()", "popitem()", "copy()", and "update()"\nbehaving similar to those for Python\'s standard dictionary objects.\nThe "collections" module provides a "MutableMapping" abstract base\nclass to help create those methods from a base set of "__getitem__()",\n"__setitem__()", "__delitem__()", and "keys()". Mutable sequences\nshould provide methods "append()", "count()", "index()", "extend()",\n"insert()", "pop()", "remove()", "reverse()" and "sort()", like Python\nstandard list objects. Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning\nrepetition) by defining the methods "__add__()", "__radd__()",\n"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" described\nbelow; they should not define other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should search the mapping\'s keys; for sequences, it\nshould search through the values. It is further recommended that both\nmappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "keys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__bool__()" method and whose "__len__()" method\n returns zero is considered to be false in a Boolean context.\n\n **CPython implementation detail:** In CPython, the length is\n required to be at most "sys.maxsize". If the length is larger than\n "sys.maxsize" some features (such as "len()") may raise\n "OverflowError". To prevent raising "OverflowError" by truth value\n testing, an object must define a "__bool__()" method.\n\nobject.__length_hint__(self)\n\n Called to implement "operator.length_hint()". Should return an\n estimated length for the object (which may be greater or less than\n the actual length). The length must be an integer ">=" 0. This\n method is purely an optimization and is never required for\n correctness.\n\n New in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\n A call like\n\n a[1:2] = b\n\n is translated to\n\n a[slice(1, 2, None)] = b\n\n and so forth. Missing slice items are always filled in with "None".\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see *this section in the\n language reference*.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__matmul__(self, other)\nobject.__truediv__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|"). For instance, to\n evaluate the expression "x + y", where *x* is an instance of a\n class that has an "__add__()" method, "x.__add__(y)" is called.\n The "__divmod__()" method should be the equivalent to using\n "__floordiv__()" and "__mod__()"; it should not be related to\n "__truediv__()". Note that "__pow__()" should be defined to accept\n an optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rmatmul__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|") with reflected (swapped)\n operands. These functions are only called if the left operand does\n not support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__imatmul__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "@=", "/=", "//=", "%=", "**=",\n "<<=", ">>=", "&=", "^=", "|="). These methods should attempt to\n do the operation in-place (modifying *self*) and return the result\n (which could be, but does not have to be, *self*). If a specific\n method is not defined, the augmented assignment falls back to the\n normal methods. For instance, if *x* is an instance of a class\n with an "__iadd__()" method, "x += y" is equivalent to "x =\n x.__iadd__(y)" . Otherwise, "x.__add__(y)" and "y.__radd__(x)" are\n considered, as with the evaluation of "x + y". In certain\n situations, augmented assignment can result in unexpected errors\n (see *Why does a_tuple[i] += [\'item\'] raise an exception when the\n addition works?*), but this behavior is in fact part of the data\n model.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__float__(self)\nobject.__round__(self[, n])\n\n Called to implement the built-in functions "complex()", "int()",\n "float()" and "round()". Should return a value of the appropriate\n type.\n\nobject.__index__(self)\n\n Called to implement "operator.index()", and whenever Python needs\n to losslessly convert the numeric object to an integer object (such\n as in slicing, or in the built-in "bin()", "hex()" and "oct()"\n functions). Presence of this method indicates that the numeric\n object is an integer type. Must return an integer.\n\n Note: In order to have a coherent integer type class, when\n "__index__()" is defined "__int__()" should also be defined, and\n both should return the same value.\n\n\nWith Statement Context Managers\n===============================\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section *The with\nstatement*), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nSpecial method lookup\n=====================\n\nFor custom classes, implicit invocations of special methods are only\nguaranteed to work correctly if defined on an object\'s type, not in\nthe object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception:\n\n >>> class C:\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print("Metaclass getattribute invoked")\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object, metaclass=Meta):\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print("Class getattribute invoked")\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n', + 'string-methods': u'\nString Methods\n**************\n\nStrings implement all of the *common* sequence operations, along with\nthe additional methods described below.\n\nStrings also support two styles of string formatting, one providing a\nlarge degree of flexibility and customization (see "str.format()",\n*Format String Syntax* and *Custom String Formatting*) and the other\nbased on C "printf" style formatting that handles a narrower range of\ntypes and is slightly harder to use correctly, but is often faster for\nthe cases it can handle (*printf-style String Formatting*).\n\nThe *Text Processing Services* section of the standard library covers\na number of other modules that provide various text related utilities\n(including regular expression support in the "re" module).\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\nstr.casefold()\n\n Return a casefolded copy of the string. Casefolded strings may be\n used for caseless matching.\n\n Casefolding is similar to lowercasing but more aggressive because\n it is intended to remove all case distinctions in a string. For\n example, the German lowercase letter "\'\xdf\'" is equivalent to ""ss"".\n Since it is already lowercase, "lower()" would do nothing to "\'\xdf\'";\n "casefold()" converts it to ""ss"".\n\n The casefolding algorithm is described in section 3.13 of the\n Unicode Standard.\n\n New in version 3.3.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is an ASCII space). The\n original string is returned if *width* is less than or equal to\n "len(s)".\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.encode(encoding="utf-8", errors="strict")\n\n Return an encoded version of the string as a bytes object. Default\n encoding is "\'utf-8\'". *errors* may be given to set a different\n error handling scheme. The default for *errors* is "\'strict\'",\n meaning that encoding errors raise a "UnicodeError". Other possible\n values are "\'ignore\'", "\'replace\'", "\'xmlcharrefreplace\'",\n "\'backslashreplace\'" and any other name registered via\n "codecs.register_error()", see section *Error Handlers*. For a list\n of possible encodings, see section *Standard Encodings*.\n\n Changed in version 3.1: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\nstr.expandtabs(tabsize=8)\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found within the slice "s[start:end]". Optional arguments *start*\n and *end* are interpreted as in slice notation. Return "-1" if\n *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\nstr.format_map(mapping)\n\n Similar to "str.format(**mapping)", except that "mapping" is used\n directly and not copied to a "dict". This is useful if for example\n "mapping" is a dict subclass:\n\n >>> class Default(dict):\n ... def __missing__(self, key):\n ... return key\n ...\n >>> \'{name} was born in {country}\'.format_map(Default(name=\'Guido\'))\n \'Guido was born in country\'\n\n New in version 3.2.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise. A character "c"\n is alphanumeric if one of the following returns "True":\n "c.isalpha()", "c.isdecimal()", "c.isdigit()", or "c.isnumeric()".\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise. Alphabetic\n characters are those characters defined in the Unicode character\n database as "Letter", i.e., those with general category property\n being one of "Lm", "Lt", "Lu", "Ll", or "Lo". Note that this is\n different from the "Alphabetic" property defined in the Unicode\n Standard.\n\nstr.isdecimal()\n\n Return true if all characters in the string are decimal characters\n and there is at least one character, false otherwise. Decimal\n characters are those that can be used to form numbers in base 10,\n e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a decimal character\n is a character in the Unicode General Category "Nd".\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise. Digits include decimal\n characters and digits that need special handling, such as the\n compatibility superscript digits. This covers digits which cannot\n be used to form numbers in base 10, like the Kharosthi numbers.\n Formally, a digit is a character that has the property value\n Numeric_Type=Digit or Numeric_Type=Decimal.\n\nstr.isidentifier()\n\n Return true if the string is a valid identifier according to the\n language definition, section *Identifiers and keywords*.\n\n Use "keyword.iskeyword()" to test for reserved identifiers such as\n "def" and "class".\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\nstr.isnumeric()\n\n Return true if all characters in the string are numeric characters,\n and there is at least one character, false otherwise. Numeric\n characters include digit characters, and all characters that have\n the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION\n ONE FIFTH. Formally, numeric characters are those with the\n property value Numeric_Type=Digit, Numeric_Type=Decimal or\n Numeric_Type=Numeric.\n\nstr.isprintable()\n\n Return true if all characters in the string are printable or the\n string is empty, false otherwise. Nonprintable characters are\n those characters defined in the Unicode character database as\n "Other" or "Separator", excepting the ASCII space (0x20) which is\n considered printable. (Note that printable characters in this\n context are those which should not be escaped when "repr()" is\n invoked on a string. It has no bearing on the handling of strings\n written to "sys.stdout" or "sys.stderr".)\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise. Whitespace\n characters are those characters defined in the Unicode character\n database as "Other" or "Separator" and those with bidirectional\n property being one of "WS", "B", or "S".\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in\n *iterable*. A "TypeError" will be raised if there are any non-\n string values in *iterable*, including "bytes" objects. The\n separator between elements is the string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n The lowercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nstatic str.maketrans(x[, y[, z]])\n\n This static method returns a translation table usable for\n "str.translate()".\n\n If there is only one argument, it must be a dictionary mapping\n Unicode ordinals (integers) or characters (strings of length 1) to\n Unicode ordinals, strings (of arbitrary lengths) or "None".\n Character keys will then be converted to ordinals.\n\n If there are two arguments, they must be strings of equal length,\n and in the resulting dictionary, each character in x will be mapped\n to the character at the same position in y. If there is a third\n argument, it must be a string, whose characters will be mapped to\n "None" in the result.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\nstr.rsplit(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nstr.split(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n For example:\n\n >>> \'1,2,3\'.split(\',\')\n [\'1\', \'2\', \'3\']\n >>> \'1,2,3\'.split(\',\', maxsplit=1)\n [\'1\', \'2,3\']\n >>> \'1,2,,3,\'.split(\',\')\n [\'1\', \'2\', \'\', \'3\', \'\']\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example:\n\n >>> \'1 2 3\'.split()\n [\'1\', \'2\', \'3\']\n >>> \'1 2 3\'.split(maxsplit=1)\n [\'1\', \'2 3\']\n >>> \' 1 2 3 \'.split()\n [\'1\', \'2\', \'3\']\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n This method splits on the following line boundaries. In\n particular, the boundaries are a superset of *universal newlines*.\n\n +-------------------------+-------------------------------+\n | Representation | Description |\n +=========================+===============================+\n | "\\n" | Line Feed |\n +-------------------------+-------------------------------+\n | "\\r" | Carriage Return |\n +-------------------------+-------------------------------+\n | "\\r\\n" | Carriage Return + Line Feed |\n +-------------------------+-------------------------------+\n | "\\v" or "\\x0b" | Line Tabulation |\n +-------------------------+-------------------------------+\n | "\\f" or "\\x0c" | Form Feed |\n +-------------------------+-------------------------------+\n | "\\x1c" | File Separator |\n +-------------------------+-------------------------------+\n | "\\x1d" | Group Separator |\n +-------------------------+-------------------------------+\n | "\\x1e" | Record Separator |\n +-------------------------+-------------------------------+\n | "\\x85" | Next Line (C1 Control Code) |\n +-------------------------+-------------------------------+\n | "\\u2028" | Line Separator |\n +-------------------------+-------------------------------+\n | "\\u2029" | Paragraph Separator |\n +-------------------------+-------------------------------+\n\n Changed in version 3.2: "\\v" and "\\f" added to list of line\n boundaries.\n\n For example:\n\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()\n [\'ab c\', \'\', \'de fg\', \'kl\']\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines(keepends=True)\n [\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line:\n\n >>> "".splitlines()\n []\n >>> "One line\\n".splitlines()\n [\'One line\']\n\n For comparison, "split(\'\\n\')" gives:\n\n >>> \'\'.split(\'\\n\')\n [\'\']\n >>> \'Two lines\\n\'.split(\'\\n\')\n [\'Two lines\', \'\']\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n The outermost leading and trailing *chars* argument values are\n stripped from the string. Characters are removed from the leading\n end until reaching a string character that is not contained in the\n set of characters in *chars*. A similar action takes place on the\n trailing end. For example:\n\n >>> comment_string = \'#....... Section 3.2.1 Issue #32 .......\'\n >>> comment_string.strip(\'.#! \')\n \'Section 3.2.1 Issue #32\'\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa. Note that it is not necessarily true that\n "s.swapcase().swapcase() == s".\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n For example:\n\n >>> \'Hello world\'.title()\n \'Hello World\'\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\nstr.translate(table)\n\n Return a copy of the string in which each character has been mapped\n through the given translation table. The table must be an object\n that implements indexing via "__getitem__()", typically a *mapping*\n or *sequence*. When indexed by a Unicode ordinal (an integer), the\n table object can do any of the following: return a Unicode ordinal\n or a string, to map the character to one or more other characters;\n return "None", to delete the character from the return string; or\n raise a "LookupError" exception, to map the character to itself.\n\n You can use "str.maketrans()" to create a translation map from\n character-to-character mappings in different formats.\n\n See also the "codecs" module for a more flexible approach to custom\n character mappings.\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n The uppercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.zfill(width)\n\n Return a copy of the string left filled with ASCII "\'0\'" digits to\n make a string of length *width*. A leading sign prefix\n ("\'+\'"/"\'-\'") is handled by inserting the padding *after* the sign\n character rather than before. The original string is returned if\n *width* is less than or equal to "len(s)".\n\n For example:\n\n >>> "42".zfill(5)\n \'00042\'\n >>> "-42".zfill(5)\n \'-0042\'\n', 'strings': u'\nString and Bytes literals\n*************************\n\nString literals are described by the following lexical definitions:\n\n stringliteral ::= [stringprefix](shortstring | longstring)\n stringprefix ::= "r" | "u" | "R" | "U"\n shortstring ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n longstring ::= "\'\'\'" longstringitem* "\'\'\'" | \'"""\' longstringitem* \'"""\'\n shortstringitem ::= shortstringchar | stringescapeseq\n longstringitem ::= longstringchar | stringescapeseq\n shortstringchar ::= \n longstringchar ::= \n stringescapeseq ::= "\\" \n\n bytesliteral ::= bytesprefix(shortbytes | longbytes)\n bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB"\n shortbytes ::= "\'" shortbytesitem* "\'" | \'"\' shortbytesitem* \'"\'\n longbytes ::= "\'\'\'" longbytesitem* "\'\'\'" | \'"""\' longbytesitem* \'"""\'\n shortbytesitem ::= shortbyteschar | bytesescapeseq\n longbytesitem ::= longbyteschar | bytesescapeseq\n shortbyteschar ::= \n longbyteschar ::= \n bytesescapeseq ::= "\\" \n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the "stringprefix" or "bytesprefix"\nand the rest of the literal. The source character set is defined by\nthe encoding declaration; it is UTF-8 if no encoding declaration is\ngiven in the source file; see section *Encoding declarations*.\n\nIn plain English: Both types of literals can be enclosed in matching\nsingle quotes ("\'") or double quotes ("""). They can also be enclosed\nin matching groups of three single or double quotes (these are\ngenerally referred to as *triple-quoted strings*). The backslash\n("\\") character is used to escape characters that otherwise have a\nspecial meaning, such as newline, backslash itself, or the quote\ncharacter.\n\nBytes literals are always prefixed with "\'b\'" or "\'B\'"; they produce\nan instance of the "bytes" type instead of the "str" type. They may\nonly contain ASCII characters; bytes with a numeric value of 128 or\ngreater must be expressed with escapes.\n\nAs of Python 3.3 it is possible again to prefix string literals with a\n"u" prefix to simplify maintenance of dual 2.x and 3.x codebases.\n\nBoth string and bytes literals may optionally be prefixed with a\nletter "\'r\'" or "\'R\'"; such strings are called *raw strings* and treat\nbackslashes as literal characters. As a result, in string literals,\n"\'\\U\'" and "\'\\u\'" escapes in raw strings are not treated specially.\nGiven that Python 2.x\'s raw unicode literals behave differently than\nPython 3.x\'s the "\'ur\'" syntax is not supported.\n\nNew in version 3.3: The "\'rb\'" prefix of raw bytes literals has been\nadded as a synonym of "\'br\'".\n\nNew in version 3.3: Support for the unicode legacy literal\n("u\'value\'") was reintroduced to simplify the maintenance of dual\nPython 2.x and 3.x codebases. See **PEP 414** for more information.\n\nIn triple-quoted literals, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the literal. (A "quote" is the character used to open the\nliteral, i.e. either "\'" or """.)\n\nUnless an "\'r\'" or "\'R\'" prefix is present, escape sequences in string\nand bytes literals are interpreted according to rules similar to those\nused by Standard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\newline" | Backslash and newline ignored | |\n+-------------------+-----------------------------------+---------+\n| "\\\\" | Backslash ("\\") | |\n+-------------------+-----------------------------------+---------+\n| "\\\'" | Single quote ("\'") | |\n+-------------------+-----------------------------------+---------+\n| "\\"" | Double quote (""") | |\n+-------------------+-----------------------------------+---------+\n| "\\a" | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| "\\b" | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| "\\f" | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| "\\n" | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| "\\r" | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| "\\t" | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| "\\v" | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| "\\ooo" | Character with octal value *ooo* | (1,3) |\n+-------------------+-----------------------------------+---------+\n| "\\xhh" | Character with hex value *hh* | (2,3) |\n+-------------------+-----------------------------------+---------+\n\nEscape sequences only recognized in string literals are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\N{name}" | Character named *name* in the | (4) |\n| | Unicode database | |\n+-------------------+-----------------------------------+---------+\n| "\\uxxxx" | Character with 16-bit hex value | (5) |\n| | *xxxx* | |\n+-------------------+-----------------------------------+---------+\n| "\\Uxxxxxxxx" | Character with 32-bit hex value | (6) |\n| | *xxxxxxxx* | |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. As in Standard C, up to three octal digits are accepted.\n\n2. Unlike in Standard C, exactly two hex digits are required.\n\n3. In a bytes literal, hexadecimal and octal escapes denote the\n byte with the given value. In a string literal, these escapes\n denote a Unicode character with the given value.\n\n4. Changed in version 3.3: Support for name aliases [1] has been\n added.\n\n5. Exactly four hex digits are required.\n\n6. Any Unicode character can be encoded this way. Exactly eight\n hex digits are required.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the result*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences only recognized in string\nliterals fall into the category of unrecognized escapes for bytes\nliterals.\n\nEven in a raw literal, quotes can be escaped with a backslash, but the\nbackslash remains in the result; for example, "r"\\""" is a valid\nstring literal consisting of two characters: a backslash and a double\nquote; "r"\\"" is not a valid string literal (even a raw string cannot\nend in an odd number of backslashes). Specifically, *a raw literal\ncannot end in a single backslash* (since the backslash would escape\nthe following quote character). Note also that a single backslash\nfollowed by a newline is interpreted as those two characters as part\nof the literal, *not* as a line continuation.\n', 'subscriptions': u'\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\n subscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object that supports subscription\n(lists or dictionaries for example). User-defined objects can support\nsubscription by defining a "__getitem__()" method.\n\nFor built-in objects, there are two types of objects that support\nsubscription:\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey. (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to\nan integer or a slice (as discussed in the following section).\n\nThe formal syntax makes no special provision for negative indices in\nsequences; however, built-in sequences all provide a "__getitem__()"\nmethod that interprets negative indices by adding the length of the\nsequence to the index (so that "x[-1]" selects the last item of "x").\nThe resulting value must be a nonnegative integer less than the number\nof items in the sequence, and the subscription selects the item whose\nindex is that value (counting from zero). Since the support for\nnegative indices and slicing occurs in the object\'s "__getitem__()"\nmethod, subclasses overriding this method will need to explicitly add\nthat support.\n\nA string\'s items are characters. A character is not a separate data\ntype but a string of exactly one character.\n', 'truth': u'\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an "if" or\n"while" condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* "None"\n\n* "False"\n\n* zero of any numeric type, for example, "0", "0.0", "0j".\n\n* any empty sequence, for example, "\'\'", "()", "[]".\n\n* any empty mapping, for example, "{}".\n\n* instances of user-defined classes, if the class defines a\n "__bool__()" or "__len__()" method, when that method returns the\n integer zero or "bool" value "False". [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn "0" or "False" for false and "1" or "True" for true, unless\notherwise stated. (Important exception: the Boolean operations "or"\nand "and" always return one of their operands.)\n', 'try': u'\nThe "try" statement\n*******************\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the "as" keyword in that except clause, if\npresent, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using "as target", it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the "sys" module and can be accessed via\n"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting of the\nexception class, the exception instance and a traceback object (see\nsection *The standard type hierarchy*) identifying the point in the\nprogram where the exception occurred. "sys.exc_info()" values are\nrestored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception it is re-raised at the end of the "finally"\nclause. If the "finally" clause raises another exception, the saved\nexception is set as the context of the new exception. If the "finally"\nclause executes a "return" or "break" statement, the saved exception\nis discarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the "raise" statement to\ngenerate exceptions may be found in section *The raise statement*.\n', - 'types': u'\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python. Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types. Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.), although such additions\nwill often be provided via the standard library instead.\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\' These are attributes that provide access to the\nimplementation and are not intended for general use. Their definition\nmay change in the future.\n\nNone\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name "None". It\n is used to signify the absence of a value in many situations, e.g.,\n it is returned from functions that don\'t explicitly return\n anything. Its truth value is false.\n\nNotImplemented\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n "NotImplemented". Numeric methods and rich comparison methods\n should return this value if they do not implement the operation for\n the operands provided. (The interpreter will then try the\n reflected operation, or some other fallback, depending on the\n operator.) Its truth value is true.\n\n See *Implementing the arithmetic operations* for more details.\n\nEllipsis\n This type has a single value. There is a single object with this\n value. This object is accessed through the literal "..." or the\n built-in name "Ellipsis". Its truth value is true.\n\n"numbers.Number"\n These are created by numeric literals and returned as results by\n arithmetic operators and arithmetic built-in functions. Numeric\n objects are immutable; once created their value never changes.\n Python numbers are of course strongly related to mathematical\n numbers, but subject to the limitations of numerical representation\n in computers.\n\n Python distinguishes between integers, floating point numbers, and\n complex numbers:\n\n "numbers.Integral"\n These represent elements from the mathematical set of integers\n (positive and negative).\n\n There are two types of integers:\n\n Integers ("int")\n\n These represent numbers in an unlimited range, subject to\n available (virtual) memory only. For the purpose of shift\n and mask operations, a binary representation is assumed, and\n negative numbers are represented in a variant of 2\'s\n complement which gives the illusion of an infinite string of\n sign bits extending to the left.\n\n Booleans ("bool")\n These represent the truth values False and True. The two\n objects representing the values "False" and "True" are the\n only Boolean objects. The Boolean type is a subtype of the\n integer type, and Boolean values behave like the values 0 and\n 1, respectively, in almost all contexts, the exception being\n that when converted to a string, the strings ""False"" or\n ""True"" are returned, respectively.\n\n The rules for integer representation are intended to give the\n most meaningful interpretation of shift and mask operations\n involving negative integers.\n\n "numbers.Real" ("float")\n These represent machine-level double precision floating point\n numbers. You are at the mercy of the underlying machine\n architecture (and C or Java implementation) for the accepted\n range and handling of overflow. Python does not support single-\n precision floating point numbers; the savings in processor and\n memory usage that are usually the reason for using these are\n dwarfed by the overhead of using objects in Python, so there is\n no reason to complicate the language with two kinds of floating\n point numbers.\n\n "numbers.Complex" ("complex")\n These represent complex numbers as a pair of machine-level\n double precision floating point numbers. The same caveats apply\n as for floating point numbers. The real and imaginary parts of a\n complex number "z" can be retrieved through the read-only\n attributes "z.real" and "z.imag".\n\nSequences\n These represent finite ordered sets indexed by non-negative\n numbers. The built-in function "len()" returns the number of items\n of a sequence. When the length of a sequence is *n*, the index set\n contains the numbers 0, 1, ..., *n*-1. Item *i* of sequence *a* is\n selected by "a[i]".\n\n Sequences also support slicing: "a[i:j]" selects all items with\n index *k* such that *i* "<=" *k* "<" *j*. When used as an\n expression, a slice is a sequence of the same type. This implies\n that the index set is renumbered so that it starts at 0.\n\n Some sequences also support "extended slicing" with a third "step"\n parameter: "a[i:j:k]" selects all items of *a* with index *x* where\n "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n\n Sequences are distinguished according to their mutability:\n\n Immutable sequences\n An object of an immutable sequence type cannot change once it is\n created. (If the object contains references to other objects,\n these other objects may be mutable and may be changed; however,\n the collection of objects directly referenced by an immutable\n object cannot change.)\n\n The following types are immutable sequences:\n\n Strings\n A string is a sequence of values that represent Unicode code\n points. All the code points in the range "U+0000 - U+10FFFF"\n can be represented in a string. Python doesn\'t have a "char"\n type; instead, every code point in the string is represented\n as a string object with length "1". The built-in function\n "ord()" converts a code point from its string form to an\n integer in the range "0 - 10FFFF"; "chr()" converts an\n integer in the range "0 - 10FFFF" to the corresponding length\n "1" string object. "str.encode()" can be used to convert a\n "str" to "bytes" using the given text encoding, and\n "bytes.decode()" can be used to achieve the opposite.\n\n Tuples\n The items of a tuple are arbitrary Python objects. Tuples of\n two or more items are formed by comma-separated lists of\n expressions. A tuple of one item (a \'singleton\') can be\n formed by affixing a comma to an expression (an expression by\n itself does not create a tuple, since parentheses must be\n usable for grouping of expressions). An empty tuple can be\n formed by an empty pair of parentheses.\n\n Bytes\n A bytes object is an immutable array. The items are 8-bit\n bytes, represented by integers in the range 0 <= x < 256.\n Bytes literals (like "b\'abc\'") and the built-in function\n "bytes()" can be used to construct bytes objects. Also,\n bytes objects can be decoded to strings via the "decode()"\n method.\n\n Mutable sequences\n Mutable sequences can be changed after they are created. The\n subscription and slicing notations can be used as the target of\n assignment and "del" (delete) statements.\n\n There are currently two intrinsic mutable sequence types:\n\n Lists\n The items of a list are arbitrary Python objects. Lists are\n formed by placing a comma-separated list of expressions in\n square brackets. (Note that there are no special cases needed\n to form lists of length 0 or 1.)\n\n Byte Arrays\n A bytearray object is a mutable array. They are created by\n the built-in "bytearray()" constructor. Aside from being\n mutable (and hence unhashable), byte arrays otherwise provide\n the same interface and functionality as immutable bytes\n objects.\n\n The extension module "array" provides an additional example of a\n mutable sequence type, as does the "collections" module.\n\nSet types\n These represent unordered, finite sets of unique, immutable\n objects. As such, they cannot be indexed by any subscript. However,\n they can be iterated over, and the built-in function "len()"\n returns the number of items in a set. Common uses for sets are fast\n membership testing, removing duplicates from a sequence, and\n computing mathematical operations such as intersection, union,\n difference, and symmetric difference.\n\n For set elements, the same immutability rules apply as for\n dictionary keys. Note that numeric types obey the normal rules for\n numeric comparison: if two numbers compare equal (e.g., "1" and\n "1.0"), only one of them can be contained in a set.\n\n There are currently two intrinsic set types:\n\n Sets\n These represent a mutable set. They are created by the built-in\n "set()" constructor and can be modified afterwards by several\n methods, such as "add()".\n\n Frozen sets\n These represent an immutable set. They are created by the\n built-in "frozenset()" constructor. As a frozenset is immutable\n and *hashable*, it can be used again as an element of another\n set, or as a dictionary key.\n\nMappings\n These represent finite sets of objects indexed by arbitrary index\n sets. The subscript notation "a[k]" selects the item indexed by "k"\n from the mapping "a"; this can be used in expressions and as the\n target of assignments or "del" statements. The built-in function\n "len()" returns the number of items in a mapping.\n\n There is currently a single intrinsic mapping type:\n\n Dictionaries\n These represent finite sets of objects indexed by nearly\n arbitrary values. The only types of values not acceptable as\n keys are values containing lists or dictionaries or other\n mutable types that are compared by value rather than by object\n identity, the reason being that the efficient implementation of\n dictionaries requires a key\'s hash value to remain constant.\n Numeric types used for keys obey the normal rules for numeric\n comparison: if two numbers compare equal (e.g., "1" and "1.0")\n then they can be used interchangeably to index the same\n dictionary entry.\n\n Dictionaries are mutable; they can be created by the "{...}"\n notation (see section *Dictionary displays*).\n\n The extension modules "dbm.ndbm" and "dbm.gnu" provide\n additional examples of mapping types, as does the "collections"\n module.\n\nCallable types\n These are the types to which the function call operation (see\n section *Calls*) can be applied:\n\n User-defined functions\n A user-defined function object is created by a function\n definition (see section *Function definitions*). It should be\n called with an argument list containing the same number of items\n as the function\'s formal parameter list.\n\n Special attributes:\n\n +---------------------------+---------------------------------+-------------+\n | Attribute | Meaning | |\n +===========================+=================================+=============+\n | "__doc__" | The function\'s documentation | Writable |\n | | string, or "None" if | |\n | | unavailable; not inherited by | |\n | | subclasses | |\n +---------------------------+---------------------------------+-------------+\n | "__name__" | The function\'s name | Writable |\n +---------------------------+---------------------------------+-------------+\n | "__qualname__" | The function\'s *qualified name* | Writable |\n | | New in version 3.3. | |\n +---------------------------+---------------------------------+-------------+\n | "__module__" | The name of the module the | Writable |\n | | function was defined in, or | |\n | | "None" if unavailable. | |\n +---------------------------+---------------------------------+-------------+\n | "__defaults__" | A tuple containing default | Writable |\n | | argument values for those | |\n | | arguments that have defaults, | |\n | | or "None" if no arguments have | |\n | | a default value | |\n +---------------------------+---------------------------------+-------------+\n | "__code__" | The code object representing | Writable |\n | | the compiled function body. | |\n +---------------------------+---------------------------------+-------------+\n | "__globals__" | A reference to the dictionary | Read-only |\n | | that holds the function\'s | |\n | | global variables --- the global | |\n | | namespace of the module in | |\n | | which the function was defined. | |\n +---------------------------+---------------------------------+-------------+\n | "__dict__" | The namespace supporting | Writable |\n | | arbitrary function attributes. | |\n +---------------------------+---------------------------------+-------------+\n | "__closure__" | "None" or a tuple of cells that | Read-only |\n | | contain bindings for the | |\n | | function\'s free variables. | |\n +---------------------------+---------------------------------+-------------+\n | "__annotations__" | A dict containing annotations | Writable |\n | | of parameters. The keys of the | |\n | | dict are the parameter names, | |\n | | and "\'return\'" for the return | |\n | | annotation, if provided. | |\n +---------------------------+---------------------------------+-------------+\n | "__kwdefaults__" | A dict containing defaults for | Writable |\n | | keyword-only parameters. | |\n +---------------------------+---------------------------------+-------------+\n\n Most of the attributes labelled "Writable" check the type of the\n assigned value.\n\n Function objects also support getting and setting arbitrary\n attributes, which can be used, for example, to attach metadata\n to functions. Regular attribute dot-notation is used to get and\n set such attributes. *Note that the current implementation only\n supports function attributes on user-defined functions. Function\n attributes on built-in functions may be supported in the\n future.*\n\n Additional information about a function\'s definition can be\n retrieved from its code object; see the description of internal\n types below.\n\n Instance methods\n An instance method object combines a class, a class instance and\n any callable object (normally a user-defined function).\n\n Special read-only attributes: "__self__" is the class instance\n object, "__func__" is the function object; "__doc__" is the\n method\'s documentation (same as "__func__.__doc__"); "__name__"\n is the method name (same as "__func__.__name__"); "__module__"\n is the name of the module the method was defined in, or "None"\n if unavailable.\n\n Methods also support accessing (but not setting) the arbitrary\n function attributes on the underlying function object.\n\n User-defined method objects may be created when getting an\n attribute of a class (perhaps via an instance of that class), if\n that attribute is a user-defined function object or a class\n method object.\n\n When an instance method object is created by retrieving a user-\n defined function object from a class via one of its instances,\n its "__self__" attribute is the instance, and the method object\n is said to be bound. The new method\'s "__func__" attribute is\n the original function object.\n\n When a user-defined method object is created by retrieving\n another method object from a class or instance, the behaviour is\n the same as for a function object, except that the "__func__"\n attribute of the new instance is not the original method object\n but its "__func__" attribute.\n\n When an instance method object is created by retrieving a class\n method object from a class or instance, its "__self__" attribute\n is the class itself, and its "__func__" attribute is the\n function object underlying the class method.\n\n When an instance method object is called, the underlying\n function ("__func__") is called, inserting the class instance\n ("__self__") in front of the argument list. For instance, when\n "C" is a class which contains a definition for a function "f()",\n and "x" is an instance of "C", calling "x.f(1)" is equivalent to\n calling "C.f(x, 1)".\n\n When an instance method object is derived from a class method\n object, the "class instance" stored in "__self__" will actually\n be the class itself, so that calling either "x.f(1)" or "C.f(1)"\n is equivalent to calling "f(C,1)" where "f" is the underlying\n function.\n\n Note that the transformation from function object to instance\n method object happens each time the attribute is retrieved from\n the instance. In some cases, a fruitful optimization is to\n assign the attribute to a local variable and call that local\n variable. Also notice that this transformation only happens for\n user-defined functions; other callable objects (and all non-\n callable objects) are retrieved without transformation. It is\n also important to note that user-defined functions which are\n attributes of a class instance are not converted to bound\n methods; this *only* happens when the function is an attribute\n of the class.\n\n Generator functions\n A function or method which uses the "yield" statement (see\n section *The yield statement*) is called a *generator function*.\n Such a function, when called, always returns an iterator object\n which can be used to execute the body of the function: calling\n the iterator\'s "iterator.__next__()" method will cause the\n function to execute until it provides a value using the "yield"\n statement. When the function executes a "return" statement or\n falls off the end, a "StopIteration" exception is raised and the\n iterator will have reached the end of the set of values to be\n returned.\n\n Coroutine functions\n A function or method which is defined using "async def" is\n called a *coroutine function*. Such a function, when called,\n returns a *coroutine* object. It may contain "await"\n expressions, as well as "async with" and "async for" statements.\n See also the *Coroutine Objects* section.\n\n Built-in functions\n A built-in function object is a wrapper around a C function.\n Examples of built-in functions are "len()" and "math.sin()"\n ("math" is a standard built-in module). The number and type of\n the arguments are determined by the C function. Special read-\n only attributes: "__doc__" is the function\'s documentation\n string, or "None" if unavailable; "__name__" is the function\'s\n name; "__self__" is set to "None" (but see the next item);\n "__module__" is the name of the module the function was defined\n in or "None" if unavailable.\n\n Built-in methods\n This is really a different disguise of a built-in function, this\n time containing an object passed to the C function as an\n implicit extra argument. An example of a built-in method is\n "alist.append()", assuming *alist* is a list object. In this\n case, the special read-only attribute "__self__" is set to the\n object denoted by *alist*.\n\n Classes\n Classes are callable. These objects normally act as factories\n for new instances of themselves, but variations are possible for\n class types that override "__new__()". The arguments of the\n call are passed to "__new__()" and, in the typical case, to\n "__init__()" to initialize the new instance.\n\n Class Instances\n Instances of arbitrary classes can be made callable by defining\n a "__call__()" method in their class.\n\nModules\n Modules are a basic organizational unit of Python code, and are\n created by the *import system* as invoked either by the "import"\n statement (see "import"), or by calling functions such as\n "importlib.import_module()" and built-in "__import__()". A module\n object has a namespace implemented by a dictionary object (this is\n the dictionary referenced by the "__globals__" attribute of\n functions defined in the module). Attribute references are\n translated to lookups in this dictionary, e.g., "m.x" is equivalent\n to "m.__dict__["x"]". A module object does not contain the code\n object used to initialize the module (since it isn\'t needed once\n the initialization is done).\n\n Attribute assignment updates the module\'s namespace dictionary,\n e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n\n Special read-only attribute: "__dict__" is the module\'s namespace\n as a dictionary object.\n\n **CPython implementation detail:** Because of the way CPython\n clears module dictionaries, the module dictionary will be cleared\n when the module falls out of scope even if the dictionary still has\n live references. To avoid this, copy the dictionary or keep the\n module around while using its dictionary directly.\n\n Predefined (writable) attributes: "__name__" is the module\'s name;\n "__doc__" is the module\'s documentation string, or "None" if\n unavailable; "__file__" is the pathname of the file from which the\n module was loaded, if it was loaded from a file. The "__file__"\n attribute may be missing for certain types of modules, such as C\n modules that are statically linked into the interpreter; for\n extension modules loaded dynamically from a shared library, it is\n the pathname of the shared library file.\n\nCustom classes\n Custom class types are typically created by class definitions (see\n section *Class definitions*). A class has a namespace implemented\n by a dictionary object. Class attribute references are translated\n to lookups in this dictionary, e.g., "C.x" is translated to\n "C.__dict__["x"]" (although there are a number of hooks which allow\n for other means of locating attributes). When the attribute name is\n not found there, the attribute search continues in the base\n classes. This search of the base classes uses the C3 method\n resolution order which behaves correctly even in the presence of\n \'diamond\' inheritance structures where there are multiple\n inheritance paths leading back to a common ancestor. Additional\n details on the C3 MRO used by Python can be found in the\n documentation accompanying the 2.3 release at\n https://www.python.org/download/releases/2.3/mro/.\n\n When a class attribute reference (for class "C", say) would yield a\n class method object, it is transformed into an instance method\n object whose "__self__" attributes is "C". When it would yield a\n static method object, it is transformed into the object wrapped by\n the static method object. See section *Implementing Descriptors*\n for another way in which attributes retrieved from a class may\n differ from those actually contained in its "__dict__".\n\n Class attribute assignments update the class\'s dictionary, never\n the dictionary of a base class.\n\n A class object can be called (see above) to yield a class instance\n (see below).\n\n Special attributes: "__name__" is the class name; "__module__" is\n the module name in which the class was defined; "__dict__" is the\n dictionary containing the class\'s namespace; "__bases__" is a tuple\n (possibly a singleton) containing the base classes, in the order of\n their occurrence in the base class list; "__doc__" is the class\'s\n documentation string, or "None" if undefined.\n\nClass instances\n A class instance is created by calling a class object (see above).\n A class instance has a namespace implemented as a dictionary which\n is the first place in which attribute references are searched.\n When an attribute is not found there, and the instance\'s class has\n an attribute by that name, the search continues with the class\n attributes. If a class attribute is found that is a user-defined\n function object, it is transformed into an instance method object\n whose "__self__" attribute is the instance. Static method and\n class method objects are also transformed; see above under\n "Classes". See section *Implementing Descriptors* for another way\n in which attributes of a class retrieved via its instances may\n differ from the objects actually stored in the class\'s "__dict__".\n If no class attribute is found, and the object\'s class has a\n "__getattr__()" method, that is called to satisfy the lookup.\n\n Attribute assignments and deletions update the instance\'s\n dictionary, never a class\'s dictionary. If the class has a\n "__setattr__()" or "__delattr__()" method, this is called instead\n of updating the instance dictionary directly.\n\n Class instances can pretend to be numbers, sequences, or mappings\n if they have methods with certain special names. See section\n *Special method names*.\n\n Special attributes: "__dict__" is the attribute dictionary;\n "__class__" is the instance\'s class.\n\nI/O objects (also known as file objects)\n A *file object* represents an open file. Various shortcuts are\n available to create file objects: the "open()" built-in function,\n and also "os.popen()", "os.fdopen()", and the "makefile()" method\n of socket objects (and perhaps by other functions or methods\n provided by extension modules).\n\n The objects "sys.stdin", "sys.stdout" and "sys.stderr" are\n initialized to file objects corresponding to the interpreter\'s\n standard input, output and error streams; they are all open in text\n mode and therefore follow the interface defined by the\n "io.TextIOBase" abstract class.\n\nInternal types\n A few types used internally by the interpreter are exposed to the\n user. Their definitions may change with future versions of the\n interpreter, but they are mentioned here for completeness.\n\n Code objects\n Code objects represent *byte-compiled* executable Python code,\n or *bytecode*. The difference between a code object and a\n function object is that the function object contains an explicit\n reference to the function\'s globals (the module in which it was\n defined), while a code object contains no context; also the\n default argument values are stored in the function object, not\n in the code object (because they represent values calculated at\n run-time). Unlike function objects, code objects are immutable\n and contain no references (directly or indirectly) to mutable\n objects.\n\n Special read-only attributes: "co_name" gives the function name;\n "co_argcount" is the number of positional arguments (including\n arguments with default values); "co_nlocals" is the number of\n local variables used by the function (including arguments);\n "co_varnames" is a tuple containing the names of the local\n variables (starting with the argument names); "co_cellvars" is a\n tuple containing the names of local variables that are\n referenced by nested functions; "co_freevars" is a tuple\n containing the names of free variables; "co_code" is a string\n representing the sequence of bytecode instructions; "co_consts"\n is a tuple containing the literals used by the bytecode;\n "co_names" is a tuple containing the names used by the bytecode;\n "co_filename" is the filename from which the code was compiled;\n "co_firstlineno" is the first line number of the function;\n "co_lnotab" is a string encoding the mapping from bytecode\n offsets to line numbers (for details see the source code of the\n interpreter); "co_stacksize" is the required stack size\n (including local variables); "co_flags" is an integer encoding a\n number of flags for the interpreter.\n\n The following flag bits are defined for "co_flags": bit "0x04"\n is set if the function uses the "*arguments" syntax to accept an\n arbitrary number of positional arguments; bit "0x08" is set if\n the function uses the "**keywords" syntax to accept arbitrary\n keyword arguments; bit "0x20" is set if the function is a\n generator.\n\n Future feature declarations ("from __future__ import division")\n also use bits in "co_flags" to indicate whether a code object\n was compiled with a particular feature enabled: bit "0x2000" is\n set if the function was compiled with future division enabled;\n bits "0x10" and "0x1000" were used in earlier versions of\n Python.\n\n Other bits in "co_flags" are reserved for internal use.\n\n If a code object represents a function, the first item in\n "co_consts" is the documentation string of the function, or\n "None" if undefined.\n\n Frame objects\n Frame objects represent execution frames. They may occur in\n traceback objects (see below).\n\n Special read-only attributes: "f_back" is to the previous stack\n frame (towards the caller), or "None" if this is the bottom\n stack frame; "f_code" is the code object being executed in this\n frame; "f_locals" is the dictionary used to look up local\n variables; "f_globals" is used for global variables;\n "f_builtins" is used for built-in (intrinsic) names; "f_lasti"\n gives the precise instruction (this is an index into the\n bytecode string of the code object).\n\n Special writable attributes: "f_trace", if not "None", is a\n function called at the start of each source code line (this is\n used by the debugger); "f_lineno" is the current line number of\n the frame --- writing to this from within a trace function jumps\n to the given line (only for the bottom-most frame). A debugger\n can implement a Jump command (aka Set Next Statement) by writing\n to f_lineno.\n\n Frame objects support one method:\n\n frame.clear()\n\n This method clears all references to local variables held by\n the frame. Also, if the frame belonged to a generator, the\n generator is finalized. This helps break reference cycles\n involving frame objects (for example when catching an\n exception and storing its traceback for later use).\n\n "RuntimeError" is raised if the frame is currently executing.\n\n New in version 3.4.\n\n Traceback objects\n Traceback objects represent a stack trace of an exception. A\n traceback object is created when an exception occurs. When the\n search for an exception handler unwinds the execution stack, at\n each unwound level a traceback object is inserted in front of\n the current traceback. When an exception handler is entered,\n the stack trace is made available to the program. (See section\n *The try statement*.) It is accessible as the third item of the\n tuple returned by "sys.exc_info()". When the program contains no\n suitable handler, the stack trace is written (nicely formatted)\n to the standard error stream; if the interpreter is interactive,\n it is also made available to the user as "sys.last_traceback".\n\n Special read-only attributes: "tb_next" is the next level in the\n stack trace (towards the frame where the exception occurred), or\n "None" if there is no next level; "tb_frame" points to the\n execution frame of the current level; "tb_lineno" gives the line\n number where the exception occurred; "tb_lasti" indicates the\n precise instruction. The line number and last instruction in\n the traceback may differ from the line number of its frame\n object if the exception occurred in a "try" statement with no\n matching except clause or with a finally clause.\n\n Slice objects\n Slice objects are used to represent slices for "__getitem__()"\n methods. They are also created by the built-in "slice()"\n function.\n\n Special read-only attributes: "start" is the lower bound; "stop"\n is the upper bound; "step" is the step value; each is "None" if\n omitted. These attributes can have any type.\n\n Slice objects support one method:\n\n slice.indices(self, length)\n\n This method takes a single integer argument *length* and\n computes information about the slice that the slice object\n would describe if applied to a sequence of *length* items.\n It returns a tuple of three integers; respectively these are\n the *start* and *stop* indices and the *step* or stride\n length of the slice. Missing or out-of-bounds indices are\n handled in a manner consistent with regular slices.\n\n Static method objects\n Static method objects provide a way of defeating the\n transformation of function objects to method objects described\n above. A static method object is a wrapper around any other\n object, usually a user-defined method object. When a static\n method object is retrieved from a class or a class instance, the\n object actually returned is the wrapped object, which is not\n subject to any further transformation. Static method objects are\n not themselves callable, although the objects they wrap usually\n are. Static method objects are created by the built-in\n "staticmethod()" constructor.\n\n Class method objects\n A class method object, like a static method object, is a wrapper\n around another object that alters the way in which that object\n is retrieved from classes and class instances. The behaviour of\n class method objects upon such retrieval is described above,\n under "User-defined methods". Class method objects are created\n by the built-in "classmethod()" constructor.\n', + 'types': u'\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python. Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types. Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.), although such additions\nwill often be provided via the standard library instead.\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\' These are attributes that provide access to the\nimplementation and are not intended for general use. Their definition\nmay change in the future.\n\nNone\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name "None". It\n is used to signify the absence of a value in many situations, e.g.,\n it is returned from functions that don\'t explicitly return\n anything. Its truth value is false.\n\nNotImplemented\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n "NotImplemented". Numeric methods and rich comparison methods\n should return this value if they do not implement the operation for\n the operands provided. (The interpreter will then try the\n reflected operation, or some other fallback, depending on the\n operator.) Its truth value is true.\n\n See *Implementing the arithmetic operations* for more details.\n\nEllipsis\n This type has a single value. There is a single object with this\n value. This object is accessed through the literal "..." or the\n built-in name "Ellipsis". Its truth value is true.\n\n"numbers.Number"\n These are created by numeric literals and returned as results by\n arithmetic operators and arithmetic built-in functions. Numeric\n objects are immutable; once created their value never changes.\n Python numbers are of course strongly related to mathematical\n numbers, but subject to the limitations of numerical representation\n in computers.\n\n Python distinguishes between integers, floating point numbers, and\n complex numbers:\n\n "numbers.Integral"\n These represent elements from the mathematical set of integers\n (positive and negative).\n\n There are two types of integers:\n\n Integers ("int")\n\n These represent numbers in an unlimited range, subject to\n available (virtual) memory only. For the purpose of shift\n and mask operations, a binary representation is assumed, and\n negative numbers are represented in a variant of 2\'s\n complement which gives the illusion of an infinite string of\n sign bits extending to the left.\n\n Booleans ("bool")\n These represent the truth values False and True. The two\n objects representing the values "False" and "True" are the\n only Boolean objects. The Boolean type is a subtype of the\n integer type, and Boolean values behave like the values 0 and\n 1, respectively, in almost all contexts, the exception being\n that when converted to a string, the strings ""False"" or\n ""True"" are returned, respectively.\n\n The rules for integer representation are intended to give the\n most meaningful interpretation of shift and mask operations\n involving negative integers.\n\n "numbers.Real" ("float")\n These represent machine-level double precision floating point\n numbers. You are at the mercy of the underlying machine\n architecture (and C or Java implementation) for the accepted\n range and handling of overflow. Python does not support single-\n precision floating point numbers; the savings in processor and\n memory usage that are usually the reason for using these are\n dwarfed by the overhead of using objects in Python, so there is\n no reason to complicate the language with two kinds of floating\n point numbers.\n\n "numbers.Complex" ("complex")\n These represent complex numbers as a pair of machine-level\n double precision floating point numbers. The same caveats apply\n as for floating point numbers. The real and imaginary parts of a\n complex number "z" can be retrieved through the read-only\n attributes "z.real" and "z.imag".\n\nSequences\n These represent finite ordered sets indexed by non-negative\n numbers. The built-in function "len()" returns the number of items\n of a sequence. When the length of a sequence is *n*, the index set\n contains the numbers 0, 1, ..., *n*-1. Item *i* of sequence *a* is\n selected by "a[i]".\n\n Sequences also support slicing: "a[i:j]" selects all items with\n index *k* such that *i* "<=" *k* "<" *j*. When used as an\n expression, a slice is a sequence of the same type. This implies\n that the index set is renumbered so that it starts at 0.\n\n Some sequences also support "extended slicing" with a third "step"\n parameter: "a[i:j:k]" selects all items of *a* with index *x* where\n "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n\n Sequences are distinguished according to their mutability:\n\n Immutable sequences\n An object of an immutable sequence type cannot change once it is\n created. (If the object contains references to other objects,\n these other objects may be mutable and may be changed; however,\n the collection of objects directly referenced by an immutable\n object cannot change.)\n\n The following types are immutable sequences:\n\n Strings\n A string is a sequence of values that represent Unicode code\n points. All the code points in the range "U+0000 - U+10FFFF"\n can be represented in a string. Python doesn\'t have a "char"\n type; instead, every code point in the string is represented\n as a string object with length "1". The built-in function\n "ord()" converts a code point from its string form to an\n integer in the range "0 - 10FFFF"; "chr()" converts an\n integer in the range "0 - 10FFFF" to the corresponding length\n "1" string object. "str.encode()" can be used to convert a\n "str" to "bytes" using the given text encoding, and\n "bytes.decode()" can be used to achieve the opposite.\n\n Tuples\n The items of a tuple are arbitrary Python objects. Tuples of\n two or more items are formed by comma-separated lists of\n expressions. A tuple of one item (a \'singleton\') can be\n formed by affixing a comma to an expression (an expression by\n itself does not create a tuple, since parentheses must be\n usable for grouping of expressions). An empty tuple can be\n formed by an empty pair of parentheses.\n\n Bytes\n A bytes object is an immutable array. The items are 8-bit\n bytes, represented by integers in the range 0 <= x < 256.\n Bytes literals (like "b\'abc\'") and the built-in function\n "bytes()" can be used to construct bytes objects. Also,\n bytes objects can be decoded to strings via the "decode()"\n method.\n\n Mutable sequences\n Mutable sequences can be changed after they are created. The\n subscription and slicing notations can be used as the target of\n assignment and "del" (delete) statements.\n\n There are currently two intrinsic mutable sequence types:\n\n Lists\n The items of a list are arbitrary Python objects. Lists are\n formed by placing a comma-separated list of expressions in\n square brackets. (Note that there are no special cases needed\n to form lists of length 0 or 1.)\n\n Byte Arrays\n A bytearray object is a mutable array. They are created by\n the built-in "bytearray()" constructor. Aside from being\n mutable (and hence unhashable), byte arrays otherwise provide\n the same interface and functionality as immutable bytes\n objects.\n\n The extension module "array" provides an additional example of a\n mutable sequence type, as does the "collections" module.\n\nSet types\n These represent unordered, finite sets of unique, immutable\n objects. As such, they cannot be indexed by any subscript. However,\n they can be iterated over, and the built-in function "len()"\n returns the number of items in a set. Common uses for sets are fast\n membership testing, removing duplicates from a sequence, and\n computing mathematical operations such as intersection, union,\n difference, and symmetric difference.\n\n For set elements, the same immutability rules apply as for\n dictionary keys. Note that numeric types obey the normal rules for\n numeric comparison: if two numbers compare equal (e.g., "1" and\n "1.0"), only one of them can be contained in a set.\n\n There are currently two intrinsic set types:\n\n Sets\n These represent a mutable set. They are created by the built-in\n "set()" constructor and can be modified afterwards by several\n methods, such as "add()".\n\n Frozen sets\n These represent an immutable set. They are created by the\n built-in "frozenset()" constructor. As a frozenset is immutable\n and *hashable*, it can be used again as an element of another\n set, or as a dictionary key.\n\nMappings\n These represent finite sets of objects indexed by arbitrary index\n sets. The subscript notation "a[k]" selects the item indexed by "k"\n from the mapping "a"; this can be used in expressions and as the\n target of assignments or "del" statements. The built-in function\n "len()" returns the number of items in a mapping.\n\n There is currently a single intrinsic mapping type:\n\n Dictionaries\n These represent finite sets of objects indexed by nearly\n arbitrary values. The only types of values not acceptable as\n keys are values containing lists or dictionaries or other\n mutable types that are compared by value rather than by object\n identity, the reason being that the efficient implementation of\n dictionaries requires a key\'s hash value to remain constant.\n Numeric types used for keys obey the normal rules for numeric\n comparison: if two numbers compare equal (e.g., "1" and "1.0")\n then they can be used interchangeably to index the same\n dictionary entry.\n\n Dictionaries are mutable; they can be created by the "{...}"\n notation (see section *Dictionary displays*).\n\n The extension modules "dbm.ndbm" and "dbm.gnu" provide\n additional examples of mapping types, as does the "collections"\n module.\n\nCallable types\n These are the types to which the function call operation (see\n section *Calls*) can be applied:\n\n User-defined functions\n A user-defined function object is created by a function\n definition (see section *Function definitions*). It should be\n called with an argument list containing the same number of items\n as the function\'s formal parameter list.\n\n Special attributes:\n\n +---------------------------+---------------------------------+-------------+\n | Attribute | Meaning | |\n +===========================+=================================+=============+\n | "__doc__" | The function\'s documentation | Writable |\n | | string, or "None" if | |\n | | unavailable; not inherited by | |\n | | subclasses | |\n +---------------------------+---------------------------------+-------------+\n | "__name__" | The function\'s name | Writable |\n +---------------------------+---------------------------------+-------------+\n | "__qualname__" | The function\'s *qualified name* | Writable |\n | | New in version 3.3. | |\n +---------------------------+---------------------------------+-------------+\n | "__module__" | The name of the module the | Writable |\n | | function was defined in, or | |\n | | "None" if unavailable. | |\n +---------------------------+---------------------------------+-------------+\n | "__defaults__" | A tuple containing default | Writable |\n | | argument values for those | |\n | | arguments that have defaults, | |\n | | or "None" if no arguments have | |\n | | a default value | |\n +---------------------------+---------------------------------+-------------+\n | "__code__" | The code object representing | Writable |\n | | the compiled function body. | |\n +---------------------------+---------------------------------+-------------+\n | "__globals__" | A reference to the dictionary | Read-only |\n | | that holds the function\'s | |\n | | global variables --- the global | |\n | | namespace of the module in | |\n | | which the function was defined. | |\n +---------------------------+---------------------------------+-------------+\n | "__dict__" | The namespace supporting | Writable |\n | | arbitrary function attributes. | |\n +---------------------------+---------------------------------+-------------+\n | "__closure__" | "None" or a tuple of cells that | Read-only |\n | | contain bindings for the | |\n | | function\'s free variables. | |\n +---------------------------+---------------------------------+-------------+\n | "__annotations__" | A dict containing annotations | Writable |\n | | of parameters. The keys of the | |\n | | dict are the parameter names, | |\n | | and "\'return\'" for the return | |\n | | annotation, if provided. | |\n +---------------------------+---------------------------------+-------------+\n | "__kwdefaults__" | A dict containing defaults for | Writable |\n | | keyword-only parameters. | |\n +---------------------------+---------------------------------+-------------+\n\n Most of the attributes labelled "Writable" check the type of the\n assigned value.\n\n Function objects also support getting and setting arbitrary\n attributes, which can be used, for example, to attach metadata\n to functions. Regular attribute dot-notation is used to get and\n set such attributes. *Note that the current implementation only\n supports function attributes on user-defined functions. Function\n attributes on built-in functions may be supported in the\n future.*\n\n Additional information about a function\'s definition can be\n retrieved from its code object; see the description of internal\n types below.\n\n Instance methods\n An instance method object combines a class, a class instance and\n any callable object (normally a user-defined function).\n\n Special read-only attributes: "__self__" is the class instance\n object, "__func__" is the function object; "__doc__" is the\n method\'s documentation (same as "__func__.__doc__"); "__name__"\n is the method name (same as "__func__.__name__"); "__module__"\n is the name of the module the method was defined in, or "None"\n if unavailable.\n\n Methods also support accessing (but not setting) the arbitrary\n function attributes on the underlying function object.\n\n User-defined method objects may be created when getting an\n attribute of a class (perhaps via an instance of that class), if\n that attribute is a user-defined function object or a class\n method object.\n\n When an instance method object is created by retrieving a user-\n defined function object from a class via one of its instances,\n its "__self__" attribute is the instance, and the method object\n is said to be bound. The new method\'s "__func__" attribute is\n the original function object.\n\n When a user-defined method object is created by retrieving\n another method object from a class or instance, the behaviour is\n the same as for a function object, except that the "__func__"\n attribute of the new instance is not the original method object\n but its "__func__" attribute.\n\n When an instance method object is created by retrieving a class\n method object from a class or instance, its "__self__" attribute\n is the class itself, and its "__func__" attribute is the\n function object underlying the class method.\n\n When an instance method object is called, the underlying\n function ("__func__") is called, inserting the class instance\n ("__self__") in front of the argument list. For instance, when\n "C" is a class which contains a definition for a function "f()",\n and "x" is an instance of "C", calling "x.f(1)" is equivalent to\n calling "C.f(x, 1)".\n\n When an instance method object is derived from a class method\n object, the "class instance" stored in "__self__" will actually\n be the class itself, so that calling either "x.f(1)" or "C.f(1)"\n is equivalent to calling "f(C,1)" where "f" is the underlying\n function.\n\n Note that the transformation from function object to instance\n method object happens each time the attribute is retrieved from\n the instance. In some cases, a fruitful optimization is to\n assign the attribute to a local variable and call that local\n variable. Also notice that this transformation only happens for\n user-defined functions; other callable objects (and all non-\n callable objects) are retrieved without transformation. It is\n also important to note that user-defined functions which are\n attributes of a class instance are not converted to bound\n methods; this *only* happens when the function is an attribute\n of the class.\n\n Generator functions\n A function or method which uses the "yield" statement (see\n section *The yield statement*) is called a *generator function*.\n Such a function, when called, always returns an iterator object\n which can be used to execute the body of the function: calling\n the iterator\'s "iterator.__next__()" method will cause the\n function to execute until it provides a value using the "yield"\n statement. When the function executes a "return" statement or\n falls off the end, a "StopIteration" exception is raised and the\n iterator will have reached the end of the set of values to be\n returned.\n\n Coroutine functions\n A function or method which is defined using "async def" is\n called a *coroutine function*. Such a function, when called,\n returns a *coroutine* object. It may contain "await"\n expressions, as well as "async with" and "async for" statements.\n See also the *Coroutine Objects* section.\n\n Built-in functions\n A built-in function object is a wrapper around a C function.\n Examples of built-in functions are "len()" and "math.sin()"\n ("math" is a standard built-in module). The number and type of\n the arguments are determined by the C function. Special read-\n only attributes: "__doc__" is the function\'s documentation\n string, or "None" if unavailable; "__name__" is the function\'s\n name; "__self__" is set to "None" (but see the next item);\n "__module__" is the name of the module the function was defined\n in or "None" if unavailable.\n\n Built-in methods\n This is really a different disguise of a built-in function, this\n time containing an object passed to the C function as an\n implicit extra argument. An example of a built-in method is\n "alist.append()", assuming *alist* is a list object. In this\n case, the special read-only attribute "__self__" is set to the\n object denoted by *alist*.\n\n Classes\n Classes are callable. These objects normally act as factories\n for new instances of themselves, but variations are possible for\n class types that override "__new__()". The arguments of the\n call are passed to "__new__()" and, in the typical case, to\n "__init__()" to initialize the new instance.\n\n Class Instances\n Instances of arbitrary classes can be made callable by defining\n a "__call__()" method in their class.\n\nModules\n Modules are a basic organizational unit of Python code, and are\n created by the *import system* as invoked either by the "import"\n statement (see "import"), or by calling functions such as\n "importlib.import_module()" and built-in "__import__()". A module\n object has a namespace implemented by a dictionary object (this is\n the dictionary referenced by the "__globals__" attribute of\n functions defined in the module). Attribute references are\n translated to lookups in this dictionary, e.g., "m.x" is equivalent\n to "m.__dict__["x"]". A module object does not contain the code\n object used to initialize the module (since it isn\'t needed once\n the initialization is done).\n\n Attribute assignment updates the module\'s namespace dictionary,\n e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n\n Special read-only attribute: "__dict__" is the module\'s namespace\n as a dictionary object.\n\n **CPython implementation detail:** Because of the way CPython\n clears module dictionaries, the module dictionary will be cleared\n when the module falls out of scope even if the dictionary still has\n live references. To avoid this, copy the dictionary or keep the\n module around while using its dictionary directly.\n\n Predefined (writable) attributes: "__name__" is the module\'s name;\n "__doc__" is the module\'s documentation string, or "None" if\n unavailable; "__file__" is the pathname of the file from which the\n module was loaded, if it was loaded from a file. The "__file__"\n attribute may be missing for certain types of modules, such as C\n modules that are statically linked into the interpreter; for\n extension modules loaded dynamically from a shared library, it is\n the pathname of the shared library file.\n\nCustom classes\n Custom class types are typically created by class definitions (see\n section *Class definitions*). A class has a namespace implemented\n by a dictionary object. Class attribute references are translated\n to lookups in this dictionary, e.g., "C.x" is translated to\n "C.__dict__["x"]" (although there are a number of hooks which allow\n for other means of locating attributes). When the attribute name is\n not found there, the attribute search continues in the base\n classes. This search of the base classes uses the C3 method\n resolution order which behaves correctly even in the presence of\n \'diamond\' inheritance structures where there are multiple\n inheritance paths leading back to a common ancestor. Additional\n details on the C3 MRO used by Python can be found in the\n documentation accompanying the 2.3 release at\n https://www.python.org/download/releases/2.3/mro/.\n\n When a class attribute reference (for class "C", say) would yield a\n class method object, it is transformed into an instance method\n object whose "__self__" attributes is "C". When it would yield a\n static method object, it is transformed into the object wrapped by\n the static method object. See section *Implementing Descriptors*\n for another way in which attributes retrieved from a class may\n differ from those actually contained in its "__dict__".\n\n Class attribute assignments update the class\'s dictionary, never\n the dictionary of a base class.\n\n A class object can be called (see above) to yield a class instance\n (see below).\n\n Special attributes: "__name__" is the class name; "__module__" is\n the module name in which the class was defined; "__dict__" is the\n dictionary containing the class\'s namespace; "__bases__" is a tuple\n containing the base classes, in the order of their occurrence in\n the base class list; "__doc__" is the class\'s documentation string,\n or "None" if undefined.\n\nClass instances\n A class instance is created by calling a class object (see above).\n A class instance has a namespace implemented as a dictionary which\n is the first place in which attribute references are searched.\n When an attribute is not found there, and the instance\'s class has\n an attribute by that name, the search continues with the class\n attributes. If a class attribute is found that is a user-defined\n function object, it is transformed into an instance method object\n whose "__self__" attribute is the instance. Static method and\n class method objects are also transformed; see above under\n "Classes". See section *Implementing Descriptors* for another way\n in which attributes of a class retrieved via its instances may\n differ from the objects actually stored in the class\'s "__dict__".\n If no class attribute is found, and the object\'s class has a\n "__getattr__()" method, that is called to satisfy the lookup.\n\n Attribute assignments and deletions update the instance\'s\n dictionary, never a class\'s dictionary. If the class has a\n "__setattr__()" or "__delattr__()" method, this is called instead\n of updating the instance dictionary directly.\n\n Class instances can pretend to be numbers, sequences, or mappings\n if they have methods with certain special names. See section\n *Special method names*.\n\n Special attributes: "__dict__" is the attribute dictionary;\n "__class__" is the instance\'s class.\n\nI/O objects (also known as file objects)\n A *file object* represents an open file. Various shortcuts are\n available to create file objects: the "open()" built-in function,\n and also "os.popen()", "os.fdopen()", and the "makefile()" method\n of socket objects (and perhaps by other functions or methods\n provided by extension modules).\n\n The objects "sys.stdin", "sys.stdout" and "sys.stderr" are\n initialized to file objects corresponding to the interpreter\'s\n standard input, output and error streams; they are all open in text\n mode and therefore follow the interface defined by the\n "io.TextIOBase" abstract class.\n\nInternal types\n A few types used internally by the interpreter are exposed to the\n user. Their definitions may change with future versions of the\n interpreter, but they are mentioned here for completeness.\n\n Code objects\n Code objects represent *byte-compiled* executable Python code,\n or *bytecode*. The difference between a code object and a\n function object is that the function object contains an explicit\n reference to the function\'s globals (the module in which it was\n defined), while a code object contains no context; also the\n default argument values are stored in the function object, not\n in the code object (because they represent values calculated at\n run-time). Unlike function objects, code objects are immutable\n and contain no references (directly or indirectly) to mutable\n objects.\n\n Special read-only attributes: "co_name" gives the function name;\n "co_argcount" is the number of positional arguments (including\n arguments with default values); "co_nlocals" is the number of\n local variables used by the function (including arguments);\n "co_varnames" is a tuple containing the names of the local\n variables (starting with the argument names); "co_cellvars" is a\n tuple containing the names of local variables that are\n referenced by nested functions; "co_freevars" is a tuple\n containing the names of free variables; "co_code" is a string\n representing the sequence of bytecode instructions; "co_consts"\n is a tuple containing the literals used by the bytecode;\n "co_names" is a tuple containing the names used by the bytecode;\n "co_filename" is the filename from which the code was compiled;\n "co_firstlineno" is the first line number of the function;\n "co_lnotab" is a string encoding the mapping from bytecode\n offsets to line numbers (for details see the source code of the\n interpreter); "co_stacksize" is the required stack size\n (including local variables); "co_flags" is an integer encoding a\n number of flags for the interpreter.\n\n The following flag bits are defined for "co_flags": bit "0x04"\n is set if the function uses the "*arguments" syntax to accept an\n arbitrary number of positional arguments; bit "0x08" is set if\n the function uses the "**keywords" syntax to accept arbitrary\n keyword arguments; bit "0x20" is set if the function is a\n generator.\n\n Future feature declarations ("from __future__ import division")\n also use bits in "co_flags" to indicate whether a code object\n was compiled with a particular feature enabled: bit "0x2000" is\n set if the function was compiled with future division enabled;\n bits "0x10" and "0x1000" were used in earlier versions of\n Python.\n\n Other bits in "co_flags" are reserved for internal use.\n\n If a code object represents a function, the first item in\n "co_consts" is the documentation string of the function, or\n "None" if undefined.\n\n Frame objects\n Frame objects represent execution frames. They may occur in\n traceback objects (see below).\n\n Special read-only attributes: "f_back" is to the previous stack\n frame (towards the caller), or "None" if this is the bottom\n stack frame; "f_code" is the code object being executed in this\n frame; "f_locals" is the dictionary used to look up local\n variables; "f_globals" is used for global variables;\n "f_builtins" is used for built-in (intrinsic) names; "f_lasti"\n gives the precise instruction (this is an index into the\n bytecode string of the code object).\n\n Special writable attributes: "f_trace", if not "None", is a\n function called at the start of each source code line (this is\n used by the debugger); "f_lineno" is the current line number of\n the frame --- writing to this from within a trace function jumps\n to the given line (only for the bottom-most frame). A debugger\n can implement a Jump command (aka Set Next Statement) by writing\n to f_lineno.\n\n Frame objects support one method:\n\n frame.clear()\n\n This method clears all references to local variables held by\n the frame. Also, if the frame belonged to a generator, the\n generator is finalized. This helps break reference cycles\n involving frame objects (for example when catching an\n exception and storing its traceback for later use).\n\n "RuntimeError" is raised if the frame is currently executing.\n\n New in version 3.4.\n\n Traceback objects\n Traceback objects represent a stack trace of an exception. A\n traceback object is created when an exception occurs. When the\n search for an exception handler unwinds the execution stack, at\n each unwound level a traceback object is inserted in front of\n the current traceback. When an exception handler is entered,\n the stack trace is made available to the program. (See section\n *The try statement*.) It is accessible as the third item of the\n tuple returned by "sys.exc_info()". When the program contains no\n suitable handler, the stack trace is written (nicely formatted)\n to the standard error stream; if the interpreter is interactive,\n it is also made available to the user as "sys.last_traceback".\n\n Special read-only attributes: "tb_next" is the next level in the\n stack trace (towards the frame where the exception occurred), or\n "None" if there is no next level; "tb_frame" points to the\n execution frame of the current level; "tb_lineno" gives the line\n number where the exception occurred; "tb_lasti" indicates the\n precise instruction. The line number and last instruction in\n the traceback may differ from the line number of its frame\n object if the exception occurred in a "try" statement with no\n matching except clause or with a finally clause.\n\n Slice objects\n Slice objects are used to represent slices for "__getitem__()"\n methods. They are also created by the built-in "slice()"\n function.\n\n Special read-only attributes: "start" is the lower bound; "stop"\n is the upper bound; "step" is the step value; each is "None" if\n omitted. These attributes can have any type.\n\n Slice objects support one method:\n\n slice.indices(self, length)\n\n This method takes a single integer argument *length* and\n computes information about the slice that the slice object\n would describe if applied to a sequence of *length* items.\n It returns a tuple of three integers; respectively these are\n the *start* and *stop* indices and the *step* or stride\n length of the slice. Missing or out-of-bounds indices are\n handled in a manner consistent with regular slices.\n\n Static method objects\n Static method objects provide a way of defeating the\n transformation of function objects to method objects described\n above. A static method object is a wrapper around any other\n object, usually a user-defined method object. When a static\n method object is retrieved from a class or a class instance, the\n object actually returned is the wrapped object, which is not\n subject to any further transformation. Static method objects are\n not themselves callable, although the objects they wrap usually\n are. Static method objects are created by the built-in\n "staticmethod()" constructor.\n\n Class method objects\n A class method object, like a static method object, is a wrapper\n around another object that alters the way in which that object\n is retrieved from classes and class instances. The behaviour of\n class method objects upon such retrieval is described above,\n under "User-defined methods". Class method objects are created\n by the built-in "classmethod()" constructor.\n', 'typesfunctions': u'\nFunctions\n*********\n\nFunction objects are created by function definitions. The only\noperation on a function object is to call it: "func(argument-list)".\n\nThere are really two flavors of function objects: built-in functions\nand user-defined functions. Both support the same operation (to call\nthe function), but the implementation is different, hence the\ndifferent object types.\n\nSee *Function definitions* for more information.\n', 'typesmapping': u'\nMapping Types --- "dict"\n************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built-\nin "list", "set", and "tuple" classes, and the "collections" module.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as "1" and "1.0") then they can be used interchangeably to index\nthe same dictionary entry. (Note however, that since computers store\nfloating-point numbers as approximations it is usually unwise to use\nthem as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of "key:\nvalue" pairs within braces, for example: "{\'jack\': 4098, \'sjoerd\':\n4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the "dict"\nconstructor.\n\nclass class dict(**kwarg)\nclass class dict(mapping, **kwarg)\nclass class dict(iterable, **kwarg)\n\n Return a new dictionary initialized from an optional positional\n argument and a possibly empty set of keyword arguments.\n\n If no positional argument is given, an empty dictionary is created.\n If a positional argument is given and it is a mapping object, a\n dictionary is created with the same key-value pairs as the mapping\n object. Otherwise, the positional argument must be an *iterable*\n object. Each item in the iterable must itself be an iterable with\n exactly two objects. The first object of each item becomes a key\n in the new dictionary, and the second object the corresponding\n value. If a key occurs more than once, the last value for that key\n becomes the corresponding value in the new dictionary.\n\n If keyword arguments are given, the keyword arguments and their\n values are added to the dictionary created from the positional\n argument. If a key being added is already present, the value from\n the keyword argument replaces the value from the positional\n argument.\n\n To illustrate, the following examples all return a dictionary equal\n to "{"one": 1, "two": 2, "three": 3}":\n\n >>> a = dict(one=1, two=2, three=3)\n >>> b = {\'one\': 1, \'two\': 2, \'three\': 3}\n >>> c = dict(zip([\'one\', \'two\', \'three\'], [1, 2, 3]))\n >>> d = dict([(\'two\', 2), (\'one\', 1), (\'three\', 3)])\n >>> e = dict({\'three\': 3, \'one\': 1, \'two\': 2})\n >>> a == b == c == d == e\n True\n\n Providing keyword arguments as in the first example only works for\n keys that are valid Python identifiers. Otherwise, any valid keys\n can be used.\n\n These are the operations that dictionaries support (and therefore,\n custom mapping types should support too):\n\n len(d)\n\n Return the number of items in the dictionary *d*.\n\n d[key]\n\n Return the item of *d* with key *key*. Raises a "KeyError" if\n *key* is not in the map.\n\n If a subclass of dict defines a method "__missing__()" and *key*\n is not present, the "d[key]" operation calls that method with\n the key *key* as argument. The "d[key]" operation then returns\n or raises whatever is returned or raised by the\n "__missing__(key)" call. No other operations or methods invoke\n "__missing__()". If "__missing__()" is not defined, "KeyError"\n is raised. "__missing__()" must be a method; it cannot be an\n instance variable:\n\n >>> class Counter(dict):\n ... def __missing__(self, key):\n ... return 0\n >>> c = Counter()\n >>> c[\'red\']\n 0\n >>> c[\'red\'] += 1\n >>> c[\'red\']\n 1\n\n The example above shows part of the implementation of\n "collections.Counter". A different "__missing__" method is used\n by "collections.defaultdict".\n\n d[key] = value\n\n Set "d[key]" to *value*.\n\n del d[key]\n\n Remove "d[key]" from *d*. Raises a "KeyError" if *key* is not\n in the map.\n\n key in d\n\n Return "True" if *d* has a key *key*, else "False".\n\n key not in d\n\n Equivalent to "not key in d".\n\n iter(d)\n\n Return an iterator over the keys of the dictionary. This is a\n shortcut for "iter(d.keys())".\n\n clear()\n\n Remove all items from the dictionary.\n\n copy()\n\n Return a shallow copy of the dictionary.\n\n classmethod fromkeys(seq[, value])\n\n Create a new dictionary with keys from *seq* and values set to\n *value*.\n\n "fromkeys()" is a class method that returns a new dictionary.\n *value* defaults to "None".\n\n get(key[, default])\n\n Return the value for *key* if *key* is in the dictionary, else\n *default*. If *default* is not given, it defaults to "None", so\n that this method never raises a "KeyError".\n\n items()\n\n Return a new view of the dictionary\'s items ("(key, value)"\n pairs). See the *documentation of view objects*.\n\n keys()\n\n Return a new view of the dictionary\'s keys. See the\n *documentation of view objects*.\n\n pop(key[, default])\n\n If *key* is in the dictionary, remove it and return its value,\n else return *default*. If *default* is not given and *key* is\n not in the dictionary, a "KeyError" is raised.\n\n popitem()\n\n Remove and return an arbitrary "(key, value)" pair from the\n dictionary.\n\n "popitem()" is useful to destructively iterate over a\n dictionary, as often used in set algorithms. If the dictionary\n is empty, calling "popitem()" raises a "KeyError".\n\n setdefault(key[, default])\n\n If *key* is in the dictionary, return its value. If not, insert\n *key* with a value of *default* and return *default*. *default*\n defaults to "None".\n\n update([other])\n\n Update the dictionary with the key/value pairs from *other*,\n overwriting existing keys. Return "None".\n\n "update()" accepts either another dictionary object or an\n iterable of key/value pairs (as tuples or other iterables of\n length two). If keyword arguments are specified, the dictionary\n is then updated with those key/value pairs: "d.update(red=1,\n blue=2)".\n\n values()\n\n Return a new view of the dictionary\'s values. See the\n *documentation of view objects*.\n\n Dictionaries compare equal if and only if they have the same "(key,\n value)" pairs. Order comparisons (\'<\', \'<=\', \'>=\', \'>\') raise\n "TypeError".\n\nSee also: "types.MappingProxyType" can be used to create a read-only\n view of a "dict".\n\n\nDictionary view objects\n=======================\n\nThe objects returned by "dict.keys()", "dict.values()" and\n"dict.items()" are *view objects*. They provide a dynamic view on the\ndictionary\'s entries, which means that when the dictionary changes,\nthe view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\n Return the number of entries in the dictionary.\n\niter(dictview)\n\n Return an iterator over the keys, values or items (represented as\n tuples of "(key, value)") in the dictionary.\n\n Keys and values are iterated over in an arbitrary order which is\n non-random, varies across Python implementations, and depends on\n the dictionary\'s history of insertions and deletions. If keys,\n values and items views are iterated over with no intervening\n modifications to the dictionary, the order of items will directly\n correspond. This allows the creation of "(value, key)" pairs using\n "zip()": "pairs = zip(d.values(), d.keys())". Another way to\n create the same list is "pairs = [(v, k) for (k, v) in d.items()]".\n\n Iterating views while adding or deleting entries in the dictionary\n may raise a "RuntimeError" or fail to iterate over all entries.\n\nx in dictview\n\n Return "True" if *x* is in the underlying dictionary\'s keys, values\n or items (in the latter case, *x* should be a "(key, value)"\n tuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that "(key, value)" pairs are unique\nand hashable, then the items view is also set-like. (Values views are\nnot treated as set-like since the entries are generally not unique.)\nFor set-like views, all of the operations defined for the abstract\nbase class "collections.abc.Set" are available (for example, "==",\n"<", or "^").\n\nAn example of dictionary view usage:\n\n >>> dishes = {\'eggs\': 2, \'sausage\': 1, \'bacon\': 1, \'spam\': 500}\n >>> keys = dishes.keys()\n >>> values = dishes.values()\n\n >>> # iteration\n >>> n = 0\n >>> for val in values:\n ... n += val\n >>> print(n)\n 504\n\n >>> # keys and values are iterated over in the same order\n >>> list(keys)\n [\'eggs\', \'bacon\', \'sausage\', \'spam\']\n >>> list(values)\n [2, 1, 1, 500]\n\n >>> # view objects are dynamic and reflect dict changes\n >>> del dishes[\'eggs\']\n >>> del dishes[\'sausage\']\n >>> list(keys)\n [\'spam\', \'bacon\']\n\n >>> # set operations\n >>> keys & {\'eggs\', \'bacon\', \'salad\'}\n {\'bacon\'}\n >>> keys ^ {\'sausage\', \'juice\'}\n {\'juice\', \'sausage\', \'bacon\', \'spam\'}\n', 'typesmethods': u'\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as "append()" on lists)\nand class instance methods. Built-in methods are described with the\ntypes that support them.\n\nIf you access a method (a function defined in a class namespace)\nthrough an instance, you get a special object: a *bound method* (also\ncalled *instance method*) object. When called, it will add the "self"\nargument to the argument list. Bound methods have two special read-\nonly attributes: "m.__self__" is the object on which the method\noperates, and "m.__func__" is the function implementing the method.\nCalling "m(arg-1, arg-2, ..., arg-n)" is completely equivalent to\ncalling "m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)".\n\nLike function objects, bound method objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object ("meth.__func__"), setting method\nattributes on bound methods is disallowed. Attempting to set an\nattribute on a method results in an "AttributeError" being raised. In\norder to set a method attribute, you need to explicitly set it on the\nunderlying function object:\n\n >>> class C:\n ... def method(self):\n ... pass\n ...\n >>> c = C()\n >>> c.method.whoami = \'my name is method\' # can\'t set on the method\n Traceback (most recent call last):\n File "", line 1, in \n AttributeError: \'method\' object has no attribute \'whoami\'\n >>> c.method.__func__.whoami = \'my name is method\'\n >>> c.method.whoami\n \'my name is method\'\n\nSee *The standard type hierarchy* for more information.\n', 'typesmodules': u'\nModules\n*******\n\nThe only special operation on a module is attribute access: "m.name",\nwhere *m* is a module and *name* accesses a name defined in *m*\'s\nsymbol table. Module attributes can be assigned to. (Note that the\n"import" statement is not, strictly speaking, an operation on a module\nobject; "import foo" does not require a module object named *foo* to\nexist, rather it requires an (external) *definition* for a module\nnamed *foo* somewhere.)\n\nA special attribute of every module is "__dict__". This is the\ndictionary containing the module\'s symbol table. Modifying this\ndictionary will actually change the module\'s symbol table, but direct\nassignment to the "__dict__" attribute is not possible (you can write\n"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but you can\'t\nwrite "m.__dict__ = {}"). Modifying "__dict__" directly is not\nrecommended.\n\nModules built into the interpreter are written like this: "". If loaded from a file, they are written as\n"".\n', - 'typesseq': u'\nSequence Types --- "list", "tuple", "range"\n*******************************************\n\nThere are three basic sequence types: lists, tuples, and range\nobjects. Additional sequence types tailored for processing of *binary\ndata* and *text strings* are described in dedicated sections.\n\n\nCommon Sequence Operations\n==========================\n\nThe operations in the following table are supported by most sequence\ntypes, both mutable and immutable. The "collections.abc.Sequence" ABC\nis provided to make it easier to correctly implement these operations\non custom sequence types.\n\nThis table lists the sequence operations sorted in ascending priority.\nIn the table, *s* and *t* are sequences of the same type, *n*, *i*,\n*j* and *k* are integers and *x* is an arbitrary object that meets any\ntype and value restrictions imposed by *s*.\n\nThe "in" and "not in" operations have the same priorities as the\ncomparison operations. The "+" (concatenation) and "*" (repetition)\noperations have the same priority as the corresponding numeric\noperations.\n\n+----------------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+============================+==================================+============+\n| "x in s" | "True" if an item of *s* is | (1) |\n| | equal to *x*, else "False" | |\n+----------------------------+----------------------------------+------------+\n| "x not in s" | "False" if an item of *s* is | (1) |\n| | equal to *x*, else "True" | |\n+----------------------------+----------------------------------+------------+\n| "s + t" | the concatenation of *s* and *t* | (6)(7) |\n+----------------------------+----------------------------------+------------+\n| "s * n" or "n * s" | equivalent to adding *s* to | (2)(7) |\n| | itself *n* times | |\n+----------------------------+----------------------------------+------------+\n| "s[i]" | *i*th item of *s*, origin 0 | (3) |\n+----------------------------+----------------------------------+------------+\n| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |\n+----------------------------+----------------------------------+------------+\n| "s[i:j:k]" | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+----------------------------+----------------------------------+------------+\n| "len(s)" | length of *s* | |\n+----------------------------+----------------------------------+------------+\n| "min(s)" | smallest item of *s* | |\n+----------------------------+----------------------------------+------------+\n| "max(s)" | largest item of *s* | |\n+----------------------------+----------------------------------+------------+\n| "s.index(x[, i[, j]])" | index of the first occurrence of | (8) |\n| | *x* in *s* (at or after index | |\n| | *i* and before index *j*) | |\n+----------------------------+----------------------------------+------------+\n| "s.count(x)" | total number of occurrences of | |\n| | *x* in *s* | |\n+----------------------------+----------------------------------+------------+\n\nSequences of the same type also support comparisons. In particular,\ntuples and lists are compared lexicographically by comparing\ncorresponding elements. This means that to compare equal, every\nelement must compare equal and the two sequences must be of the same\ntype and have the same length. (For full details see *Comparisons* in\nthe language reference.)\n\nNotes:\n\n1. While the "in" and "not in" operations are used only for simple\n containment testing in the general case, some specialised sequences\n (such as "str", "bytes" and "bytearray") also use them for\n subsequence testing:\n\n >>> "gg" in "eggs"\n True\n\n2. Values of *n* less than "0" are treated as "0" (which yields an\n empty sequence of the same type as *s*). Note that items in the\n sequence *s* are not copied; they are referenced multiple times.\n This often haunts new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that "[[]]" is a one-element list containing\n an empty list, so all three elements of "[[]] * 3" are references\n to this single empty list. Modifying any of the elements of\n "lists" modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n Further explanation is available in the FAQ entry *How do I create\n a multidimensional list?*.\n\n3. If *i* or *j* is negative, the index is relative to the end of\n sequence *s*: "len(s) + i" or "len(s) + j" is substituted. But\n note that "-0" is still "0".\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that "i <= k < j". If *i* or *j* is\n greater than "len(s)", use "len(s)". If *i* is omitted or "None",\n use "0". If *j* is omitted or "None", use "len(s)". If *i* is\n greater than or equal to *j*, the slice is empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index "x = i + n*k" such that "0 <= n <\n (j-i)/k". In other words, the indices are "i", "i+k", "i+2*k",\n "i+3*k" and so on, stopping when *j* is reached (but never\n including *j*). When *k* is positive, *i* and *j* are reduced to\n "len(s)" if they are greater. When *k* is negative, *i* and *j* are\n reduced to "len(s) - 1" if they are greater. If *i* or *j* are\n omitted or "None", they become "end" values (which end depends on\n the sign of *k*). Note, *k* cannot be zero. If *k* is "None", it\n is treated like "1".\n\n6. Concatenating immutable sequences always results in a new\n object. This means that building up a sequence by repeated\n concatenation will have a quadratic runtime cost in the total\n sequence length. To get a linear runtime cost, you must switch to\n one of the alternatives below:\n\n * if concatenating "str" objects, you can build a list and use\n "str.join()" at the end or else write to an "io.StringIO"\n instance and retrieve its value when complete\n\n * if concatenating "bytes" objects, you can similarly use\n "bytes.join()" or "io.BytesIO", or you can do in-place\n concatenation with a "bytearray" object. "bytearray" objects are\n mutable and have an efficient overallocation mechanism\n\n * if concatenating "tuple" objects, extend a "list" instead\n\n * for other types, investigate the relevant class documentation\n\n7. Some sequence types (such as "range") only support item\n sequences that follow specific patterns, and hence don\'t support\n sequence concatenation or repetition.\n\n8. "index" raises "ValueError" when *x* is not found in *s*. When\n supported, the additional arguments to the index method allow\n efficient searching of subsections of the sequence. Passing the\n extra arguments is roughly equivalent to using "s[i:j].index(x)",\n only without copying any data and with the returned index being\n relative to the start of the sequence rather than the start of the\n slice.\n\n\nImmutable Sequence Types\n========================\n\nThe only operation that immutable sequence types generally implement\nthat is not also implemented by mutable sequence types is support for\nthe "hash()" built-in.\n\nThis support allows immutable sequences, such as "tuple" instances, to\nbe used as "dict" keys and stored in "set" and "frozenset" instances.\n\nAttempting to hash an immutable sequence that contains unhashable\nvalues will result in "TypeError".\n\n\nMutable Sequence Types\n======================\n\nThe operations in the following table are defined on mutable sequence\ntypes. The "collections.abc.MutableSequence" ABC is provided to make\nit easier to correctly implement these operations on custom sequence\ntypes.\n\nIn the table *s* is an instance of a mutable sequence type, *t* is any\niterable object and *x* is an arbitrary object that meets any type and\nvalue restrictions imposed by *s* (for example, "bytearray" only\naccepts integers that meet the value restriction "0 <= x <= 255").\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | appends *x* to the end of the | |\n| | sequence (same as | |\n| | "s[len(s):len(s)] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.clear()" | removes all items from "s" (same | (5) |\n| | as "del s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.copy()" | creates a shallow copy of "s" | (5) |\n| | (same as "s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(t)" or "s += t" | extends *s* with the contents of | |\n| | *t* (for the most part the same | |\n| | as "s[len(s):len(s)] = t") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s *= n" | updates *s* with its contents | (6) |\n| | repeated *n* times | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | inserts *x* into *s* at the | |\n| | index given by *i* (same as | |\n| | "s[i:i] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | retrieves the item at *i* and | (2) |\n| | also removes it from *s* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | remove the first item from *s* | (3) |\n| | where "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (4) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The optional argument *i* defaults to "-1", so that by default\n the last item is removed and returned.\n\n3. "remove" raises "ValueError" when *x* is not found in *s*.\n\n4. The "reverse()" method modifies the sequence in place for\n economy of space when reversing a large sequence. To remind users\n that it operates by side effect, it does not return the reversed\n sequence.\n\n5. "clear()" and "copy()" are included for consistency with the\n interfaces of mutable containers that don\'t support slicing\n operations (such as "dict" and "set")\n\n New in version 3.3: "clear()" and "copy()" methods.\n\n6. The value *n* is an integer, or an object implementing\n "__index__()". Zero and negative values of *n* clear the sequence.\n Items in the sequence are not copied; they are referenced multiple\n times, as explained for "s * n" under *Common Sequence Operations*.\n\n\nLists\n=====\n\nLists are mutable sequences, typically used to store collections of\nhomogeneous items (where the precise degree of similarity will vary by\napplication).\n\nclass class list([iterable])\n\n Lists may be constructed in several ways:\n\n * Using a pair of square brackets to denote the empty list: "[]"\n\n * Using square brackets, separating items with commas: "[a]",\n "[a, b, c]"\n\n * Using a list comprehension: "[x for x in iterable]"\n\n * Using the type constructor: "list()" or "list(iterable)"\n\n The constructor builds a list whose items are the same and in the\n same order as *iterable*\'s items. *iterable* may be either a\n sequence, a container that supports iteration, or an iterator\n object. If *iterable* is already a list, a copy is made and\n returned, similar to "iterable[:]". For example, "list(\'abc\')"\n returns "[\'a\', \'b\', \'c\']" and "list( (1, 2, 3) )" returns "[1, 2,\n 3]". If no argument is given, the constructor creates a new empty\n list, "[]".\n\n Many other operations also produce lists, including the "sorted()"\n built-in.\n\n Lists implement all of the *common* and *mutable* sequence\n operations. Lists also provide the following additional method:\n\n sort(*, key=None, reverse=None)\n\n This method sorts the list in place, using only "<" comparisons\n between items. Exceptions are not suppressed - if any comparison\n operations fail, the entire sort operation will fail (and the\n list will likely be left in a partially modified state).\n\n "sort()" accepts two arguments that can only be passed by\n keyword (*keyword-only arguments*):\n\n *key* specifies a function of one argument that is used to\n extract a comparison key from each list element (for example,\n "key=str.lower"). The key corresponding to each item in the list\n is calculated once and then used for the entire sorting process.\n The default value of "None" means that list items are sorted\n directly without calculating a separate key value.\n\n The "functools.cmp_to_key()" utility is available to convert a\n 2.x style *cmp* function to a *key* function.\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n This method modifies the sequence in place for economy of space\n when sorting a large sequence. To remind users that it operates\n by side effect, it does not return the sorted sequence (use\n "sorted()" to explicitly request a new sorted list instance).\n\n The "sort()" method is guaranteed to be stable. A sort is\n stable if it guarantees not to change the relative order of\n elements that compare equal --- this is helpful for sorting in\n multiple passes (for example, sort by department, then by salary\n grade).\n\n **CPython implementation detail:** While a list is being sorted,\n the effect of attempting to mutate, or even inspect, the list is\n undefined. The C implementation of Python makes the list appear\n empty for the duration, and raises "ValueError" if it can detect\n that the list has been mutated during a sort.\n\n\nTuples\n======\n\nTuples are immutable sequences, typically used to store collections of\nheterogeneous data (such as the 2-tuples produced by the "enumerate()"\nbuilt-in). Tuples are also used for cases where an immutable sequence\nof homogeneous data is needed (such as allowing storage in a "set" or\n"dict" instance).\n\nclass class tuple([iterable])\n\n Tuples may be constructed in a number of ways:\n\n * Using a pair of parentheses to denote the empty tuple: "()"\n\n * Using a trailing comma for a singleton tuple: "a," or "(a,)"\n\n * Separating items with commas: "a, b, c" or "(a, b, c)"\n\n * Using the "tuple()" built-in: "tuple()" or "tuple(iterable)"\n\n The constructor builds a tuple whose items are the same and in the\n same order as *iterable*\'s items. *iterable* may be either a\n sequence, a container that supports iteration, or an iterator\n object. If *iterable* is already a tuple, it is returned\n unchanged. For example, "tuple(\'abc\')" returns "(\'a\', \'b\', \'c\')"\n and "tuple( [1, 2, 3] )" returns "(1, 2, 3)". If no argument is\n given, the constructor creates a new empty tuple, "()".\n\n Note that it is actually the comma which makes a tuple, not the\n parentheses. The parentheses are optional, except in the empty\n tuple case, or when they are needed to avoid syntactic ambiguity.\n For example, "f(a, b, c)" is a function call with three arguments,\n while "f((a, b, c))" is a function call with a 3-tuple as the sole\n argument.\n\n Tuples implement all of the *common* sequence operations.\n\nFor heterogeneous collections of data where access by name is clearer\nthan access by index, "collections.namedtuple()" may be a more\nappropriate choice than a simple tuple object.\n\n\nRanges\n======\n\nThe "range" type represents an immutable sequence of numbers and is\ncommonly used for looping a specific number of times in "for" loops.\n\nclass class range(stop)\nclass class range(start, stop[, step])\n\n The arguments to the range constructor must be integers (either\n built-in "int" or any object that implements the "__index__"\n special method). If the *step* argument is omitted, it defaults to\n "1". If the *start* argument is omitted, it defaults to "0". If\n *step* is zero, "ValueError" is raised.\n\n For a positive *step*, the contents of a range "r" are determined\n by the formula "r[i] = start + step*i" where "i >= 0" and "r[i] <\n stop".\n\n For a negative *step*, the contents of the range are still\n determined by the formula "r[i] = start + step*i", but the\n constraints are "i >= 0" and "r[i] > stop".\n\n A range object will be empty if "r[0]" does not meet the value\n constraint. Ranges do support negative indices, but these are\n interpreted as indexing from the end of the sequence determined by\n the positive indices.\n\n Ranges containing absolute values larger than "sys.maxsize" are\n permitted but some features (such as "len()") may raise\n "OverflowError".\n\n Range examples:\n\n >>> list(range(10))\n [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n >>> list(range(1, 11))\n [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n >>> list(range(0, 30, 5))\n [0, 5, 10, 15, 20, 25]\n >>> list(range(0, 10, 3))\n [0, 3, 6, 9]\n >>> list(range(0, -10, -1))\n [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n >>> list(range(0))\n []\n >>> list(range(1, 0))\n []\n\n Ranges implement all of the *common* sequence operations except\n concatenation and repetition (due to the fact that range objects\n can only represent sequences that follow a strict pattern and\n repetition and concatenation will usually violate that pattern).\n\n start\n\n The value of the *start* parameter (or "0" if the parameter was\n not supplied)\n\n stop\n\n The value of the *stop* parameter\n\n step\n\n The value of the *step* parameter (or "1" if the parameter was\n not supplied)\n\nThe advantage of the "range" type over a regular "list" or "tuple" is\nthat a "range" object will always take the same (small) amount of\nmemory, no matter the size of the range it represents (as it only\nstores the "start", "stop" and "step" values, calculating individual\nitems and subranges as needed).\n\nRange objects implement the "collections.abc.Sequence" ABC, and\nprovide features such as containment tests, element index lookup,\nslicing and support for negative indices (see *Sequence Types ---\nlist, tuple, range*):\n\n>>> r = range(0, 20, 2)\n>>> r\nrange(0, 20, 2)\n>>> 11 in r\nFalse\n>>> 10 in r\nTrue\n>>> r.index(10)\n5\n>>> r[5]\n10\n>>> r[:5]\nrange(0, 10, 2)\n>>> r[-1]\n18\n\nTesting range objects for equality with "==" and "!=" compares them as\nsequences. That is, two range objects are considered equal if they\nrepresent the same sequence of values. (Note that two range objects\nthat compare equal might have different "start", "stop" and "step"\nattributes, for example "range(0) == range(2, 1, 3)" or "range(0, 3,\n2) == range(0, 4, 2)".)\n\nChanged in version 3.2: Implement the Sequence ABC. Support slicing\nand negative indices. Test "int" objects for membership in constant\ntime instead of iterating through all items.\n\nChanged in version 3.3: Define \'==\' and \'!=\' to compare range objects\nbased on the sequence of values they define (instead of comparing\nbased on object identity).\n\nNew in version 3.3: The "start", "stop" and "step" attributes.\n', + 'typesseq': u'\nSequence Types --- "list", "tuple", "range"\n*******************************************\n\nThere are three basic sequence types: lists, tuples, and range\nobjects. Additional sequence types tailored for processing of *binary\ndata* and *text strings* are described in dedicated sections.\n\n\nCommon Sequence Operations\n==========================\n\nThe operations in the following table are supported by most sequence\ntypes, both mutable and immutable. The "collections.abc.Sequence" ABC\nis provided to make it easier to correctly implement these operations\non custom sequence types.\n\nThis table lists the sequence operations sorted in ascending priority.\nIn the table, *s* and *t* are sequences of the same type, *n*, *i*,\n*j* and *k* are integers and *x* is an arbitrary object that meets any\ntype and value restrictions imposed by *s*.\n\nThe "in" and "not in" operations have the same priorities as the\ncomparison operations. The "+" (concatenation) and "*" (repetition)\noperations have the same priority as the corresponding numeric\noperations. [3]\n\n+----------------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+============================+==================================+============+\n| "x in s" | "True" if an item of *s* is | (1) |\n| | equal to *x*, else "False" | |\n+----------------------------+----------------------------------+------------+\n| "x not in s" | "False" if an item of *s* is | (1) |\n| | equal to *x*, else "True" | |\n+----------------------------+----------------------------------+------------+\n| "s + t" | the concatenation of *s* and *t* | (6)(7) |\n+----------------------------+----------------------------------+------------+\n| "s * n" or "n * s" | equivalent to adding *s* to | (2)(7) |\n| | itself *n* times | |\n+----------------------------+----------------------------------+------------+\n| "s[i]" | *i*th item of *s*, origin 0 | (3) |\n+----------------------------+----------------------------------+------------+\n| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |\n+----------------------------+----------------------------------+------------+\n| "s[i:j:k]" | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+----------------------------+----------------------------------+------------+\n| "len(s)" | length of *s* | |\n+----------------------------+----------------------------------+------------+\n| "min(s)" | smallest item of *s* | |\n+----------------------------+----------------------------------+------------+\n| "max(s)" | largest item of *s* | |\n+----------------------------+----------------------------------+------------+\n| "s.index(x[, i[, j]])" | index of the first occurrence of | (8) |\n| | *x* in *s* (at or after index | |\n| | *i* and before index *j*) | |\n+----------------------------+----------------------------------+------------+\n| "s.count(x)" | total number of occurrences of | |\n| | *x* in *s* | |\n+----------------------------+----------------------------------+------------+\n\nSequences of the same type also support comparisons. In particular,\ntuples and lists are compared lexicographically by comparing\ncorresponding elements. This means that to compare equal, every\nelement must compare equal and the two sequences must be of the same\ntype and have the same length. (For full details see *Comparisons* in\nthe language reference.)\n\nNotes:\n\n1. While the "in" and "not in" operations are used only for simple\n containment testing in the general case, some specialised sequences\n (such as "str", "bytes" and "bytearray") also use them for\n subsequence testing:\n\n >>> "gg" in "eggs"\n True\n\n2. Values of *n* less than "0" are treated as "0" (which yields an\n empty sequence of the same type as *s*). Note that items in the\n sequence *s* are not copied; they are referenced multiple times.\n This often haunts new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that "[[]]" is a one-element list containing\n an empty list, so all three elements of "[[]] * 3" are references\n to this single empty list. Modifying any of the elements of\n "lists" modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n Further explanation is available in the FAQ entry *How do I create\n a multidimensional list?*.\n\n3. If *i* or *j* is negative, the index is relative to the end of\n sequence *s*: "len(s) + i" or "len(s) + j" is substituted. But\n note that "-0" is still "0".\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that "i <= k < j". If *i* or *j* is\n greater than "len(s)", use "len(s)". If *i* is omitted or "None",\n use "0". If *j* is omitted or "None", use "len(s)". If *i* is\n greater than or equal to *j*, the slice is empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index "x = i + n*k" such that "0 <= n <\n (j-i)/k". In other words, the indices are "i", "i+k", "i+2*k",\n "i+3*k" and so on, stopping when *j* is reached (but never\n including *j*). When *k* is positive, *i* and *j* are reduced to\n "len(s)" if they are greater. When *k* is negative, *i* and *j* are\n reduced to "len(s) - 1" if they are greater. If *i* or *j* are\n omitted or "None", they become "end" values (which end depends on\n the sign of *k*). Note, *k* cannot be zero. If *k* is "None", it\n is treated like "1".\n\n6. Concatenating immutable sequences always results in a new\n object. This means that building up a sequence by repeated\n concatenation will have a quadratic runtime cost in the total\n sequence length. To get a linear runtime cost, you must switch to\n one of the alternatives below:\n\n * if concatenating "str" objects, you can build a list and use\n "str.join()" at the end or else write to an "io.StringIO"\n instance and retrieve its value when complete\n\n * if concatenating "bytes" objects, you can similarly use\n "bytes.join()" or "io.BytesIO", or you can do in-place\n concatenation with a "bytearray" object. "bytearray" objects are\n mutable and have an efficient overallocation mechanism\n\n * if concatenating "tuple" objects, extend a "list" instead\n\n * for other types, investigate the relevant class documentation\n\n7. Some sequence types (such as "range") only support item\n sequences that follow specific patterns, and hence don\'t support\n sequence concatenation or repetition.\n\n8. "index" raises "ValueError" when *x* is not found in *s*. When\n supported, the additional arguments to the index method allow\n efficient searching of subsections of the sequence. Passing the\n extra arguments is roughly equivalent to using "s[i:j].index(x)",\n only without copying any data and with the returned index being\n relative to the start of the sequence rather than the start of the\n slice.\n\n\nImmutable Sequence Types\n========================\n\nThe only operation that immutable sequence types generally implement\nthat is not also implemented by mutable sequence types is support for\nthe "hash()" built-in.\n\nThis support allows immutable sequences, such as "tuple" instances, to\nbe used as "dict" keys and stored in "set" and "frozenset" instances.\n\nAttempting to hash an immutable sequence that contains unhashable\nvalues will result in "TypeError".\n\n\nMutable Sequence Types\n======================\n\nThe operations in the following table are defined on mutable sequence\ntypes. The "collections.abc.MutableSequence" ABC is provided to make\nit easier to correctly implement these operations on custom sequence\ntypes.\n\nIn the table *s* is an instance of a mutable sequence type, *t* is any\niterable object and *x* is an arbitrary object that meets any type and\nvalue restrictions imposed by *s* (for example, "bytearray" only\naccepts integers that meet the value restriction "0 <= x <= 255").\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | appends *x* to the end of the | |\n| | sequence (same as | |\n| | "s[len(s):len(s)] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.clear()" | removes all items from "s" (same | (5) |\n| | as "del s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.copy()" | creates a shallow copy of "s" | (5) |\n| | (same as "s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(t)" or "s += t" | extends *s* with the contents of | |\n| | *t* (for the most part the same | |\n| | as "s[len(s):len(s)] = t") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s *= n" | updates *s* with its contents | (6) |\n| | repeated *n* times | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | inserts *x* into *s* at the | |\n| | index given by *i* (same as | |\n| | "s[i:i] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | retrieves the item at *i* and | (2) |\n| | also removes it from *s* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | remove the first item from *s* | (3) |\n| | where "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (4) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The optional argument *i* defaults to "-1", so that by default\n the last item is removed and returned.\n\n3. "remove" raises "ValueError" when *x* is not found in *s*.\n\n4. The "reverse()" method modifies the sequence in place for\n economy of space when reversing a large sequence. To remind users\n that it operates by side effect, it does not return the reversed\n sequence.\n\n5. "clear()" and "copy()" are included for consistency with the\n interfaces of mutable containers that don\'t support slicing\n operations (such as "dict" and "set")\n\n New in version 3.3: "clear()" and "copy()" methods.\n\n6. The value *n* is an integer, or an object implementing\n "__index__()". Zero and negative values of *n* clear the sequence.\n Items in the sequence are not copied; they are referenced multiple\n times, as explained for "s * n" under *Common Sequence Operations*.\n\n\nLists\n=====\n\nLists are mutable sequences, typically used to store collections of\nhomogeneous items (where the precise degree of similarity will vary by\napplication).\n\nclass class list([iterable])\n\n Lists may be constructed in several ways:\n\n * Using a pair of square brackets to denote the empty list: "[]"\n\n * Using square brackets, separating items with commas: "[a]",\n "[a, b, c]"\n\n * Using a list comprehension: "[x for x in iterable]"\n\n * Using the type constructor: "list()" or "list(iterable)"\n\n The constructor builds a list whose items are the same and in the\n same order as *iterable*\'s items. *iterable* may be either a\n sequence, a container that supports iteration, or an iterator\n object. If *iterable* is already a list, a copy is made and\n returned, similar to "iterable[:]". For example, "list(\'abc\')"\n returns "[\'a\', \'b\', \'c\']" and "list( (1, 2, 3) )" returns "[1, 2,\n 3]". If no argument is given, the constructor creates a new empty\n list, "[]".\n\n Many other operations also produce lists, including the "sorted()"\n built-in.\n\n Lists implement all of the *common* and *mutable* sequence\n operations. Lists also provide the following additional method:\n\n sort(*, key=None, reverse=None)\n\n This method sorts the list in place, using only "<" comparisons\n between items. Exceptions are not suppressed - if any comparison\n operations fail, the entire sort operation will fail (and the\n list will likely be left in a partially modified state).\n\n "sort()" accepts two arguments that can only be passed by\n keyword (*keyword-only arguments*):\n\n *key* specifies a function of one argument that is used to\n extract a comparison key from each list element (for example,\n "key=str.lower"). The key corresponding to each item in the list\n is calculated once and then used for the entire sorting process.\n The default value of "None" means that list items are sorted\n directly without calculating a separate key value.\n\n The "functools.cmp_to_key()" utility is available to convert a\n 2.x style *cmp* function to a *key* function.\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n This method modifies the sequence in place for economy of space\n when sorting a large sequence. To remind users that it operates\n by side effect, it does not return the sorted sequence (use\n "sorted()" to explicitly request a new sorted list instance).\n\n The "sort()" method is guaranteed to be stable. A sort is\n stable if it guarantees not to change the relative order of\n elements that compare equal --- this is helpful for sorting in\n multiple passes (for example, sort by department, then by salary\n grade).\n\n **CPython implementation detail:** While a list is being sorted,\n the effect of attempting to mutate, or even inspect, the list is\n undefined. The C implementation of Python makes the list appear\n empty for the duration, and raises "ValueError" if it can detect\n that the list has been mutated during a sort.\n\n\nTuples\n======\n\nTuples are immutable sequences, typically used to store collections of\nheterogeneous data (such as the 2-tuples produced by the "enumerate()"\nbuilt-in). Tuples are also used for cases where an immutable sequence\nof homogeneous data is needed (such as allowing storage in a "set" or\n"dict" instance).\n\nclass class tuple([iterable])\n\n Tuples may be constructed in a number of ways:\n\n * Using a pair of parentheses to denote the empty tuple: "()"\n\n * Using a trailing comma for a singleton tuple: "a," or "(a,)"\n\n * Separating items with commas: "a, b, c" or "(a, b, c)"\n\n * Using the "tuple()" built-in: "tuple()" or "tuple(iterable)"\n\n The constructor builds a tuple whose items are the same and in the\n same order as *iterable*\'s items. *iterable* may be either a\n sequence, a container that supports iteration, or an iterator\n object. If *iterable* is already a tuple, it is returned\n unchanged. For example, "tuple(\'abc\')" returns "(\'a\', \'b\', \'c\')"\n and "tuple( [1, 2, 3] )" returns "(1, 2, 3)". If no argument is\n given, the constructor creates a new empty tuple, "()".\n\n Note that it is actually the comma which makes a tuple, not the\n parentheses. The parentheses are optional, except in the empty\n tuple case, or when they are needed to avoid syntactic ambiguity.\n For example, "f(a, b, c)" is a function call with three arguments,\n while "f((a, b, c))" is a function call with a 3-tuple as the sole\n argument.\n\n Tuples implement all of the *common* sequence operations.\n\nFor heterogeneous collections of data where access by name is clearer\nthan access by index, "collections.namedtuple()" may be a more\nappropriate choice than a simple tuple object.\n\n\nRanges\n======\n\nThe "range" type represents an immutable sequence of numbers and is\ncommonly used for looping a specific number of times in "for" loops.\n\nclass class range(stop)\nclass class range(start, stop[, step])\n\n The arguments to the range constructor must be integers (either\n built-in "int" or any object that implements the "__index__"\n special method). If the *step* argument is omitted, it defaults to\n "1". If the *start* argument is omitted, it defaults to "0". If\n *step* is zero, "ValueError" is raised.\n\n For a positive *step*, the contents of a range "r" are determined\n by the formula "r[i] = start + step*i" where "i >= 0" and "r[i] <\n stop".\n\n For a negative *step*, the contents of the range are still\n determined by the formula "r[i] = start + step*i", but the\n constraints are "i >= 0" and "r[i] > stop".\n\n A range object will be empty if "r[0]" does not meet the value\n constraint. Ranges do support negative indices, but these are\n interpreted as indexing from the end of the sequence determined by\n the positive indices.\n\n Ranges containing absolute values larger than "sys.maxsize" are\n permitted but some features (such as "len()") may raise\n "OverflowError".\n\n Range examples:\n\n >>> list(range(10))\n [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n >>> list(range(1, 11))\n [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n >>> list(range(0, 30, 5))\n [0, 5, 10, 15, 20, 25]\n >>> list(range(0, 10, 3))\n [0, 3, 6, 9]\n >>> list(range(0, -10, -1))\n [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n >>> list(range(0))\n []\n >>> list(range(1, 0))\n []\n\n Ranges implement all of the *common* sequence operations except\n concatenation and repetition (due to the fact that range objects\n can only represent sequences that follow a strict pattern and\n repetition and concatenation will usually violate that pattern).\n\n start\n\n The value of the *start* parameter (or "0" if the parameter was\n not supplied)\n\n stop\n\n The value of the *stop* parameter\n\n step\n\n The value of the *step* parameter (or "1" if the parameter was\n not supplied)\n\nThe advantage of the "range" type over a regular "list" or "tuple" is\nthat a "range" object will always take the same (small) amount of\nmemory, no matter the size of the range it represents (as it only\nstores the "start", "stop" and "step" values, calculating individual\nitems and subranges as needed).\n\nRange objects implement the "collections.abc.Sequence" ABC, and\nprovide features such as containment tests, element index lookup,\nslicing and support for negative indices (see *Sequence Types ---\nlist, tuple, range*):\n\n>>> r = range(0, 20, 2)\n>>> r\nrange(0, 20, 2)\n>>> 11 in r\nFalse\n>>> 10 in r\nTrue\n>>> r.index(10)\n5\n>>> r[5]\n10\n>>> r[:5]\nrange(0, 10, 2)\n>>> r[-1]\n18\n\nTesting range objects for equality with "==" and "!=" compares them as\nsequences. That is, two range objects are considered equal if they\nrepresent the same sequence of values. (Note that two range objects\nthat compare equal might have different "start", "stop" and "step"\nattributes, for example "range(0) == range(2, 1, 3)" or "range(0, 3,\n2) == range(0, 4, 2)".)\n\nChanged in version 3.2: Implement the Sequence ABC. Support slicing\nand negative indices. Test "int" objects for membership in constant\ntime instead of iterating through all items.\n\nChanged in version 3.3: Define \'==\' and \'!=\' to compare range objects\nbased on the sequence of values they define (instead of comparing\nbased on object identity).\n\nNew in version 3.3: The "start", "stop" and "step" attributes.\n', 'typesseq-mutable': u'\nMutable Sequence Types\n**********************\n\nThe operations in the following table are defined on mutable sequence\ntypes. The "collections.abc.MutableSequence" ABC is provided to make\nit easier to correctly implement these operations on custom sequence\ntypes.\n\nIn the table *s* is an instance of a mutable sequence type, *t* is any\niterable object and *x* is an arbitrary object that meets any type and\nvalue restrictions imposed by *s* (for example, "bytearray" only\naccepts integers that meet the value restriction "0 <= x <= 255").\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | appends *x* to the end of the | |\n| | sequence (same as | |\n| | "s[len(s):len(s)] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.clear()" | removes all items from "s" (same | (5) |\n| | as "del s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.copy()" | creates a shallow copy of "s" | (5) |\n| | (same as "s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(t)" or "s += t" | extends *s* with the contents of | |\n| | *t* (for the most part the same | |\n| | as "s[len(s):len(s)] = t") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s *= n" | updates *s* with its contents | (6) |\n| | repeated *n* times | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | inserts *x* into *s* at the | |\n| | index given by *i* (same as | |\n| | "s[i:i] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | retrieves the item at *i* and | (2) |\n| | also removes it from *s* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | remove the first item from *s* | (3) |\n| | where "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (4) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The optional argument *i* defaults to "-1", so that by default\n the last item is removed and returned.\n\n3. "remove" raises "ValueError" when *x* is not found in *s*.\n\n4. The "reverse()" method modifies the sequence in place for\n economy of space when reversing a large sequence. To remind users\n that it operates by side effect, it does not return the reversed\n sequence.\n\n5. "clear()" and "copy()" are included for consistency with the\n interfaces of mutable containers that don\'t support slicing\n operations (such as "dict" and "set")\n\n New in version 3.3: "clear()" and "copy()" methods.\n\n6. The value *n* is an integer, or an object implementing\n "__index__()". Zero and negative values of *n* clear the sequence.\n Items in the sequence are not copied; they are referenced multiple\n times, as explained for "s * n" under *Common Sequence Operations*.\n', 'unary': u'\nUnary arithmetic and bitwise operations\n***************************************\n\nAll unary arithmetic and bitwise operations have the same priority:\n\n u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary "-" (minus) operator yields the negation of its numeric\nargument.\n\nThe unary "+" (plus) operator yields its numeric argument unchanged.\n\nThe unary "~" (invert) operator yields the bitwise inversion of its\ninteger argument. The bitwise inversion of "x" is defined as\n"-(x+1)". It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n"TypeError" exception is raised.\n', 'while': u'\nThe "while" statement\n*********************\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n', diff --git a/Lib/smtplib.py b/Lib/smtplib.py index 5b9e665..ab3197c 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -250,6 +250,7 @@ class SMTP: if host: (code, msg) = self.connect(host, port) if code != 220: + self.close() raise SMTPConnectError(code, msg) if local_hostname is not None: self.local_hostname = local_hostname diff --git a/Lib/sre_constants.py b/Lib/sre_constants.py index fc684ae..a6e8a1f 100644 --- a/Lib/sre_constants.py +++ b/Lib/sre_constants.py @@ -21,6 +21,17 @@ from _sre import MAXREPEAT, MAXGROUPS # should this really be here? class error(Exception): + """Exception raised for invalid regular expressions. + + Attributes: + + msg: The unformatted error message + pattern: The regular expression pattern + pos: The index in the pattern where compilation failed (may be None) + lineno: The line corresponding to pos (may be None) + colno: The column corresponding to pos (may be None) + """ + def __init__(self, msg, pattern=None, pos=None): self.msg = msg self.pattern = pattern diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 4ff50d1..df94784 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -309,7 +309,7 @@ def isname(name): return False return True -def _class_escape(source, escape): +def _class_escape(source, escape, nested): # handle escape code inside character class code = ESCAPES.get(escape) if code: @@ -353,13 +353,13 @@ def _class_escape(source, escape): if c in ASCIILETTERS: import warnings warnings.warn('bad escape %s' % escape, - DeprecationWarning, stacklevel=8) + DeprecationWarning, stacklevel=nested + 6) return LITERAL, ord(escape[1]) except ValueError: pass raise source.error("bad escape %s" % escape, len(escape)) -def _escape(source, escape, state): +def _escape(source, escape, state, nested): # handle escape code in expression code = CATEGORIES.get(escape) if code: @@ -420,13 +420,13 @@ def _escape(source, escape, state): if c in ASCIILETTERS: import warnings warnings.warn('bad escape %s' % escape, - DeprecationWarning, stacklevel=8) + DeprecationWarning, stacklevel=nested + 6) return LITERAL, ord(escape[1]) except ValueError: pass raise source.error("bad escape %s" % escape, len(escape)) -def _parse_sub(source, state, nested=True): +def _parse_sub(source, state, nested): # parse an alternation: a|b|c items = [] @@ -434,7 +434,7 @@ def _parse_sub(source, state, nested=True): sourcematch = source.match start = source.tell() while True: - itemsappend(_parse(source, state)) + itemsappend(_parse(source, state, nested + 1)) if not sourcematch("|"): break @@ -476,10 +476,10 @@ def _parse_sub(source, state, nested=True): subpattern.append((BRANCH, (None, items))) return subpattern -def _parse_sub_cond(source, state, condgroup): - item_yes = _parse(source, state) +def _parse_sub_cond(source, state, condgroup, nested): + item_yes = _parse(source, state, nested + 1) if source.match("|"): - item_no = _parse(source, state) + item_no = _parse(source, state, nested + 1) if source.next == "|": raise source.error("conditional backref with more than two branches") else: @@ -488,7 +488,7 @@ def _parse_sub_cond(source, state, condgroup): subpattern.append((GROUPREF_EXISTS, (condgroup, item_yes, item_no))) return subpattern -def _parse(source, state): +def _parse(source, state, nested): # parse a simple pattern subpattern = SubPattern(state) @@ -521,7 +521,7 @@ def _parse(source, state): continue if this[0] == "\\": - code = _escape(source, this, state) + code = _escape(source, this, state, nested + 1) subpatternappend(code) elif this not in SPECIAL_CHARS: @@ -546,7 +546,7 @@ def _parse(source, state): if this == "]" and set != start: break elif this[0] == "\\": - code1 = _class_escape(source, this) + code1 = _class_escape(source, this, nested + 1) else: code1 = LITERAL, _ord(this) if sourcematch("-"): @@ -562,7 +562,7 @@ def _parse(source, state): setappend((LITERAL, _ord("-"))) break if that[0] == "\\": - code2 = _class_escape(source, that) + code2 = _class_escape(source, that, nested + 1) else: code2 = LITERAL, _ord(that) if code1[0] != LITERAL or code2[0] != LITERAL: @@ -713,7 +713,7 @@ def _parse(source, state): lookbehindgroups = state.lookbehindgroups if lookbehindgroups is None: state.lookbehindgroups = state.groups - p = _parse_sub(source, state) + p = _parse_sub(source, state, nested + 1) if dir < 0: if lookbehindgroups is None: state.lookbehindgroups = None @@ -773,9 +773,9 @@ def _parse(source, state): except error as err: raise source.error(err.msg, len(name) + 1) from None if condgroup: - p = _parse_sub_cond(source, state, condgroup) + p = _parse_sub_cond(source, state, condgroup, nested + 1) else: - p = _parse_sub(source, state) + p = _parse_sub(source, state, nested + 1) if not source.match(")"): raise source.error("missing ), unterminated subpattern", source.tell() - start) diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 502e26b..8e44998 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -741,19 +741,21 @@ class Popen(object): self.stdin.write(input) except BrokenPipeError: pass # communicate() must ignore broken pipe errors. - except OSError as e: - if e.errno == errno.EINVAL and self.poll() is not None: - # Issue #19612: On Windows, stdin.write() fails with EINVAL - # if the process already exited before the write + except OSError as exc: + if exc.errno == errno.EINVAL: + # bpo-19612, bpo-30418: On Windows, stdin.write() fails + # with EINVAL if the child process exited or if the child + # process is still running but closed the pipe. pass else: raise + try: self.stdin.close() except BrokenPipeError: pass # communicate() must ignore broken pipe errors. - except OSError as e: - if e.errno == errno.EINVAL and self.poll() is not None: + except OSError as exc: + if exc.errno == errno.EINVAL: pass else: raise @@ -1198,8 +1200,12 @@ class Popen(object): # and pass it to fork_exec() if env is not None: - env_list = [os.fsencode(k) + b'=' + os.fsencode(v) - for k, v in env.items()] + env_list = [] + for k, v in env.items(): + k = os.fsencode(k) + if b'=' in k: + raise ValueError("illegal environment variable name") + env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) @@ -1214,7 +1220,8 @@ class Popen(object): fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, - close_fds, sorted(fds_to_keep), cwd, env_list, + close_fds, tuple(sorted(map(int, fds_to_keep))), + cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, @@ -1285,7 +1292,8 @@ class Popen(object): def _handle_exitstatus(self, sts, _WIFSIGNALED=os.WIFSIGNALED, _WTERMSIG=os.WTERMSIG, _WIFEXITED=os.WIFEXITED, - _WEXITSTATUS=os.WEXITSTATUS): + _WEXITSTATUS=os.WEXITSTATUS, _WIFSTOPPED=os.WIFSTOPPED, + _WSTOPSIG=os.WSTOPSIG): """All callers to this function MUST hold self._waitpid_lock.""" # This method is called (indirectly) by __del__, so it cannot # refer to anything outside of its local scope. @@ -1293,6 +1301,8 @@ class Popen(object): self.returncode = -_WTERMSIG(sts) elif _WIFEXITED(sts): self.returncode = _WEXITSTATUS(sts) + elif _WIFSTOPPED(sts): + self.returncode = -_WSTOPSIG(sts) else: # Should never happen raise SubprocessError("Unknown child exit status!") diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py index 46e0f56..bfb670c 100755 --- a/Lib/tabnanny.py +++ b/Lib/tabnanny.py @@ -59,7 +59,7 @@ def main(): class NannyNag(Exception): """ - Raised by tokeneater() if detecting an ambiguous indent. + Raised by process_tokens() if detecting an ambiguous indent. Captured and handled in check(). """ def __init__(self, lineno, msg, line): diff --git a/Lib/test/185test.db b/Lib/test/185test.db deleted file mode 100644 index 14cb5e258bc0961fa22527dcb5d947a6a0fd5480..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI!F$%&k6vpwdEl39?E*_+VxVZETo tests + ./python -m test.bisect -i tests test_os +""" + +import argparse +import datetime +import os.path +import math +import random +import subprocess +import sys +import tempfile +import time + + +def write_tests(filename, tests): + with open(filename, "w") as fp: + for name in tests: + print(name, file=fp) + fp.flush() + + +def write_output(filename, tests): + if not filename: + return + print("Write %s tests into %s" % (len(tests), filename)) + write_tests(filename, tests) + return filename + + +def format_shell_args(args): + return ' '.join(args) + + +def list_cases(args): + cmd = [sys.executable, '-m', 'test', '--list-cases'] + cmd.extend(args.test_args) + proc = subprocess.run(cmd, + stdout=subprocess.PIPE, + universal_newlines=True) + exitcode = proc.returncode + if exitcode: + cmd = format_shell_args(cmd) + print("Failed to list tests: %s failed with exit code %s" + % (cmd, exitcode)) + sys.exit(exitcode) + tests = proc.stdout.splitlines() + return tests + + +def run_tests(args, tests, huntrleaks=None): + tmp = tempfile.mktemp() + try: + write_tests(tmp, tests) + + cmd = [sys.executable, '-m', 'test', '--matchfile', tmp] + cmd.extend(args.test_args) + print("+ %s" % format_shell_args(cmd)) + proc = subprocess.run(cmd) + return proc.returncode + finally: + if os.path.exists(tmp): + os.unlink(tmp) + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument('-i', '--input', + help='Test names produced by --list-tests written ' + 'into a file. If not set, run --list-tests') + parser.add_argument('-o', '--output', + help='Result of the bisection') + parser.add_argument('-n', '--max-tests', type=int, default=1, + help='Maximum number of tests to stop the bisection ' + '(default: 1)') + parser.add_argument('-N', '--max-iter', type=int, default=100, + help='Maximum number of bisection iterations ' + '(default: 100)') + # FIXME: document that following arguments are test arguments + + args, test_args = parser.parse_known_args() + args.test_args = test_args + return args + + +def main(): + args = parse_args() + + if args.input: + with open(args.input) as fp: + tests = [line.strip() for line in fp] + else: + tests = list_cases(args) + + print("Start bisection with %s tests" % len(tests)) + print("Test arguments: %s" % format_shell_args(args.test_args)) + print("Bisection will stop when getting %s or less tests " + "(-n/--max-tests option), or after %s iterations " + "(-N/--max-iter option)" + % (args.max_tests, args.max_iter)) + output = write_output(args.output, tests) + print() + + start_time = time.monotonic() + iteration = 1 + try: + while len(tests) > args.max_tests and iteration <= args.max_iter: + ntest = len(tests) + ntest = max(ntest // 2, 1) + subtests = random.sample(tests, ntest) + + print("[+] Iteration %s: run %s tests/%s" + % (iteration, len(subtests), len(tests))) + print() + + exitcode = run_tests(args, subtests) + + print("ran %s tests/%s" % (ntest, len(tests))) + print("exit", exitcode) + if exitcode: + print("Tests failed: use this new subtest") + tests = subtests + output = write_output(args.output, tests) + else: + print("Tests succeeded: skip this subtest, try a new subbset") + print() + iteration += 1 + except KeyboardInterrupt: + print() + print("Bisection interrupted!") + print() + + print("Tests (%s):" % len(tests)) + for test in tests: + print("* %s" % test) + print() + + if output: + print("Output written into %s" % output) + + dt = math.ceil(time.monotonic() - start_time) + if len(tests) <= args.max_tests: + print("Bisection completed in %s iterations and %s" + % (iteration, datetime.timedelta(seconds=dt))) + sys.exit(1) + else: + print("Bisection failed after %s iterations and %s" + % (iteration, datetime.timedelta(seconds=dt))) + + +if __name__ == "__main__": + main() diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py index e3f1aa5..ad68bd7 100644 --- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -9,7 +9,7 @@ sub-second periodicity (contrarily to signal()). """ import contextlib -import io +import faulthandler import os import select import signal @@ -50,6 +50,10 @@ class EINTRBaseTest(unittest.TestCase): signal.setitimer(signal.ITIMER_REAL, cls.signal_delay, cls.signal_period) + # Issue #25277: Use faulthandler to try to debug a hang on FreeBSD + if hasattr(faulthandler, 'dump_traceback_later'): + faulthandler.dump_traceback_later(10 * 60, exit=True) + @classmethod def stop_alarm(cls): signal.setitimer(signal.ITIMER_REAL, 0, 0) @@ -58,6 +62,8 @@ class EINTRBaseTest(unittest.TestCase): def tearDownClass(cls): cls.stop_alarm() signal.signal(signal.SIGALRM, cls.orig_handler) + if hasattr(faulthandler, 'cancel_dump_traceback_later'): + faulthandler.cancel_dump_traceback_later() def subprocess(self, *args, **kw): cmd_args = (sys.executable, '-c') + args @@ -77,6 +83,9 @@ class OSEINTRTest(EINTRBaseTest): processes = [self.new_sleep_process() for _ in range(num)] for _ in range(num): wait_func() + # Call the Popen method to avoid a ResourceWarning + for proc in processes: + proc.wait() def test_wait(self): self._test_wait_multiple(os.wait) @@ -88,6 +97,8 @@ class OSEINTRTest(EINTRBaseTest): def _test_wait_single(self, wait_func): proc = self.new_sleep_process() wait_func(proc.pid) + # Call the Popen method to avoid a ResourceWarning + proc.wait() def test_waitpid(self): self._test_wait_single(lambda pid: os.waitpid(pid, 0)) @@ -358,59 +369,55 @@ class TimeEINTRTest(EINTRBaseTest): @unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()") +# bpo-30320: Need pthread_sigmask() to block the signal, otherwise the test +# is vulnerable to a race condition between the child and the parent processes. +@unittest.skipUnless(hasattr(signal, 'pthread_sigmask'), + 'need signal.pthread_sigmask()') class SignalEINTRTest(EINTRBaseTest): """ EINTR tests for the signal module. """ - @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), - 'need signal.sigtimedwait()') - def test_sigtimedwait(self): - t0 = time.monotonic() - signal.sigtimedwait([signal.SIGUSR1], self.sleep_time) - dt = time.monotonic() - t0 - self.assertGreaterEqual(dt, self.sleep_time) - - @unittest.skipUnless(hasattr(signal, 'sigwaitinfo'), - 'need signal.sigwaitinfo()') - def test_sigwaitinfo(self): - # Issue #25277, #25868: give a few milliseconds to the parent process - # between os.write() and signal.sigwaitinfo() to works around a race - # condition - self.sleep_time = 0.100 - + def check_sigwait(self, wait_func): signum = signal.SIGUSR1 pid = os.getpid() old_handler = signal.signal(signum, lambda *args: None) self.addCleanup(signal.signal, signum, old_handler) - rpipe, wpipe = os.pipe() - code = '\n'.join(( 'import os, time', 'pid = %s' % os.getpid(), 'signum = %s' % int(signum), 'sleep_time = %r' % self.sleep_time, - 'rpipe = %r' % rpipe, - 'os.read(rpipe, 1)', - 'os.close(rpipe)', 'time.sleep(sleep_time)', 'os.kill(pid, signum)', )) + old_mask = signal.pthread_sigmask(signal.SIG_BLOCK, [signum]) + self.addCleanup(signal.pthread_sigmask, signal.SIG_UNBLOCK, [signum]) + t0 = time.monotonic() - proc = self.subprocess(code, pass_fds=(rpipe,)) - os.close(rpipe) + proc = self.subprocess(code) with kill_on_error(proc): - # sync child-parent - os.write(wpipe, b'x') - os.close(wpipe) + wait_func(signum) + dt = time.monotonic() - t0 + + self.assertEqual(proc.wait(), 0) - # parent + @unittest.skipUnless(hasattr(signal, 'sigwaitinfo'), + 'need signal.sigwaitinfo()') + def test_sigwaitinfo(self): + def wait_func(signum): signal.sigwaitinfo([signum]) - dt = time.monotonic() - t0 - self.assertEqual(proc.wait(), 0) - self.assertGreaterEqual(dt, self.sleep_time) + self.check_sigwait(wait_func) + + @unittest.skipUnless(hasattr(signal, 'sigtimedwait'), + 'need signal.sigwaitinfo()') + def test_sigtimedwait(self): + def wait_func(signum): + signal.sigtimedwait([signum], 120.0) + + self.check_sigwait(wait_func) @unittest.skipUnless(hasattr(signal, "setitimer"), "requires setitimer()") @@ -424,6 +431,8 @@ class SelectEINTRTest(EINTRBaseTest): self.stop_alarm() self.assertGreaterEqual(dt, self.sleep_time) + @unittest.skipIf(sys.platform == "darwin", + "poll may fail on macOS; see issue #28087") @unittest.skipUnless(hasattr(select, 'poll'), 'need select.poll') def test_poll(self): poller = select.poll() diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py index a64aa18..6c03b5a 100644 --- a/Lib/test/lock_tests.py +++ b/Lib/test/lock_tests.py @@ -449,21 +449,28 @@ class ConditionTests(BaseTestCase): # construct. In particular, it is possible that this can no longer # be conveniently guaranteed should their implementation ever change. N = 5 + ready = [] results1 = [] results2 = [] phase_num = 0 def f(): cond.acquire() + ready.append(phase_num) result = cond.wait() cond.release() results1.append((result, phase_num)) cond.acquire() + ready.append(phase_num) result = cond.wait() cond.release() results2.append((result, phase_num)) b = Bunch(f, N) b.wait_for_started() - _wait() + # first wait, to ensure all workers settle into cond.wait() before + # we continue. See issues #8799 and #30727. + while len(ready) < 5: + _wait() + ready.clear() self.assertEqual(results1, []) # Notify 3 threads at first cond.acquire() @@ -475,9 +482,9 @@ class ConditionTests(BaseTestCase): _wait() self.assertEqual(results1, [(True, 1)] * 3) self.assertEqual(results2, []) - # first wait, to ensure all workers settle into cond.wait() before - # we continue. See issue #8799 - _wait() + # make sure all awaken workers settle into cond.wait() + while len(ready) < 3: + _wait() # Notify 5 threads: they might be in their first or second wait cond.acquire() cond.notify(5) @@ -488,7 +495,9 @@ class ConditionTests(BaseTestCase): _wait() self.assertEqual(results1, [(True, 1)] * 3 + [(True, 2)] * 2) self.assertEqual(results2, [(True, 2)] * 3) - _wait() # make sure all workers settle into cond.wait() + # make sure all workers settle into cond.wait() + while len(ready) < 5: + _wait() # Notify all threads: they are all in their second wait cond.acquire() cond.notify_all() diff --git a/Lib/test/mod_generics_cache.py b/Lib/test/mod_generics_cache.py new file mode 100644 index 0000000..d9a60b4 --- /dev/null +++ b/Lib/test/mod_generics_cache.py @@ -0,0 +1,14 @@ +"""Module for testing the behavior of generics across different modules.""" + +from typing import TypeVar, Generic + +T = TypeVar('T') + + +class A(Generic[T]): + pass + + +class B(Generic[T]): + class A(Generic[T]): + pass diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index c1d85f6..8b63d91 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -117,6 +117,13 @@ resources to test. Currently only the following are defined: To enable all resources except one, use '-uall,-'. For example, to run all the tests except for the gui tests, give the option '-uall,-gui'. + +--matchfile filters tests using a text file, one pattern per line. +Pattern examples: + +- test method: test_stat_attributes +- test class: FileTests +- test identifier: test_os.FileTests.test_stat_attributes """ # We import importlib *ASAP* in order to test #15386 @@ -124,6 +131,7 @@ import importlib import argparse import builtins +import datetime import faulthandler import io import json @@ -140,6 +148,7 @@ import sysconfig import tempfile import time import traceback +import types import unittest import warnings from inspect import isabstract @@ -198,8 +207,14 @@ CHILD_ERROR = -5 # error in a child process from test import support -RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', - 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui') +ALL_RESOURCES = ('audio', 'curses', 'largefile', 'network', + 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui') + +# Other resources excluded from --use=all: +# +# - extralagefile (ex: test_zipfile64): really too slow to be enabled +# "by default" +RESOURCE_NAMES = ALL_RESOURCES + ('extralargefile',) # When tests are run from the Python build directory, it is best practice # to keep the test files in a subfolder. This eases the cleanup of leftover @@ -254,7 +269,7 @@ def _create_parser(): help='display test output on failure') group.add_argument('-q', '--quiet', action='store_true', help='no output unless one or more tests fail') - group.add_argument('-o', '--slow', action='store_true', dest='print_slow', + group.add_argument('-o', '--slowest', action='store_true', dest='print_slow', help='print the slowest 10 tests') group.add_argument('--header', action='store_true', help='print header with interpreter info') @@ -275,8 +290,12 @@ def _create_parser(): help='single step through a set of tests.' + more_details) group.add_argument('-m', '--match', metavar='PAT', - dest='match_tests', + dest='match_tests', action='append', help='match test cases and methods with glob pattern PAT') + group.add_argument('--matchfile', metavar='FILENAME', + dest='match_filename', + help='similar to --match but get patterns from a ' + 'text file, one pattern per line') group.add_argument('-G', '--failfast', action='store_true', help='fail as soon as a test fails (only with -v or -W)') group.add_argument('-u', '--use', metavar='RES1,RES2,...', @@ -322,8 +341,17 @@ def _create_parser(): group.add_argument('-F', '--forever', action='store_true', help='run the specified tests in a loop, until an ' 'error happens') + group.add_argument('--list-tests', action='store_true', + help="only write the name of tests that will be run, " + "don't execute them") + group.add_argument('--list-cases', action='store_true', + help='only write the name of test cases that will be run' + ' , don\'t execute them') group.add_argument('-P', '--pgo', dest='pgo', action='store_true', help='enable Profile Guided Optimization training') + group.add_argument('--fail-env-changed', action='store_true', + help='if a test file alters the environment, mark ' + 'the test as failed') return parser @@ -360,7 +388,8 @@ def _parse_args(args, **kwargs): findleaks=False, use_resources=None, trace=False, coverdir='coverage', runleaks=False, huntrleaks=False, verbose2=False, print_slow=False, random_seed=None, use_mp=None, verbose3=False, forever=False, - header=False, failfast=False, match_tests=None, pgo=False) + header=False, failfast=False, match_tests=None, match_filename=None, + pgo=False) for k, v in kwargs.items(): if not hasattr(ns, k): raise TypeError('%r is an invalid keyword argument ' @@ -409,7 +438,7 @@ def _parse_args(args, **kwargs): for a in ns.use: for r in a: if r == 'all': - ns.use_resources[:] = RESOURCE_NAMES + ns.use_resources[:] = ALL_RESOURCES continue if r == 'none': del ns.use_resources[:] @@ -425,6 +454,18 @@ def _parse_args(args, **kwargs): ns.use_resources.append(r) if ns.random_seed is not None: ns.randomize = True + if ns.huntrleaks and ns.verbose3: + ns.verbose3 = False + print("WARNING: Disable --verbose3 because it's incompatible with " + "--huntrleaks: see http://bugs.python.org/issue27103", + file=sys.stderr) + if ns.match_filename: + if ns.match_tests is None: + ns.match_tests = [] + filename = os.path.join(support.SAVEDCWD, ns.match_filename) + with open(filename) as fp: + for line in fp: + ns.match_tests.append(line.strip()) return ns @@ -443,17 +484,15 @@ def run_test_in_subprocess(testname, ns): # required to spawn a new process with PGO flag on/off if ns.pgo: base_cmd = base_cmd + ['--pgo'] - slaveargs = ( - (testname, ns.verbose, ns.quiet), - dict(huntrleaks=ns.huntrleaks, - use_resources=ns.use_resources, - output_on_failure=ns.verbose3, - timeout=ns.timeout, failfast=ns.failfast, - match_tests=ns.match_tests, pgo=ns.pgo)) + + ns_dict = vars(ns) + slaveargs = (ns_dict, testname) + slaveargs = json.dumps(slaveargs) + # Running the child from the same working directory as regrtest's original # invocation ensures that TEMPDIR for the child is the same when # sysconfig.is_python_build() is true. See issue 15300. - popen = Popen(base_cmd + ['--slaveargs', json.dumps(slaveargs)], + popen = Popen(base_cmd + ['--slaveargs', slaveargs], stdout=PIPE, stderr=PIPE, universal_newlines=True, close_fds=(os.name != 'nt'), @@ -463,6 +502,47 @@ def run_test_in_subprocess(testname, ns): return retcode, stdout, stderr +def setup_tests(ns): + if ns.testdir: + # Prepend test directory to sys.path, so runtest() will be able + # to locate tests + sys.path.insert(0, os.path.abspath(ns.testdir)) + if ns.huntrleaks: + # Avoid false positives due to various caches + # filling slowly with random data: + warm_caches() + if ns.memlimit is not None: + support.set_memlimit(ns.memlimit) + if ns.threshold is not None: + import gc + gc.set_threshold(ns.threshold) + if ns.nowindows: + print('The --nowindows (-n) option is deprecated. ' + 'Use -vv to display assertions in stderr.') + try: + import msvcrt + except ImportError: + pass + else: + msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS| + msvcrt.SEM_NOALIGNMENTFAULTEXCEPT| + msvcrt.SEM_NOGPFAULTERRORBOX| + msvcrt.SEM_NOOPENFILEERRORBOX) + try: + msvcrt.CrtSetReportMode + except AttributeError: + # release build + pass + else: + for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]: + if ns.verbose and ns.verbose >= 2: + msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE) + msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR) + else: + msvcrt.CrtSetReportMode(m, 0) + + + def main(tests=None, **kwargs): """Execute a test suite. @@ -486,6 +566,8 @@ def main(tests=None, **kwargs): directly to set the values that would normally be set by flags on the command line. """ + start_time = time.monotonic() + # Display the Python traceback on fatal errors (e.g. segfault) faulthandler.enable(all_threads=True) @@ -504,58 +586,38 @@ def main(tests=None, **kwargs): ns = _parse_args(sys.argv[1:], **kwargs) - if ns.huntrleaks: - # Avoid false positives due to various caches - # filling slowly with random data: - warm_caches() - if ns.memlimit is not None: - support.set_memlimit(ns.memlimit) - if ns.threshold is not None: - import gc - gc.set_threshold(ns.threshold) - if ns.nowindows: - print('The --nowindows (-n) option is deprecated. ' - 'Use -vv to display assertions in stderr.') - try: - import msvcrt - except ImportError: - pass - else: - msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS| - msvcrt.SEM_NOALIGNMENTFAULTEXCEPT| - msvcrt.SEM_NOGPFAULTERRORBOX| - msvcrt.SEM_NOOPENFILEERRORBOX) - try: - msvcrt.CrtSetReportMode - except AttributeError: - # release build - pass - else: - for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]: - if ns.verbose and ns.verbose >= 2: - msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE) - msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR) - else: - msvcrt.CrtSetReportMode(m, 0) - if ns.wait: - input("Press any key to continue...") - if ns.slaveargs is not None: - args, kwargs = json.loads(ns.slaveargs) - if kwargs.get('huntrleaks'): + ns_dict, testname = json.loads(ns.slaveargs) + ns = types.SimpleNamespace(**ns_dict) + + setup_tests(ns) + + if ns.huntrleaks: unittest.BaseTestSuite._cleanup = False + try: - result = runtest(*args, **kwargs) + result = runtest(ns, testname, ns.verbose, ns.quiet, + ns.huntrleaks, + output_on_failure=ns.verbose3, + timeout=ns.timeout, failfast=ns.failfast, + match_tests=ns.match_tests, pgo=ns.pgo, + use_resources=ns.use_resources) except KeyboardInterrupt: result = INTERRUPTED, '' except BaseException as e: traceback.print_exc() result = CHILD_ERROR, str(e) + sys.stdout.flush() print() # Force a newline (just in case) print(json.dumps(result)) sys.exit(0) + setup_tests(ns) + + if ns.wait: + input("Press any key to continue...") + good = [] bad = [] skipped = [] @@ -591,12 +653,15 @@ def main(tests=None, **kwargs): if ns.fromfile: tests = [] with open(os.path.join(support.SAVEDCWD, ns.fromfile)) as fp: - count_pat = re.compile(r'\[\s*\d+/\s*\d+\]') + # regex to match 'test_builtin' in line: + # '0:00:00 [ 4/400] test_builtin -- test_dict took 1 sec' + regex = re.compile(r'\btest_[a-zA-Z0-9_]+\b') for line in fp: - line = count_pat.sub('', line) - guts = line.split() # assuming no test has whitespace in its name - if guts and not guts[0].startswith('#'): - tests.extend(guts) + line = line.split('#', 1)[0] + line = line.strip() + match = regex.search(line) + if match is not None: + tests.append(match.group()) # Strip .py extensions. removepy(ns.args) @@ -611,18 +676,6 @@ def main(tests=None, **kwargs): nottests.add(arg) ns.args = [] - # For a partial run, we do not need to clutter the output. - if (ns.verbose or ns.header or - not (ns.pgo or ns.quiet or ns.single or tests or ns.args)): - # Print basic platform information - print("==", platform.python_implementation(), *sys.version.split()) - print("== ", platform.platform(aliased=True), - "%s-endian" % sys.byteorder) - print("== ", "hash algorithm:", sys.hash_info.algorithm, - "64bit" if sys.maxsize > 2**32 else "32bit") - print("== ", os.getcwd()) - print("Testing with flags:", sys.flags) - # if testdir is set, then we are not running the python tests suite, so # don't add default tests to be executed or skipped (pass empty values) if ns.testdir: @@ -651,9 +704,7 @@ def main(tests=None, **kwargs): random.shuffle(selected) if ns.trace: import trace, tempfile - tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix, - tempfile.gettempdir()], - trace=False, count=True) + tracer = trace.Trace(trace=False, count=True) test_times = [] support.verbose = ns.verbose # Tell tests to be moderately quiet @@ -666,7 +717,7 @@ def main(tests=None, **kwargs): test_times.append((test_time, test)) if ok == PASSED: good.append(test) - elif ok == FAILED: + elif ok in (FAILED, CHILD_ERROR): bad.append(test) elif ok == ENV_CHANGED: environment_changed.append(test) @@ -675,6 +726,17 @@ def main(tests=None, **kwargs): elif ok == RESOURCE_DENIED: skipped.append(test) resource_denieds.append(test) + elif ok != INTERRUPTED: + raise ValueError("invalid test result: %r" % ok) + + if ns.list_tests: + for name in selected: + print(name) + sys.exit(0) + + if ns.list_cases: + list_cases(ns, selected) + sys.exit(0) if ns.forever: def test_forever(tests=list(selected)): @@ -683,6 +745,8 @@ def main(tests=None, **kwargs): yield test if bad: return + if ns.fail_env_changed and environment_changed: + return tests = test_forever() test_count = '' test_count_width = 3 @@ -691,6 +755,39 @@ def main(tests=None, **kwargs): test_count = '/{}'.format(len(selected)) test_count_width = len(test_count) - 1 + # For a partial run, we do not need to clutter the output. + if (ns.verbose or ns.header or + not (ns.pgo or ns.quiet or ns.single or tests or ns.args)): + # Print basic platform information + print("==", platform.python_implementation(), *sys.version.split()) + print("== ", platform.platform(aliased=True), + "%s-endian" % sys.byteorder) + print("== ", "hash algorithm:", sys.hash_info.algorithm, + "64bit" if sys.maxsize > 2**32 else "32bit") + print("== ", os.getcwd()) + print("Testing with flags:", sys.flags) + + def display_progress(test_index, test): + if ns.quiet: + return + + # "[ 51/405/1] test_tcl passed" + line = "{0:{1}}{2}".format(test_index, test_count_width, test_count) + if bad and not ns.pgo: + line = "{0}/{1}".format(line, len(bad)) + line = "[{0}] {1}".format(line, test) + + # add the system load prefix: "load avg: 1.80 " + if hasattr(os, 'getloadavg'): + load_avg_1min = os.getloadavg()[0] + line = "load avg: {0:.2f} {1}".format(load_avg_1min, line) + + # add the timestamp prefix: "0:01:05 " + test_time = time.monotonic() - start_time + test_time = datetime.timedelta(seconds=int(test_time)) + line = "{0} {1}".format(test_time, line) + print(line, flush=True) + if ns.use_mp: try: from threading import Thread @@ -718,7 +815,7 @@ def main(tests=None, **kwargs): if retcode != 0: result = (CHILD_ERROR, "Exit code %s" % retcode) output.put((test, stdout.rstrip(), stderr.rstrip(), result)) - return + continue if not result: output.put((None, None, None, None)) return @@ -739,14 +836,7 @@ def main(tests=None, **kwargs): finished += 1 continue accumulate_result(test, result) - if not ns.quiet: - if bad and not ns.pgo: - fmt = "[{1:{0}}{2}/{3}] {4}" - else: - fmt = "[{1:{0}}{2}] {4}" - print(fmt.format( - test_count_width, test_index, test_count, - len(bad), test)) + display_progress(test_index, test) if stdout: print(stdout) if stderr and not ns.pgo: @@ -755,8 +845,6 @@ def main(tests=None, **kwargs): sys.stderr.flush() if result[0] == INTERRUPTED: raise KeyboardInterrupt - if result[0] == CHILD_ERROR: - raise Exception("Child error on {}: {}".format(test, result[1])) test_index += 1 except KeyboardInterrupt: interrupted = True @@ -765,27 +853,24 @@ def main(tests=None, **kwargs): worker.join() else: for test_index, test in enumerate(tests, 1): - if not ns.quiet: - if bad and not ns.pgo: - fmt = "[{1:{0}}{2}/{3}] {4}" - else: - fmt = "[{1:{0}}{2}] {4}" - print(fmt.format( - test_count_width, test_index, test_count, len(bad), test)) - sys.stdout.flush() + display_progress(test_index, test) + + def runtest_accumulate(): + result = runtest(ns, test, ns.verbose, ns.quiet, + ns.huntrleaks, + output_on_failure=ns.verbose3, + timeout=ns.timeout, failfast=ns.failfast, + match_tests=ns.match_tests, pgo=ns.pgo) + accumulate_result(test, result) + if ns.trace: # If we're tracing code coverage, then we don't exit with status # if on a false return value from main. - tracer.runctx('runtest(test, ns.verbose, ns.quiet, timeout=ns.timeout)', + tracer.runctx('runtest_accumulate()', globals=globals(), locals=vars()) else: try: - result = runtest(test, ns.verbose, ns.quiet, - ns.huntrleaks, - output_on_failure=ns.verbose3, - timeout=ns.timeout, failfast=ns.failfast, - match_tests=ns.match_tests, pgo=ns.pgo) - accumulate_result(test, result) + runtest_accumulate() except KeyboardInterrupt: interrupted = True break @@ -817,8 +902,8 @@ def main(tests=None, **kwargs): if ns.print_slow: test_times.sort(reverse=True) print("10 slowest tests:") - for time, test in test_times[:10]: - print("%s: %.1fs" % (test, time)) + for test_time, test in test_times[:10]: + print("- %s: %.1fs" % (test, test_time)) if bad and not ns.pgo: print(count(len(bad), "test"), "failed:") printlist(bad) @@ -838,7 +923,7 @@ def main(tests=None, **kwargs): sys.stdout.flush() try: ns.verbose = True - ok = runtest(test, True, ns.quiet, ns.huntrleaks, + ok = runtest(ns, test, True, ns.quiet, ns.huntrleaks, timeout=ns.timeout, pgo=ns.pgo) except KeyboardInterrupt: # print a newline separate from the ^C @@ -866,7 +951,23 @@ def main(tests=None, **kwargs): if ns.runleaks: os.system("leaks %d" % os.getpid()) - sys.exit(len(bad) > 0 or interrupted) + if bad: + result = "FAILURE" + elif interrupted: + result = "INTERRUPTED" + elif ns.fail_env_changed and environment_changed: + result = "ENV CHANGED" + else: + result = "SUCCESS" + print("Tests result: %s" % result) + + if bad: + sys.exit(2) + if interrupted: + sys.exit(130) + if ns.fail_env_changed and environment_changed: + sys.exit(3) + sys.exit(0) # small set of tests to determine if we have a basically functioning interpreter @@ -935,7 +1036,7 @@ def replace_stdout(): sys.stdout = stdout atexit.register(restore_stdout) -def runtest(test, verbose, quiet, +def runtest(ns, test, verbose, quiet, huntrleaks=False, use_resources=None, output_on_failure=False, failfast=False, match_tests=None, timeout=None, *, pgo=False): @@ -990,8 +1091,9 @@ def runtest(test, verbose, quiet, try: sys.stdout = stream sys.stderr = stream - result = runtest_inner(test, verbose, quiet, huntrleaks, - display_failure=False, pgo=pgo) + result = runtest_inner(ns, test, verbose, quiet, huntrleaks, + display_failure=False, + pgo=pgo) if result[0] != PASSED and not pgo: output = stream.getvalue() orig_stderr.write(output) @@ -1001,8 +1103,9 @@ def runtest(test, verbose, quiet, sys.stderr = orig_stderr else: support.verbose = verbose # Tell tests to be moderately quiet - result = runtest_inner(test, verbose, quiet, huntrleaks, - display_failure=not verbose, pgo=pgo) + result = runtest_inner(ns, test, verbose, quiet, huntrleaks, + display_failure=not verbose, + pgo=pgo) return result finally: if use_timeout: @@ -1267,25 +1370,20 @@ class saved_test_environment: print("Warning -- {} was modified by {}".format( name, self.testname), file=sys.stderr) - if self.verbose > 1 and not self.pgo: - print(" Before: {}\n After: {} ".format( - original, current), - file=sys.stderr) + print(" Before: {}\n After: {} ".format( + original, current), + file=sys.stderr) return False -def runtest_inner(test, verbose, quiet, +def runtest_inner(ns, test, verbose, quiet, huntrleaks=False, display_failure=True, pgo=False): support.unload(test) test_time = 0.0 refleak = False # True if the test leaked references. try: - if test.startswith('test.'): - abstest = test - else: - # Always import it from the test package - abstest = 'test.' + test + abstest = get_abs_module(ns, test) clear_caches() with saved_test_environment(test, verbose, quiet, pgo=pgo) as environment: start_time = time.time() @@ -1431,24 +1529,33 @@ def dash_R(the_module, test, indirect_test, huntrleaks): alloc_deltas[i] = alloc_after - alloc_before alloc_before, rc_before = alloc_after, rc_after print(file=sys.stderr) + # These checkers return False on success, True on failure def check_rc_deltas(deltas): - return any(deltas) - def check_alloc_deltas(deltas): - # At least 1/3rd of 0s - if 3 * deltas.count(0) < len(deltas): - return True - # Nothing else than 1s, 0s and -1s - if not set(deltas) <= {1,0,-1}: - return True - return False + # Checker for reference counters and memomry blocks. + # + # bpo-30776: Try to ignore false positives: + # + # [3, 0, 0] + # [0, 1, 0] + # [8, -8, 1] + # + # Expected leaks: + # + # [5, 5, 6] + # [10, 1, 1] + return all(delta >= 1 for delta in deltas) + failed = False for deltas, item_name, checker in [ (rc_deltas, 'references', check_rc_deltas), - (alloc_deltas, 'memory blocks', check_alloc_deltas)]: + (alloc_deltas, 'memory blocks', check_rc_deltas) + ]: + # ignore warmup runs + deltas = deltas[nwarmup:] if checker(deltas): msg = '%s leaked %s %s, sum=%s' % ( - test, deltas[nwarmup:], item_name, sum(deltas)) + test, deltas, item_name, sum(deltas)) print(msg, file=sys.stderr) sys.stderr.flush() with open(fname, "a") as refrep: @@ -1480,9 +1587,14 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs): sys._clear_type_cache() # Clear ABC registries, restoring previously saved ABC registries. - for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]: - if not isabstract(abc): - continue + abs_classes = [getattr(collections.abc, a) for a in collections.abc.__all__] + abs_classes = filter(isabstract, abs_classes) + if 'typing' in sys.modules: + t = sys.modules['typing'] + # these classes require special treatment because they do not appear + # in direct subclasses on collections.abc classes + abs_classes = list(abs_classes) + [t.ChainMap, t.Counter, t.DefaultDict] + for abc in abs_classes: for obj in abc.__subclasses__() + [abc]: obj._abc_registry = abcs.get(obj, WeakSet()).copy() obj._abc_cache.clear() @@ -1621,7 +1733,7 @@ def count(n, word): else: return "%d %ss" % (n, word) -def printlist(x, width=70, indent=4): +def printlist(x, width=70, indent=4, file=None): """Print the elements of iterable x to stdout. Optional arg width (default 70) is the maximum line length. @@ -1633,7 +1745,45 @@ def printlist(x, width=70, indent=4): blanks = ' ' * indent # Print the sorted list: 'x' may be a '--random' list or a set() print(fill(' '.join(str(elt) for elt in sorted(x)), width, - initial_indent=blanks, subsequent_indent=blanks)) + initial_indent=blanks, subsequent_indent=blanks), file=file) + + +def get_abs_module(ns, test): + if test.startswith('test.') or ns.testdir: + return test + else: + # Always import it from the test package + return 'test.' + test + + +def _list_cases(suite): + for test in suite: + if isinstance(test, unittest.loader._FailedTest): + continue + if isinstance(test, unittest.TestSuite): + _list_cases(test) + elif isinstance(test, unittest.TestCase): + if support._match_test(test): + print(test.id()) + + +def list_cases(ns, selected): + support.verbose = False + support.match_tests = ns.match_tests + + skipped = [] + for test in selected: + abstest = get_abs_module(ns, test) + try: + suite = unittest.defaultTestLoader.loadTestsFromName(abstest) + _list_cases(suite) + except unittest.SkipTest: + skipped.append(test) + + if skipped: + print(file=sys.stderr) + print(count(len(skipped), "test"), "skipped:", file=sys.stderr) + printlist(skipped, file=sys.stderr) def main_in_temp_cwd(): diff --git a/Lib/test/sndhdrdata/README b/Lib/test/sndhdrdata/README index 8a17c00..b2cb664 100644 --- a/Lib/test/sndhdrdata/README +++ b/Lib/test/sndhdrdata/README @@ -3,10 +3,3 @@ following commands: dd if=/dev/zero of=sndhdr.raw bs=20 count=1 sox -s -2 -c 2 -r 44100 sndhdr.raw sndhdr. - -Sound file samples used by Lib/test/test_sndhdr.py and generated using the -following commands: - - dd if=/dev/zero of=sndhdr.raw bs=20 count=1 - sox -s -2 -c 2 -r 44100 sndhdr.raw sndhdr. - diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index d0d126a..85878eb 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1866,6 +1866,23 @@ def _run_suite(suite): raise TestFailed(err) +def _match_test(test): + global match_tests + + if match_tests is None: + return True + test_id = test.id() + + for match_test in match_tests: + if fnmatch.fnmatchcase(test_id, match_test): + return True + + for name in test_id.split("."): + if fnmatch.fnmatchcase(name, match_test): + return True + return False + + def run_unittest(*classes): """Run tests from unittest.TestCase-derived classes.""" valid_types = (unittest.TestSuite, unittest.TestCase) @@ -1880,14 +1897,7 @@ def run_unittest(*classes): suite.addTest(cls) else: suite.addTest(unittest.makeSuite(cls)) - def case_pred(test): - if match_tests is None: - return True - for name in test.id().split("."): - if fnmatch.fnmatchcase(name, match_tests): - return True - return False - _filter_suite(suite, case_pred) + _filter_suite(suite, _match_test) _run_suite(suite) #======================================================================= @@ -2073,12 +2083,15 @@ def swap_attr(obj, attr, new_val): restoring the old value at the end of the block. If `attr` doesn't exist on `obj`, it will be created and then deleted at the end of the block. + + The old value (or None if it doesn't exist) will be assigned to the + target of the "as" clause, if there is one. """ if hasattr(obj, attr): real_val = getattr(obj, attr) setattr(obj, attr, new_val) try: - yield + yield real_val finally: setattr(obj, attr, real_val) else: @@ -2086,7 +2099,8 @@ def swap_attr(obj, attr, new_val): try: yield finally: - delattr(obj, attr) + if hasattr(obj, attr): + delattr(obj, attr) @contextlib.contextmanager def swap_item(obj, item, new_val): @@ -2100,12 +2114,15 @@ def swap_item(obj, item, new_val): restoring the old value at the end of the block. If `item` doesn't exist on `obj`, it will be created and then deleted at the end of the block. + + The old value (or None if it doesn't exist) will be assigned to the + target of the "as" clause, if there is one. """ if item in obj: real_val = obj[item] obj[item] = new_val try: - yield + yield real_val finally: obj[item] = real_val else: @@ -2113,7 +2130,8 @@ def swap_item(obj, item, new_val): try: yield finally: - del obj[item] + if item in obj: + del obj[item] def strip_python_stderr(stderr): """Strip the stderr of a Python process from potential debug output @@ -2337,6 +2355,7 @@ class SuppressCrashReport: (0, self.old_value[1])) except (ValueError, OSError): pass + if sys.platform == 'darwin': # Check if the 'Crash Reporter' on OSX was configured # in 'Developer' mode and warn that it will get triggered @@ -2344,10 +2363,14 @@ class SuppressCrashReport: # # This assumes that this context manager is used in tests # that might trigger the next manager. - value = subprocess.Popen(['/usr/bin/defaults', 'read', - 'com.apple.CrashReporter', 'DialogType'], - stdout=subprocess.PIPE).communicate()[0] - if value.strip() == b'developer': + cmd = ['/usr/bin/defaults', 'read', + 'com.apple.CrashReporter', 'DialogType'] + proc = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + with proc: + stdout = proc.communicate()[0] + if stdout.strip() == b'developer': print("this test triggers the Crash Reporter, " "that is intentional", end='', flush=True) diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py index 80889b1..ca5f9c2 100644 --- a/Lib/test/support/script_helper.py +++ b/Lib/test/support/script_helper.py @@ -70,17 +70,28 @@ def run_python_until_end(*args, **env_vars): elif not env_vars and not env_required: # ignore Python environment variables cmd_line.append('-E') - # Need to preserve the original environment, for in-place testing of - # shared library builds. - env = os.environ.copy() - # set TERM='' unless the TERM environment variable is passed explicitly - # see issues #11390 and #18300 - if 'TERM' not in env_vars: - env['TERM'] = '' + # But a special flag that can be set to override -- in this case, the # caller is responsible to pass the full environment. if env_vars.pop('__cleanenv', None): env = {} + if sys.platform == 'win32': + # Windows requires at least the SYSTEMROOT environment variable to + # start Python. + env['SYSTEMROOT'] = os.environ['SYSTEMROOT'] + + # Other interesting environment variables, not copied currently: + # COMSPEC, HOME, PATH, TEMP, TMPDIR, TMP. + else: + # Need to preserve the original environment, for in-place testing of + # shared library builds. + env = os.environ.copy() + + # set TERM='' unless the TERM environment variable is passed explicitly + # see issues #11390 and #18300 + if 'TERM' not in env_vars: + env['TERM'] = '' + env.update(env_vars) cmd_line.extend(args) proc = subprocess.Popen(cmd_line, stdin=subprocess.PIPE, diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index e94d984..2fc5e3e 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -70,17 +70,6 @@ class AllTest(unittest.TestCase): # than an AttributeError somewhere deep in CGIHTTPServer. import _socket - # rlcompleter needs special consideration; it import readline which - # initializes GNU readline which calls setlocale(LC_CTYPE, "")... :-( - import locale - locale_tuple = locale.getlocale(locale.LC_CTYPE) - try: - import rlcompleter - except ImportError: - pass - finally: - locale.setlocale(locale.LC_CTYPE, locale_tuple) - ignored = [] failed_imports = [] lib_dir = os.path.dirname(os.path.dirname(__file__)) diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py index ab51437..eaa24b6 100644 --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -1,5 +1,6 @@ -from test.support import findfile, TESTFN, unlink +from test.support import check_no_resource_warning, findfile, TESTFN, unlink import unittest +from unittest import mock from test import audiotests from audioop import byteswap import os @@ -150,6 +151,21 @@ class AifcMiscTest(audiotests.AudioTests, unittest.TestCase): #This file contains chunk types aifc doesn't recognize. self.f = aifc.open(findfile('Sine-1000Hz-300ms.aif')) + def test_close_opened_files_on_error(self): + non_aifc_file = findfile('pluck-pcm8.wav', subdir='audiodata') + with check_no_resource_warning(self): + with self.assertRaises(aifc.Error): + # Try opening a non-AIFC file, with the expectation that + # `aifc.open` will fail (without raising a ResourceWarning) + self.f = aifc.open(non_aifc_file, 'rb') + + # Aifc_write.initfp() won't raise in normal case. But some errors + # (e.g. MemoryError, KeyboardInterrupt, etc..) can happen. + with mock.patch.object(aifc.Aifc_write, 'initfp', + side_effect=RuntimeError): + with self.assertRaises(RuntimeError): + self.fout = aifc.open(TESTFN, 'wb') + def test_params_added(self): f = self.f = aifc.open(TESTFN, 'wb') f.aiff() diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 4779a13..197d576 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -1943,6 +1943,23 @@ class TestAddSubparsers(TestCase): ++foo foo help ''')) + def test_help_non_breaking_spaces(self): + parser = ErrorRaisingArgumentParser( + prog='PROG', description='main description') + parser.add_argument( + "--non-breaking", action='store_false', + help='help message containing non-breaking spaces shall not ' + 'wrap\N{NO-BREAK SPACE}at non-breaking spaces') + self.assertEqual(parser.format_help(), textwrap.dedent('''\ + usage: PROG [-h] [--non-breaking] + + main description + + optional arguments: + -h, --help show this help message and exit + --non-breaking help message containing non-breaking spaces shall not + wrap\N{NO-BREAK SPACE}at non-breaking spaces + ''')) def test_help_alternate_prefix_chars(self): parser = self._get_parser(prefix_chars='+:/') diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 2a21e74..cbc6b6d 100644 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -1225,7 +1225,26 @@ class NumberTest(BaseTest): b = array.array(self.typecode, a) self.assertEqual(a, b) -class SignedNumberTest(NumberTest): +class IntegerNumberTest(NumberTest): + def test_type_error(self): + a = array.array(self.typecode) + a.append(42) + with self.assertRaises(TypeError): + a.append(42.0) + with self.assertRaises(TypeError): + a[0] = 42.0 + +class Intable: + def __init__(self, num): + self._num = num + def __int__(self): + return self._num + def __sub__(self, other): + return Intable(int(self) - int(other)) + def __add__(self, other): + return Intable(int(self) + int(other)) + +class SignedNumberTest(IntegerNumberTest): example = [-1, 0, 1, 42, 0x7f] smallerexample = [-1, 0, 1, 42, 0x7e] biggerexample = [-1, 0, 1, 43, 0x7f] @@ -1236,8 +1255,9 @@ class SignedNumberTest(NumberTest): lower = -1 * int(pow(2, a.itemsize * 8 - 1)) upper = int(pow(2, a.itemsize * 8 - 1)) - 1 self.check_overflow(lower, upper) + self.check_overflow(Intable(lower), Intable(upper)) -class UnsignedNumberTest(NumberTest): +class UnsignedNumberTest(IntegerNumberTest): example = [0, 1, 17, 23, 42, 0xff] smallerexample = [0, 1, 17, 23, 42, 0xfe] biggerexample = [0, 1, 17, 23, 43, 0xff] @@ -1248,6 +1268,7 @@ class UnsignedNumberTest(NumberTest): lower = 0 upper = int(pow(2, a.itemsize * 8)) - 1 self.check_overflow(lower, upper) + self.check_overflow(Intable(lower), Intable(upper)) def test_bytes_extend(self): s = bytes(self.example) diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 28d92a9..492a84a 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -1,6 +1,7 @@ """Tests for events.py.""" import collections.abc +import concurrent.futures import functools import gc import io @@ -57,6 +58,15 @@ def osx_tiger(): return version < (10, 5) +def _test_get_event_loop_new_process__sub_proc(): + async def doit(): + return 'hello' + + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + return loop.run_until_complete(doit()) + + ONLYCERT = data_file('ssl_cert.pem') ONLYKEY = data_file('ssl_key.pem') SIGNED_CERTFILE = data_file('keycert3.pem') @@ -2181,6 +2191,20 @@ else: asyncio.set_child_watcher(None) super().tearDown() + def test_get_event_loop_new_process(self): + async def main(): + pool = concurrent.futures.ProcessPoolExecutor() + result = await self.loop.run_in_executor( + pool, _test_get_event_loop_new_process__sub_proc) + pool.shutdown() + return result + + self.unpatch_get_running_loop() + + self.assertEqual( + self.loop.run_until_complete(main()), + 'hello') + if hasattr(selectors, 'KqueueSelector'): class KqueueEventLoopTests(UnixEventLoopTestsMixin, SubprocessTestsMixin, diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index c306b77..195a006 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -315,6 +315,14 @@ class FutureTests(test_utils.TestCase): self.assertFalse(m_log.error.called) @mock.patch('asyncio.base_events.logger') + def test_tb_logger_not_called_after_cancel(self, m_log): + fut = asyncio.Future(loop=self.loop) + fut.set_exception(Exception()) + fut.cancel() + del fut + self.assertFalse(m_log.error.called) + + @mock.patch('asyncio.base_events.logger') def test_tb_logger_result_unretrieved(self, m_log): fut = asyncio.Future(loop=self.loop) fut.set_result(42) diff --git a/Lib/test/test_asyncio/test_locks.py b/Lib/test/test_asyncio/test_locks.py index 152948c..c85e8b1 100644 --- a/Lib/test/test_asyncio/test_locks.py +++ b/Lib/test/test_asyncio/test_locks.py @@ -176,6 +176,28 @@ class LockTests(test_utils.TestCase): self.assertTrue(tb.cancelled()) self.assertTrue(tc.done()) + def test_finished_waiter_cancelled(self): + lock = asyncio.Lock(loop=self.loop) + + ta = asyncio.Task(lock.acquire(), loop=self.loop) + test_utils.run_briefly(self.loop) + self.assertTrue(lock.locked()) + + tb = asyncio.Task(lock.acquire(), loop=self.loop) + test_utils.run_briefly(self.loop) + self.assertEqual(len(lock._waiters), 1) + + # Create a second waiter, wake up the first, and cancel it. + # Without the fix, the second was not woken up. + tc = asyncio.Task(lock.acquire(), loop=self.loop) + lock.release() + tb.cancel() + test_utils.run_briefly(self.loop) + + self.assertTrue(lock.locked()) + self.assertTrue(ta.done()) + self.assertTrue(tb.cancelled()) + def test_release_not_acquired(self): lock = asyncio.Lock(loop=self.loop) diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py index 6bf7862..c50b3e4 100644 --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -24,16 +24,14 @@ MOCK_ANY = mock.ANY class TestBaseSelectorEventLoop(BaseSelectorEventLoop): - def close(self): - # Don't call the close() method of the parent class, because the - # selector is mocked - self._closed = True - def _make_self_pipe(self): self._ssock = mock.Mock() self._csock = mock.Mock() self._internal_fds += 1 + def _close_self_pipe(self): + pass + def list_to_buffer(l=()): return bytearray().join(l) diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py index 59ff0f6..bcd236e 100644 --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -42,6 +42,7 @@ class SslProtoHandshakeTests(test_utils.TestCase): sslpipe.do_handshake.side_effect = mock_handshake with mock.patch('asyncio.sslproto._SSLPipe', return_value=sslpipe): ssl_proto.connection_made(transport) + return transport def test_cancel_handshake(self): # Python issue #23197: cancelling a handshake must not raise an @@ -95,5 +96,31 @@ class SslProtoHandshakeTests(test_utils.TestCase): test_utils.run_briefly(self.loop) self.assertIsInstance(waiter.exception(), ConnectionAbortedError) + def test_close_during_handshake(self): + # bpo-29743 Closing transport during handshake process leaks socket + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + + def do_handshake(callback): + return [] + + transport = self.connection_made(ssl_proto) + test_utils.run_briefly(self.loop) + + ssl_proto._app_transport.close() + self.assertTrue(transport.abort.called) + + def test_get_extra_info_on_closed_connection(self): + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + self.assertIsNone(ssl_proto._get_extra_info('socket')) + default = object() + self.assertIs(ssl_proto._get_extra_info('socket', default), default) + self.connection_made(ssl_proto) + self.assertIsNotNone(ssl_proto._get_extra_info('socket')) + ssl_proto.connection_lost(None) + self.assertIsNone(ssl_proto._get_extra_info('socket')) + + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index bba688b..2e14a8a 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -459,6 +459,30 @@ class SubprocessMixin: self.loop.run_until_complete(create) self.assertEqual(warns, []) + def test_read_stdout_after_process_exit(self): + @asyncio.coroutine + def execute(): + code = '\n'.join(['import sys', + 'for _ in range(64):', + ' sys.stdout.write("x" * 4096)', + 'sys.stdout.flush()', + 'sys.exit(1)']) + + fut = asyncio.create_subprocess_exec( + sys.executable, '-c', code, + stdout=asyncio.subprocess.PIPE, + loop=self.loop) + + process = yield from fut + while True: + data = yield from process.stdout.read(65536) + if data: + yield from asyncio.sleep(0.3, loop=self.loop) + else: + break + + self.loop.run_until_complete(execute()) + if sys.platform != 'win32': # Unix diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 9872926..c419015 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -573,6 +573,24 @@ class TaskTests(test_utils.TestCase): self.assertFalse(t._must_cancel) # White-box test. self.assertFalse(t.cancel()) + def test_cancel_at_end(self): + """coroutine end right after task is cancelled""" + loop = asyncio.new_event_loop() + self.set_event_loop(loop) + + @asyncio.coroutine + def task(): + t.cancel() + self.assertTrue(t._must_cancel) # White-box test. + return 12 + + t = asyncio.Task(task(), loop=loop) + self.assertRaises( + asyncio.CancelledError, loop.run_until_complete, t) + self.assertTrue(t.done()) + self.assertFalse(t._must_cancel) # White-box test. + self.assertFalse(t.cancel()) + def test_stop_while_run_in_complete(self): def gen(): @@ -1810,6 +1828,25 @@ class TaskTests(test_utils.TestCase): }) mock_handler.reset_mock() + @mock.patch('asyncio.base_events.logger') + def test_tb_logger_not_called_after_cancel(self, m_log): + loop = asyncio.new_event_loop() + self.set_event_loop(loop) + + @asyncio.coroutine + def coro(): + raise TypeError + + @asyncio.coroutine + def runner(): + task = loop.create_task(coro()) + yield from asyncio.sleep(0.05, loop=loop) + task.cancel() + task = None + + loop.run_until_complete(runner()) + self.assertFalse(m_log.error.called) + @mock.patch('asyncio.coroutines.logger') def test_coroutine_never_yielded(self, m_log): with set_coroutine_debug(True): diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 3857916..18f1ea2 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -656,6 +656,9 @@ class BaseTestAPI: if HAS_UNIX_SOCKETS and self.family == socket.AF_UNIX: self.skipTest("Not applicable to AF_UNIX sockets.") + if sys.platform == "darwin" and self.use_poll: + self.skipTest("poll may fail on macOS; see issue #28087") + class TestClient(BaseClient): def handle_expt(self): self.socket.recv(1024, socket.MSG_OOB) diff --git a/Lib/test/test_atexit.py b/Lib/test/test_atexit.py index 172bd25..1d0b018 100644 --- a/Lib/test/test_atexit.py +++ b/Lib/test/test_atexit.py @@ -23,6 +23,9 @@ def raise1(): def raise2(): raise SystemError +def exit(): + raise SystemExit + class GeneralTest(unittest.TestCase): @@ -76,6 +79,13 @@ class GeneralTest(unittest.TestCase): self.assertRaises(ZeroDivisionError, atexit._run_exitfuncs) self.assertIn("ZeroDivisionError", self.stream.getvalue()) + def test_exit(self): + # be sure a SystemExit is handled properly + atexit.register(exit) + + self.assertRaises(SystemExit, atexit._run_exitfuncs) + self.assertEqual(self.stream.getvalue(), '') + def test_print_tracebacks(self): # Issue #18776: the tracebacks should be printed when errors occur. def f(): @@ -143,6 +153,7 @@ class GeneralTest(unittest.TestCase): self.assertEqual(l, [5]) +@support.cpython_only class SubinterpreterTest(unittest.TestCase): def test_callbacks_leak(self): diff --git a/Lib/test/test_base64.py b/Lib/test/test_base64.py index 4f86aaa..4754739 100644 --- a/Lib/test/test_base64.py +++ b/Lib/test/test_base64.py @@ -18,6 +18,14 @@ class LegacyBase64TestCase(unittest.TestCase): int_data = memoryview(b"1234").cast('I') self.assertRaises(TypeError, f, int_data) + def test_encodestring_warns(self): + with self.assertWarns(DeprecationWarning): + base64.encodestring(b"www.python.org") + + def test_decodestring_warns(self): + with self.assertWarns(DeprecationWarning): + base64.decodestring(b"d3d3LnB5dGhvbi5vcmc=\n") + def test_encodebytes(self): eq = self.assertEqual eq(base64.encodebytes(b"www.python.org"), b"d3d3LnB5dGhvbi5vcmc=\n") diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 0b03340..18e80c7 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -151,6 +151,8 @@ class BuiltinTest(unittest.TestCase): self.assertRaises(TypeError, __import__, 1, 2, 3, 4) self.assertRaises(ValueError, __import__, '') self.assertRaises(TypeError, __import__, 'sys', name='sys') + # embedded null character + self.assertRaises((ImportError, ValueError), __import__, 'string\x00') def test_abs(self): # int @@ -1002,6 +1004,10 @@ class BuiltinTest(unittest.TestCase): self.assertEqual(fp.read(300), 'XXX'*100) self.assertEqual(fp.read(1000), 'YYY'*100) + # embedded null bytes and characters + self.assertRaises(ValueError, open, 'a\x00b') + self.assertRaises(ValueError, open, b'a\x00b') + def test_open_default_encoding(self): old_environ = dict(os.environ) try: diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index 1eadd22..f404858 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -96,7 +96,7 @@ class CAPITest(unittest.TestCase): def __len__(self): return 1 self.assertRaises(TypeError, _posixsubprocess.fork_exec, - 1,Z(),3,[1, 2],5,6,7,8,9,10,11,12,13,14,15,16,17) + 1,Z(),3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17) # Issue #15736: overflow in _PySequence_BytesToCharpArray() class Z(object): def __len__(self): @@ -104,7 +104,7 @@ class CAPITest(unittest.TestCase): def __getitem__(self, i): return b'x' self.assertRaises(MemoryError, _posixsubprocess.fork_exec, - 1,Z(),3,[1, 2],5,6,7,8,9,10,11,12,13,14,15,16,17) + 1,Z(),3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17) @unittest.skipUnless(_posixsubprocess, '_posixsubprocess required for this test.') def test_subprocess_fork_exec(self): @@ -114,7 +114,7 @@ class CAPITest(unittest.TestCase): # Issue #15738: crash in subprocess_fork_exec() self.assertRaises(TypeError, _posixsubprocess.fork_exec, - Z(),[b'1'],3,[1, 2],5,6,7,8,9,10,11,12,13,14,15,16,17) + Z(),[b'1'],3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17) @unittest.skipIf(MISSING_C_DOCSTRINGS, "Signature information for builtins requires docstrings") @@ -487,9 +487,8 @@ class SkipitemTest(unittest.TestCase): # test the format unit when not skipped format = c + "i" try: - # (note: the format string must be bytes!) _testcapi.parse_tuple_and_keywords(tuple_1, dict_b, - format.encode("ascii"), keywords) + format, keywords) when_not_skipped = False except TypeError as e: s = "argument 1 (impossible)" @@ -501,7 +500,7 @@ class SkipitemTest(unittest.TestCase): optional_format = "|" + format try: _testcapi.parse_tuple_and_keywords(empty_tuple, dict_b, - optional_format.encode("ascii"), keywords) + optional_format, keywords) when_skipped = False except RuntimeError as e: s = "impossible: '{}'".format(format) @@ -514,15 +513,36 @@ class SkipitemTest(unittest.TestCase): self.assertIs(when_skipped, when_not_skipped, message) def test_parse_tuple_and_keywords(self): - # parse_tuple_and_keywords error handling tests + # Test handling errors in the parse_tuple_and_keywords helper itself self.assertRaises(TypeError, _testcapi.parse_tuple_and_keywords, (), {}, 42, []) self.assertRaises(ValueError, _testcapi.parse_tuple_and_keywords, - (), {}, b'', 42) + (), {}, '', 42) self.assertRaises(ValueError, _testcapi.parse_tuple_and_keywords, - (), {}, b'', [''] * 42) + (), {}, '', [''] * 42) self.assertRaises(ValueError, _testcapi.parse_tuple_and_keywords, - (), {}, b'', [42]) + (), {}, '', [42]) + + def test_bad_use(self): + # Test handling invalid format and keywords in + # PyArg_ParseTupleAndKeywords() + self.assertRaises((TypeError, SystemError), _testcapi.parse_tuple_and_keywords, + (1,), {}, '||O', ['a']) + self.assertRaises((RuntimeError, SystemError), _testcapi.parse_tuple_and_keywords, + (1, 2), {}, '|O|O', ['a', 'b']) + self.assertRaises((TypeError, SystemError), _testcapi.parse_tuple_and_keywords, + (), {'a': 1}, '$$O', ['a']) + self.assertRaises((RuntimeError, SystemError), _testcapi.parse_tuple_and_keywords, + (), {'a': 1, 'b': 2}, '$O$O', ['a', 'b']) + self.assertRaises((TypeError, SystemError), _testcapi.parse_tuple_and_keywords, + (), {'a': 1}, '$|O', ['a']) + self.assertRaises((RuntimeError, SystemError), _testcapi.parse_tuple_and_keywords, + (), {'a': 1, 'b': 2}, '$O|O', ['a', 'b']) + self.assertRaises((RuntimeError, SystemError), _testcapi.parse_tuple_and_keywords, + (1,), {}, '|O', ['a', 'b']) + self.assertRaises((RuntimeError, SystemError), _testcapi.parse_tuple_and_keywords, + (1,), {}, '|OO', ['a']) + @unittest.skipUnless(threading, 'Threading required for this test.') class TestThreadState(unittest.TestCase): diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py index 4d554a3..ecc01f2 100644 --- a/Lib/test/test_class.py +++ b/Lib/test/test_class.py @@ -568,5 +568,32 @@ class ClassTests(unittest.TestCase): a = A(hash(A.f)^(-1)) hash(a.f) + def testSetattrWrapperNameIntern(self): + # Issue #25794: __setattr__ should intern the attribute name + class A: + pass + + def add(self, other): + return 'summa' + + name = str(b'__add__', 'ascii') # shouldn't be optimized + self.assertIsNot(name, '__add__') # not interned + type.__setattr__(A, name, add) + self.assertEqual(A() + 1, 'summa') + + name2 = str(b'__add__', 'ascii') + self.assertIsNot(name2, '__add__') + self.assertIsNot(name2, name) + type.__delattr__(A, name2) + with self.assertRaises(TypeError): + A() + 1 + + def testSetattrNonStringName(self): + class A: + pass + + with self.assertRaises(TypeError): + type.__setattr__(A, b'x', None) + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_codecencodings_cn.py b/Lib/test/test_codecencodings_cn.py index d0e3a15..5101b5c 100644 --- a/Lib/test/test_codecencodings_cn.py +++ b/Lib/test/test_codecencodings_cn.py @@ -49,6 +49,12 @@ class Test_GB18030(multibytecodec_support.TestBase, unittest.TestCase): (b"abc\x84\x32\x80\x80def", "replace", 'abc\ufffd2\ufffd\ufffddef'), (b"abc\x81\x30\x81\x30def", "strict", 'abc\x80def'), (b"abc\x86\x30\x81\x30def", "replace", 'abc\ufffd0\ufffd0def'), + # issue29990 + (b"\xff\x30\x81\x30", "strict", None), + (b"\x81\x30\xff\x30", "strict", None), + (b"abc\x81\x39\xff\x39\xc1\xc4", "replace", "abc\ufffd\x39\ufffd\x39\u804a"), + (b"abc\xab\x36\xff\x30def", "replace", 'abc\ufffd\x36\ufffd\x30def'), + (b"abc\xbf\x38\xff\x32\xc1\xc4", "ignore", "abc\x38\x32\u804a"), ) has_iso10646 = True @@ -81,6 +87,10 @@ class Test_HZ(multibytecodec_support.TestBase, unittest.TestCase): (b'ab~{\x81\x81\x41\x44~}cd', 'replace', 'ab\uFFFD\uFFFD\u804Acd'), (b'ab~{\x41\x44~}cd', 'replace', 'ab\u804Acd'), (b"ab~{\x79\x79\x41\x44~}cd", "replace", "ab\ufffd\ufffd\u804acd"), + # issue 30003 + ('ab~cd', 'strict', b'ab~~cd'), # escape ~ + (b'~{Dc~~:C~}', 'strict', None), # ~~ only in ASCII mode + (b'~{Dc~\n:C~}', 'strict', None), # ~\n only in ASCII mode ) if __name__ == "__main__": diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 824e843..4ea66a4 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -634,6 +634,7 @@ if 1: f1 = ns['f1'] f2 = ns['f2'] self.assertIsNot(f1.__code__, f2.__code__) + self.assertNotEqual(f1.__code__, f2.__code__) self.check_constant(f1, const1) self.check_constant(f2, const2) self.assertEqual(repr(f1()), repr(const1)) @@ -642,6 +643,8 @@ if 1: check_different_constants(0, 0.0) check_different_constants(+0.0, -0.0) check_different_constants((0,), (0.0,)) + check_different_constants('a', b'a') + check_different_constants(('a',), (b'a',)) # check_different_constants() cannot be used because repr(-0j) is # '(-0-0j)', but when '(-0-0j)' is evaluated to 0j: we loose the sign. diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py index 403ee3b..8d551a4 100644 --- a/Lib/test/test_complex.py +++ b/Lib/test/test_complex.py @@ -385,6 +385,29 @@ class ComplexTest(unittest.TestCase): self.assertAlmostEqual(complex(complex1(1j)), 2j) self.assertRaises(TypeError, complex, complex2(1j)) + @support.requires_IEEE_754 + def test_constructor_special_numbers(self): + class complex2(complex): + pass + for x in 0.0, -0.0, INF, -INF, NAN: + for y in 0.0, -0.0, INF, -INF, NAN: + with self.subTest(x=x, y=y): + z = complex(x, y) + self.assertFloatsAreIdentical(z.real, x) + self.assertFloatsAreIdentical(z.imag, y) + z = complex2(x, y) + self.assertIs(type(z), complex2) + self.assertFloatsAreIdentical(z.real, x) + self.assertFloatsAreIdentical(z.imag, y) + z = complex(complex2(x, y)) + self.assertIs(type(z), complex) + self.assertFloatsAreIdentical(z.real, x) + self.assertFloatsAreIdentical(z.imag, y) + z = complex2(complex(x, y)) + self.assertIs(type(z), complex2) + self.assertFloatsAreIdentical(z.real, x) + self.assertFloatsAreIdentical(z.imag, y) + def test_hash(self): for x in range(-30, 30): self.assertEqual(hash(x), hash(complex(x, 0))) diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py index 516403e..ad1b6cd 100644 --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -119,6 +119,29 @@ def woohoo(): else: self.fail('StopIteration was suppressed') + def test_contextmanager_do_not_unchain_non_stopiteration_exceptions(self): + @contextmanager + def test_issue29692(): + try: + yield + except Exception as exc: + raise RuntimeError('issue29692:Chained') from exc + try: + with test_issue29692(): + raise ZeroDivisionError + except Exception as ex: + self.assertIs(type(ex), RuntimeError) + self.assertEqual(ex.args[0], 'issue29692:Chained') + self.assertIsInstance(ex.__cause__, ZeroDivisionError) + + try: + with test_issue29692(): + raise StopIteration('issue29692:Unchained') + except Exception as ex: + self.assertIs(type(ex), StopIteration) + self.assertEqual(ex.args[0], 'issue29692:Unchained') + self.assertIsNone(ex.__cause__) + def _create_contextmanager_attribs(self): def attribs(**kw): def decorate(func): diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py index 4a327b5..402fbe8 100644 --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -975,6 +975,21 @@ class CoroutineTest(unittest.TestCase): "coroutine is being awaited already"): waiter(coro).send(None) + def test_await_16(self): + # See https://bugs.python.org/issue29600 for details. + + async def f(): + return ValueError() + + async def g(): + try: + raise KeyError + except: + return await f() + + _, result = run_async(g()) + self.assertIsNone(result.__context__) + def test_with_1(self): class Manager: def __init__(self, name): @@ -1757,6 +1772,7 @@ class SysSetCoroWrapperTest(unittest.TestCase): sys.set_coroutine_wrapper(None) +@support.cpython_only class CAPITest(unittest.TestCase): def test_tp_await_1(self): diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py index 14ba87f..0d0b160 100644 --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -81,7 +81,7 @@ class TestCurses(unittest.TestCase): win2 = curses.newwin(15,15, 5,5) for meth in [stdscr.addch, stdscr.addstr]: - for args in [('a'), ('a', curses.A_BOLD), + for args in [('a',), ('a', curses.A_BOLD), (4,4, 'a'), (5,5, 'a', curses.A_BOLD)]: with self.subTest(meth=meth.__qualname__, args=args): meth(*args) @@ -194,6 +194,15 @@ class TestCurses(unittest.TestCase): self.assertRaises(ValueError, stdscr.instr, -2) self.assertRaises(ValueError, stdscr.instr, 2, 3, -2) + def test_embedded_null_chars(self): + # reject embedded null bytes and characters + stdscr = self.stdscr + for arg in ['a', b'a']: + with self.subTest(arg=arg): + self.assertRaises(ValueError, stdscr.addstr, 'a\0') + self.assertRaises(ValueError, stdscr.addnstr, 'a\0', 1) + self.assertRaises(ValueError, stdscr.insstr, 'a\0') + self.assertRaises(ValueError, stdscr.insnstr, 'a\0', 1) def test_module_funcs(self): "Test module-level functions" @@ -244,7 +253,7 @@ class TestCurses(unittest.TestCase): # Functions only available on a few platforms def test_colors_funcs(self): if not curses.has_colors(): - self.skip('requires colors support') + self.skipTest('requires colors support') curses.start_color() curses.init_pair(2, 1,1) curses.color_content(1) @@ -267,7 +276,7 @@ class TestCurses(unittest.TestCase): def test_getmouse(self): (availmask, oldmask) = curses.mousemask(curses.BUTTON1_PRESSED) if availmask == 0: - self.skip('mouse stuff not available') + self.skipTest('mouse stuff not available') curses.mouseinterval(10) # just verify these don't cause errors curses.ungetmouse(0, 0, 0, 0, curses.BUTTON1_PRESSED) diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index b85d333..f59490a 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -976,6 +976,92 @@ class DictTest(unittest.TestCase): support.check_free_after_iterating(self, lambda d: iter(d.values()), dict) support.check_free_after_iterating(self, lambda d: iter(d.items()), dict) + def test_equal_operator_modifying_operand(self): + # test fix for seg fault reported in issue 27945 part 3. + class X(): + def __del__(self): + dict_b.clear() + + def __eq__(self, other): + dict_a.clear() + return True + + def __hash__(self): + return 13 + + dict_a = {X(): 0} + dict_b = {X(): X()} + self.assertTrue(dict_a == dict_b) + + def test_fromkeys_operator_modifying_dict_operand(self): + # test fix for seg fault reported in issue 27945 part 4a. + class X(int): + def __hash__(self): + return 13 + + def __eq__(self, other): + if len(d) > 1: + d.clear() + return False + + d = {} # this is required to exist so that d can be constructed! + d = {X(1): 1, X(2): 2} + try: + dict.fromkeys(d) # shouldn't crash + except RuntimeError: # implementation defined + pass + + def test_fromkeys_operator_modifying_set_operand(self): + # test fix for seg fault reported in issue 27945 part 4b. + class X(int): + def __hash__(self): + return 13 + + def __eq__(self, other): + if len(d) > 1: + d.clear() + return False + + d = {} # this is required to exist so that d can be constructed! + d = {X(1), X(2)} + try: + dict.fromkeys(d) # shouldn't crash + except RuntimeError: # implementation defined + pass + + def test_dictitems_contains_use_after_free(self): + class X: + def __eq__(self, other): + d.clear() + return NotImplemented + + d = {0: set()} + (0, X()) in d.items() + + def test_init_use_after_free(self): + class X: + def __hash__(self): + pair[:] = [] + return 13 + + pair = [X(), 123] + dict([pair]) + + def test_oob_indexing_dictiter_iternextitem(self): + class X(int): + def __del__(self): + d.clear() + + d = {i: X(i) for i in range(8)} + + def iter_and_mutate(): + for result in d.items(): + if result[0] == 2: + d[2] = None # free d[2] --> X(2).__del__ was called + + self.assertRaises(RuntimeError, iter_and_mutate) + + from test import mapping_tests class GeneralMappingTests(mapping_tests.BasicTestMappingProtocol): diff --git a/Lib/test/test_eintr.py b/Lib/test/test_eintr.py index aabad83..25f86d3 100644 --- a/Lib/test/test_eintr.py +++ b/Lib/test/test_eintr.py @@ -1,7 +1,5 @@ import os import signal -import subprocess -import sys import unittest from test import support @@ -16,14 +14,8 @@ class EINTRTests(unittest.TestCase): # Run the tester in a sub-process, to make sure there is only one # thread (for reliable signal delivery). tester = support.findfile("eintr_tester.py", subdir="eintrdata") - - if support.verbose: - args = [sys.executable, tester] - with subprocess.Popen(args) as proc: - exitcode = proc.wait() - self.assertEqual(exitcode, 0) - else: - script_helper.assert_python_ok(tester) + # use -u to try to get the full output if the test hangs or crash + script_helper.assert_python_ok("-u", tester) if __name__ == "__main__": diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py index f7ac0e3..b1e7dff 100644 --- a/Lib/test/test_email/test__header_value_parser.py +++ b/Lib/test/test_email/test__header_value_parser.py @@ -2711,5 +2711,17 @@ class TestFolding(TestEmailBase): self._test(parser.get_unstructured('xxx ' + 'y'*77), 'xxx \n ' + 'y'*77 + '\n') + def test_long_filename_attachment(self): + folded = self.policy.fold('Content-Disposition', 'attachment; filename="TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TES.txt"') + self.assertEqual( + 'Content-Disposition: attachment;\n filename="TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TES.txt"\n', + folded + ) + folded = self.policy.fold('Content-Disposition', 'attachment; filename="TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_T.txt"') + self.assertEqual( + 'Content-Disposition: attachment;\n filename="TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_T.txt"\n', + folded + ) + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_email/test_generator.py b/Lib/test/test_email/test_generator.py index b1cbce2..226c5f9 100644 --- a/Lib/test/test_email/test_generator.py +++ b/Lib/test/test_email/test_generator.py @@ -162,6 +162,13 @@ class TestGeneratorBase: g.flatten(msg) self.assertEqual(s.getvalue(), self.typ(expected)) + def test_compat32_max_line_length_does_not_fold_when_none(self): + msg = self.msgmaker(self.typ(self.refold_long_expected[0])) + s = self.ioclass() + g = self.genclass(s, policy=policy.compat32.clone(max_line_length=None)) + g.flatten(msg) + self.assertEqual(s.getvalue(), self.typ(self.refold_long_expected[0])) + class TestGenerator(TestGeneratorBase, TestEmailBase): diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 96c3a48..12cf7b8 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -1,5 +1,6 @@ # Python test set -- part 5, built-in exceptions +import copy import os import sys import unittest @@ -1120,6 +1121,25 @@ class ImportErrorTests(unittest.TestCase): exc = ImportError(arg) self.assertEqual(str(arg), str(exc)) + def test_copy_pickle(self): + for kwargs in (dict(), + dict(name='somename'), + dict(path='somepath'), + dict(name='somename', path='somepath')): + orig = ImportError('test', **kwargs) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + exc = pickle.loads(pickle.dumps(orig, proto)) + self.assertEqual(exc.args, ('test',)) + self.assertEqual(exc.msg, 'test') + self.assertEqual(exc.name, orig.name) + self.assertEqual(exc.path, orig.path) + for c in copy.copy, copy.deepcopy: + exc = c(orig) + self.assertEqual(exc.args, ('test',)) + self.assertEqual(exc.msg, 'test') + self.assertEqual(exc.name, orig.name) + self.assertEqual(exc.path, orig.path) + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py index 9cb0d38..94501de 100644 --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -52,15 +52,15 @@ Here we add keyword arguments >>> f(1, 2, **{'a': -1, 'b': 5}, **{'a': 4, 'c': 6}) Traceback (most recent call last): ... - TypeError: f() got multiple values for keyword argument 'a' + TypeError: function got multiple values for keyword argument 'a' >>> f(1, 2, **{'a': -1, 'b': 5}, a=4, c=6) Traceback (most recent call last): ... - TypeError: f() got multiple values for keyword argument 'a' + TypeError: function got multiple values for keyword argument 'a' >>> f(1, 2, a=3, **{'a': 4}, **{'a': 5}) Traceback (most recent call last): ... - TypeError: f() got multiple values for keyword argument 'a' + TypeError: function got multiple values for keyword argument 'a' >>> f(1, 2, 3, *[4, 5], **{'a':6, 'b':7}) (1, 2, 3, 4, 5) {'a': 6, 'b': 7} >>> f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b': 9}) diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py index 12f2f11..1bc1847 100644 --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -9,7 +9,8 @@ from array import array from weakref import proxy from functools import wraps -from test.support import TESTFN, check_warnings, run_unittest, make_bad_fd, cpython_only +from test.support import (TESTFN, check_warnings, run_unittest, + make_bad_fd, cpython_only, swap_attr) from collections import UserList import _io # C implementation of io @@ -175,6 +176,12 @@ class AutoFileTests: finally: os.close(fd) + def testRecursiveRepr(self): + # Issue #25455 + with swap_attr(self.f, 'name', self.f): + with self.assertRaises(RuntimeError): + repr(self.f) # Should not crash + def testErrors(self): f = self.f self.assertFalse(f.isatty()) diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index cb1f6db..28b6954 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -98,15 +98,27 @@ class GeneralFloatCases(unittest.TestCase): self.assertEqual(float(memoryview(b'12.34')[1:4]), 2.3) def test_error_message(self): - testlist = ('\xbd', '123\xbd', ' 123 456 ') - for s in testlist: - try: + def check(s): + with self.assertRaises(ValueError, msg='float(%r)' % (s,)) as cm: float(s) - except ValueError as e: - self.assertIn(s.strip(), e.args[0]) - else: - self.fail("Expected int(%r) to raise a ValueError", s) - + self.assertEqual(str(cm.exception), + 'could not convert string to float: %r' % (s,)) + + check('\xbd') + check('123\xbd') + check(' 123 456 ') + check(b' 123 456 ') + + # non-ascii digits (error came from non-digit '!') + check('\u0663\u0661\u0664!') + # embedded NUL + check('123\x00') + check('123\x00 245') + check('123\x00245') + # byte string with embedded NUL + check(b'123\x00') + # non-UTF-8 byte string + check(b'123\xa0') @support.run_with_locale('LC_NUMERIC', 'fr_FR', 'de_DE') def test_float_with_comma(self): diff --git a/Lib/test/test_fnmatch.py b/Lib/test/test_fnmatch.py index fa37f90..e37e4f5 100644 --- a/Lib/test/test_fnmatch.py +++ b/Lib/test/test_fnmatch.py @@ -1,18 +1,19 @@ """Test cases for the fnmatch module.""" import unittest +import os from fnmatch import fnmatch, fnmatchcase, translate, filter class FnmatchTestCase(unittest.TestCase): - def check_match(self, filename, pattern, should_match=1, fn=fnmatch): + def check_match(self, filename, pattern, should_match=True, fn=fnmatch): if should_match: self.assertTrue(fn(filename, pattern), "expected %r to match pattern %r" % (filename, pattern)) else: - self.assertTrue(not fn(filename, pattern), + self.assertFalse(fn(filename, pattern), "expected %r not to match pattern %r" % (filename, pattern)) @@ -26,15 +27,15 @@ class FnmatchTestCase(unittest.TestCase): check('abc', '*') check('abc', 'ab[cd]') check('abc', 'ab[!de]') - check('abc', 'ab[de]', 0) - check('a', '??', 0) - check('a', 'b', 0) + check('abc', 'ab[de]', False) + check('a', '??', False) + check('a', 'b', False) # these test that '\' is handled correctly in character sets; # see SF bug #409651 check('\\', r'[\]') check('a', r'[!\]') - check('\\', r'[!\]', 0) + check('\\', r'[!\]', False) # test that filenames with newlines in them are handled correctly. # http://bugs.python.org/issue6665 @@ -51,14 +52,38 @@ class FnmatchTestCase(unittest.TestCase): def test_fnmatchcase(self): check = self.check_match - check('AbC', 'abc', 0, fnmatchcase) - check('abc', 'AbC', 0, fnmatchcase) + check('abc', 'abc', True, fnmatchcase) + check('AbC', 'abc', False, fnmatchcase) + check('abc', 'AbC', False, fnmatchcase) + check('AbC', 'AbC', True, fnmatchcase) + + check('usr/bin', 'usr/bin', True, fnmatchcase) + check('usr\\bin', 'usr/bin', False, fnmatchcase) + check('usr/bin', 'usr\\bin', False, fnmatchcase) + check('usr\\bin', 'usr\\bin', True, fnmatchcase) def test_bytes(self): self.check_match(b'test', b'te*') self.check_match(b'test\xff', b'te*\xff') self.check_match(b'foo\nbar', b'foo*') + def test_case(self): + ignorecase = os.path.normcase('ABC') == os.path.normcase('abc') + check = self.check_match + check('abc', 'abc') + check('AbC', 'abc', ignorecase) + check('abc', 'AbC', ignorecase) + check('AbC', 'AbC') + + def test_sep(self): + normsep = os.path.normcase('\\') == os.path.normcase('/') + check = self.check_match + check('usr/bin', 'usr/bin') + check('usr\\bin', 'usr/bin', normsep) + check('usr/bin', 'usr\\bin', normsep) + check('usr\\bin', 'usr\\bin') + + class TranslateTestCase(unittest.TestCase): def test_translate(self): @@ -75,7 +100,28 @@ class TranslateTestCase(unittest.TestCase): class FilterTestCase(unittest.TestCase): def test_filter(self): - self.assertEqual(filter(['a', 'b'], 'a'), ['a']) + self.assertEqual(filter(['Python', 'Ruby', 'Perl', 'Tcl'], 'P*'), + ['Python', 'Perl']) + self.assertEqual(filter([b'Python', b'Ruby', b'Perl', b'Tcl'], b'P*'), + [b'Python', b'Perl']) + + def test_mix_bytes_str(self): + self.assertRaises(TypeError, filter, ['test'], b'*') + self.assertRaises(TypeError, filter, [b'test'], '*') + + def test_case(self): + ignorecase = os.path.normcase('P') == os.path.normcase('p') + self.assertEqual(filter(['Test.py', 'Test.rb', 'Test.PL'], '*.p*'), + ['Test.py', 'Test.PL'] if ignorecase else ['Test.py']) + self.assertEqual(filter(['Test.py', 'Test.rb', 'Test.PL'], '*.P*'), + ['Test.py', 'Test.PL'] if ignorecase else ['Test.PL']) + + def test_sep(self): + normsep = os.path.normcase('\\') == os.path.normcase('/') + self.assertEqual(filter(['usr/bin', 'usr', 'usr\\lib'], 'usr/*'), + ['usr/bin', 'usr\\lib'] if normsep else ['usr/bin']) + self.assertEqual(filter(['usr/bin', 'usr', 'usr\\lib'], 'usr\\*'), + ['usr/bin', 'usr\\lib'] if normsep else ['usr\\lib']) if __name__ == "__main__": diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py index aef66da..583d3b1 100644 --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -482,6 +482,9 @@ class TestFTPClass(TestCase): self.assertEqual(self.client.sanitize('PASS 12345'), repr('PASS *****')) def test_exceptions(self): + self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\r\n0') + self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\n0') + self.assertRaises(ValueError, self.client.sendcmd, 'echo 40\r0') self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 400') self.assertRaises(ftplib.error_temp, self.client.sendcmd, 'echo 499') self.assertRaises(ftplib.error_perm, self.client.sendcmd, 'echo 500') @@ -490,7 +493,8 @@ class TestFTPClass(TestCase): def test_all_errors(self): exceptions = (ftplib.error_reply, ftplib.error_temp, ftplib.error_perm, - ftplib.error_proto, ftplib.Error, OSError, EOFError) + ftplib.error_proto, ftplib.Error, OSError, + EOFError) for x in exceptions: try: raise x('exception not included in all_errors set') diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index b431e05..04ffab9 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -7,6 +7,7 @@ import pickle from random import choice import sys from test import support +import time import unittest from weakref import proxy try: @@ -79,6 +80,15 @@ class TestPartial: p(b=7) self.assertEqual(d, {'a':3}) + def test_kwargs_copy(self): + # Issue #29532: Altering a kwarg dictionary passed to a constructor + # should not affect a partial object after creation + d = {'a': 3} + p = self.partial(capture, **d) + self.assertEqual(p(), ((), {'a': 3})) + d['a'] = 5 + self.assertEqual(p(), ((), {'a': 3})) + def test_arg_combinations(self): # exercise special code paths for zero args in either partial # object or the caller @@ -377,6 +387,32 @@ class TestPartialC(TestPartial, unittest.TestCase): self.assertRaises(TypeError, f.__setstate__, BadSequence()) + def test_manually_adding_non_string_keyword(self): + p = self.partial(capture) + # Adding a non-string/unicode keyword to partial kwargs + p.keywords[1234] = 'value' + r = repr(p) + self.assertIn('1234', r) + self.assertIn("'value'", r) + with self.assertRaises(TypeError): + p() + + def test_keystr_replaces_value(self): + p = self.partial(capture) + + class MutatesYourDict(object): + def __str__(self): + p.keywords[self] = ['sth2'] + return 'astr' + + # Raplacing the value during key formatting should keep the original + # value alive (at least long enough). + p.keywords[MutatesYourDict()] = ['sth'] + r = repr(p) + self.assertIn('astr', r) + self.assertIn("['sth']", r) + + class TestPartialPy(TestPartial, unittest.TestCase): partial = staticmethod(py_functools.partial) @@ -1364,6 +1400,20 @@ class TestLRU: pause.reset() self.assertEqual(f.cache_info(), (0, (i+1)*n, m*n, i+1)) + @unittest.skipUnless(threading, 'This test requires threading.') + def test_lru_cache_threaded3(self): + @self.module.lru_cache(maxsize=2) + def f(x): + time.sleep(.01) + return 3 * x + def test(i, x): + with self.subTest(thread=i): + self.assertEqual(f(x), 3 * x, i) + threads = [threading.Thread(target=test, args=(i, v)) + for i, v in enumerate([1, 2, 2, 3, 2])] + with support.start_threads(threads): + pass + def test_need_for_rlock(self): # This will deadlock on an LRU cache that uses a regular lock diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py index f57e546..df3dc2b 100644 --- a/Lib/test/test_gettext.py +++ b/Lib/test/test_gettext.py @@ -2,6 +2,7 @@ import os import base64 import shutil import gettext +import locale import unittest from test import support @@ -453,6 +454,122 @@ class PluralFormsTestCase(GettextBaseTest): self.assertRaises(TypeError, f, object()) +class LGettextTestCase(GettextBaseTest): + def setUp(self): + GettextBaseTest.setUp(self) + self.mofile = MOFILE + + def test_lgettext(self): + lgettext = gettext.lgettext + ldgettext = gettext.ldgettext + self.assertEqual(lgettext('mullusk'), b'bacon') + self.assertEqual(lgettext('spam'), b'spam') + self.assertEqual(ldgettext('gettext', 'mullusk'), b'bacon') + self.assertEqual(ldgettext('gettext', 'spam'), b'spam') + + def test_lgettext_2(self): + with open(self.mofile, 'rb') as fp: + t = gettext.GNUTranslations(fp) + lgettext = t.lgettext + self.assertEqual(lgettext('mullusk'), b'bacon') + self.assertEqual(lgettext('spam'), b'spam') + + def test_lgettext_bind_textdomain_codeset(self): + lgettext = gettext.lgettext + ldgettext = gettext.ldgettext + saved_codeset = gettext.bind_textdomain_codeset('gettext') + try: + gettext.bind_textdomain_codeset('gettext', 'utf-16') + self.assertEqual(lgettext('mullusk'), 'bacon'.encode('utf-16')) + self.assertEqual(lgettext('spam'), 'spam'.encode('utf-16')) + self.assertEqual(ldgettext('gettext', 'mullusk'), 'bacon'.encode('utf-16')) + self.assertEqual(ldgettext('gettext', 'spam'), 'spam'.encode('utf-16')) + finally: + del gettext._localecodesets['gettext'] + gettext.bind_textdomain_codeset('gettext', saved_codeset) + + def test_lgettext_output_encoding(self): + with open(self.mofile, 'rb') as fp: + t = gettext.GNUTranslations(fp) + lgettext = t.lgettext + t.set_output_charset('utf-16') + self.assertEqual(lgettext('mullusk'), 'bacon'.encode('utf-16')) + self.assertEqual(lgettext('spam'), 'spam'.encode('utf-16')) + + def test_lngettext(self): + lngettext = gettext.lngettext + ldngettext = gettext.ldngettext + x = lngettext('There is %s file', 'There are %s files', 1) + self.assertEqual(x, b'Hay %s fichero') + x = lngettext('There is %s file', 'There are %s files', 2) + self.assertEqual(x, b'Hay %s ficheros') + x = lngettext('There is %s directory', 'There are %s directories', 1) + self.assertEqual(x, b'There is %s directory') + x = lngettext('There is %s directory', 'There are %s directories', 2) + self.assertEqual(x, b'There are %s directories') + x = ldngettext('gettext', 'There is %s file', 'There are %s files', 1) + self.assertEqual(x, b'Hay %s fichero') + x = ldngettext('gettext', 'There is %s file', 'There are %s files', 2) + self.assertEqual(x, b'Hay %s ficheros') + x = ldngettext('gettext', 'There is %s directory', 'There are %s directories', 1) + self.assertEqual(x, b'There is %s directory') + x = ldngettext('gettext', 'There is %s directory', 'There are %s directories', 2) + self.assertEqual(x, b'There are %s directories') + + def test_lngettext_2(self): + with open(self.mofile, 'rb') as fp: + t = gettext.GNUTranslations(fp) + lngettext = t.lngettext + x = lngettext('There is %s file', 'There are %s files', 1) + self.assertEqual(x, b'Hay %s fichero') + x = lngettext('There is %s file', 'There are %s files', 2) + self.assertEqual(x, b'Hay %s ficheros') + x = lngettext('There is %s directory', 'There are %s directories', 1) + self.assertEqual(x, b'There is %s directory') + x = lngettext('There is %s directory', 'There are %s directories', 2) + self.assertEqual(x, b'There are %s directories') + + def test_lngettext_bind_textdomain_codeset(self): + lngettext = gettext.lngettext + ldngettext = gettext.ldngettext + saved_codeset = gettext.bind_textdomain_codeset('gettext') + try: + gettext.bind_textdomain_codeset('gettext', 'utf-16') + x = lngettext('There is %s file', 'There are %s files', 1) + self.assertEqual(x, 'Hay %s fichero'.encode('utf-16')) + x = lngettext('There is %s file', 'There are %s files', 2) + self.assertEqual(x, 'Hay %s ficheros'.encode('utf-16')) + x = lngettext('There is %s directory', 'There are %s directories', 1) + self.assertEqual(x, 'There is %s directory'.encode('utf-16')) + x = lngettext('There is %s directory', 'There are %s directories', 2) + self.assertEqual(x, 'There are %s directories'.encode('utf-16')) + x = ldngettext('gettext', 'There is %s file', 'There are %s files', 1) + self.assertEqual(x, 'Hay %s fichero'.encode('utf-16')) + x = ldngettext('gettext', 'There is %s file', 'There are %s files', 2) + self.assertEqual(x, 'Hay %s ficheros'.encode('utf-16')) + x = ldngettext('gettext', 'There is %s directory', 'There are %s directories', 1) + self.assertEqual(x, 'There is %s directory'.encode('utf-16')) + x = ldngettext('gettext', 'There is %s directory', 'There are %s directories', 2) + self.assertEqual(x, 'There are %s directories'.encode('utf-16')) + finally: + del gettext._localecodesets['gettext'] + gettext.bind_textdomain_codeset('gettext', saved_codeset) + + def test_lngettext_output_encoding(self): + with open(self.mofile, 'rb') as fp: + t = gettext.GNUTranslations(fp) + lngettext = t.lngettext + t.set_output_charset('utf-16') + x = lngettext('There is %s file', 'There are %s files', 1) + self.assertEqual(x, 'Hay %s fichero'.encode('utf-16')) + x = lngettext('There is %s file', 'There are %s files', 2) + self.assertEqual(x, 'Hay %s ficheros'.encode('utf-16')) + x = lngettext('There is %s directory', 'There are %s directories', 1) + self.assertEqual(x, 'There is %s directory'.encode('utf-16')) + x = lngettext('There is %s directory', 'There are %s directories', 2) + self.assertEqual(x, 'There are %s directories'.encode('utf-16')) + + class GNUTranslationParsingTest(GettextBaseTest): def test_plural_form_error_issue17898(self): with open(MOFILE, 'wb') as fp: @@ -470,13 +587,10 @@ class UnicodeTranslationsTest(GettextBaseTest): self._ = self.t.gettext def test_unicode_msgid(self): - unless = self.assertTrue - unless(isinstance(self._(''), str)) - unless(isinstance(self._(''), str)) + self.assertIsInstance(self._(''), str) def test_unicode_msgstr(self): - eq = self.assertEqual - eq(self._('ab\xde'), '\xa4yz') + self.assertEqual(self._('ab\xde'), '\xa4yz') class WeirdMetadataTest(GettextBaseTest): @@ -539,7 +653,7 @@ if __name__ == '__main__': # The original version was automatically generated from the sources with # pygettext. Later it was manually modified to add plural forms support. -''' +b''' # Dummy translation for the Python test_gettext.py module. # Copyright (C) 2001 Python Software Foundation # Barry Warsaw , 2000. @@ -599,7 +713,7 @@ msgstr[1] "Hay %s ficheros" # Here's the second example po file example, used to generate the UMO_DATA # containing utf-8 encoded Unicode strings -''' +b''' # Dummy translation for the Python test_gettext.py module. # Copyright (C) 2001 Python Software Foundation # Barry Warsaw , 2000. @@ -622,7 +736,7 @@ msgstr "\xc2\xa4yz" # Here's the third example po file, used to generate MMO_DATA -''' +b''' msgid "" msgstr "" "Project-Id-Version: No Project 0.0\n" @@ -641,7 +755,7 @@ msgstr "" # messages.po, used for bug 17898 # -''' +b''' # test file for http://bugs.python.org/issue17898 msgid "" msgstr "" diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py index 272b086..c218ea3 100644 --- a/Lib/test/test_grp.py +++ b/Lib/test/test_grp.py @@ -50,6 +50,8 @@ class GroupDatabaseTestCase(unittest.TestCase): self.assertRaises(TypeError, grp.getgrgid) self.assertRaises(TypeError, grp.getgrnam) self.assertRaises(TypeError, grp.getgrall, 42) + # embedded null character + self.assertRaises(ValueError, grp.getgrnam, 'a\x00b') # try to get some errors bynames = {} diff --git a/Lib/test/test_idle.py b/Lib/test/test_idle.py index 141e89e..7df98ff 100644 --- a/Lib/test/test_idle.py +++ b/Lib/test/test_idle.py @@ -2,15 +2,18 @@ import unittest from test import support from test.support import import_module -# Skip test if _thread or _tkinter wasn't built or idlelib was deleted. +# Skip test if _thread or _tkinter wasn't built, or idlelib is missing, +# or if tcl/tk version before 8.5, which is needed for ttk widgets. + import_module('threading') # imported by PyShell, imports _thread tk = import_module('tkinter') # imports _tkinter -idletest = import_module('idlelib.idle_test') +idlelib = import_module('idlelib') +idlelib.testing = True # Avoid locale-changed test error -# Without test_main present, regrtest.runtest_inner (line1219) calls -# unittest.TestLoader().loadTestsFromModule(this_module) which calls -# load_tests() if it finds it. (Unittest.main does the same.) -load_tests = idletest.load_tests +# Without test_main present, test.libregrtest.runtest.runtest_inner +# calls (line 173) unittest.TestLoader().loadTestsFromModule(module) +# which calls load_tests() if it finds it. (Unittest.main does the same.) +from idlelib.idle_test import load_tests if __name__ == '__main__': unittest.main(verbosity=2, exit=False) diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 6e4a90f..9990355 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -477,7 +477,7 @@ class NewIMAPTests(NewIMAPTestsMixin, unittest.TestCase): @unittest.skipUnless(ssl, "SSL not available") class NewIMAPSSLTests(NewIMAPTestsMixin, unittest.TestCase): - imap_class = imaplib.IMAP4_SSL + imap_class = IMAP4_SSL server_class = SecureTCPServer def test_ssl_raises(self): @@ -917,17 +917,6 @@ class RemoteIMAP_SSLTest(RemoteIMAPTest): _server = self.imap_class(self.host, self.port) self.check_logincapa(_server) - def test_logincapa_with_client_certfile(self): - with transient_internet(self.host): - _server = self.imap_class(self.host, self.port, certfile=CERTFILE) - self.check_logincapa(_server) - - def test_logincapa_with_client_ssl_context(self): - with transient_internet(self.host): - _server = self.imap_class( - self.host, self.port, ssl_context=self.create_ssl_context()) - self.check_logincapa(_server) - def test_logout(self): with transient_internet(self.host): _server = self.imap_class(self.host, self.port) diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py index ee9ee1a..433de34 100644 --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -315,6 +315,10 @@ class ImportTests(unittest.TestCase): loader.get_data(imp.__file__) # File should be closed loader.get_data(imp.__file__) # Will need to create a newly opened file + def test_load_source(self): + with self.assertRaisesRegex(ValueError, 'embedded null'): + imp.load_source(__name__, __file__ + "\0") + class ReloadTests(unittest.TestCase): diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py index 1e33274..6ef9bd5 100644 --- a/Lib/test/test_import/__init__.py +++ b/Lib/test/test_import/__init__.py @@ -22,8 +22,9 @@ from test.support import ( EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython, make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask, unlink, unload, create_empty_file, cpython_only, TESTFN_UNENCODABLE, - temp_dir) + temp_dir, DirsOnSysPath) from test.support import script_helper +from test.test_importlib.util import uncache skip_if_dont_write_bytecode = unittest.skipIf( @@ -555,7 +556,7 @@ class PathsTests(unittest.TestCase): try: os.listdir(unc) except OSError as e: - if e.errno in (errno.EPERM, errno.EACCES): + if e.errno in (errno.EPERM, errno.EACCES, errno.ENOENT): # See issue #15338 self.skipTest("cannot access administrative share %r" % (unc,)) raise @@ -600,11 +601,11 @@ class RelativeImportTests(unittest.TestCase): # Check relative import fails with only __package__ wrong ns = dict(__package__='foo', __name__='test.notarealmodule') - self.assertRaises(SystemError, check_relative) + self.assertRaises(ImportError, check_relative) # Check relative import fails with __package__ and __name__ wrong ns = dict(__package__='foo', __name__='notarealpkg.notarealmodule') - self.assertRaises(SystemError, check_relative) + self.assertRaises(ImportError, check_relative) # Check relative import fails with package set to a non-string ns = dict(__package__=object()) @@ -619,6 +620,20 @@ class RelativeImportTests(unittest.TestCase): self.fail("explicit relative import triggered an " "implicit absolute import") + def test_import_from_non_package(self): + path = os.path.join(os.path.dirname(__file__), 'data', 'package2') + with uncache('submodule1', 'submodule2'), DirsOnSysPath(path): + with self.assertRaises(ImportError): + import submodule1 + self.assertNotIn('submodule1', sys.modules) + self.assertNotIn('submodule2', sys.modules) + + def test_import_from_unloaded_package(self): + with uncache('package2', 'package2.submodule1', 'package2.submodule2'), \ + DirsOnSysPath(os.path.join(os.path.dirname(__file__), 'data')): + import package2.submodule1 + package2.submodule1.submodule2 + class OverridingImportBuiltinTests(unittest.TestCase): def test_override_builtin(self): diff --git a/Lib/test/test_import/data/package2/submodule1.py b/Lib/test/test_import/data/package2/submodule1.py new file mode 100644 index 0000000..0698ed6 --- /dev/null +++ b/Lib/test/test_import/data/package2/submodule1.py @@ -0,0 +1,3 @@ +import sys +sys.modules.pop(__package__, None) +from . import submodule2 diff --git a/Lib/test/test_import/data/package2/submodule2.py b/Lib/test/test_import/data/package2/submodule2.py new file mode 100644 index 0000000..e69de29 diff --git a/Lib/test/test_importlib/import_/test___package__.py b/Lib/test/test_importlib/import_/test___package__.py index c7d3a2a..9a70405 100644 --- a/Lib/test/test_importlib/import_/test___package__.py +++ b/Lib/test/test_importlib/import_/test___package__.py @@ -61,7 +61,7 @@ class Using__package__: def test_bad__package__(self): globals = {'__package__': ''} - with self.assertRaises(SystemError): + with self.assertRaises(ImportError): self.__import__('', globals, {}, ['relimport'], 1) def test_bunk__package__(self): diff --git a/Lib/test/test_importlib/import_/test_relative_imports.py b/Lib/test/test_importlib/import_/test_relative_imports.py index 3bb819f..717fc5b 100644 --- a/Lib/test/test_importlib/import_/test_relative_imports.py +++ b/Lib/test/test_importlib/import_/test_relative_imports.py @@ -207,8 +207,13 @@ class RelativeImports: with self.assertRaises(KeyError): self.__import__('sys', level=1) + def test_relative_import_no_package(self): + with self.assertRaises(ImportError): + self.__import__('a', {'__package__': '', '__spec__': None}, + level=1) + def test_relative_import_no_package_exists_absolute(self): - with self.assertRaises(SystemError): + with self.assertRaises(ImportError): self.__import__('sys', {'__package__': '', '__spec__': None}, level=1) diff --git a/Lib/test/test_importlib/source/test_file_loader.py b/Lib/test/test_importlib/source/test_file_loader.py index 73f4c62..6d5a886 100644 --- a/Lib/test/test_importlib/source/test_file_loader.py +++ b/Lib/test/test_importlib/source/test_file_loader.py @@ -603,5 +603,109 @@ class SourcelessLoaderBadBytecodeTestPEP302(SourcelessLoaderBadBytecodeTest, util=importlib_util) +########################################################################### +# Issue #29537: Test backwards compatibility with legacy 3.5.0/1/2 bytecode +########################################################################### + +class LegacyBytecodeTest: + + def _test_legacy_magic(self, test, *, del_source=False): + # Replace the default magic number with one copied from a pyc file + # generated by Python 3.5.2 + with util.create_modules('_temp') as mapping: + bc_path = self.manipulate_bytecode('_temp', mapping, + lambda bc: b'\x16\r\r\n' + bc[4:]) + test('_temp', mapping, bc_path) + +LegacyBytecodeTestPEP451 = BadBytecodeTestPEP451 +LegacyBytecodeTestPEP302 = BadBytecodeTestPEP302 + +# SourceLoader via both PEP 451 and 302 hooks + +class SourceLoaderLegacyBytecodeTest(LegacyBytecodeTest): + + @classmethod + def setUpClass(cls): + cls.loader = cls.machinery.SourceFileLoader + + @util.writes_bytecode_files + def test_legacy_magic(self): + # The magic number from 3.5.0/1/2 should be accepted as is + def test(name, mapping, bytecode_path): + self.import_(mapping[name], name) + with open(bytecode_path, 'rb') as bytecode_file: + self.assertEqual(bytecode_file.read(4), + self.util._BACKCOMPAT_MAGIC_NUMBER) + + self._test_legacy_magic(test) + + +class SourceLoaderLegacyBytecodeTestPEP451( + SourceLoaderLegacyBytecodeTest, LegacyBytecodeTestPEP451): + pass + + +(Frozen_SourceLegacyBytecodePEP451, + Source_SourceLegacyBytecodePEP451 + ) = util.test_both(SourceLoaderLegacyBytecodeTestPEP451, importlib=importlib, + machinery=machinery, abc=importlib_abc, + util=importlib_util) + + +class SourceLoaderLegacyBytecodeTestPEP302( + SourceLoaderLegacyBytecodeTest, LegacyBytecodeTestPEP302): + pass + + +(Frozen_SourceLegacyBytecodePEP302, + Source_SourceLegacyBytecodePEP302 + ) = util.test_both(SourceLoaderLegacyBytecodeTestPEP302, importlib=importlib, + machinery=machinery, abc=importlib_abc, + util=importlib_util) + +# SourcelessLoader via both PEP 451 and 302 hooks + +class SourcelessLoaderLegacyBytecodeTest(LegacyBytecodeTest): + + @classmethod + def setUpClass(cls): + cls.loader = cls.machinery.SourcelessFileLoader + + + @util.writes_bytecode_files + def test_legacy_magic(self): + # The magic number from 3.5.0/1/2 should be accepted as is + def test(name, mapping, bytecode_path): + self.import_(bytecode_path, name) + with open(bytecode_path, 'rb') as bytecode_file: + self.assertEqual(bytecode_file.read(4), + self.util._BACKCOMPAT_MAGIC_NUMBER) + + self._test_legacy_magic(test) + +class SourcelessLoaderLegacyBytecodeTestPEP451( + SourcelessLoaderLegacyBytecodeTest, LegacyBytecodeTestPEP451): + pass + +(Frozen_SourcelessLegacyBytecodePEP451, + Source_SourcelessLegacyBytecodePEP451 + ) = util.test_both(SourcelessLoaderLegacyBytecodeTestPEP451, importlib=importlib, + machinery=machinery, abc=importlib_abc, + util=importlib_util) + + +class SourcelessLoaderLegacyBytecodeTestPEP302(SourcelessLoaderLegacyBytecodeTest, + LegacyBytecodeTestPEP302): + pass + + +(Frozen_SourcelessLegacyBytecodePEP302, + Source_SourcelessLegacyBytecodePEP302 + ) = util.test_both(SourcelessLoaderLegacyBytecodeTestPEP302, importlib=importlib, + machinery=machinery, abc=importlib_abc, + util=importlib_util) + +# End of Issue #29537 legacy bytecode compatibility tests + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_importlib/test_util.py b/Lib/test/test_importlib/test_util.py index 41ca333..230cd29 100644 --- a/Lib/test/test_importlib/test_util.py +++ b/Lib/test/test_importlib/test_util.py @@ -4,6 +4,7 @@ init = util.import_importlib('importlib') machinery = util.import_importlib('importlib.machinery') importlib_util = util.import_importlib('importlib.util') +import importlib.util import os import string import sys @@ -744,5 +745,48 @@ class PEP3147Tests: ) = util.test_both(PEP3147Tests, util=importlib_util) +class MagicNumberTests(unittest.TestCase): + """ + Test release compatibility issues relating to importlib + """ + @unittest.skipUnless( + sys.version_info.releaselevel in ('final', 'release'), + 'only applies to candidate or final python release levels' + ) + def test_magic_number(self): + """ + Each python minor release should generally have a MAGIC_NUMBER + that does not change once the release reaches candidate status. + + Once a release reaches candidate status, the value of the constant + EXPECTED_MAGIC_NUMBER in this test should be changed. + This test will then check that the actual MAGIC_NUMBER matches + the expected value for the release. + + In exceptional cases, it may be required to change the MAGIC_NUMBER + for a maintenance release. In this case the change should be + discussed in python-dev. If a change is required, community + stakeholders such as OS package maintainers must be notified + in advance. Such exceptional releases will then require an + adjustment to this test case. + """ + EXPECTED_MAGIC_NUMBER = 3351 + actual = int.from_bytes(importlib.util.MAGIC_NUMBER[:2], 'little') + + msg = ( + "To avoid breaking backwards compatibility with cached bytecode " + "files that can't be automatically regenerated by the current " + "user, candidate and final releases require the current " + "importlib.util.MAGIC_NUMBER to match the expected " + "magic number in this test. Set the expected " + "magic number in this test to the current MAGIC_NUMBER to " + "continue with the release.\n\n" + "Changing the MAGIC_NUMBER for a maintenance release " + "requires discussion in python-dev and notification of " + "community stakeholders." + ) + self.assertEqual(EXPECTED_MAGIC_NUMBER, actual, msg) + + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index d33de9e..95c5ead 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -376,6 +376,11 @@ class TestRetrievingSourceCode(GetSourceBase): def test_getcomments(self): self.assertEqual(inspect.getcomments(mod), '# line 1\n') self.assertEqual(inspect.getcomments(mod.StupidGit), '# line 20\n') + # If the object source file is not available, return None. + co = compile('x=1', '_non_existing_filename.py', 'exec') + self.assertIsNone(inspect.getcomments(co)) + # If the object has been defined in C, return None. + self.assertIsNone(inspect.getcomments(list)) def test_getmodule(self): # Check actual module @@ -1949,6 +1954,41 @@ class TestSignatureObject(unittest.TestCase): ('kwargs', ..., int, "var_keyword")), ...)) + def test_signature_without_self(self): + def test_args_only(*args): # NOQA + pass + + def test_args_kwargs_only(*args, **kwargs): # NOQA + pass + + class A: + @classmethod + def test_classmethod(*args): # NOQA + pass + + @staticmethod + def test_staticmethod(*args): # NOQA + pass + + f1 = functools.partialmethod((test_classmethod), 1) + f2 = functools.partialmethod((test_args_only), 1) + f3 = functools.partialmethod((test_staticmethod), 1) + f4 = functools.partialmethod((test_args_kwargs_only),1) + + self.assertEqual(self.signature(test_args_only), + ((('args', ..., ..., 'var_positional'),), ...)) + self.assertEqual(self.signature(test_args_kwargs_only), + ((('args', ..., ..., 'var_positional'), + ('kwargs', ..., ..., 'var_keyword')), ...)) + self.assertEqual(self.signature(A.f1), + ((('args', ..., ..., 'var_positional'),), ...)) + self.assertEqual(self.signature(A.f2), + ((('args', ..., ..., 'var_positional'),), ...)) + self.assertEqual(self.signature(A.f3), + ((('args', ..., ..., 'var_positional'),), ...)) + self.assertEqual(self.signature(A.f4), + ((('args', ..., ..., 'var_positional'), + ('kwargs', ..., ..., 'var_keyword')), ...)) @cpython_only @unittest.skipIf(MISSING_C_DOCSTRINGS, "Signature information for builtins requires docstrings") diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 5111882..8b4892b 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -536,6 +536,22 @@ class IOTest(unittest.TestCase): with self.open(support.TESTFN, "r") as f: self.assertRaises(TypeError, f.readline, 5.3) + def test_readline_nonsizeable(self): + # Issue #30061 + # Crash when readline() returns an object without __len__ + class R(self.IOBase): + def readline(self): + return None + self.assertRaises((TypeError, StopIteration), next, R()) + + def test_next_nonsizeable(self): + # Issue #30061 + # Crash when __next__() returns an object without __len__ + class R(self.IOBase): + def __next__(self): + return None + self.assertRaises(TypeError, R().readlines, 1) + def test_raw_bytes_io(self): f = self.BytesIO() self.write_ops(f) @@ -981,6 +997,16 @@ class CommonBufferedTests: raw.name = b"dummy" self.assertEqual(repr(b), "<%s name=b'dummy'>" % clsname) + def test_recursive_repr(self): + # Issue #25455 + raw = self.MockRawIO() + b = self.tp(raw) + with support.swap_attr(raw, 'name', b): + try: + repr(b) # Should not crash + except RuntimeError: + pass + def test_flush_error_on_close(self): # Test that buffered file is closed despite failed flush # and that flush() is called before file closed. @@ -2391,6 +2417,16 @@ class TextIOWrapperTest(unittest.TestCase): t.buffer.detach() repr(t) # Should not raise an exception + def test_recursive_repr(self): + # Issue #25455 + raw = self.BytesIO() + t = self.TextIOWrapper(raw) + with support.swap_attr(raw, 'name', t): + try: + repr(t) # Should not crash + except RuntimeError: + pass + def test_line_buffering(self): r = self.BytesIO() b = self.BufferedWriter(r, 1000) @@ -3446,6 +3482,7 @@ class MiscIOTest(unittest.TestCase): self.assertRaises(ValueError, f.readinto1, bytearray(1024)) self.assertRaises(ValueError, f.readline) self.assertRaises(ValueError, f.readlines) + self.assertRaises(ValueError, f.readlines, 1) self.assertRaises(ValueError, f.seek, 0) self.assertRaises(ValueError, f.tell) self.assertRaises(ValueError, f.truncate) @@ -3651,6 +3688,7 @@ class CMiscIOTest(MiscIOTest): import sys import time import threading + from test.support import SuppressCrashReport file = sys.{stream_name} @@ -3659,6 +3697,10 @@ class CMiscIOTest(MiscIOTest): file.write('.') file.flush() + crash = SuppressCrashReport() + crash.__enter__() + # don't call __exit__(): the crash occurs at Python shutdown + thread = threading.Thread(target=run) thread.daemon = True thread.start() diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py index 91ae8d8..e3dec87 100644 --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -1404,14 +1404,35 @@ class IpaddrUnitTest(unittest.TestCase): ipaddress.ip_address('::2')) def testInterfaceComparison(self): - self.assertTrue(ipaddress.ip_interface('1.1.1.1') <= - ipaddress.ip_interface('1.1.1.1')) - self.assertTrue(ipaddress.ip_interface('1.1.1.1') <= - ipaddress.ip_interface('1.1.1.2')) - self.assertTrue(ipaddress.ip_interface('::1') <= - ipaddress.ip_interface('::1')) - self.assertTrue(ipaddress.ip_interface('::1') <= - ipaddress.ip_interface('::2')) + self.assertTrue(ipaddress.ip_interface('1.1.1.1/24') == + ipaddress.ip_interface('1.1.1.1/24')) + self.assertTrue(ipaddress.ip_interface('1.1.1.1/16') < + ipaddress.ip_interface('1.1.1.1/24')) + self.assertTrue(ipaddress.ip_interface('1.1.1.1/24') < + ipaddress.ip_interface('1.1.1.2/24')) + self.assertTrue(ipaddress.ip_interface('1.1.1.2/16') < + ipaddress.ip_interface('1.1.1.1/24')) + self.assertTrue(ipaddress.ip_interface('1.1.1.1/24') > + ipaddress.ip_interface('1.1.1.1/16')) + self.assertTrue(ipaddress.ip_interface('1.1.1.2/24') > + ipaddress.ip_interface('1.1.1.1/24')) + self.assertTrue(ipaddress.ip_interface('1.1.1.1/24') > + ipaddress.ip_interface('1.1.1.2/16')) + + self.assertTrue(ipaddress.ip_interface('::1/64') == + ipaddress.ip_interface('::1/64')) + self.assertTrue(ipaddress.ip_interface('::1/64') < + ipaddress.ip_interface('::1/80')) + self.assertTrue(ipaddress.ip_interface('::1/64') < + ipaddress.ip_interface('::2/64')) + self.assertTrue(ipaddress.ip_interface('::2/48') < + ipaddress.ip_interface('::1/64')) + self.assertTrue(ipaddress.ip_interface('::1/80') > + ipaddress.ip_interface('::1/64')) + self.assertTrue(ipaddress.ip_interface('::2/64') > + ipaddress.ip_interface('::1/64')) + self.assertTrue(ipaddress.ip_interface('::1/64') > + ipaddress.ip_interface('::2/48')) def testNetworkComparison(self): # ip1 and ip2 have the same network address diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index e054303..b8399fc 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -1943,6 +1943,14 @@ class RegressionTests(unittest.TestCase): self.assertRaises(AssertionError, list, cycle(gen1())) self.assertEqual(hist, [0,1]) + def test_long_chain_of_empty_iterables(self): + # Make sure itertools.chain doesn't run into recursion limits when + # dealing with long chains of empty iterables. Even with a high + # number this would probably only fail in Py_DEBUG mode. + it = chain.from_iterable(() for unused in range(10000000)) + with self.assertRaises(StopIteration): + next(it) + class SubclassWithKwargsTest(unittest.TestCase): def test_keywords_in_subclass(self): # count is not subclassable... diff --git a/Lib/test/test_json/test_speedups.py b/Lib/test/test_json/test_speedups.py index 109a246..56f1882 100644 --- a/Lib/test/test_json/test_speedups.py +++ b/Lib/test/test_json/test_speedups.py @@ -1,6 +1,11 @@ from test.test_json import CTest +class BadBool: + def __bool__(self): + 1/0 + + class TestSpeedups(CTest): def test_scanstring(self): self.assertEqual(self.json.decoder.scanstring.__module__, "_json") @@ -17,8 +22,29 @@ class TestDecode(CTest): def test_make_scanner(self): self.assertRaises(AttributeError, self.json.scanner.c_make_scanner, 1) + def test_bad_bool_args(self): + def test(value): + self.json.decoder.JSONDecoder(strict=BadBool()).decode(value) + self.assertRaises(ZeroDivisionError, test, '""') + self.assertRaises(ZeroDivisionError, test, '{}') + + +class TestEncode(CTest): def test_make_encoder(self): self.assertRaises(TypeError, self.json.encoder.c_make_encoder, (True, False), b"\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75", None) + + def test_bad_bool_args(self): + def test(name): + self.json.encoder.JSONEncoder(**{name: BadBool()}).encode({'a': 1}) + self.assertRaises(ZeroDivisionError, test, 'skipkeys') + self.assertRaises(ZeroDivisionError, test, 'ensure_ascii') + self.assertRaises(ZeroDivisionError, test, 'check_circular') + self.assertRaises(ZeroDivisionError, test, 'allow_nan') + self.assertRaises(ZeroDivisionError, test, 'sort_keys') + + def test_unsortable_keys(self): + with self.assertRaises(TypeError): + self.json.encoder.JSONEncoder(sort_keys=True).encode({'a': 1, 1: 'a'}) diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py index fae2c3d..8d40a94 100644 --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -339,9 +339,14 @@ class TestCollation(unittest.TestCase): self.assertLess(locale.strcoll('a', 'b'), 0) self.assertEqual(locale.strcoll('a', 'a'), 0) self.assertGreater(locale.strcoll('b', 'a'), 0) + # embedded null character + self.assertRaises(ValueError, locale.strcoll, 'a\0', 'a') + self.assertRaises(ValueError, locale.strcoll, 'a', 'a\0') def test_strxfrm(self): self.assertLess(locale.strxfrm('a'), locale.strxfrm('b')) + # embedded null character + self.assertRaises(ValueError, locale.strxfrm, 'a\0') class TestEnUSCollation(BaseLocalizedTest, TestCollation): diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 0e70ccd..382714f 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -308,6 +308,14 @@ class BuiltinLevelsTest(BaseTest): self.assertEqual(logging.getLevelName('INFO'), logging.INFO) self.assertEqual(logging.getLevelName(logging.INFO), 'INFO') + def test_regression_29220(self): + """See issue #29220 for more information.""" + logging.addLevelName(logging.INFO, '') + self.addCleanup(logging.addLevelName, logging.INFO, 'INFO') + self.assertEqual(logging.getLevelName(logging.INFO), '') + self.assertEqual(logging.getLevelName(logging.NOTSET), 'NOTSET') + self.assertEqual(logging.getLevelName('NOTSET'), logging.NOTSET) + class BasicFilterTest(BaseTest): """Test the bundled Filter class.""" @@ -1563,7 +1571,7 @@ class SysLogHandlerTest(BaseTest): server.ready.wait() hcls = logging.handlers.SysLogHandler if isinstance(server.server_address, tuple): - self.sl_hdlr = hcls(('localhost', server.port)) + self.sl_hdlr = hcls((server.server_address[0], server.port)) else: self.sl_hdlr = hcls(server.server_address) self.log_output = '' @@ -1619,6 +1627,24 @@ class UnixSysLogHandlerTest(SysLogHandlerTest): SysLogHandlerTest.tearDown(self) os.remove(self.address) +@unittest.skipUnless(support.IPV6_ENABLED, + 'IPv6 support required for this test.') +@unittest.skipUnless(threading, 'Threading required for this test.') +class IPv6SysLogHandlerTest(SysLogHandlerTest): + + """Test for SysLogHandler with IPv6 host.""" + + server_class = TestUDPServer + address = ('::1', 0) + + def setUp(self): + self.server_class.address_family = socket.AF_INET6 + super(IPv6SysLogHandlerTest, self).setUp() + + def tearDown(self): + self.server_class.address_family = socket.AF_INET + super(IPv6SysLogHandlerTest, self).tearDown() + @unittest.skipUnless(threading, 'Threading required for this test.') class HTTPHandlerTest(BaseTest): """Test for HTTPHandler.""" @@ -3059,6 +3085,7 @@ if hasattr(logging.handlers, 'QueueListener'): handler.close() @patch.object(logging.handlers.QueueListener, 'handle') + @support.reap_threads def test_handle_called_with_queue_queue(self, mock_handle): for i in range(self.repeat): log_queue = queue.Queue() @@ -3068,10 +3095,13 @@ if hasattr(logging.handlers, 'QueueListener'): @support.requires_multiprocessing_queue @patch.object(logging.handlers.QueueListener, 'handle') + @support.reap_threads def test_handle_called_with_mp_queue(self, mock_handle): for i in range(self.repeat): log_queue = multiprocessing.Queue() self.setup_and_log(log_queue, '%s_%s' % (self.id(), i)) + log_queue.close() + log_queue.join_thread() self.assertEqual(mock_handle.call_count, 5 * self.repeat, 'correct number of handled log messages') @@ -3084,6 +3114,7 @@ if hasattr(logging.handlers, 'QueueListener'): return [] @support.requires_multiprocessing_queue + @support.reap_threads def test_no_messages_in_queue_after_stop(self): """ Five messages are logged then the QueueListener is stopped. This @@ -3096,6 +3127,9 @@ if hasattr(logging.handlers, 'QueueListener'): self.setup_and_log(queue, '%s_%s' %(self.id(), i)) # time.sleep(1) items = list(self.get_all_from_queue(queue)) + queue.close() + queue.join_thread() + expected = [[], [logging.handlers.QueueListener._sentinel]] self.assertIn(items, expected, 'Found unexpected messages in queue: %s' % ( @@ -4255,7 +4289,7 @@ def test_main(): QueueHandlerTest, ShutdownTest, ModuleLevelMiscTest, BasicConfigTest, LoggerAdapterTest, LoggerTest, SMTPHandlerTest, FileHandlerTest, RotatingFileHandlerTest, LastResortTest, LogRecordTest, - ExceptionTest, SysLogHandlerTest, HTTPHandlerTest, + ExceptionTest, SysLogHandlerTest, IPv6SysLogHandlerTest, HTTPHandlerTest, NTEventLogHandlerTest, TimedRotatingFileHandlerTest, UnixSocketHandlerTest, UnixDatagramHandlerTest, UnixSysLogHandlerTest, ] diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py index 66ef930..22fb45a 100644 --- a/Lib/test/test_nntplib.py +++ b/Lib/test/test_nntplib.py @@ -286,7 +286,12 @@ class NetworkedNNTPTests(NetworkedNNTPTestsMixin, unittest.TestCase): def setUpClass(cls): support.requires("network") with support.transient_internet(cls.NNTP_HOST): - cls.server = cls.NNTP_CLASS(cls.NNTP_HOST, timeout=TIMEOUT, usenetrc=False) + try: + cls.server = cls.NNTP_CLASS(cls.NNTP_HOST, timeout=TIMEOUT, + usenetrc=False) + except EOFError: + raise unittest.SkipTest("%s got EOF error on connecting " + "to %r" % (cls, cls.NNTP_HOST)) @classmethod def tearDownClass(cls): diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py index 30fa612..40d5894 100644 --- a/Lib/test/test_normalization.py +++ b/Lib/test/test_normalization.py @@ -37,15 +37,23 @@ def unistr(data): class NormalizationTest(unittest.TestCase): def test_main(self): - part = None - part1_data = {} # Hit the exception early try: testdata = open_urlresource(TESTDATAURL, encoding="utf-8", check=check_version) + except PermissionError: + self.skipTest("Permission error when downloading %s " + "into the test data directory" % TESTDATAURL) except (OSError, HTTPException): - self.skipTest("Could not retrieve " + TESTDATAURL) - self.addCleanup(testdata.close) + self.fail("Could not retrieve %s" % TESTDATAURL) + + with testdata: + self.run_normalization_tests(testdata) + + def run_normalization_tests(self, testdata): + part = None + part1_data = {} + for line in testdata: if '#' in line: line = line.split('#')[0] diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 10383cf..bb5d2e3 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -448,7 +448,9 @@ class StatAttributeTests(unittest.TestCase): # force CreateFile to fail with ERROR_ACCESS_DENIED. DETACHED_PROCESS = 8 subprocess.check_call( - ['icacls.exe', fname, '/deny', 'Users:(S)'], + # bpo-30584: Use security identifier *S-1-5-32-545 instead + # of localized "Users" to not depend on the locale. + ['icacls.exe', fname, '/deny', '*S-1-5-32-545:(S)'], creationflags=DETACHED_PROCESS ) result = os.stat(fname) @@ -807,6 +809,30 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol): self.assertIs(cm.exception.args[0], missing) self.assertTrue(cm.exception.__suppress_context__) + def _test_environ_iteration(self, collection): + iterator = iter(collection) + new_key = "__new_key__" + + next(iterator) # start iteration over os.environ.items + + # add a new key in os.environ mapping + os.environ[new_key] = "test_environ_iteration" + + try: + next(iterator) # force iteration over modified mapping + self.assertEqual(os.environ[new_key], "test_environ_iteration") + finally: + del os.environ[new_key] + + def test_iter_error_when_changing_os_environ(self): + self._test_environ_iteration(os.environ) + + def test_iter_error_when_changing_os_environ_items(self): + self._test_environ_iteration(os.environ.items()) + + def test_iter_error_when_changing_os_environ_values(self): + self._test_environ_iteration(os.environ.values()) + class WalkTests(unittest.TestCase): """Tests for os.walk().""" @@ -1499,6 +1525,27 @@ class ExecTests(unittest.TestCase): if os.name != "nt": self._test_internal_execvpe(bytes) + def test_execve_invalid_env(self): + args = [sys.executable, '-c', 'pass'] + + # null character in the enviroment variable name + newenv = os.environ.copy() + newenv["FRUIT\0VEGETABLE"] = "cabbage" + with self.assertRaises(ValueError): + os.execve(args[0], args, newenv) + + # null character in the enviroment variable value + newenv = os.environ.copy() + newenv["FRUIT"] = "orange\0VEGETABLE=cabbage" + with self.assertRaises(ValueError): + os.execve(args[0], args, newenv) + + # equal character in the enviroment variable name + newenv = os.environ.copy() + newenv["FRUIT=ORANGE"] = "lemon" + with self.assertRaises(ValueError): + os.execve(args[0], args, newenv) + @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests") class Win32ErrorTests(unittest.TestCase): @@ -2182,6 +2229,62 @@ class PidTests(unittest.TestCase): self.assertEqual(status, (pid, 0)) +class SpawnTests(unittest.TestCase): + def _test_invalid_env(self, spawn): + args = [sys.executable, '-c', 'pass'] + + # null character in the enviroment variable name + newenv = os.environ.copy() + newenv["FRUIT\0VEGETABLE"] = "cabbage" + try: + exitcode = spawn(os.P_WAIT, args[0], args, newenv) + except ValueError: + pass + else: + self.assertEqual(exitcode, 127) + + # null character in the enviroment variable value + newenv = os.environ.copy() + newenv["FRUIT"] = "orange\0VEGETABLE=cabbage" + try: + exitcode = spawn(os.P_WAIT, args[0], args, newenv) + except ValueError: + pass + else: + self.assertEqual(exitcode, 127) + + # equal character in the enviroment variable name + newenv = os.environ.copy() + newenv["FRUIT=ORANGE"] = "lemon" + try: + exitcode = spawn(os.P_WAIT, args[0], args, newenv) + except ValueError: + pass + else: + self.assertEqual(exitcode, 127) + + # equal character in the enviroment variable value + filename = support.TESTFN + self.addCleanup(support.unlink, filename) + with open(filename, "w") as fp: + fp.write('import sys, os\n' + 'if os.getenv("FRUIT") != "orange=lemon":\n' + ' raise AssertionError') + args = [sys.executable, filename] + newenv = os.environ.copy() + newenv["FRUIT"] = "orange=lemon" + exitcode = spawn(os.P_WAIT, args[0], args, newenv) + self.assertEqual(exitcode, 0) + + @unittest.skipUnless(hasattr(os, 'spawnve'), "test needs os.spawnve") + def test_spawnve_invalid_env(self): + self._test_invalid_env(os.spawnve) + + @unittest.skipUnless(hasattr(os, 'spawnvpe'), "test needs os.spawnvpe") + def test_spawnvpe_invalid_env(self): + self._test_invalid_env(os.spawnvpe) + + # The introduction of this TestCase caused at least two different errors on # *nix buildbots. Temporarily skip this to let the buildbots move along. @unittest.skip("Skip due to platform/environment differences on *NIX buildbots") @@ -2340,6 +2443,7 @@ class TestSendfile(unittest.TestCase): self.client.close() if self.server.running: self.server.stop() + self.server = None def sendfile_wrapper(self, sock, file, offset, nbytes, headers=[], trailers=[]): """A higher level wrapper representing how an application is @@ -3082,6 +3186,28 @@ class TestScandir(unittest.TestCase): self.assertEqual(entry.path, os.fsencode(os.path.join(self.path, 'file.txt'))) + def test_bytes_like(self): + if os.name == "nt": + # On Windows, os.scandir(bytes) must raise an exception + for cls in bytearray, memoryview: + self.assertRaises(TypeError, os.scandir, cls(b'.')) + return + + # Deprecated in 3.6. + self.create_file("file.txt") + + for cls in bytearray, memoryview: + path_bytes = cls(os.fsencode(self.path)) + entries = list(os.scandir(path_bytes)) + self.assertEqual(len(entries), 1, entries) + entry = entries[0] + + self.assertEqual(entry.name, b'file.txt') + self.assertEqual(entry.path, + os.fsencode(os.path.join(self.path, 'file.txt'))) + self.assertIs(type(entry.name), bytes) + self.assertIs(type(entry.path), bytes) + def test_empty_path(self): self.assertRaises(FileNotFoundError, os.scandir, '') diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index ab6577f..42ce6b0 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -1,4 +1,6 @@ +import copy import parser +import pickle import unittest import sys import operator @@ -386,6 +388,52 @@ class IllegalSyntaxTestCase(unittest.TestCase): # not even remotely valid: self.check_bad_tree((1, 2, 3), "") + def test_illegal_terminal(self): + tree = \ + (257, + (269, + (270, + (271, + (277, + (1,))), + (4, ''))), + (4, ''), + (0, '')) + self.check_bad_tree(tree, "too small items in terminal node") + tree = \ + (257, + (269, + (270, + (271, + (277, + (1, b'pass'))), + (4, ''))), + (4, ''), + (0, '')) + self.check_bad_tree(tree, "non-string second item in terminal node") + tree = \ + (257, + (269, + (270, + (271, + (277, + (1, 'pass', '0', 0))), + (4, ''))), + (4, ''), + (0, '')) + self.check_bad_tree(tree, "non-integer third item in terminal node") + tree = \ + (257, + (269, + (270, + (271, + (277, + (1, 'pass', 0, 0))), + (4, ''))), + (4, ''), + (0, '')) + self.check_bad_tree(tree, "too many items in terminal node") + def test_illegal_yield_1(self): # Illegal yield statement: def f(): return 1; yield 1 tree = \ @@ -590,6 +638,24 @@ class IllegalSyntaxTestCase(unittest.TestCase): (4, ''), (0, '')) self.check_bad_tree(tree, "from import fred") + def test_illegal_encoding(self): + # Illegal encoding declaration + tree = \ + (338, + (257, (0, ''))) + self.check_bad_tree(tree, "missed encoding") + tree = \ + (338, + (257, (0, '')), + b'iso-8859-1') + self.check_bad_tree(tree, "non-string encoding") + tree = \ + (338, + (257, (0, '')), + '\udcff') + with self.assertRaises(UnicodeEncodeError): + parser.sequence2st(tree) + class CompileTestCase(unittest.TestCase): @@ -728,6 +794,21 @@ class STObjectTestCase(unittest.TestCase): self.assertRaises(TypeError, operator.lt, st1, 1815) self.assertRaises(TypeError, operator.gt, b'waterloo', st2) + def test_copy_pickle(self): + sts = [ + parser.expr('2 + 3'), + parser.suite('x = 2; y = x + 3'), + parser.expr('list(x**3 for x in range(20))') + ] + for st in sts: + st_copy = copy.copy(st) + self.assertEqual(st_copy.totuple(), st.totuple()) + st_copy = copy.deepcopy(st) + self.assertEqual(st_copy.totuple(), st.totuple()) + for proto in range(pickle.HIGHEST_PROTOCOL+1): + st_copy = pickle.loads(pickle.dumps(st, proto)) + self.assertEqual(st_copy.totuple(), st.totuple()) + check_sizeof = support.check_sizeof @support.cpython_only diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index fa96d9f..5e0708a 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -8,6 +8,7 @@ import socket import stat import tempfile import unittest +from unittest import mock from test import support TESTFN = support.TESTFN @@ -1727,6 +1728,22 @@ class _BasePathTest(object): self.assertTrue(p.exists()) self.assertEqual(p.stat().st_ctime, st_ctime_first) + def test_mkdir_exist_ok_root(self): + # Issue #25803: A drive root could raise PermissionError on Windows + self.cls('/').resolve().mkdir(exist_ok=True) + self.cls('/').resolve().mkdir(parents=True, exist_ok=True) + + @only_nt # XXX: not sure how to test this on POSIX + def test_mkdir_with_unknown_drive(self): + for d in 'ZYXWVUTSRQPONMLKJIHGFEDCBA': + p = self.cls(d + ':\\') + if not p.is_dir(): + break + else: + self.skipTest("cannot find a drive that doesn't exist") + with self.assertRaises(OSError): + (p / 'child' / 'path').mkdir(parents=True) + def test_mkdir_with_child_file(self): p = self.cls(BASE, 'dirB', 'fileB') self.assertTrue(p.exists()) @@ -1751,6 +1768,35 @@ class _BasePathTest(object): p.mkdir(exist_ok=True) self.assertEqual(cm.exception.errno, errno.EEXIST) + def test_mkdir_concurrent_parent_creation(self): + for pattern_num in range(32): + p = self.cls(BASE, 'dirCPC%d' % pattern_num) + self.assertFalse(p.exists()) + + def my_mkdir(path, mode=0o777): + path = str(path) + # Emulate another process that would create the directory + # just before we try to create it ourselves. We do it + # in all possible pattern combinations, assuming that this + # function is called at most 5 times (dirCPC/dir1/dir2, + # dirCPC/dir1, dirCPC, dirCPC/dir1, dirCPC/dir1/dir2). + if pattern.pop(): + os.mkdir(path, mode) # from another process + concurrently_created.add(path) + os.mkdir(path, mode) # our real call + + pattern = [bool(pattern_num & (1 << n)) for n in range(5)] + concurrently_created = set() + p12 = p / 'dir1' / 'dir2' + try: + with mock.patch("pathlib._normal_accessor.mkdir", my_mkdir): + p12.mkdir(parents=True, exist_ok=False) + except FileExistsError: + self.assertIn(str(p12), concurrently_created) + else: + self.assertNotIn(str(p12), concurrently_created) + self.assertTrue(p.exists()) + @with_symlinks def test_symlink_to(self): P = self.cls(BASE) diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 18de110..e16b9fa 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -66,12 +66,12 @@ class PlatformTest(unittest.TestCase): def setUp(self): self.save_version = sys.version - self.save_mercurial = sys._mercurial + self.save_git = sys._git self.save_platform = sys.platform def tearDown(self): sys.version = self.save_version - sys._mercurial = self.save_mercurial + sys._git = self.save_git sys.platform = self.save_platform def test_sys_version(self): @@ -101,7 +101,7 @@ class PlatformTest(unittest.TestCase): ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), ): # branch and revision are not "parsed", but fetched - # from sys._mercurial. Ignore them + # from sys._git. Ignore them (name, version, branch, revision, buildno, builddate, compiler) \ = platform._sys_version(input) self.assertEqual( @@ -148,10 +148,10 @@ class PlatformTest(unittest.TestCase): sys_versions.items(): sys.version = version_tag if subversion is None: - if hasattr(sys, "_mercurial"): - del sys._mercurial + if hasattr(sys, "_git"): + del sys._git else: - sys._mercurial = subversion + sys._git = subversion if sys_platform is not None: sys.platform = sys_platform self.assertEqual(platform.python_implementation(), info[0]) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 2a59c38..b229cd3 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -577,17 +577,25 @@ class PosixTester(unittest.TestCase): self.assertRaises(OSError, posix.chdir, support.TESTFN) def test_listdir(self): - self.assertTrue(support.TESTFN in posix.listdir(os.curdir)) + self.assertIn(support.TESTFN, posix.listdir(os.curdir)) def test_listdir_default(self): # When listdir is called without argument, # it's the same as listdir(os.curdir). - self.assertTrue(support.TESTFN in posix.listdir()) + self.assertIn(support.TESTFN, posix.listdir()) def test_listdir_bytes(self): # When listdir is called with a bytes object, # the returned strings are of type bytes. - self.assertTrue(os.fsencode(support.TESTFN) in posix.listdir(b'.')) + self.assertIn(os.fsencode(support.TESTFN), posix.listdir(b'.')) + + def test_listdir_bytes_like(self): + # Deprecated in 3.6. + for cls in bytearray, memoryview: + names = posix.listdir(cls(b'.')) + self.assertIn(os.fsencode(support.TESTFN), names) + for name in names: + self.assertIs(type(name), bytes) @unittest.skipUnless(posix.listdir in os.supports_fd, "test needs fd support for posix.listdir()") @@ -747,6 +755,21 @@ class PosixTester(unittest.TestCase): self.assertEqual(type(k), item_type) self.assertEqual(type(v), item_type) + @unittest.skipUnless(hasattr(os, "putenv"), "requires os.putenv()") + def test_putenv(self): + with self.assertRaises(ValueError): + os.putenv('FRUIT\0VEGETABLE', 'cabbage') + with self.assertRaises(ValueError): + os.putenv(b'FRUIT\0VEGETABLE', b'cabbage') + with self.assertRaises(ValueError): + os.putenv('FRUIT', 'orange\0VEGETABLE=cabbage') + with self.assertRaises(ValueError): + os.putenv(b'FRUIT', b'orange\0VEGETABLE=cabbage') + with self.assertRaises(ValueError): + os.putenv('FRUIT=ORANGE', 'lemon') + with self.assertRaises(ValueError): + os.putenv(b'FRUIT=ORANGE', b'lemon') + @unittest.skipUnless(hasattr(posix, 'getcwd'), 'test needs posix.getcwd()') def test_getcwd_long_pathnames(self): dirname = 'getcwd-test-directory-0123456789abcdef-01234567890abcdef' diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index 6feac40..ba608fb 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -59,9 +59,6 @@ class PowTest(unittest.TestCase): def test_powint(self): self.powtest(int) - def test_powlong(self): - self.powtest(int) - def test_powfloat(self): self.powtest(float) diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index e80ed17..83a663f 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -348,6 +348,7 @@ class MersenneTwister_TestBasicOps(TestBasicOps, unittest.TestCase): self.assertRaises(ValueError, self.gen.setstate, (1, None, None)) def test_setstate_middle_arg(self): + start_state = self.gen.getstate() # Wrong type, s/b tuple self.assertRaises(TypeError, self.gen.setstate, (2, None, None)) # Wrong length, s/b 625 @@ -361,6 +362,10 @@ class MersenneTwister_TestBasicOps(TestBasicOps, unittest.TestCase): self.gen.setstate((2, (1,)*624+(625,), None)) with self.assertRaises((ValueError, OverflowError)): self.gen.setstate((2, (1,)*624+(-1,), None)) + # Failed calls to setstate() should not have changed the state. + bits100 = self.gen.getrandbits(100) + self.gen.setstate(start_state) + self.assertEqual(self.gen.getrandbits(100), bits100) # Little trick to make "tuple(x % (2**32) for x in internalstate)" # raise ValueError. I cannot think of a simple way to achieve this, so diff --git a/Lib/test/test_range.py b/Lib/test/test_range.py index c022f07..90efa1a 100644 --- a/Lib/test/test_range.py +++ b/Lib/test/test_range.py @@ -98,20 +98,24 @@ class RangeTest(unittest.TestCase): x = range(10**20+10, 10**20, 3) self.assertEqual(len(x), 0) self.assertEqual(len(list(x)), 0) + self.assertFalse(x) x = range(10**20, 10**20+10, -3) self.assertEqual(len(x), 0) self.assertEqual(len(list(x)), 0) + self.assertFalse(x) x = range(10**20+10, 10**20, -3) self.assertEqual(len(x), 4) self.assertEqual(len(list(x)), 4) + self.assertTrue(x) # Now test range() with longs - self.assertEqual(list(range(-2**100)), []) - self.assertEqual(list(range(0, -2**100)), []) - self.assertEqual(list(range(0, 2**100, -1)), []) - self.assertEqual(list(range(0, 2**100, -1)), []) + for x in [range(-2**100), + range(0, -2**100), + range(0, 2**100, -1)]: + self.assertEqual(list(x), []) + self.assertFalse(x) a = int(10 * sys.maxsize) b = int(100 * sys.maxsize) @@ -152,6 +156,7 @@ class RangeTest(unittest.TestCase): step = x[1] - x[0] length = 1 + ((x[-1] - x[0]) // step) return length + a = -sys.maxsize b = sys.maxsize expected_len = b - a @@ -159,6 +164,7 @@ class RangeTest(unittest.TestCase): self.assertIn(a, x) self.assertNotIn(b, x) self.assertRaises(OverflowError, len, x) + self.assertTrue(x) self.assertEqual(_range_len(x), expected_len) self.assertEqual(x[0], a) idx = sys.maxsize+1 @@ -176,6 +182,7 @@ class RangeTest(unittest.TestCase): self.assertIn(a, x) self.assertNotIn(b, x) self.assertRaises(OverflowError, len, x) + self.assertTrue(x) self.assertEqual(_range_len(x), expected_len) self.assertEqual(x[0], a) idx = sys.maxsize+1 @@ -194,6 +201,7 @@ class RangeTest(unittest.TestCase): self.assertIn(a, x) self.assertNotIn(b, x) self.assertRaises(OverflowError, len, x) + self.assertTrue(x) self.assertEqual(_range_len(x), expected_len) self.assertEqual(x[0], a) idx = sys.maxsize+1 @@ -212,6 +220,7 @@ class RangeTest(unittest.TestCase): self.assertIn(a, x) self.assertNotIn(b, x) self.assertRaises(OverflowError, len, x) + self.assertTrue(x) self.assertEqual(_range_len(x), expected_len) self.assertEqual(x[0], a) idx = sys.maxsize+1 diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 0834fe0..839bf27 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -638,14 +638,18 @@ class ReTests(unittest.TestCase): re.purge() # for warnings for c in 'ceghijklmopqyzCEFGHIJKLMNOPQRTVXY': with self.subTest(c): - with self.assertWarns(DeprecationWarning): + with self.assertWarns(DeprecationWarning) as warns: self.assertEqual(re.fullmatch('\\%c' % c, c).group(), c) self.assertIsNone(re.match('\\%c' % c, 'a')) + self.assertRegex(str(warns.warnings[0].message), 'bad escape') + self.assertEqual(warns.warnings[0].filename, __file__) for c in 'ceghijklmopqyzABCEFGHIJKLMNOPQRTVXYZ': with self.subTest(c): - with self.assertWarns(DeprecationWarning): + with self.assertWarns(DeprecationWarning) as warns: self.assertEqual(re.fullmatch('[\\%c]' % c, c).group(), c) self.assertIsNone(re.match('[\\%c]' % c, 'a')) + self.assertRegex(str(warns.warnings[0].message), 'bad escape') + self.assertEqual(warns.warnings[0].filename, __file__) def test_string_boundaries(self): # See http://bugs.python.org/issue10713 @@ -1679,6 +1683,16 @@ SUBPATTERN None self.checkPatternError(r'(?<>)', 'unknown extension ?<>', 1) self.checkPatternError(r'(?', 'unexpected end of pattern', 2) + def test_bug_29444(self): + s = bytearray(b'abcdefgh') + m = re.search(b'[a-h]+', s) + m2 = re.search(b'[e-h]+', s) + self.assertEqual(m.group(), b'abcdefgh') + self.assertEqual(m2.group(), b'efgh') + s[:] = b'xyz' + self.assertEqual(m.group(), b'xyz') + self.assertEqual(m2.group(), b'') + class PatternReprTests(unittest.TestCase): def check(self, pattern, expected): diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py index 2c73df2..931c855 100644 --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -9,7 +9,7 @@ import subprocess import sys import tempfile import unittest -from test.support import import_module, unlink, TESTFN +from test.support import import_module, unlink, temp_dir, TESTFN from test.support.script_helper import assert_python_ok # Skip tests if there is no readline module @@ -195,13 +195,57 @@ print("history", ascii(readline.get_history_item(1))) self.assertIn(b"result " + expected + b"\r\n", output) self.assertIn(b"history " + expected + b"\r\n", output) + # We have 2 reasons to skip this test: + # - readline: history size was added in 6.0 + # See https://cnswww.cns.cwru.edu/php/chet/readline/CHANGES + # - editline: history size is broken on OS X 10.11.6. + # Newer versions were not tested yet. + @unittest.skipIf(readline._READLINE_VERSION < 0x600, + "this readline version does not support history-size") + @unittest.skipIf(is_editline, + "editline history size configuration is broken") + def test_history_size(self): + history_size = 10 + with temp_dir() as test_dir: + inputrc = os.path.join(test_dir, "inputrc") + with open(inputrc, "wb") as f: + f.write(b"set history-size %d\n" % history_size) + + history_file = os.path.join(test_dir, "history") + with open(history_file, "wb") as f: + # history_size * 2 items crashes readline + data = b"".join(b"item %d\n" % i + for i in range(history_size * 2)) + f.write(data) + + script = """ +import os +import readline + +history_file = os.environ["HISTORY_FILE"] +readline.read_history_file(history_file) +input() +readline.write_history_file(history_file) +""" + + env = dict(os.environ) + env["INPUTRC"] = inputrc + env["HISTORY_FILE"] = history_file + + run_pty(script, input=b"last input\r", env=env) + + with open(history_file, "rb") as f: + lines = f.readlines() + self.assertEqual(len(lines), history_size) + self.assertEqual(lines[-1].strip(), b"last input") + -def run_pty(script, input=b"dummy input\r"): +def run_pty(script, input=b"dummy input\r", env=None): pty = import_module('pty') output = bytearray() [master, slave] = pty.openpty() args = (sys.executable, '-c', script) - proc = subprocess.Popen(args, stdin=slave, stdout=slave, stderr=slave) + proc = subprocess.Popen(args, stdin=slave, stdout=slave, stderr=slave, env=env) os.close(slave) with ExitStack() as cleanup: cleanup.enter_context(proc) diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index e2c2f2d..2618b0f 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -1,13 +1,37 @@ """ Tests of regrtest.py. + +Note: test_regrtest cannot be run twice in parallel. """ -import argparse import faulthandler -import getopt import os.path +import platform +import re +import subprocess +import sys +import sysconfig +import tempfile +import textwrap import unittest -from test import regrtest, support +from test import regrtest +from test import support + + +Py_DEBUG = hasattr(sys, 'getobjects') +ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..') +ROOT_DIR = os.path.abspath(os.path.normpath(ROOT_DIR)) + +TEST_INTERRUPTED = textwrap.dedent(""" + from signal import SIGINT + try: + from _testcapi import raise_signal + raise_signal(SIGINT) + except ImportError: + import os + os.kill(os.getpid(), SIGINT) + """) + class ParseArgsTestCase(unittest.TestCase): @@ -82,7 +106,7 @@ class ParseArgsTestCase(unittest.TestCase): self.assertEqual(ns.verbose, 0) def test_slow(self): - for opt in '-o', '--slow': + for opt in '-o', '--slowest': with self.subTest(opt=opt): ns = regrtest._parse_args([opt]) self.assertTrue(ns.print_slow) @@ -98,7 +122,7 @@ class ParseArgsTestCase(unittest.TestCase): self.assertTrue(ns.randomize) def test_randseed(self): - ns = regrtest._parse_args(['--randseed', '12345']) + ns = libregrtest._parse_args(['--randseed', '12345']) self.assertEqual(ns.random_seed, 12345) self.assertTrue(ns.randomize) self.checkError(['--randseed'], 'expected one argument') @@ -112,6 +136,13 @@ class ParseArgsTestCase(unittest.TestCase): self.checkError([opt], 'expected one argument') self.checkError([opt, 'foo', '-s'], "don't go together") + def test_randseed(self): + ns = regrtest._parse_args(['--randseed', '12345']) + self.assertEqual(ns.random_seed, 12345) + self.assertTrue(ns.randomize) + self.checkError(['--randseed'], 'expected one argument') + self.checkError(['--randseed', 'foo'], 'invalid int value') + def test_exclude(self): for opt in '-x', '--exclude': with self.subTest(opt=opt): @@ -129,9 +160,24 @@ class ParseArgsTestCase(unittest.TestCase): for opt in '-m', '--match': with self.subTest(opt=opt): ns = regrtest._parse_args([opt, 'pattern']) - self.assertEqual(ns.match_tests, 'pattern') + self.assertEqual(ns.match_tests, ['pattern']) self.checkError([opt], 'expected one argument') + ns = regrtest._parse_args(['-m', 'pattern1', + '-m', 'pattern2']) + self.assertEqual(ns.match_tests, ['pattern1', 'pattern2']) + + self.addCleanup(support.unlink, support.TESTFN) + with open(support.TESTFN, "w") as fp: + print('matchfile1', file=fp) + print('matchfile2', file=fp) + + filename = os.path.abspath(support.TESTFN) + ns = regrtest._parse_args(['-m', 'match', + '--matchfile', filename]) + self.assertEqual(ns.match_tests, + ['match', 'matchfile1', 'matchfile2']) + def test_failfast(self): for opt in '-G', '--failfast': with self.subTest(opt=opt): @@ -146,15 +192,26 @@ class ParseArgsTestCase(unittest.TestCase): with self.subTest(opt=opt): ns = regrtest._parse_args([opt, 'gui,network']) self.assertEqual(ns.use_resources, ['gui', 'network']) + ns = regrtest._parse_args([opt, 'gui,none,network']) self.assertEqual(ns.use_resources, ['network']) - expected = list(regrtest.RESOURCE_NAMES) + + expected = list(regrtest.ALL_RESOURCES) expected.remove('gui') ns = regrtest._parse_args([opt, 'all,-gui']) self.assertEqual(ns.use_resources, expected) self.checkError([opt], 'expected one argument') self.checkError([opt, 'foo'], 'invalid resource') + # all + a resource not part of "all" + ns = regrtest._parse_args([opt, 'all,extralargefile']) + self.assertEqual(ns.use_resources, + list(regrtest.ALL_RESOURCES) + ['extralargefile']) + + # test another resource which is not part of "all" + ns = regrtest._parse_args([opt, 'extralargefile']) + self.assertEqual(ns.use_resources, ['extralargefile']) + def test_memlimit(self): for opt in '-M', '--memlimit': with self.subTest(opt=opt): @@ -244,7 +301,6 @@ class ParseArgsTestCase(unittest.TestCase): ns = regrtest._parse_args([opt]) self.assertTrue(ns.forever) - def test_unrecognized_argument(self): self.checkError(['--xxx'], 'usage:') @@ -283,6 +339,603 @@ class ParseArgsTestCase(unittest.TestCase): 'unrecognized arguments: --unknown-option') +class BaseTestCase(unittest.TestCase): + TEST_UNIQUE_ID = 1 + TESTNAME_PREFIX = 'test_regrtest_' + TESTNAME_REGEX = r'test_[a-zA-Z0-9_]+' + + def setUp(self): + self.testdir = os.path.realpath(os.path.dirname(__file__)) + + self.tmptestdir = tempfile.mkdtemp() + self.addCleanup(support.rmtree, self.tmptestdir) + + def create_test(self, name=None, code=''): + if not name: + name = 'noop%s' % BaseTestCase.TEST_UNIQUE_ID + BaseTestCase.TEST_UNIQUE_ID += 1 + + # test_regrtest cannot be run twice in parallel because + # of setUp() and create_test() + name = self.TESTNAME_PREFIX + name + path = os.path.join(self.tmptestdir, name + '.py') + + self.addCleanup(support.unlink, path) + # Use 'x' mode to ensure that we do not override existing tests + try: + with open(path, 'x', encoding='utf-8') as fp: + fp.write(code) + except PermissionError as exc: + if not sysconfig.is_python_build(): + self.skipTest("cannot write %s: %s" % (path, exc)) + raise + return name + + def regex_search(self, regex, output): + match = re.search(regex, output, re.MULTILINE) + if not match: + self.fail("%r not found in %r" % (regex, output)) + return match + + def check_line(self, output, regex): + regex = re.compile(r'^' + regex, re.MULTILINE) + self.assertRegex(output, regex) + + def parse_executed_tests(self, output): + regex = (r'^[0-9]+:[0-9]+:[0-9]+ (?:load avg: [0-9]+\.[0-9]{2} )?\[ *[0-9]+(?:/ *[0-9]+)*\] (%s)' + % self.TESTNAME_REGEX) + parser = re.finditer(regex, output, re.MULTILINE) + return list(match.group(1) for match in parser) + + def check_executed_tests(self, output, tests, skipped=(), failed=(), + env_changed=(), omitted=(), + randomize=False, interrupted=False, + fail_env_changed=False): + if isinstance(tests, str): + tests = [tests] + if isinstance(skipped, str): + skipped = [skipped] + if isinstance(failed, str): + failed = [failed] + if isinstance(env_changed, str): + env_changed = [env_changed] + if isinstance(omitted, str): + omitted = [omitted] + + executed = self.parse_executed_tests(output) + if randomize: + self.assertEqual(set(executed), set(tests), output) + else: + self.assertEqual(executed, tests, output) + + def plural(count): + return 's' if count != 1 else '' + + def list_regex(line_format, tests): + count = len(tests) + names = ' '.join(sorted(tests)) + regex = line_format % (count, plural(count)) + regex = r'%s:\n %s$' % (regex, names) + return regex + + if skipped: + regex = list_regex('%s test%s skipped', skipped) + self.check_line(output, regex) + + if failed: + regex = list_regex('%s test%s failed', failed) + self.check_line(output, regex) + + if env_changed: + regex = list_regex('%s test%s altered the execution environment', + env_changed) + self.check_line(output, regex) + + if omitted: + regex = list_regex('%s test%s omitted', omitted) + self.check_line(output, regex) + + good = (len(tests) - len(skipped) - len(failed) + - len(omitted) - len(env_changed)) + if good: + regex = r'%s test%s OK\.$' % (good, plural(good)) + if not skipped and not failed and good > 1: + regex = 'All %s' % regex + self.check_line(output, regex) + + if interrupted: + self.check_line(output, 'Test suite interrupted by signal SIGINT.') + + if failed: + result = 'FAILURE' + elif interrupted: + result = 'INTERRUPTED' + elif fail_env_changed and env_changed: + result = 'ENV CHANGED' + else: + result = 'SUCCESS' + self.check_line(output, 'Tests result: %s' % result) + + def parse_random_seed(self, output): + match = self.regex_search(r'Using random seed ([0-9]+)', output) + randseed = int(match.group(1)) + self.assertTrue(0 <= randseed <= 10000000, randseed) + return randseed + + def run_command(self, args, input=None, exitcode=0, **kw): + if not input: + input = '' + if 'stderr' not in kw: + kw['stderr'] = subprocess.PIPE + proc = subprocess.run(args, + universal_newlines=True, + input=input, + stdout=subprocess.PIPE, + **kw) + if proc.returncode != exitcode: + msg = ("Command %s failed with exit code %s\n" + "\n" + "stdout:\n" + "---\n" + "%s\n" + "---\n" + % (str(args), proc.returncode, proc.stdout)) + if proc.stderr: + msg += ("\n" + "stderr:\n" + "---\n" + "%s" + "---\n" + % proc.stderr) + self.fail(msg) + return proc + + def run_python(self, args, **kw): + args = [sys.executable, '-X', 'faulthandler', '-I', *args] + proc = self.run_command(args, **kw) + return proc.stdout + + +class ProgramsTestCase(BaseTestCase): + """ + Test various ways to run the Python test suite. Use options close + to options used on the buildbot. + """ + + NTEST = 4 + + def setUp(self): + super().setUp() + + # Create NTEST tests doing nothing + self.tests = [self.create_test() for index in range(self.NTEST)] + + self.python_args = ['-Wd', '-E', '-bb'] + self.regrtest_args = ['-uall', '-rwW', + '--testdir=%s' % self.tmptestdir] + if hasattr(faulthandler, 'dump_traceback_later'): + self.regrtest_args.extend(('--timeout', '3600', '-j4')) + if sys.platform == 'win32': + self.regrtest_args.append('-n') + + def check_output(self, output): + self.parse_random_seed(output) + self.check_executed_tests(output, self.tests, randomize=True) + + def run_tests(self, args): + output = self.run_python(args) + self.check_output(output) + + def test_script_regrtest(self): + # Lib/test/regrtest.py + script = os.path.join(self.testdir, 'regrtest.py') + + args = [*self.python_args, script, *self.regrtest_args, *self.tests] + self.run_tests(args) + + def test_module_test(self): + # -m test + args = [*self.python_args, '-m', 'test', + *self.regrtest_args, *self.tests] + self.run_tests(args) + + def test_module_regrtest(self): + # -m test.regrtest + args = [*self.python_args, '-m', 'test.regrtest', + *self.regrtest_args, *self.tests] + self.run_tests(args) + + def test_module_autotest(self): + # -m test.autotest + args = [*self.python_args, '-m', 'test.autotest', + *self.regrtest_args, *self.tests] + self.run_tests(args) + + def test_module_from_test_autotest(self): + # from test import autotest + code = 'from test import autotest' + args = [*self.python_args, '-c', code, + *self.regrtest_args, *self.tests] + self.run_tests(args) + + def test_script_autotest(self): + # Lib/test/autotest.py + script = os.path.join(self.testdir, 'autotest.py') + args = [*self.python_args, script, *self.regrtest_args, *self.tests] + self.run_tests(args) + + @unittest.skipUnless(sysconfig.is_python_build(), + 'run_tests.py script is not installed') + def test_tools_script_run_tests(self): + # Tools/scripts/run_tests.py + script = os.path.join(ROOT_DIR, 'Tools', 'scripts', 'run_tests.py') + args = [script, *self.regrtest_args, *self.tests] + self.run_tests(args) + + def run_batch(self, *args): + proc = self.run_command(args) + self.check_output(proc.stdout) + + @unittest.skipUnless(sysconfig.is_python_build(), + 'test.bat script is not installed') + @unittest.skipUnless(sys.platform == 'win32', 'Windows only') + def test_tools_buildbot_test(self): + # Tools\buildbot\test.bat + script = os.path.join(ROOT_DIR, 'Tools', 'buildbot', 'test.bat') + test_args = ['--testdir=%s' % self.tmptestdir] + if platform.architecture()[0] == '64bit': + test_args.append('-x64') # 64-bit build + if not Py_DEBUG: + test_args.append('+d') # Release build, use python.exe + self.run_batch(script, *test_args, *self.tests) + + @unittest.skipUnless(sys.platform == 'win32', 'Windows only') + def test_pcbuild_rt(self): + # PCbuild\rt.bat + script = os.path.join(ROOT_DIR, r'PCbuild\rt.bat') + rt_args = ["-q"] # Quick, don't run tests twice + if platform.architecture()[0] == '64bit': + rt_args.append('-x64') # 64-bit build + if Py_DEBUG: + rt_args.append('-d') # Debug build, use python_d.exe + self.run_batch(script, *rt_args, *self.regrtest_args, *self.tests) + + +class ArgsTestCase(BaseTestCase): + """ + Test arguments of the Python test suite. + """ + + def run_tests(self, *testargs, **kw): + cmdargs = ['-m', 'test', '--testdir=%s' % self.tmptestdir, *testargs] + return self.run_python(cmdargs, **kw) + + def test_failing_test(self): + # test a failing test + code = textwrap.dedent(""" + import unittest + + class FailingTest(unittest.TestCase): + def test_failing(self): + self.fail("bug") + """) + test_ok = self.create_test('ok') + test_failing = self.create_test('failing', code=code) + tests = [test_ok, test_failing] + + output = self.run_tests(*tests, exitcode=2) + self.check_executed_tests(output, tests, failed=test_failing) + + def test_resources(self): + # test -u command line option + tests = {} + for resource in ('audio', 'network'): + code = 'from test import support\nsupport.requires(%r)' % resource + tests[resource] = self.create_test(resource, code) + test_names = sorted(tests.values()) + + # -u all: 2 resources enabled + output = self.run_tests('-u', 'all', *test_names) + self.check_executed_tests(output, test_names) + + # -u audio: 1 resource enabled + output = self.run_tests('-uaudio', *test_names) + self.check_executed_tests(output, test_names, + skipped=tests['network']) + + # no option: 0 resources enabled + output = self.run_tests(*test_names) + self.check_executed_tests(output, test_names, + skipped=test_names) + + def test_random(self): + # test -r and --randseed command line option + code = textwrap.dedent(""" + import random + print("TESTRANDOM: %s" % random.randint(1, 1000)) + """) + test = self.create_test('random', code) + + # first run to get the output with the random seed + output = self.run_tests('-r', test) + randseed = self.parse_random_seed(output) + match = self.regex_search(r'TESTRANDOM: ([0-9]+)', output) + test_random = int(match.group(1)) + + # try to reproduce with the random seed + output = self.run_tests('-r', '--randseed=%s' % randseed, test) + randseed2 = self.parse_random_seed(output) + self.assertEqual(randseed2, randseed) + + match = self.regex_search(r'TESTRANDOM: ([0-9]+)', output) + test_random2 = int(match.group(1)) + self.assertEqual(test_random2, test_random) + + def test_fromfile(self): + # test --fromfile + tests = [self.create_test() for index in range(5)] + + # Write the list of files using a format similar to regrtest output: + # [1/2] test_1 + # [2/2] test_2 + filename = support.TESTFN + self.addCleanup(support.unlink, filename) + + # test format '0:00:00 [2/7] test_opcodes -- test_grammar took 0 sec' + with open(filename, "w") as fp: + previous = None + for index, name in enumerate(tests, 1): + line = ("00:00:%02i [%s/%s] %s" + % (index, index, len(tests), name)) + if previous: + line += " -- %s took 0 sec" % previous + print(line, file=fp) + previous = name + + output = self.run_tests('--fromfile', filename) + self.check_executed_tests(output, tests) + + # test format '[2/7] test_opcodes' + with open(filename, "w") as fp: + for index, name in enumerate(tests, 1): + print("[%s/%s] %s" % (index, len(tests), name), file=fp) + + output = self.run_tests('--fromfile', filename) + self.check_executed_tests(output, tests) + + # test format 'test_opcodes' + with open(filename, "w") as fp: + for name in tests: + print(name, file=fp) + + output = self.run_tests('--fromfile', filename) + self.check_executed_tests(output, tests) + + # test format 'Lib/test/test_opcodes.py' + with open(filename, "w") as fp: + for name in tests: + print('Lib/test/%s.py' % name, file=fp) + + output = self.run_tests('--fromfile', filename) + self.check_executed_tests(output, tests) + + def test_interrupted(self): + code = TEST_INTERRUPTED + test = self.create_test('sigint', code=code) + output = self.run_tests(test, exitcode=130) + self.check_executed_tests(output, test, omitted=test, + interrupted=True) + + def test_slowest(self): + # test --slowest + tests = [self.create_test() for index in range(3)] + output = self.run_tests("--slowest", *tests) + self.check_executed_tests(output, tests) + regex = ('10 slowest tests:\n' + '(?:- %s: .*\n){%s}' + % (self.TESTNAME_REGEX, len(tests))) + self.check_line(output, regex) + + def test_slow_interrupted(self): + # Issue #25373: test --slowest with an interrupted test + code = TEST_INTERRUPTED + test = self.create_test("sigint", code=code) + + try: + import threading + tests = (False, True) + except ImportError: + tests = (False,) + for multiprocessing in tests: + if multiprocessing: + args = ("--slowest", "-j2", test) + else: + args = ("--slowest", test) + output = self.run_tests(*args, exitcode=130) + self.check_executed_tests(output, test, + omitted=test, interrupted=True) + + regex = ('10 slowest tests:\n') + self.check_line(output, regex) + + def test_coverage(self): + # test --coverage + test = self.create_test('coverage') + output = self.run_tests("--coverage", test) + self.check_executed_tests(output, [test]) + regex = (r'lines +cov% +module +\(path\)\n' + r'(?: *[0-9]+ *[0-9]{1,2}% *[^ ]+ +\([^)]+\)+)+') + self.check_line(output, regex) + + def test_wait(self): + # test --wait + test = self.create_test('wait') + output = self.run_tests("--wait", test, input='key') + self.check_line(output, 'Press any key to continue') + + def test_forever(self): + # test --forever + code = textwrap.dedent(""" + import builtins + import unittest + + class ForeverTester(unittest.TestCase): + def test_run(self): + # Store the state in the builtins module, because the test + # module is reload at each run + if 'RUN' in builtins.__dict__: + builtins.__dict__['RUN'] += 1 + if builtins.__dict__['RUN'] >= 3: + self.fail("fail at the 3rd runs") + else: + builtins.__dict__['RUN'] = 1 + """) + test = self.create_test('forever', code=code) + output = self.run_tests('--forever', test, exitcode=2) + self.check_executed_tests(output, [test]*3, failed=test) + + def check_leak(self, code, what): + test = self.create_test('huntrleaks', code=code) + + filename = 'reflog.txt' + self.addCleanup(support.unlink, filename) + output = self.run_tests('--huntrleaks', '3:3:', test, + exitcode=2, + stderr=subprocess.STDOUT) + self.check_executed_tests(output, [test], failed=test) + + line = 'beginning 6 repetitions\n123456\n......\n' + self.check_line(output, re.escape(line)) + + line2 = '%s leaked [1, 1, 1] %s, sum=3\n' % (test, what) + self.assertIn(line2, output) + + with open(filename) as fp: + reflog = fp.read() + self.assertIn(line2, reflog) + + @unittest.skipUnless(Py_DEBUG, 'need a debug build') + def test_huntrleaks(self): + # test --huntrleaks + code = textwrap.dedent(""" + import unittest + + GLOBAL_LIST = [] + + class RefLeakTest(unittest.TestCase): + def test_leak(self): + GLOBAL_LIST.append(object()) + """) + self.check_leak(code, 'references') + + def test_list_tests(self): + # test --list-tests + tests = [self.create_test() for i in range(5)] + output = self.run_tests('--list-tests', *tests) + self.assertEqual(output.rstrip().splitlines(), + tests) + + def test_list_cases(self): + # test --list-cases + code = textwrap.dedent(""" + import unittest + + class Tests(unittest.TestCase): + def test_method1(self): + pass + def test_method2(self): + pass + """) + testname = self.create_test(code=code) + + # Test --list-cases + all_methods = ['%s.Tests.test_method1' % testname, + '%s.Tests.test_method2' % testname] + output = self.run_tests('--list-cases', testname) + self.assertEqual(output.splitlines(), all_methods) + + # Test --list-cases with --match + all_methods = ['%s.Tests.test_method1' % testname] + output = self.run_tests('--list-cases', + '-m', 'test_method1', + testname) + self.assertEqual(output.splitlines(), all_methods) + + def test_crashed(self): + # Any code which causes a crash + code = 'import faulthandler; faulthandler._sigsegv()' + crash_test = self.create_test(name="crash", code=code) + ok_test = self.create_test(name="ok") + + tests = [crash_test, ok_test] + output = self.run_tests("-j2", *tests, exitcode=2) + self.check_executed_tests(output, tests, failed=crash_test, + randomize=True) + + def parse_methods(self, output): + regex = re.compile("^(test[^ ]+).*ok$", flags=re.MULTILINE) + return [match.group(1) for match in regex.finditer(output)] + + def test_matchfile(self): + code = textwrap.dedent(""" + import unittest + + class Tests(unittest.TestCase): + def test_method1(self): + pass + def test_method2(self): + pass + def test_method3(self): + pass + def test_method4(self): + pass + """) + all_methods = ['test_method1', 'test_method2', + 'test_method3', 'test_method4'] + testname = self.create_test(code=code) + + # by default, all methods should be run + output = self.run_tests("-v", testname) + methods = self.parse_methods(output) + self.assertEqual(methods, all_methods) + + # only run a subset + filename = support.TESTFN + self.addCleanup(support.unlink, filename) + + subset = [ + # only match the method name + 'test_method1', + # match the full identifier + '%s.Tests.test_method3' % testname] + with open(filename, "w") as fp: + for name in subset: + print(name, file=fp) + + output = self.run_tests("-v", "--matchfile", filename, testname) + methods = self.parse_methods(output) + subset = ['test_method1', 'test_method3'] + self.assertEqual(methods, subset) + + def test_env_changed(self): + code = textwrap.dedent(""" + import unittest + + class Tests(unittest.TestCase): + def test_env_changed(self): + open("env_changed", "w").close() + """) + testname = self.create_test(code=code) + + # don't fail by default + output = self.run_tests(testname) + self.check_executed_tests(output, [testname], env_changed=testname) + + # fail with --fail-env-changed + output = self.run_tests("--fail-env-changed", testname, exitcode=3) + self.check_executed_tests(output, [testname], env_changed=testname, + fail_env_changed=True) + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index 2411895..2eb6290 100644 --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -4,6 +4,7 @@ from xml.sax import make_parser, ContentHandler, \ SAXException, SAXReaderNotAvailable, SAXParseException import unittest +from unittest import mock try: make_parser() except SAXReaderNotAvailable: @@ -175,12 +176,8 @@ class ParseTest(unittest.TestCase): with self.assertRaises(SAXException): self.check_parse(BytesIO(xml_bytes(self.data, 'iso-8859-1', None))) make_xml_file(self.data, 'iso-8859-1', None) - with support.check_warnings(('unclosed file', ResourceWarning)): - # XXX Failed parser leaks an opened file. - with self.assertRaises(SAXException): - self.check_parse(TESTFN) - # Collect leaked file. - gc.collect() + with self.assertRaises(SAXException): + self.check_parse(TESTFN) with open(TESTFN, 'rb') as f: with self.assertRaises(SAXException): self.check_parse(f) @@ -194,6 +191,21 @@ class ParseTest(unittest.TestCase): input.setEncoding('iso-8859-1') self.check_parse(input) + def test_parse_close_source(self): + builtin_open = open + fileobj = None + + def mock_open(*args): + nonlocal fileobj + fileobj = builtin_open(*args) + return fileobj + + with mock.patch('xml.sax.saxutils.open', side_effect=mock_open): + make_xml_file(self.data, 'iso-8859-1', None) + with self.assertRaises(SAXException): + self.check_parse(TESTFN) + self.assertTrue(fileobj.closed) + def check_parseString(self, s): from xml.sax import parseString result = StringIO() diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index 1b80ff0..5c7b31d 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -764,6 +764,15 @@ class ItimerTest(unittest.TestCase): # and the handler should have been called self.assertEqual(self.hndl_called, True) + def test_setitimer_tiny(self): + # bpo-30807: C setitimer() takes a microsecond-resolution interval. + # Check that float -> timeval conversion doesn't round + # the interval down to zero, which would disable the timer. + self.itimer = signal.ITIMER_REAL + signal.setitimer(self.itimer, 1e-6) + time.sleep(1) + self.assertEqual(self.hndl_called, True) + class PendingSignalsTests(unittest.TestCase): """ diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index da20a3d..755eb9c 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -26,14 +26,27 @@ if sys.flags.no_site: import site -if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE): - # need to add user site directory for tests - try: - os.makedirs(site.USER_SITE) - site.addsitedir(site.USER_SITE) - except PermissionError as exc: - raise unittest.SkipTest('unable to create user site directory (%r): %s' - % (site.USER_SITE, exc)) + +OLD_SYS_PATH = None + + +def setUpModule(): + global OLD_SYS_PATH + OLD_SYS_PATH = sys.path[:] + + if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE): + # need to add user site directory for tests + try: + os.makedirs(site.USER_SITE) + # modify sys.path: will be restored by tearDownModule() + site.addsitedir(site.USER_SITE) + except PermissionError as exc: + raise unittest.SkipTest('unable to create user site directory (%r): %s' + % (site.USER_SITE, exc)) + + +def tearDownModule(): + sys.path[:] = OLD_SYS_PATH class HelperFunctionsTests(unittest.TestCase): diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index ea3ca28..58c04d7 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -876,6 +876,7 @@ class GeneralModuleTests(unittest.TestCase): self.assertEqual(swapped & mask, mask) self.assertRaises(OverflowError, func, 1<<34) + @support.cpython_only def testNtoHErrors(self): good_values = [ 1, 2, 3, 1, 2, 3 ] bad_values = [ -1, -2, -3, -1, -2, -3 ] @@ -2843,6 +2844,7 @@ class SCMRightsTest(SendrecvmsgServerTimeoutBase): nbytes = self.sendmsgToServer([msg]) self.assertEqual(nbytes, len(msg)) + @unittest.skipIf(sys.platform == "darwin", "skipping, see issue #24725") def testFDPassEmpty(self): # Try to pass an empty FD array. Can receive either no array # or an empty array. @@ -4588,6 +4590,10 @@ class TestUnixDomain(unittest.TestCase): else: raise + def testUnbound(self): + # Issue #30205 + self.assertIn(self.sock.getsockname(), (None, '')) + def testStrAddr(self): # Test binding to and retrieving a normal string pathname. path = os.path.abspath(support.TESTFN) @@ -4719,14 +4725,10 @@ def isTipcAvailable(): return False try: f = open("/proc/modules") - except IOError as e: + except (FileNotFoundError, IsADirectoryError, PermissionError): # It's ok if the file does not exist, is a directory or if we - # have not the permission to read it. In any other case it's a - # real error, so raise it again. - if e.errno in (errno.ENOENT, errno.EISDIR, errno.EACCES): - return False - else: - raise + # have not the permission to read it. + return False with f: for line in f: if line.startswith("tipc "): diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 5515583..ffb7314 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -2034,7 +2034,7 @@ else: class EchoServer (asyncore.dispatcher): - class ConnectionHandler (asyncore.dispatcher_with_send): + class ConnectionHandler(asyncore.dispatcher_with_send): def __init__(self, conn, certfile): self.socket = ssl.wrap_socket(conn, server_side=True, @@ -2125,6 +2125,8 @@ else: self.join() if support.verbose: sys.stdout.write(" cleanup: successfully joined.\n") + # make sure that ConnectionHandler is removed from socket_map + asyncore.close_all(ignore_all=True) def start (self, flag=None): self.flag = flag diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index efbdbfc..9b8178f 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -428,6 +428,10 @@ class StructTest(unittest.TestCase): for i in range(6, len(test_string) + 1): self.assertRaises(struct.error, struct.unpack_from, fmt, data, i) + # keyword arguments + self.assertEqual(s.unpack_from(buffer=test_string, offset=2), + (b'cd01',)) + def test_pack_into(self): test_string = b'Reykjavik rocks, eow!' writable_buf = array.array('b', b' '*100) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 758e094..45b7ce4 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -4,6 +4,7 @@ from test.support import script_helper from test import support import subprocess import sys +import platform import signal import io import locale @@ -21,6 +22,13 @@ import gc import textwrap try: + import ctypes +except ImportError: + ctypes = None +else: + import ctypes.util + +try: import threading except ImportError: threading = None @@ -628,6 +636,46 @@ class ProcessTestCase(BaseTestCase): # environment b"['__CF_USER_TEXT_ENCODING']")) + def test_invalid_cmd(self): + # null character in the command name + cmd = sys.executable + '\0' + with self.assertRaises(ValueError): + subprocess.Popen([cmd, "-c", "pass"]) + + # null character in the command argument + with self.assertRaises(ValueError): + subprocess.Popen([sys.executable, "-c", "pass#\0"]) + + def test_invalid_env(self): + # null character in the enviroment variable name + newenv = os.environ.copy() + newenv["FRUIT\0VEGETABLE"] = "cabbage" + with self.assertRaises(ValueError): + subprocess.Popen([sys.executable, "-c", "pass"], env=newenv) + + # null character in the enviroment variable value + newenv = os.environ.copy() + newenv["FRUIT"] = "orange\0VEGETABLE=cabbage" + with self.assertRaises(ValueError): + subprocess.Popen([sys.executable, "-c", "pass"], env=newenv) + + # equal character in the enviroment variable name + newenv = os.environ.copy() + newenv["FRUIT=ORANGE"] = "lemon" + with self.assertRaises(ValueError): + subprocess.Popen([sys.executable, "-c", "pass"], env=newenv) + + # equal character in the enviroment variable value + newenv = os.environ.copy() + newenv["FRUIT"] = "orange=lemon" + with subprocess.Popen([sys.executable, "-c", + 'import sys, os;' + 'sys.stdout.write(os.getenv("FRUIT"))'], + stdout=subprocess.PIPE, + env=newenv) as p: + stdout, stderr = p.communicate() + self.assertEqual(stdout, b"orange=lemon") + def test_communicate_stdin(self): p = subprocess.Popen([sys.executable, "-c", 'import sys;' @@ -2365,7 +2413,7 @@ class POSIXProcessTestCase(BaseTestCase): with self.assertRaises(TypeError): _posixsubprocess.fork_exec( args, exe_list, - True, [], cwd, env_list, + True, (), cwd, env_list, -1, -1, -1, -1, 1, 2, 3, 4, True, True, func) @@ -2377,6 +2425,16 @@ class POSIXProcessTestCase(BaseTestCase): def test_fork_exec_sorted_fd_sanity_check(self): # Issue #23564: sanity check the fork_exec() fds_to_keep sanity check. import _posixsubprocess + class BadInt: + first = True + def __init__(self, value): + self.value = value + def __int__(self): + if self.first: + self.first = False + return self.value + raise ValueError + gc_enabled = gc.isenabled() try: gc.enable() @@ -2387,6 +2445,7 @@ class POSIXProcessTestCase(BaseTestCase): (18, 23, 42, 2**63), # Out of range. (5, 4), # Not sorted. (6, 7, 7, 8), # Duplicate. + (BadInt(1), BadInt(2)), ): with self.assertRaises( ValueError, @@ -2448,6 +2507,43 @@ class POSIXProcessTestCase(BaseTestCase): proc.communicate(timeout=999) mock_proc_stdin.close.assert_called_once_with() + @unittest.skipIf(not ctypes, 'ctypes module required') + @unittest.skipIf(not sys.executable, 'Test requires sys.executable') + def test_child_terminated_in_stopped_state(self): + """Test wait() behavior when waitpid returns WIFSTOPPED; issue29335.""" + PTRACE_TRACEME = 0 # From glibc and MacOS (PT_TRACE_ME). + libc_name = ctypes.util.find_library('c') + libc = ctypes.CDLL(libc_name) + if not hasattr(libc, 'ptrace'): + raise unittest.SkipTest('ptrace() required') + + code = textwrap.dedent(""" + import ctypes + import faulthandler + from test.support import SuppressCrashReport + + libc = ctypes.CDLL({libc_name!r}) + libc.ptrace({PTRACE_TRACEME}, 0, 0) + """.format(libc_name=libc_name, PTRACE_TRACEME=PTRACE_TRACEME)) + + child = subprocess.Popen([sys.executable, '-c', code]) + if child.wait() != 0: + raise unittest.SkipTest('ptrace() failed - unable to test') + + code += textwrap.dedent(""" + with SuppressCrashReport(): + # Crash the process + faulthandler._sigsegv() + """) + child = subprocess.Popen([sys.executable, '-c', code]) + try: + returncode = child.wait() + except: + child.kill() # Clean up the hung stopped process. + raise + self.assertNotEqual(0, returncode) + self.assertLess(returncode, 0) # signal death, likely SIGSEGV. + @unittest.skipUnless(mswindows, "Windows specific tests") class Win32ProcessTestCase(BaseTestCase): diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 5e0f990..70137e1 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -283,17 +283,34 @@ class TestSupport(unittest.TestCase): def test_swap_attr(self): class Obj: - x = 1 + pass obj = Obj() - with support.swap_attr(obj, "x", 5): + obj.x = 1 + with support.swap_attr(obj, "x", 5) as x: self.assertEqual(obj.x, 5) + self.assertEqual(x, 1) self.assertEqual(obj.x, 1) + with support.swap_attr(obj, "y", 5) as y: + self.assertEqual(obj.y, 5) + self.assertIsNone(y) + self.assertFalse(hasattr(obj, 'y')) + with support.swap_attr(obj, "y", 5): + del obj.y + self.assertFalse(hasattr(obj, 'y')) def test_swap_item(self): - D = {"item":1} - with support.swap_item(D, "item", 5): - self.assertEqual(D["item"], 5) - self.assertEqual(D["item"], 1) + D = {"x":1} + with support.swap_item(D, "x", 5) as x: + self.assertEqual(D["x"], 5) + self.assertEqual(x, 1) + self.assertEqual(D["x"], 1) + with support.swap_item(D, "y", 5) as y: + self.assertEqual(D["y"], 5) + self.assertIsNone(y) + self.assertNotIn("y", D) + with support.swap_item(D, "y", 5): + del D["y"] + self.assertNotIn("y", D) class RefClass: attribute1 = None diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index a23bf06..3830679 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -5,7 +5,8 @@ import subprocess import shutil from copy import copy -from test.support import (run_unittest, TESTFN, unlink, check_warnings, +from test.support import (run_unittest, + import_module, TESTFN, unlink, check_warnings, captured_stdout, skip_unless_symlink, change_cwd) import sysconfig @@ -387,7 +388,8 @@ class TestSysConfig(unittest.TestCase): @unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test') def test_triplet_in_ext_suffix(self): - import ctypes, platform, re + ctypes = import_module('ctypes') + import platform, re machine = platform.machine() suffix = sysconfig.get_config_var('EXT_SUFFIX') if re.match('(aarch64|arm|mips|ppc|powerpc|s390|sparc)', machine): diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py index 51df1ec..d0cf04b 100644 --- a/Lib/test/test_tempfile.py +++ b/Lib/test/test_tempfile.py @@ -273,13 +273,12 @@ class TestGetDefaultTempdir(BaseTestCase): tempfile._get_default_tempdir() self.assertEqual(os.listdir(our_temp_directory), []) - open = io.open def bad_writer(*args, **kwargs): - fp = open(*args, **kwargs) + fp = orig_open(*args, **kwargs) fp.write = raise_OSError return fp - with support.swap_attr(io, "open", bad_writer): + with support.swap_attr(io, "open", bad_writer) as orig_open: # test again with failing write() with self.assertRaises(FileNotFoundError): tempfile._get_default_tempdir() diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py index ef3059b..3909b75 100644 --- a/Lib/test/test_thread.py +++ b/Lib/test/test_thread.py @@ -20,6 +20,7 @@ def verbose_print(arg): with _print_mutex: print(arg) + class BasicThreadTest(unittest.TestCase): def setUp(self): @@ -31,6 +32,9 @@ class BasicThreadTest(unittest.TestCase): self.running = 0 self.next_ident = 0 + key = support.threading_setup() + self.addCleanup(support.threading_cleanup, *key) + class ThreadRunningTests(BasicThreadTest): diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index b630509..edae526 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -170,6 +170,9 @@ class ThreadTests(BaseTestCase): mutex.acquire() self.assertIn(tid, threading._active) self.assertIsInstance(threading._active[tid], threading._DummyThread) + #Issue 29376 + self.assertTrue(threading._active[tid].is_alive()) + self.assertRegex(repr(threading._active[tid]), '_DummyThread') del threading._active[tid] # PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently) @@ -467,13 +470,15 @@ class ThreadTests(BaseTestCase): for i in range(20): t = threading.Thread(target=lambda: None) t.start() - self.addCleanup(t.join) pid = os.fork() if pid == 0: - os._exit(1 if t.is_alive() else 0) + os._exit(11 if t.is_alive() else 10) else: + t.join() + pid, status = os.waitpid(pid, 0) - self.assertEqual(0, status) + self.assertTrue(os.WIFEXITED(status)) + self.assertEqual(10, os.WEXITSTATUS(status)) def test_main_thread(self): main = threading.main_thread() diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index 76b894e..04962b2 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -114,6 +114,10 @@ class TimeTestCase(unittest.TestCase): except ValueError: self.fail('conversion specifier: %r failed.' % format) + self.assertRaises(TypeError, time.strftime, b'%S', tt) + # embedded null character + self.assertRaises(ValueError, time.strftime, '%S\0', tt) + def _bounds_checking(self, func): # Make sure that strftime() checks the bounds of the various parts # of the time tuple (0 is valid for *all* values). diff --git a/Lib/test/test_tools/test_reindent.py b/Lib/test/test_tools/test_reindent.py index d7c20e1..34df0c5 100644 --- a/Lib/test/test_tools/test_reindent.py +++ b/Lib/test/test_tools/test_reindent.py @@ -7,6 +7,7 @@ Tools directory of a Python checkout or tarball, such as reindent.py. import os import unittest from test.support.script_helper import assert_python_ok +from test.support import findfile from test.test_tools import scriptsdir, skip_if_missing @@ -23,6 +24,12 @@ class ReindentTests(unittest.TestCase): self.assertEqual(out, b'') self.assertGreater(err, b'') + def test_reindent_file_with_bad_encoding(self): + bad_coding_path = findfile('bad_coding.py') + rc, out, err = assert_python_ok(self.script, '-r', bad_coding_path) + self.assertEqual(out, b'') + self.assertNotEqual(err, b'') + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py index da89a9a..2d1a9b3 100644 --- a/Lib/test/test_tracemalloc.py +++ b/Lib/test/test_tracemalloc.py @@ -809,6 +809,7 @@ class TestCommandLine(unittest.TestCase): b'number of frames', stderr) + @support.cpython_only def test_pymem_alloc0(self): # Issue #21639: Check that PyMem_Malloc(0) with tracemalloc enabled # does not crash. diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index d203ce3..6d0b265 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -6,13 +6,13 @@ import sys from unittest import TestCase, main, skipUnless, SkipTest from copy import copy, deepcopy -from typing import Any +from typing import Any, NoReturn from typing import TypeVar, AnyStr from typing import T, KT, VT # Not in __all__. from typing import Union, Optional from typing import Tuple, List, MutableMapping from typing import Callable -from typing import Generic, ClassVar +from typing import Generic, ClassVar, GenericMeta from typing import cast from typing import get_type_hints from typing import no_type_check, no_type_check_decorator @@ -23,6 +23,7 @@ from typing import IO, TextIO, BinaryIO from typing import Pattern, Match import abc import typing +import weakref try: import collections.abc as collections_abc except ImportError: @@ -101,10 +102,6 @@ class AnyTests(BaseTestCase): with self.assertRaises(TypeError): type(Any)() - def test_cannot_subscript(self): - with self.assertRaises(TypeError): - Any[int] - def test_any_works_with_alias(self): # These expressions must simply not fail. typing.Match[Any] @@ -112,6 +109,40 @@ class AnyTests(BaseTestCase): typing.IO[Any] +class NoReturnTests(BaseTestCase): + + def test_noreturn_instance_type_error(self): + with self.assertRaises(TypeError): + isinstance(42, NoReturn) + + def test_noreturn_subclass_type_error(self): + with self.assertRaises(TypeError): + issubclass(Employee, NoReturn) + with self.assertRaises(TypeError): + issubclass(NoReturn, Employee) + + def test_repr(self): + self.assertEqual(repr(NoReturn), 'typing.NoReturn') + + def test_not_generic(self): + with self.assertRaises(TypeError): + NoReturn[int] + + def test_cannot_subclass(self): + with self.assertRaises(TypeError): + class A(NoReturn): + pass + with self.assertRaises(TypeError): + class A(type(NoReturn)): + pass + + def test_cannot_instantiate(self): + with self.assertRaises(TypeError): + NoReturn() + with self.assertRaises(TypeError): + type(NoReturn)() + + class TypeVarTests(BaseTestCase): def test_basic_plain(self): @@ -189,6 +220,10 @@ class TypeVarTests(BaseTestCase): with self.assertRaises(TypeError): TypeVar('X', str, float, bound=Employee) + def test_no_bivariant(self): + with self.assertRaises(ValueError): + TypeVar('T', covariant=True, contravariant=True) + class UnionTests(BaseTestCase): @@ -253,6 +288,11 @@ class UnionTests(BaseTestCase): self.assertEqual(repr(u), 'typing.Union[%s.Employee, int]' % __name__) u = Union[int, Employee] self.assertEqual(repr(u), 'typing.Union[int, %s.Employee]' % __name__) + T = TypeVar('T') + u = Union[T, int][int] + self.assertEqual(repr(u), repr(int)) + u = Union[List[int], int] + self.assertEqual(repr(u), 'typing.Union[typing.List[int], int]') def test_cannot_subclass(self): with self.assertRaises(TypeError): @@ -281,6 +321,15 @@ class UnionTests(BaseTestCase): self.assertFalse(Union[str, typing.Iterable[int]] == typing.Iterable[int]) self.assertTrue(Union[str, typing.Iterable] == typing.Iterable) + def test_union_compare_other(self): + self.assertNotEqual(Union, object) + self.assertNotEqual(Union, Any) + self.assertNotEqual(ClassVar, Union) + self.assertNotEqual(Optional, Union) + self.assertNotEqual([None], Optional) + self.assertNotEqual(Optional, typing.Mapping) + self.assertNotEqual(Optional[typing.MutableMapping], Union) + def test_optional(self): o = Optional[int] u = Union[int, None] @@ -294,6 +343,15 @@ class UnionTests(BaseTestCase): with self.assertRaises(TypeError): isinstance(42, Union[int, str]) + def test_no_eval_union(self): + u = Union[int, str] + def f(x: u): ... + self.assertIs(get_type_hints(f)['x'], u) + + def test_function_repr_union(self): + def fun() -> int: ... + self.assertEqual(repr(Union[fun, int]), 'typing.Union[fun, int]') + def test_union_str_pattern(self): # Shouldn't crash; see http://bugs.python.org/issue25390 A = Union[str, Pattern] @@ -391,6 +449,8 @@ class CallableTests(BaseTestCase): Callable[[()], int] with self.assertRaises(TypeError): Callable[[int, 1], 2] + with self.assertRaises(TypeError): + Callable[int] def test_callable_instance_works(self): def f(): @@ -536,15 +596,27 @@ class GenericTests(BaseTestCase): Y[str] with self.assertRaises(TypeError): Y[str, str] + self.assertIsSubclass(SimpleMapping[str, int], SimpleMapping) def test_generic_errors(self): T = TypeVar('T') + S = TypeVar('S') with self.assertRaises(TypeError): Generic[T]() with self.assertRaises(TypeError): + Generic[T][T] + with self.assertRaises(TypeError): + Generic[T][S] + with self.assertRaises(TypeError): isinstance([], List[int]) with self.assertRaises(TypeError): issubclass(list, List[int]) + with self.assertRaises(TypeError): + class NewGeneric(Generic): ... + with self.assertRaises(TypeError): + class MyGeneric(Generic[T], Generic[S]): ... + with self.assertRaises(TypeError): + class MyGeneric(List[T], Generic[S]): ... def test_init(self): T = TypeVar('T') @@ -602,8 +674,10 @@ class GenericTests(BaseTestCase): self.assertEqual(repr(typing.Mapping[T, TS][TS, T]), 'typing.Mapping[~TS, ~T]') self.assertEqual(repr(List[Tuple[T, TS]][int, T]), 'typing.List[typing.Tuple[int, ~T]]') - self.assertEqual(repr(List[Tuple[T, T]][List[int]]), - 'typing.List[typing.Tuple[typing.List[int], typing.List[int]]]') + self.assertEqual( + repr(List[Tuple[T, T]][List[int]]), + 'typing.List[typing.Tuple[typing.List[int], typing.List[int]]]' + ) def test_new_repr_bare(self): T = TypeVar('T') @@ -630,6 +704,41 @@ class GenericTests(BaseTestCase): c.bar = 'abc' self.assertEqual(c.__dict__, {'bar': 'abc'}) + def test_subscripted_generics_as_proxies(self): + T = TypeVar('T') + class C(Generic[T]): + x = 'def' + self.assertEqual(C[int].x, 'def') + self.assertEqual(C[C[int]].x, 'def') + C[C[int]].x = 'changed' + self.assertEqual(C.x, 'changed') + self.assertEqual(C[str].x, 'changed') + C[List[str]].z = 'new' + self.assertEqual(C.z, 'new') + self.assertEqual(C[Tuple[int]].z, 'new') + + self.assertEqual(C().x, 'changed') + self.assertEqual(C[Tuple[str]]().z, 'new') + + class D(C[T]): + pass + self.assertEqual(D[int].x, 'changed') + self.assertEqual(D.z, 'new') + D.z = 'from derived z' + D[int].x = 'from derived x' + self.assertEqual(C.x, 'changed') + self.assertEqual(C[int].z, 'new') + self.assertEqual(D.x, 'from derived x') + self.assertEqual(D[str].z, 'from derived z') + + def test_abc_registry_kept(self): + T = TypeVar('T') + class C(Generic[T]): ... + C.register(int) + self.assertIsInstance(1, C) + C[int] + self.assertIsInstance(1, C) + def test_false_subclasses(self): class MyMapping(MutableMapping[str, str]): pass self.assertNotIsInstance({}, MyMapping) @@ -674,8 +783,10 @@ class GenericTests(BaseTestCase): raise NotImplementedError if tp.__args__: KT, VT = tp.__args__ - return all(isinstance(k, KT) and isinstance(v, VT) - for k, v in obj.items()) + return all( + isinstance(k, KT) and isinstance(v, VT) + for k, v in obj.items() + ) self.assertTrue(naive_dict_check({'x': 1}, typing.Dict[str, int])) self.assertFalse(naive_dict_check({1: 'x'}, typing.Dict[str, int])) with self.assertRaises(NotImplementedError): @@ -691,7 +802,7 @@ class GenericTests(BaseTestCase): self.assertFalse(naive_generic_check(Node[str](), Node[int])) self.assertFalse(naive_generic_check(Node[str](), List)) with self.assertRaises(NotImplementedError): - naive_generic_check([1,2,3], Node[int]) + naive_generic_check([1, 2, 3], Node[int]) def naive_list_base_check(obj, tp): # Check if list conforms to a List subclass @@ -718,6 +829,59 @@ class GenericTests(BaseTestCase): self.assertEqual(C.__orig_bases__, (List[T][U][V],)) self.assertEqual(D.__orig_bases__, (C, List[T][U][V])) + def test_subscript_meta(self): + T = TypeVar('T') + self.assertEqual(Type[GenericMeta], Type[GenericMeta]) + self.assertEqual(Union[T, int][GenericMeta], Union[GenericMeta, int]) + self.assertEqual(Callable[..., GenericMeta].__args__, (Ellipsis, GenericMeta)) + + def test_generic_hashes(self): + try: + from test import mod_generics_cache + except ImportError: # for Python 3.4 and previous versions + import mod_generics_cache + class A(Generic[T]): + ... + + class B(Generic[T]): + class A(Generic[T]): + ... + + self.assertEqual(A, A) + self.assertEqual(mod_generics_cache.A[str], mod_generics_cache.A[str]) + self.assertEqual(B.A, B.A) + self.assertEqual(mod_generics_cache.B.A[B.A[str]], + mod_generics_cache.B.A[B.A[str]]) + + self.assertNotEqual(A, B.A) + self.assertNotEqual(A, mod_generics_cache.A) + self.assertNotEqual(A, mod_generics_cache.B.A) + self.assertNotEqual(B.A, mod_generics_cache.A) + self.assertNotEqual(B.A, mod_generics_cache.B.A) + + self.assertNotEqual(A[str], B.A[str]) + self.assertNotEqual(A[List[Any]], B.A[List[Any]]) + self.assertNotEqual(A[str], mod_generics_cache.A[str]) + self.assertNotEqual(A[str], mod_generics_cache.B.A[str]) + self.assertNotEqual(B.A[int], mod_generics_cache.A[int]) + self.assertNotEqual(B.A[List[Any]], mod_generics_cache.B.A[List[Any]]) + + self.assertNotEqual(Tuple[A[str]], Tuple[B.A[str]]) + self.assertNotEqual(Tuple[A[List[Any]]], Tuple[B.A[List[Any]]]) + self.assertNotEqual(Union[str, A[str]], Union[str, mod_generics_cache.A[str]]) + self.assertNotEqual(Union[A[str], A[str]], + Union[A[str], mod_generics_cache.A[str]]) + self.assertNotEqual(typing.FrozenSet[A[str]], + typing.FrozenSet[mod_generics_cache.B.A[str]]) + + if sys.version_info[:2] > (3, 2): + self.assertTrue(repr(Tuple[A[str]]).endswith('.A[str]]')) + self.assertTrue(repr(Tuple[B.A[str]]).endswith('.B.A[str]]')) + self.assertTrue(repr(Tuple[mod_generics_cache.A[str]]) + .endswith('mod_generics_cache.A[str]]')) + self.assertTrue(repr(Tuple[mod_generics_cache.B.A[str]]) + .endswith('mod_generics_cache.B.A[str]]')) + def test_extended_generic_rules_eq(self): T = TypeVar('T') U = TypeVar('U') @@ -757,7 +921,10 @@ class GenericTests(BaseTestCase): def test_generic_forward_ref(self): def foobar(x: List[List['CC']]): ... class CC: ... - self.assertEqual(get_type_hints(foobar, globals(), locals()), {'x': List[List[CC]]}) + self.assertEqual( + get_type_hints(foobar, globals(), locals()), + {'x': List[List[CC]]} + ) T = TypeVar('T') AT = Tuple[T, ...] def barfoo(x: AT): ... @@ -812,6 +979,8 @@ class GenericTests(BaseTestCase): Tuple[Generic[T]] with self.assertRaises(TypeError): List[typing._Protocol] + with self.assertRaises(TypeError): + isinstance(1, Generic) def test_type_erasure_special(self): T = TypeVar('T') @@ -830,6 +999,11 @@ class GenericTests(BaseTestCase): class MyDef(typing.DefaultDict[str, T]): ... self.assertIs(MyDef[int]().__class__, MyDef) self.assertIs(MyDef[int]().__orig_class__, MyDef[int]) + # ChainMap was added in 3.3 + if sys.version_info >= (3, 3): + class MyChain(typing.ChainMap[str, T]): ... + self.assertIs(MyChain[int]().__class__, MyChain) + self.assertIs(MyChain[int]().__orig_class__, MyChain[int]) def test_all_repr_eq_any(self): objs = (getattr(typing, el) for el in typing.__all__) @@ -896,6 +1070,14 @@ class GenericTests(BaseTestCase): self.assertEqual(t, copy(t)) self.assertEqual(t, deepcopy(t)) + def test_weakref_all(self): + T = TypeVar('T') + things = [Any, Union[T, int], Callable[..., T], Tuple[Any, Any], + Optional[List[int]], typing.Mapping[int, str], + typing.re.Match[bytes], typing.Iterable['whatever']] + for t in things: + self.assertEqual(weakref.ref(t)(), t) + def test_parameterized_slots(self): T = TypeVar('T') class C(Generic[T]): @@ -1070,6 +1252,7 @@ class GenericTests(BaseTestCase): with self.assertRaises(Exception): D[T] + class ClassVarTests(BaseTestCase): def test_basics(self): @@ -1171,6 +1354,19 @@ class ForwardRefTests(BaseTestCase): with self.assertRaises(TypeError): isinstance(42, fr) + def test_forwardref_subclass_type_error(self): + fr = typing._ForwardRef('int') + with self.assertRaises(TypeError): + issubclass(int, fr) + + def test_forward_equality(self): + fr = typing._ForwardRef('int') + self.assertEqual(fr, typing._ForwardRef('int')) + self.assertNotEqual(List['int'], List[int]) + + def test_forward_repr(self): + self.assertEqual(repr(List['int']), "typing.List[_ForwardRef('int')]") + def test_union_forward(self): def foo(a: Union['T']): @@ -1253,6 +1449,15 @@ class ForwardRefTests(BaseTestCase): ith = get_type_hints(C().foo) self.assertEqual(ith, {}) + def test_no_type_check_no_bases(self): + class C: + def meth(self, x: int): ... + @no_type_check + class D(C): + c = C + # verify that @no_type_check never affects bases + self.assertEqual(get_type_hints(C.meth), {'x': int}) + def test_meta_no_type_check(self): @no_type_check_decorator @@ -1292,9 +1497,6 @@ class ForwardRefTests(BaseTestCase): class OverloadTests(BaseTestCase): - def test_overload_exists(self): - from typing import overload - def test_overload_fails(self): from typing import overload @@ -1350,6 +1552,12 @@ class AsyncIteratorWrapper(typing.AsyncIterator[T_a]): return data else: raise StopAsyncIteration + +class ACM: + async def __aenter__(self) -> int: + return 42 + async def __aexit__(self, etype, eval, tb): + return None """ if ASYNCIO: @@ -1357,32 +1565,75 @@ if ASYNCIO: exec(ASYNCIO_TESTS) except ImportError: ASYNCIO = False +else: + # fake names for the sake of static analysis + asyncio = None + AwaitableWrapper = AsyncIteratorWrapper = ACM = object PY36 = sys.version_info[:2] >= (3, 6) PY36_TESTS = """ from test import ann_module, ann_module2, ann_module3 +from typing import AsyncContextManager class A: y: float class B(A): x: ClassVar[Optional['B']] = None y: int + b: int class CSub(B): z: ClassVar['CSub'] = B() class G(Generic[T]): lst: ClassVar[List[T]] = [] +class NoneAndForward: + parent: 'NoneAndForward' + meaning: None + class CoolEmployee(NamedTuple): name: str cool: int + +class CoolEmployeeWithDefault(NamedTuple): + name: str + cool: int = 0 + +class XMeth(NamedTuple): + x: int + def double(self): + return 2 * self.x + +class XRepr(NamedTuple): + x: int + y: int = 1 + def __str__(self): + return f'{self.x} -> {self.y}' + def __add__(self, other): + return 0 + +async def g_with(am: AsyncContextManager[int]): + x: int + async with am as x: + return x + +try: + g_with(ACM()).send(None) +except StopIteration as e: + assert e.args[0] == 42 """ if PY36: exec(PY36_TESTS) +else: + # fake names for the sake of static analysis + ann_module = ann_module2 = ann_module3 = None + A = B = CSub = G = CoolEmployee = CoolEmployeeWithDefault = object + XMeth = XRepr = NoneAndForward = object gth = get_type_hints + class GetTypeHintTests(BaseTestCase): def test_get_type_hints_from_various_objects(self): # For invalid objects should fail with TypeError (not AttributeError etc). @@ -1395,7 +1646,8 @@ class GetTypeHintTests(BaseTestCase): @skipUnless(PY36, 'Python 3.6 required') def test_get_type_hints_modules(self): - self.assertEqual(gth(ann_module), {1: 2, 'f': Tuple[int, int], 'x': int, 'y': str}) + ann_module_type_hints = {1: 2, 'f': Tuple[int, int], 'x': int, 'y': str} + self.assertEqual(gth(ann_module), ann_module_type_hints) self.assertEqual(gth(ann_module2), {}) self.assertEqual(gth(ann_module3), {}) @@ -1412,6 +1664,8 @@ class GetTypeHintTests(BaseTestCase): {'y': Optional[ann_module.C]}) self.assertEqual(gth(ann_module.S), {'x': str, 'y': str}) self.assertEqual(gth(ann_module.foo), {'x': int}) + self.assertEqual(gth(NoneAndForward, globals()), + {'parent': NoneAndForward, 'meaning': type(None)}) @skipUnless(PY36, 'Python 3.6 required') def test_respect_no_type_check(self): @@ -1428,17 +1682,22 @@ class GetTypeHintTests(BaseTestCase): class Der(ABase): ... self.assertEqual(gth(ABase.meth), {'x': int}) - def test_get_type_hints_for_builins(self): + def test_get_type_hints_for_builtins(self): # Should not fail for built-in classes and functions. self.assertEqual(gth(int), {}) self.assertEqual(gth(type), {}) self.assertEqual(gth(dir), {}) self.assertEqual(gth(len), {}) + self.assertEqual(gth(object.__str__), {}) + self.assertEqual(gth(object().__str__), {}) + self.assertEqual(gth(str.join), {}) def test_previous_behavior(self): def testf(x, y): ... testf.__annotations__['x'] = 'int' self.assertEqual(gth(testf), {'x': int}) + def testg(x: None): ... + self.assertEqual(gth(testg), {'x': type(None)}) def test_get_type_hints_for_object_with_annotations(self): class A: ... @@ -1452,9 +1711,10 @@ class GetTypeHintTests(BaseTestCase): self.assertEqual(gth(ann_module2.CV, ann_module2.__dict__), {'var': typing.ClassVar[ann_module2.CV]}) self.assertEqual(gth(B, globals()), - {'y': int, 'x': ClassVar[Optional[B]]}) + {'y': int, 'x': ClassVar[Optional[B]], 'b': int}) self.assertEqual(gth(CSub, globals()), - {'z': ClassVar[CSub], 'y': int, 'x': ClassVar[Optional[B]]}) + {'z': ClassVar[CSub], 'y': int, 'b': int, + 'x': ClassVar[Optional[B]]}) self.assertEqual(gth(G), {'lst': ClassVar[List[T]]}) @@ -1572,6 +1832,14 @@ class CollectionsAbcTests(BaseTestCase): def test_list(self): self.assertIsSubclass(list, typing.List) + def test_deque(self): + self.assertIsSubclass(collections.deque, typing.Deque) + class MyDeque(typing.Deque[int]): ... + self.assertIsInstance(MyDeque(), collections.deque) + + def test_counter(self): + self.assertIsSubclass(collections.Counter, typing.Counter) + def test_set(self): self.assertIsSubclass(set, typing.Set) self.assertNotIsSubclass(frozenset, typing.Set) @@ -1623,13 +1891,10 @@ class CollectionsAbcTests(BaseTestCase): self.assertIsSubclass(MyDict, dict) self.assertNotIsSubclass(dict, MyDict) - def test_no_defaultdict_instantiation(self): - with self.assertRaises(TypeError): - typing.DefaultDict() - with self.assertRaises(TypeError): - typing.DefaultDict[KT, VT]() - with self.assertRaises(TypeError): - typing.DefaultDict[str, int]() + def test_defaultdict_instantiation(self): + self.assertIs(type(typing.DefaultDict()), collections.defaultdict) + self.assertIs(type(typing.DefaultDict[KT, VT]()), collections.defaultdict) + self.assertIs(type(typing.DefaultDict[str, int]()), collections.defaultdict) def test_defaultdict_subclass(self): @@ -1642,6 +1907,50 @@ class CollectionsAbcTests(BaseTestCase): self.assertIsSubclass(MyDefDict, collections.defaultdict) self.assertNotIsSubclass(collections.defaultdict, MyDefDict) + @skipUnless(sys.version_info >= (3, 3), 'ChainMap was added in 3.3') + def test_chainmap_instantiation(self): + self.assertIs(type(typing.ChainMap()), collections.ChainMap) + self.assertIs(type(typing.ChainMap[KT, VT]()), collections.ChainMap) + self.assertIs(type(typing.ChainMap[str, int]()), collections.ChainMap) + class CM(typing.ChainMap[KT, VT]): ... + self.assertIs(type(CM[int, str]()), CM) + + @skipUnless(sys.version_info >= (3, 3), 'ChainMap was added in 3.3') + def test_chainmap_subclass(self): + + class MyChainMap(typing.ChainMap[str, int]): + pass + + cm = MyChainMap() + self.assertIsInstance(cm, MyChainMap) + + self.assertIsSubclass(MyChainMap, collections.ChainMap) + self.assertNotIsSubclass(collections.ChainMap, MyChainMap) + + def test_deque_instantiation(self): + self.assertIs(type(typing.Deque()), collections.deque) + self.assertIs(type(typing.Deque[T]()), collections.deque) + self.assertIs(type(typing.Deque[int]()), collections.deque) + class D(typing.Deque[T]): ... + self.assertIs(type(D[int]()), D) + + def test_counter_instantiation(self): + self.assertIs(type(typing.Counter()), collections.Counter) + self.assertIs(type(typing.Counter[T]()), collections.Counter) + self.assertIs(type(typing.Counter[int]()), collections.Counter) + class C(typing.Counter[T]): ... + self.assertIs(type(C[int]()), C) + + def test_counter_subclass_instantiation(self): + + class MyCounter(typing.Counter[int]): + pass + + d = MyCounter() + self.assertIsInstance(d, MyCounter) + self.assertIsInstance(d, typing.Counter) + self.assertIsInstance(d, collections.Counter) + def test_no_set_instantiation(self): with self.assertRaises(TypeError): typing.Set() @@ -1696,6 +2005,23 @@ class CollectionsAbcTests(BaseTestCase): with self.assertRaises(TypeError): typing.Generator[int, int, int]() + @skipUnless(PY36, 'Python 3.6 required') + def test_async_generator(self): + ns = {} + exec("async def f():\n" + " yield 42\n", globals(), ns) + g = ns['f']() + self.assertIsSubclass(type(g), typing.AsyncGenerator) + + @skipUnless(PY36, 'Python 3.6 required') + def test_no_async_generator_instantiation(self): + with self.assertRaises(TypeError): + typing.AsyncGenerator() + with self.assertRaises(TypeError): + typing.AsyncGenerator[T, T]() + with self.assertRaises(TypeError): + typing.AsyncGenerator[int, int]() + def test_subclassing(self): class MMA(typing.MutableMapping): @@ -1765,6 +2091,31 @@ class CollectionsAbcTests(BaseTestCase): self.assertIsSubclass(G, collections.Iterable) self.assertNotIsSubclass(type(g), G) + @skipUnless(PY36, 'Python 3.6 required') + def test_subclassing_async_generator(self): + class G(typing.AsyncGenerator[int, int]): + def asend(self, value): + pass + def athrow(self, typ, val=None, tb=None): + pass + + ns = {} + exec('async def g(): yield 0', globals(), ns) + g = ns['g'] + self.assertIsSubclass(G, typing.AsyncGenerator) + self.assertIsSubclass(G, typing.AsyncIterable) + self.assertIsSubclass(G, collections.AsyncGenerator) + self.assertIsSubclass(G, collections.AsyncIterable) + self.assertNotIsSubclass(type(g), G) + + instance = G() + self.assertIsInstance(instance, typing.AsyncGenerator) + self.assertIsInstance(instance, typing.AsyncIterable) + self.assertIsInstance(instance, collections.AsyncGenerator) + self.assertIsInstance(instance, collections.AsyncIterable) + self.assertNotIsInstance(type(g), G) + self.assertNotIsInstance(g, G) + def test_subclassing_subclasshook(self): class Base(typing.Iterable): @@ -1822,8 +2173,6 @@ class CollectionsAbcTests(BaseTestCase): class OtherABCTests(BaseTestCase): - @skipUnless(hasattr(typing, 'ContextManager'), - 'requires typing.ContextManager') def test_contextmanager(self): @contextlib.contextmanager def manager(): @@ -1833,6 +2182,24 @@ class OtherABCTests(BaseTestCase): self.assertIsInstance(cm, typing.ContextManager) self.assertNotIsInstance(42, typing.ContextManager) + @skipUnless(ASYNCIO, 'Python 3.5 required') + def test_async_contextmanager(self): + class NotACM: + pass + self.assertIsInstance(ACM(), typing.AsyncContextManager) + self.assertNotIsInstance(NotACM(), typing.AsyncContextManager) + @contextlib.contextmanager + def manager(): + yield 42 + + cm = manager() + self.assertNotIsInstance(cm, typing.AsyncContextManager) + self.assertEqual(typing.AsyncContextManager[int].__args__, (int,)) + with self.assertRaises(TypeError): + isinstance(42, typing.AsyncContextManager[int]) + with self.assertRaises(TypeError): + typing.AsyncContextManager[int, str] + class TypeTests(BaseTestCase): @@ -1845,7 +2212,7 @@ class TypeTests(BaseTestCase): def new_user(user_class: Type[User]) -> User: return user_class() - joe = new_user(BasicUser) + new_user(BasicUser) def test_type_typevar(self): @@ -1858,7 +2225,7 @@ class TypeTests(BaseTestCase): def new_user(user_class: Type[U]) -> U: return user_class() - joe = new_user(BasicUser) + new_user(BasicUser) def test_type_optional(self): A = Optional[Type[BaseException]] @@ -1907,7 +2274,17 @@ class NamedTupleTests(BaseTestCase): self.assertEqual(jim.id, 1) self.assertEqual(Emp.__name__, 'Emp') self.assertEqual(Emp._fields, ('name', 'id')) - self.assertEqual(Emp._field_types, dict(name=str, id=int)) + self.assertEqual(Emp.__annotations__, + collections.OrderedDict([('name', str), ('id', int)])) + self.assertIs(Emp._field_types, Emp.__annotations__) + + def test_namedtuple_pyversion(self): + if sys.version_info[:2] < (3, 6): + with self.assertRaises(TypeError): + NamedTuple('Name', one=int, other=str) + with self.assertRaises(TypeError): + class NotYet(NamedTuple): + whatever = 0 @skipUnless(PY36, 'Python 3.6 required') def test_annotation_usage(self): @@ -1918,7 +2295,54 @@ class NamedTupleTests(BaseTestCase): self.assertEqual(tim.cool, 9000) self.assertEqual(CoolEmployee.__name__, 'CoolEmployee') self.assertEqual(CoolEmployee._fields, ('name', 'cool')) - self.assertEqual(CoolEmployee._field_types, dict(name=str, cool=int)) + self.assertEqual(CoolEmployee.__annotations__, + collections.OrderedDict(name=str, cool=int)) + self.assertIs(CoolEmployee._field_types, CoolEmployee.__annotations__) + + @skipUnless(PY36, 'Python 3.6 required') + def test_annotation_usage_with_default(self): + jelle = CoolEmployeeWithDefault('Jelle') + self.assertIsInstance(jelle, CoolEmployeeWithDefault) + self.assertIsInstance(jelle, tuple) + self.assertEqual(jelle.name, 'Jelle') + self.assertEqual(jelle.cool, 0) + cooler_employee = CoolEmployeeWithDefault('Sjoerd', 1) + self.assertEqual(cooler_employee.cool, 1) + + self.assertEqual(CoolEmployeeWithDefault.__name__, 'CoolEmployeeWithDefault') + self.assertEqual(CoolEmployeeWithDefault._fields, ('name', 'cool')) + self.assertEqual(CoolEmployeeWithDefault._field_types, dict(name=str, cool=int)) + self.assertEqual(CoolEmployeeWithDefault._field_defaults, dict(cool=0)) + + with self.assertRaises(TypeError): + exec(""" +class NonDefaultAfterDefault(NamedTuple): + x: int = 3 + y: int +""") + + @skipUnless(PY36, 'Python 3.6 required') + def test_annotation_usage_with_methods(self): + self.assertEqual(XMeth(1).double(), 2) + self.assertEqual(XMeth(42).x, XMeth(42)[0]) + self.assertEqual(str(XRepr(42)), '42 -> 1') + self.assertEqual(XRepr(1, 2) + XRepr(3), 0) + + with self.assertRaises(AttributeError): + exec(""" +class XMethBad(NamedTuple): + x: int + def _fields(self): + return 'no chance for this' +""") + + with self.assertRaises(AttributeError): + exec(""" +class XMethBad2(NamedTuple): + x: int + def _source(self): + return 'no chance for this as well' +""") @skipUnless(PY36, 'Python 3.6 required') def test_namedtuple_keyword_usage(self): @@ -1928,7 +2352,8 @@ class NamedTupleTests(BaseTestCase): self.assertEqual(nick.name, 'Nick') self.assertEqual(LocalEmployee.__name__, 'LocalEmployee') self.assertEqual(LocalEmployee._fields, ('name', 'age')) - self.assertEqual(LocalEmployee._field_types, dict(name=str, age=int)) + self.assertEqual(LocalEmployee.__annotations__, dict(name=str, age=int)) + self.assertIs(LocalEmployee._field_types, LocalEmployee.__annotations__) with self.assertRaises(TypeError): NamedTuple('Name', [('x', int)], y=str) with self.assertRaises(TypeError): @@ -1994,8 +2419,14 @@ class RETests(BaseTestCase): self.assertIsInstance(mat, Match) # these should just work - p = Pattern[Union[str, bytes]] - m = Match[Union[bytes, str]] + Pattern[Union[str, bytes]] + Match[Union[bytes, str]] + + def test_alias_equality(self): + self.assertEqual(Pattern[str], Pattern[str]) + self.assertNotEqual(Pattern[str], Pattern[bytes]) + self.assertNotEqual(Pattern[str], Match[str]) + self.assertNotEqual(Pattern[str], str) def test_errors(self): with self.assertRaises(TypeError): @@ -2011,6 +2442,9 @@ class RETests(BaseTestCase): with self.assertRaises(TypeError): # We don't support isinstance(). isinstance(42, Pattern[str]) + with self.assertRaises(TypeError): + # We don't support issubclass(). + issubclass(Pattern[bytes], Pattern[str]) def test_repr(self): self.assertEqual(repr(Pattern), 'Pattern[~AnyStr]') @@ -2057,6 +2491,9 @@ class AllTests(BaseTestCase): self.assertNotIn('sys', a) # Check that Text is defined. self.assertIn('Text', a) + # Check previously missing classes. + self.assertIn('SupportsBytes', a) + self.assertIn('SupportsComplex', a) if __name__ == '__main__': diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index f696a5b..9dbded2 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -464,6 +464,13 @@ class UnicodeTest(string_tests.CommonTest, self.checkraises(TypeError, ' ', 'join', [1, 2, 3]) self.checkraises(TypeError, ' ', 'join', ['1', '2', 3]) + @unittest.skipIf(sys.maxsize > 2**32, + 'needs too much memory on a 64-bit platform') + def test_join_overflow(self): + size = int(sys.maxsize**0.5) + 1 + seq = ('A' * size,) * size + self.assertRaises(OverflowError, ''.join, seq) + def test_replace(self): string_tests.CommonTest.test_replace(self) @@ -1417,6 +1424,15 @@ class UnicodeTest(string_tests.CommonTest, with self.assertRaises(ValueError): result = format_string % 2.34 + def test_issue28598_strsubclass_rhs(self): + # A subclass of str with an __rmod__ method should be able to hook + # into the % operator + class SubclassedStr(str): + def __rmod__(self, other): + return 'Success, self.__rmod__({!r}) was called'.format(other) + self.assertEqual('lhs %% %r' % SubclassedStr('rhs'), + "Success, self.__rmod__('lhs %% %r') was called") + @support.cpython_only def test_formatting_huge_precision_c_limits(self): from _testcapi import INT_MAX diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py index 74346b4..43cf638 100644 --- a/Lib/test/test_unpack_ex.py +++ b/Lib/test/test_unpack_ex.py @@ -251,7 +251,7 @@ Overridden parameters >>> f(x=5, **{'x': 3}, **{'x': 2}) Traceback (most recent call last): ... - TypeError: f() got multiple values for keyword argument 'x' + TypeError: function got multiple values for keyword argument 'x' >>> f(**{1: 3}, **{1: 5}) Traceback (most recent call last): diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index 247598a..1a28c9a 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -206,6 +206,7 @@ class urlopen_FileTests(unittest.TestCase): def test_relativelocalfile(self): self.assertRaises(ValueError,urllib.request.urlopen,'./' + self.pathname) + class ProxyTests(unittest.TestCase): def setUp(self): @@ -247,17 +248,19 @@ class ProxyTests(unittest.TestCase): def test_proxy_bypass_environment_host_match(self): bypass = urllib.request.proxy_bypass_environment self.env.set('NO_PROXY', - 'localhost, anotherdomain.com, newdomain.com:1234') + 'localhost, anotherdomain.com, newdomain.com:1234, .d.o.t') self.assertTrue(bypass('localhost')) self.assertTrue(bypass('LocalHost')) # MixedCase self.assertTrue(bypass('LOCALHOST')) # UPPERCASE self.assertTrue(bypass('newdomain.com:1234')) + self.assertTrue(bypass('foo.d.o.t')) # issue 29142 self.assertTrue(bypass('anotherdomain.com:8888')) self.assertTrue(bypass('www.newdomain.com:1234')) self.assertFalse(bypass('prelocalhost')) self.assertFalse(bypass('newdomain.com')) # no port self.assertFalse(bypass('newdomain.com:1235')) # wrong port + class ProxyTests_withOrderedEnv(unittest.TestCase): def setUp(self): @@ -293,6 +296,7 @@ class ProxyTests_withOrderedEnv(unittest.TestCase): proxies = urllib.request.getproxies_environment() self.assertEqual('http://somewhere:3128', proxies['http']) + class urlopen_HttpTests(unittest.TestCase, FakeHTTPMixin, FakeFTPMixin): """Test urlopen() opening a fake http connection.""" @@ -431,7 +435,6 @@ Connection: close finally: self.unfakeftp() - def test_userpass_inurl(self): self.fakehttp(b"HTTP/1.0 200 OK\r\n\r\nHello!") try: @@ -474,6 +477,7 @@ Connection: close "https://localhost", cafile="/nonexistent/path", context=context ) + class urlopen_DataTests(unittest.TestCase): """Test urlopen() opening a data URL.""" @@ -547,6 +551,7 @@ class urlopen_DataTests(unittest.TestCase): # missing padding character self.assertRaises(ValueError,urllib.request.urlopen,'data:;base64,Cg=') + class urlretrieve_FileTests(unittest.TestCase): """Test urllib.urlretrieve() on local files""" diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index eda7ccc..3ed81ce 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -826,7 +826,6 @@ class HandlerTests(unittest.TestCase): for url, ftp in [ ("file://ftp.example.com//foo.txt", False), ("file://ftp.example.com///foo.txt", False), -# XXXX bug: fails with OSError, should be URLError ("file://ftp.example.com/foo.txt", False), ("file://somehost//foo/something.txt", False), ("file://localhost//foo/something.txt", False), @@ -834,8 +833,7 @@ class HandlerTests(unittest.TestCase): req = Request(url) try: h.file_open(req) - # XXXX remove OSError when bug fixed - except (urllib.error.URLError, OSError): + except urllib.error.URLError: self.assertFalse(ftp) else: self.assertIs(o.req, req) @@ -1341,7 +1339,6 @@ class HandlerTests(unittest.TestCase): self.assertEqual(req.host, "proxy.example.com:3128") self.assertEqual(req.get_header("Proxy-authorization"), "FooBar") - # TODO: This should be only for OSX @unittest.skipUnless(sys.platform == 'darwin', "only relevant for OSX") def test_osx_proxy_bypass(self): bypass = { @@ -1617,7 +1614,6 @@ class HandlerTests(unittest.TestCase): self.assertTrue(conn.fakesock.closed, "Connection not closed") - class MiscTests(unittest.TestCase): def opener_has_handler(self, opener, handler_class): diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py index cad83fd..13e2dd5 100644 --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -97,8 +97,8 @@ class OtherNetworkTests(unittest.TestCase): def test_ftp(self): urls = [ - 'ftp://ftp.debian.org/debian/README', - ('ftp://ftp.debian.org/debian/non-existent-file', + 'ftp://www.pythontest.net/README', + ('ftp://www.pythontest.net/non-existent-file', None, urllib.error.URLError), ] self._test_urls(urls, self._extra_handlers()) @@ -287,7 +287,7 @@ class TimeoutTest(unittest.TestCase): self.addCleanup(u.close) self.assertEqual(u.fp.raw._sock.gettimeout(), 120) - FTP_HOST = 'ftp://ftp.debian.org/debian/' + FTP_HOST = 'ftp://www.pythontest.net/' def test_ftp_basic(self): self.assertIsNone(socket.getdefaulttimeout()) diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index b811930..b9b1eaa 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -12,6 +12,7 @@ import time support.requires('network') + class URLTimeoutTest(unittest.TestCase): # XXX this test doesn't seem to test anything useful. @@ -26,11 +27,11 @@ class URLTimeoutTest(unittest.TestCase): def testURLread(self): with support.transient_internet("www.example.com"): f = urllib.request.urlopen("http://www.example.com/") - x = f.read() + f.read() class urlopenNetworkTests(unittest.TestCase): - """Tests urllib.reqest.urlopen using the network. + """Tests urllib.request.urlopen using the network. These tests are not exhaustive. Assuming that testing using files does a good job overall of some of the basic interface features. There are no @@ -189,6 +190,7 @@ class urlretrieveNetworkTests(unittest.TestCase): def test_reporthook(self): records = [] + def recording_reporthook(blocks, block_size, total_size): records.append((blocks, block_size, total_size)) diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py index 71abc14..e2cf1b7 100644 --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -6,8 +6,8 @@ RFC2396_BASE = "http://a/b/c/d;p?q" RFC3986_BASE = 'http://a/b/c/d;p?q' SIMPLE_BASE = 'http://a/b/c/d' -# A list of test cases. Each test case is a two-tuple that contains -# a string with the query and a dictionary with the expected result. +# Each parse_qsl testcase is a two-tuple that contains +# a string with the query and a list with the expected result. parse_qsl_test_cases = [ ("", []), @@ -42,6 +42,9 @@ parse_qsl_test_cases = [ (b"a=1;a=2", [(b'a', b'1'), (b'a', b'2')]), ] +# Each parse_qs testcase is a two-tuple that contains +# a string with the query and a dictionary with the expected result. + parse_qs_test_cases = [ ("", {}), ("&", {}), @@ -290,7 +293,6 @@ class UrlParseTestCase(unittest.TestCase): def test_RFC2396(self): # cases from RFC 2396 - self.checkJoin(RFC2396_BASE, 'g:h', 'g:h') self.checkJoin(RFC2396_BASE, 'g', 'http://a/b/c/g') self.checkJoin(RFC2396_BASE, './g', 'http://a/b/c/g') @@ -333,9 +335,7 @@ class UrlParseTestCase(unittest.TestCase): # self.checkJoin(RFC2396_BASE, '/./g', 'http://a/./g') # self.checkJoin(RFC2396_BASE, '/../g', 'http://a/../g') - def test_RFC3986(self): - # Test cases from RFC3986 self.checkJoin(RFC3986_BASE, '?y','http://a/b/c/d;p?y') self.checkJoin(RFC3986_BASE, ';x', 'http://a/b/c/;x') self.checkJoin(RFC3986_BASE, 'g:h','g:h') @@ -363,7 +363,7 @@ class UrlParseTestCase(unittest.TestCase): self.checkJoin(RFC3986_BASE, '../../g','http://a/g') self.checkJoin(RFC3986_BASE, '../../../g', 'http://a/g') - #Abnormal Examples + # Abnormal Examples # The 'abnormal scenarios' are incompatible with RFC2986 parsing # Tests are here for reference. @@ -757,28 +757,35 @@ class UrlParseTestCase(unittest.TestCase): def test_parse_fragments(self): # Exercise the allow_fragments parameter of urlparse() and urlsplit() tests = ( - ("http:#frag", "path"), - ("//example.net#frag", "path"), - ("index.html#frag", "path"), - (";a=b#frag", "params"), - ("?a=b#frag", "query"), - ("#frag", "path"), + ("http:#frag", "path", "frag"), + ("//example.net#frag", "path", "frag"), + ("index.html#frag", "path", "frag"), + (";a=b#frag", "params", "frag"), + ("?a=b#frag", "query", "frag"), + ("#frag", "path", "frag"), + ("abc#@frag", "path", "@frag"), + ("//abc#@frag", "path", "@frag"), + ("//abc:80#@frag", "path", "@frag"), + ("//abc#@frag:80", "path", "@frag:80"), ) - for url, attr in tests: + for url, attr, expected_frag in tests: for func in (urllib.parse.urlparse, urllib.parse.urlsplit): if attr == "params" and func is urllib.parse.urlsplit: attr = "path" with self.subTest(url=url, function=func): result = func(url, allow_fragments=False) self.assertEqual(result.fragment, "") - self.assertTrue(getattr(result, attr).endswith("#frag")) + self.assertTrue( + getattr(result, attr).endswith("#" + expected_frag)) self.assertEqual(func(url, "", False).fragment, "") result = func(url, allow_fragments=True) - self.assertEqual(result.fragment, "frag") - self.assertFalse(getattr(result, attr).endswith("frag")) - self.assertEqual(func(url, "", True).fragment, "frag") - self.assertEqual(func(url).fragment, "frag") + self.assertEqual(result.fragment, expected_frag) + self.assertFalse( + getattr(result, attr).endswith(expected_frag)) + self.assertEqual(func(url, "", True).fragment, + expected_frag) + self.assertEqual(func(url).fragment, expected_frag) def test_mixed_types_rejected(self): # Several functions that process either strings or ASCII encoded bytes @@ -985,6 +992,26 @@ class Utility_Tests(unittest.TestCase): self.assertEqual(splithost('/foo/bar/baz.html'), (None, '/foo/bar/baz.html')) + # bpo-30500: # starts a fragment. + self.assertEqual(splithost('//127.0.0.1#@host.com'), + ('127.0.0.1', '/#@host.com')) + self.assertEqual(splithost('//127.0.0.1#@host.com:80'), + ('127.0.0.1', '/#@host.com:80')) + self.assertEqual(splithost('//127.0.0.1:80#@host.com'), + ('127.0.0.1:80', '/#@host.com')) + + # Empty host is returned as empty string. + self.assertEqual(splithost("///file"), + ('', '/file')) + + # Trailing semicolon, question mark and hash symbol are kept. + self.assertEqual(splithost("//example.net/file;"), + ('example.net', '/file;')) + self.assertEqual(splithost("//example.net/file?"), + ('example.net', '/file?')) + self.assertEqual(splithost("//example.net/file#"), + ('example.net', '/file#')) + def test_splituser(self): splituser = urllib.parse.splituser self.assertEqual(splituser('User:Pass@www.python.org:080'), diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py index 3999d1f..c1e6566 100644 --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -328,13 +328,7 @@ class EnsurePipTest(BaseTest): with open(os.devnull, "rb") as f: self.assertEqual(f.read(), b"") - # Requesting pip fails without SSL (http://bugs.python.org/issue19744) - @unittest.skipIf(ssl is None, ensurepip._MISSING_SSL_MESSAGE) - @unittest.skipUnless(threading, 'some dependencies of pip import threading' - ' module unconditionally') - # Issue #26610: pip/pep425tags.py requires ctypes - @unittest.skipUnless(ctypes, 'pip requires ctypes') - def test_with_pip(self): + def do_test_with_pip(self, system_site_packages): rmtree(self.env_dir) with EnvironmentVarGuard() as envvars: # pip's cross-version compatibility may trigger deprecation @@ -368,6 +362,7 @@ class EnsurePipTest(BaseTest): # config in place to ensure we ignore it try: self.run_with_capture(venv.create, self.env_dir, + system_site_packages=system_site_packages, with_pip=True) except subprocess.CalledProcessError as exc: # The output this produces can be a little hard to read, @@ -417,9 +412,21 @@ class EnsurePipTest(BaseTest): out = out.decode("latin-1") # Force to text, prevent decoding errors self.assertIn("Successfully uninstalled pip", out) self.assertIn("Successfully uninstalled setuptools", out) - # Check pip is now gone from the virtual environment - self.assert_pip_not_installed() + # Check pip is now gone from the virtual environment. This only + # applies in the system_site_packages=False case, because in the + # other case, pip may still be available in the system site-packages + if not system_site_packages: + self.assert_pip_not_installed() + # Requesting pip fails without SSL (http://bugs.python.org/issue19744) + @unittest.skipIf(ssl is None, ensurepip._MISSING_SSL_MESSAGE) + @unittest.skipUnless(threading, 'some dependencies of pip import threading' + ' module unconditionally') + # Issue #26610: pip/pep425tags.py requires ctypes + @unittest.skipUnless(ctypes, 'pip requires ctypes') + def test_with_pip(self): + self.do_test_with_pip(False) + self.do_test_with_pip(True) if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py index 4a8ab7d..caac3c3 100644 --- a/Lib/test/test_winsound.py +++ b/Lib/test/test_winsound.py @@ -87,6 +87,10 @@ class PlaySoundTest(unittest.TestCase): winsound.PlaySound, "none", winsound.SND_ASYNC | winsound.SND_MEMORY ) + self.assertRaises(TypeError, winsound.PlaySound, b"bad", 0) + self.assertRaises(TypeError, winsound.PlaySound, 1, 0) + # embedded null character + self.assertRaises(ValueError, winsound.PlaySound, 'bad\0', 0) def test_aliases(self): aliases = [ diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 6c7616b..5d0166a 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -1875,6 +1875,118 @@ class BadElementTest(ElementTestCase, unittest.TestCase): with self.assertRaises(RuntimeError): repr(e) # Should not crash + def test_element_get_text(self): + # Issue #27863 + class X(str): + def __del__(self): + try: + elem.text + except NameError: + pass + + b = ET.TreeBuilder() + b.start('tag', {}) + b.data('ABCD') + b.data(X('EFGH')) + b.data('IJKL') + b.end('tag') + + elem = b.close() + self.assertEqual(elem.text, 'ABCDEFGHIJKL') + + def test_element_get_tail(self): + # Issue #27863 + class X(str): + def __del__(self): + try: + elem[0].tail + except NameError: + pass + + b = ET.TreeBuilder() + b.start('root', {}) + b.start('tag', {}) + b.end('tag') + b.data('ABCD') + b.data(X('EFGH')) + b.data('IJKL') + b.end('root') + + elem = b.close() + self.assertEqual(elem[0].tail, 'ABCDEFGHIJKL') + + def test_element_iter(self): + # Issue #27863 + state = { + 'tag': 'tag', + '_children': [None], # non-Element + 'attrib': 'attr', + 'tail': 'tail', + 'text': 'text', + } + + e = ET.Element('tag') + try: + e.__setstate__(state) + except AttributeError: + e.__dict__ = state + + it = e.iter() + self.assertIs(next(it), e) + self.assertRaises(AttributeError, next, it) + + def test_subscr(self): + # Issue #27863 + class X: + def __index__(self): + del e[:] + return 1 + + e = ET.Element('elem') + e.append(ET.Element('child')) + e[:X()] # shouldn't crash + + e.append(ET.Element('child')) + e[0:10:X()] # shouldn't crash + + def test_ass_subscr(self): + # Issue #27863 + class X: + def __index__(self): + e[:] = [] + return 1 + + e = ET.Element('elem') + for _ in range(10): + e.insert(0, ET.Element('child')) + + e[0:10:X()] = [] # shouldn't crash + + def test_treebuilder_start(self): + # Issue #27863 + def element_factory(x, y): + return [] + b = ET.TreeBuilder(element_factory=element_factory) + + b.start('tag', {}) + b.data('ABCD') + self.assertRaises(AttributeError, b.start, 'tag2', {}) + del b + gc_collect() + + def test_treebuilder_end(self): + # Issue #27863 + def element_factory(x, y): + return [] + b = ET.TreeBuilder(element_factory=element_factory) + + b.start('tag', {}) + b.data('ABCD') + self.assertRaises(AttributeError, b.end, 'tag') + del b + gc_collect() + + class MutatingElementPath(str): def __new__(cls, elem, *args): self = str.__new__(cls, *args) diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 02d9f5c..c2de057 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -295,6 +295,94 @@ class XMLRPCTestCase(unittest.TestCase): self.assertEqual(p.method(), 5) self.assertEqual(p.method(), 5) + +class SimpleXMLRPCDispatcherTestCase(unittest.TestCase): + class DispatchExc(Exception): + """Raised inside the dispatched functions when checking for + chained exceptions""" + + def test_call_registered_func(self): + """Calls explicitly registered function""" + # Makes sure any exception raised inside the function has no other + # exception chained to it + + exp_params = 1, 2, 3 + + def dispatched_func(*params): + raise self.DispatchExc(params) + + dispatcher = xmlrpc.server.SimpleXMLRPCDispatcher() + dispatcher.register_function(dispatched_func) + with self.assertRaises(self.DispatchExc) as exc_ctx: + dispatcher._dispatch('dispatched_func', exp_params) + self.assertEqual(exc_ctx.exception.args, (exp_params,)) + self.assertIsNone(exc_ctx.exception.__cause__) + self.assertIsNone(exc_ctx.exception.__context__) + + def test_call_instance_func(self): + """Calls a registered instance attribute as a function""" + # Makes sure any exception raised inside the function has no other + # exception chained to it + + exp_params = 1, 2, 3 + + class DispatchedClass: + def dispatched_func(self, *params): + raise SimpleXMLRPCDispatcherTestCase.DispatchExc(params) + + dispatcher = xmlrpc.server.SimpleXMLRPCDispatcher() + dispatcher.register_instance(DispatchedClass()) + with self.assertRaises(self.DispatchExc) as exc_ctx: + dispatcher._dispatch('dispatched_func', exp_params) + self.assertEqual(exc_ctx.exception.args, (exp_params,)) + self.assertIsNone(exc_ctx.exception.__cause__) + self.assertIsNone(exc_ctx.exception.__context__) + + def test_call_dispatch_func(self): + """Calls the registered instance's `_dispatch` function""" + # Makes sure any exception raised inside the function has no other + # exception chained to it + + exp_method = 'method' + exp_params = 1, 2, 3 + + class TestInstance: + def _dispatch(self, method, params): + raise SimpleXMLRPCDispatcherTestCase.DispatchExc( + method, params) + + dispatcher = xmlrpc.server.SimpleXMLRPCDispatcher() + dispatcher.register_instance(TestInstance()) + with self.assertRaises(self.DispatchExc) as exc_ctx: + dispatcher._dispatch(exp_method, exp_params) + self.assertEqual(exc_ctx.exception.args, (exp_method, exp_params)) + self.assertIsNone(exc_ctx.exception.__cause__) + self.assertIsNone(exc_ctx.exception.__context__) + + def test_registered_func_is_none(self): + """Calls explicitly registered function which is None""" + + dispatcher = xmlrpc.server.SimpleXMLRPCDispatcher() + dispatcher.register_function(None, name='method') + with self.assertRaisesRegex(Exception, 'method'): + dispatcher._dispatch('method', ('param',)) + + def test_instance_has_no_func(self): + """Attempts to call nonexistent function on a registered instance""" + + dispatcher = xmlrpc.server.SimpleXMLRPCDispatcher() + dispatcher.register_instance(object()) + with self.assertRaisesRegex(Exception, 'method'): + dispatcher._dispatch('method', ('param',)) + + def test_cannot_locate_func(self): + """Calls a function that the dispatcher cannot locate""" + + dispatcher = xmlrpc.server.SimpleXMLRPCDispatcher() + with self.assertRaisesRegex(Exception, 'method'): + dispatcher._dispatch('method', ('param',)) + + class HelperTestCase(unittest.TestCase): def test_escape(self): self.assertEqual(xmlrpclib.escape("a&b"), "a&b") @@ -1265,7 +1353,7 @@ def test_main(): KeepaliveServerTestCase1, KeepaliveServerTestCase2, GzipServerTestCase, GzipUtilTestCase, MultiPathServerTestCase, ServerProxyTestCase, FailingServerTestCase, - CGIHandlerTestCase) + CGIHandlerTestCase, SimpleXMLRPCDispatcherTestCase) if __name__ == "__main__": diff --git a/Lib/threading.py b/Lib/threading.py index 06b7b9b..c40d330 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -1215,6 +1215,10 @@ class _DummyThread(Thread): def _stop(self): pass + def is_alive(self): + assert not self._is_stopped and self._started.is_set() + return True + def join(self, timeout=None): assert False, "cannot join a dummy thread" diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 1eaab44..5eeefbb 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -854,8 +854,7 @@ class Misc: self.tk.call('winfo', 'height', self._w)) def winfo_id(self): """Return identifier ID for this widget.""" - return self.tk.getint( - self.tk.call('winfo', 'id', self._w)) + return int(self.tk.call('winfo', 'id', self._w), 0) def winfo_interps(self, displayof=0): """Return the name of all Tcl interpreters for this display.""" args = ('winfo', 'interps') + self._displayof(displayof) @@ -865,7 +864,7 @@ class Misc: return self.tk.getint( self.tk.call('winfo', 'ismapped', self._w)) def winfo_manager(self): - """Return the window mananger name for this widget.""" + """Return the window manager name for this widget.""" return self.tk.call('winfo', 'manager', self._w) def winfo_name(self): """Return the name of this widget.""" @@ -1539,7 +1538,7 @@ class Misc: return self.tk.splitlist(self.tk.call('image', 'names')) def image_types(self): - """Return a list of all available image types (e.g. phote bitmap).""" + """Return a list of all available image types (e.g. photo bitmap).""" return self.tk.splitlist(self.tk.call('image', 'types')) @@ -1678,7 +1677,7 @@ class Wm: return self.tk.call('wm', 'focusmodel', self._w, model) focusmodel = wm_focusmodel def wm_forget(self, window): # new in Tk 8.5 - """The window will be unmappend from the screen and will no longer + """The window will be unmapped from the screen and will no longer be managed by wm. toplevel windows will be treated like frame windows once they are no longer managed by wm, however, the menu option configuration will be remembered and the menus will return @@ -2382,7 +2381,7 @@ class Canvas(Widget, XView, YView): """Return item which is closest to pixel at X, Y. If several match take the top-most. All items closer than HALO are considered overlapping (all are - closests). If START is specified the next below this tag is taken.""" + closest). If START is specified the next below this tag is taken.""" return self.find('closest', x, y, halo, start) def find_enclosed(self, x1, y1, x2, y2): """Return all items in rectangle defined @@ -2442,7 +2441,7 @@ class Canvas(Widget, XView, YView): """Print the contents of the canvas to a postscript file. Valid options: colormap, colormode, file, fontmap, height, pageanchor, pageheight, pagewidth, pagex, pagey, - rotate, witdh, x, y.""" + rotate, width, x, y.""" return self.tk.call((self._w, 'postscript') + self._options(cnf, kw)) def tag_raise(self, *args): @@ -3386,7 +3385,7 @@ class Image: return self.tk.getint( self.tk.call('image', 'height', self.name)) def type(self): - """Return the type of the imgage, e.g. "photo" or "bitmap".""" + """Return the type of the image, e.g. "photo" or "bitmap".""" return self.tk.call('image', 'type', self.name) def width(self): """Return the width of the image.""" diff --git a/Lib/tkinter/test/test_tkinter/test_widgets.py b/Lib/tkinter/test/test_tkinter/test_widgets.py index c924d55..81b52ea 100644 --- a/Lib/tkinter/test/test_tkinter/test_widgets.py +++ b/Lib/tkinter/test/test_tkinter/test_widgets.py @@ -91,9 +91,10 @@ class ToplevelTest(AbstractToplevelTest, unittest.TestCase): widget = self.create() self.assertEqual(widget['use'], '') parent = self.create(container=True) - wid = parent.winfo_id() - widget2 = self.create(use=wid) - self.assertEqual(int(widget2['use']), wid) + wid = hex(parent.winfo_id()) + with self.subTest(wid=wid): + widget2 = self.create(use=wid) + self.assertEqual(widget2['use'], wid) @add_standard_options(StandardOptionsTests) diff --git a/Lib/typing.py b/Lib/typing.py index 34845b7..c487afc 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -10,6 +10,14 @@ try: import collections.abc as collections_abc except ImportError: import collections as collections_abc # Fallback for PY3.2. +if sys.version_info[:2] >= (3, 6): + import _collections_abc # Needed for private function _check_methods # noqa +try: + from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType +except ImportError: + WrapperDescriptorType = type(object.__init__) + MethodWrapperType = type(object().__str__) + MethodDescriptorType = type(str.join) # Please keep __all__ alphabetized within each category. @@ -27,8 +35,11 @@ __all__ = [ # ABCs (from collections.abc). 'AbstractSet', # collections.abc.Set. + 'GenericMeta', # subclass of abc.ABCMeta and a metaclass + # for 'Generic' and ABCs below. 'ByteString', 'Container', + 'ContextManager', 'Hashable', 'ItemsView', 'Iterable', @@ -49,16 +60,21 @@ __all__ = [ # AsyncIterable, # Coroutine, # Collection, - # ContextManager + # AsyncGenerator, + # AsyncContextManager # Structural checks, a.k.a. protocols. 'Reversible', 'SupportsAbs', + 'SupportsBytes', + 'SupportsComplex', 'SupportsFloat', 'SupportsInt', 'SupportsRound', # Concrete collection types. + 'Counter', + 'Deque', 'Dict', 'DefaultDict', 'List', @@ -93,8 +109,8 @@ def _qualname(x): def _trim_name(nm): - if nm.startswith('_') and nm not in ('_TypeAlias', - '_ForwardRef', '_TypingBase', '_FinalTypingBase'): + whitelist = ('_TypeAlias', '_ForwardRef', '_TypingBase', '_FinalTypingBase') + if nm.startswith('_') and nm not in whitelist: nm = nm[1:] return nm @@ -144,7 +160,7 @@ class TypingMeta(type): class _TypingBase(metaclass=TypingMeta, _root=True): """Internal indicator of special typing constructs.""" - __slots__ = () + __slots__ = ('__weakref__',) def __init__(self, *args, **kwds): pass @@ -351,13 +367,17 @@ def _type_check(arg, msg): return type(None) if isinstance(arg, str): arg = _ForwardRef(arg) - if (isinstance(arg, _TypingBase) and type(arg).__name__ == '_ClassVar' or - not isinstance(arg, (type, _TypingBase)) and not callable(arg)): + if ( + isinstance(arg, _TypingBase) and type(arg).__name__ == '_ClassVar' or + not isinstance(arg, (type, _TypingBase)) and not callable(arg) + ): raise TypeError(msg + " Got %.100r." % (arg,)) # Bare Union etc. are not valid as type arguments - if (type(arg).__name__ in ('_Union', '_Optional') - and not getattr(arg, '__origin__', None) - or isinstance(arg, TypingMeta) and _gorg(arg) in (Generic, _Protocol)): + if ( + type(arg).__name__ in ('_Union', '_Optional') and + not getattr(arg, '__origin__', None) or + isinstance(arg, TypingMeta) and _gorg(arg) in (Generic, _Protocol) + ): raise TypeError("Plain %s is not valid as type argument" % arg) return arg @@ -405,6 +425,31 @@ class _Any(_FinalTypingBase, _root=True): Any = _Any(_root=True) +class _NoReturn(_FinalTypingBase, _root=True): + """Special type indicating functions that never return. + Example:: + + from typing import NoReturn + + def stop() -> NoReturn: + raise Exception('no way') + + This type is invalid in other positions, e.g., ``List[NoReturn]`` + will fail in static type checkers. + """ + + __slots__ = () + + def __instancecheck__(self, obj): + raise TypeError("NoReturn cannot be used with isinstance().") + + def __subclasscheck__(self, cls): + raise TypeError("NoReturn cannot be used with issubclass().") + + +NoReturn = _NoReturn(_root=True) + + class TypeVar(_TypingBase, _root=True): """Type variable. @@ -451,7 +496,7 @@ class TypeVar(_TypingBase, _root=True): '__covariant__', '__contravariant__') def __init__(self, name, *constraints, bound=None, - covariant=False, contravariant=False): + covariant=False, contravariant=False): super().__init__(name, *constraints, bound=bound, covariant=covariant, contravariant=contravariant) self.__name__ = name @@ -513,7 +558,7 @@ def _replace_arg(arg, tvars, args): if tvars is None: tvars = [] - if hasattr(arg, '_subs_tree'): + if hasattr(arg, '_subs_tree') and isinstance(arg, (GenericMeta, _TypingBase)): return arg._subs_tree(tvars, args) if isinstance(arg, TypeVar): for i, tvar in enumerate(tvars): @@ -522,6 +567,16 @@ def _replace_arg(arg, tvars, args): return arg +# Special typing constructs Union, Optional, Generic, Callable and Tuple +# use three special attributes for internal bookkeeping of generic types: +# * __parameters__ is a tuple of unique free type parameters of a generic +# type, for example, Dict[T, T].__parameters__ == (T,); +# * __origin__ keeps a reference to a type that was subscripted, +# e.g., Union[T, int].__origin__ == Union; +# * __args__ is a tuple of all arguments used in subscripting, +# e.g., Dict[T, int].__args__ == (T, int). + + def _subs_tree(cls, tvars=None, args=None): """An internal helper function: calculate substitution tree for generic cls after replacing its type parameters with @@ -549,7 +604,7 @@ def _subs_tree(cls, tvars=None, args=None): # ... then continue replacing down the origin chain. for ocls in orig_chain: new_tree_args = [] - for i, arg in enumerate(ocls.__args__): + for arg in ocls.__args__: new_tree_args.append(_replace_arg(arg, ocls.__parameters__, tree_args)) tree_args = new_tree_args return tree_args @@ -617,6 +672,7 @@ def _tp_cache(func): cached = functools.lru_cache()(func) _cleanups.append(cached.cache_clear) + @functools.wraps(func) def inner(*args, **kwds): try: @@ -756,9 +812,12 @@ class _Union(_FinalTypingBase, _root=True): return (Union,) + tree_args def __eq__(self, other): - if not isinstance(other, _Union): + if isinstance(other, _Union): + return self.__tree_hash__ == other.__tree_hash__ + elif self is not Union: return self._subs_tree() == other - return self.__tree_hash__ == other.__tree_hash__ + else: + return self is other def __hash__(self): return self.__tree_hash__ @@ -823,21 +882,10 @@ def _next_in_mro(cls): # Look for the last occurrence of Generic or Generic[...]. for i, c in enumerate(cls.__mro__[:-1]): if isinstance(c, GenericMeta) and _gorg(c) is Generic: - next_in_mro = cls.__mro__[i+1] + next_in_mro = cls.__mro__[i + 1] return next_in_mro -def _valid_for_check(cls): - """An internal helper to prohibit isinstance([1], List[str]) etc.""" - if cls is Generic: - raise TypeError("Class %r cannot be used with class " - "or instance checks" % cls) - if (cls.__origin__ is not None and - sys._getframe(3).f_globals['__name__'] not in ['abc', 'functools']): - raise TypeError("Parameterized generics cannot be used with class " - "or instance checks") - - def _make_subclasshook(cls): """Construct a __subclasshook__ callable that incorporates the associated __extra__ class in subclass checks performed @@ -848,7 +896,6 @@ def _make_subclasshook(cls): # Registered classes need not be checked here because # cls and its extra share the same _abc_registry. def __extrahook__(subclass): - _valid_for_check(cls) res = cls.__extra__.__subclasshook__(subclass) if res is not NotImplemented: return res @@ -863,7 +910,6 @@ def _make_subclasshook(cls): else: # For non-ABC extras we'll just call issubclass(). def __extrahook__(subclass): - _valid_for_check(cls) if cls.__extra__ and issubclass(subclass, cls.__extra__): return True return NotImplemented @@ -882,10 +928,26 @@ def _no_slots_copy(dct): class GenericMeta(TypingMeta, abc.ABCMeta): - """Metaclass for generic types.""" + """Metaclass for generic types. + + This is a metaclass for typing.Generic and generic ABCs defined in + typing module. User defined subclasses of GenericMeta can override + __new__ and invoke super().__new__. Note that GenericMeta.__new__ + has strict rules on what is allowed in its bases argument: + * plain Generic is disallowed in bases; + * Generic[...] should appear in bases at most once; + * if Generic[...] is present, then it should list all type variables + that appear in other bases. + In addition, type of all generic bases is erased, e.g., C[int] is + stripped to plain C. + """ def __new__(cls, name, bases, namespace, tvars=None, args=None, origin=None, extra=None, orig_bases=None): + """Create a new generic class. GenericMeta.__new__ accepts + keyword arguments that are used for internal bookkeeping, therefore + an override should pass unused keyword arguments to super(). + """ if tvars is not None: # Called from __getitem__() below. assert origin is not None @@ -934,6 +996,7 @@ class GenericMeta(TypingMeta, abc.ABCMeta): # remove bare Generic from bases if there are other generic bases if any(isinstance(b, GenericMeta) and b is not Generic for b in bases): bases = tuple(b for b in bases if b is not Generic) + namespace.update({'__origin__': origin, '__extra__': extra}) self = super().__new__(cls, name, bases, namespace, _root=True) self.__parameters__ = tvars @@ -942,8 +1005,6 @@ class GenericMeta(TypingMeta, abc.ABCMeta): self.__args__ = tuple(... if a is _TypingEllipsis else () if a is _TypingEmpty else a for a in args) if args else None - self.__origin__ = origin - self.__extra__ = extra # Speed hack (https://github.com/python/typing/issues/196). self.__next_in_mro__ = _next_in_mro(self) # Preserve base classes on subclassing (__bases__ are type erased now). @@ -953,18 +1014,57 @@ class GenericMeta(TypingMeta, abc.ABCMeta): # This allows unparameterized generic collections to be used # with issubclass() and isinstance() in the same way as their # collections.abc counterparts (e.g., isinstance([], Iterable)). - if ('__subclasshook__' not in namespace and extra # allow overriding - or hasattr(self.__subclasshook__, '__name__') and - self.__subclasshook__.__name__ == '__extrahook__'): + if ( + '__subclasshook__' not in namespace and extra or + # allow overriding + getattr(self.__subclasshook__, '__name__', '') == '__extrahook__' + ): self.__subclasshook__ = _make_subclasshook(self) if isinstance(extra, abc.ABCMeta): self._abc_registry = extra._abc_registry + self._abc_cache = extra._abc_cache + elif origin is not None: + self._abc_registry = origin._abc_registry + self._abc_cache = origin._abc_cache if origin and hasattr(origin, '__qualname__'): # Fix for Python 3.2. self.__qualname__ = origin.__qualname__ - self.__tree_hash__ = hash(self._subs_tree()) if origin else hash((self.__name__,)) + self.__tree_hash__ = (hash(self._subs_tree()) if origin else + super(GenericMeta, self).__hash__()) return self + # _abc_negative_cache and _abc_negative_cache_version + # realised as descriptors, since GenClass[t1, t2, ...] always + # share subclass info with GenClass. + # This is an important memory optimization. + @property + def _abc_negative_cache(self): + if isinstance(self.__extra__, abc.ABCMeta): + return self.__extra__._abc_negative_cache + return _gorg(self)._abc_generic_negative_cache + + @_abc_negative_cache.setter + def _abc_negative_cache(self, value): + if self.__origin__ is None: + if isinstance(self.__extra__, abc.ABCMeta): + self.__extra__._abc_negative_cache = value + else: + self._abc_generic_negative_cache = value + + @property + def _abc_negative_cache_version(self): + if isinstance(self.__extra__, abc.ABCMeta): + return self.__extra__._abc_negative_cache_version + return _gorg(self)._abc_generic_negative_cache_version + + @_abc_negative_cache_version.setter + def _abc_negative_cache_version(self, value): + if self.__origin__ is None: + if isinstance(self.__extra__, abc.ABCMeta): + self.__extra__._abc_negative_cache_version = value + else: + self._abc_generic_negative_cache_version = value + def _get_type_vars(self, tvars): if self.__origin__ and self.__parameters__: _get_type_vars(self.__parameters__, tvars) @@ -1052,8 +1152,10 @@ class GenericMeta(TypingMeta, abc.ABCMeta): _check_generic(self, params) tvars = _type_vars(params) args = params + + prepend = (self,) if self.__origin__ is None else () return self.__class__(self.__name__, - self.__bases__, + prepend + self.__bases__, _no_slots_copy(self.__dict__), tvars=tvars, args=args, @@ -1061,6 +1163,17 @@ class GenericMeta(TypingMeta, abc.ABCMeta): extra=self.__extra__, orig_bases=self.__orig_bases__) + def __subclasscheck__(self, cls): + if self.__origin__ is not None: + if sys._getframe(1).f_globals['__name__'] not in ['abc', 'functools']: + raise TypeError("Parameterized generics cannot be used with class " + "or instance checks") + return False + if self is Generic: + raise TypeError("Class %r cannot be used with class " + "or instance checks" % self) + return super().__subclasscheck__(cls) + def __instancecheck__(self, instance): # Since we extend ABC.__subclasscheck__ and # ABC.__instancecheck__ inlines the cache checking done by the @@ -1075,6 +1188,16 @@ class GenericMeta(TypingMeta, abc.ABCMeta): self.__parameters__, self.__args__, self.__origin__, self.__extra__, self.__orig_bases__) + def __setattr__(self, attr, value): + # We consider all the subscripted genrics as proxies for original class + if ( + attr.startswith('__') and attr.endswith('__') or + attr.startswith('_abc_') + ): + super(GenericMeta, self).__setattr__(attr, value) + else: + super(GenericMeta, _gorg(self)).__setattr__(attr, value) + # Prevent checks for Generic to crash when defining Generic. Generic = None @@ -1159,13 +1282,13 @@ class TupleMeta(GenericMeta): return super().__getitem__(parameters) def __instancecheck__(self, obj): - if self.__args__ == None: + if self.__args__ is None: return isinstance(obj, tuple) raise TypeError("Parameterized Tuple cannot be used " "with isinstance().") def __subclasscheck__(self, cls): - if self.__args__ == None: + if self.__args__ is None: return issubclass(cls, tuple) raise TypeError("Parameterized Tuple cannot be used " "with issubclass().") @@ -1219,7 +1342,7 @@ class CallableMeta(GenericMeta): with hashable arguments to improve speed. """ - if self.__origin__ is not None or not _geqv(self, Callable): + if self.__origin__ is not None or not _geqv(self, Callable): return super().__getitem__(parameters) if not isinstance(parameters, tuple) or len(parameters) != 2: raise TypeError("Callable must be used as " @@ -1247,7 +1370,7 @@ class CallableMeta(GenericMeta): return super().__getitem__(parameters) -class Callable(extra=collections_abc.Callable, metaclass = CallableMeta): +class Callable(extra=collections_abc.Callable, metaclass=CallableMeta): """Callable type; Callable[[int], str] is a function of (int) -> str. The subscription syntax must always be used with exactly two @@ -1355,6 +1478,11 @@ def _get_defaults(func): return res +_allowed_types = (types.FunctionType, types.BuiltinFunctionType, + types.MethodType, types.ModuleType, + WrapperDescriptorType, MethodWrapperType, MethodDescriptorType) + + def get_type_hints(obj, globalns=None, localns=None): """Return type hints for an object. @@ -1409,10 +1537,7 @@ def get_type_hints(obj, globalns=None, localns=None): hints = getattr(obj, '__annotations__', None) if hints is None: # Return empty annotations for something that _could_ have them. - if (isinstance(obj, types.FunctionType) or - isinstance(obj, types.BuiltinFunctionType) or - isinstance(obj, types.MethodType) or - isinstance(obj, types.ModuleType)): + if isinstance(obj, _allowed_types): return {} else: raise TypeError('{!r} is not a module, class, method, ' @@ -1452,7 +1577,7 @@ def no_type_check(arg): no_type_check(obj) try: arg.__no_type_check__ = True - except TypeError: # built-in classes + except TypeError: # built-in classes pass return arg @@ -1738,14 +1863,15 @@ else: class MutableMapping(Mapping[KT, VT], extra=collections_abc.MutableMapping): __slots__ = () + if hasattr(collections_abc, 'Reversible'): if hasattr(collections_abc, 'Collection'): class Sequence(Reversible[T_co], Collection[T_co], - extra=collections_abc.Sequence): + extra=collections_abc.Sequence): __slots__ = () else: class Sequence(Sized, Reversible[T_co], Container[T_co], - extra=collections_abc.Sequence): + extra=collections_abc.Sequence): __slots__ = () else: class Sequence(Sized, Iterable[T_co], Container[T_co], @@ -1772,6 +1898,16 @@ class List(list, MutableSequence[T], extra=list): return _generic_new(list, cls, *args, **kwds) +class Deque(collections.deque, MutableSequence[T], extra=collections.deque): + + __slots__ = () + + def __new__(cls, *args, **kwds): + if _geqv(cls, Deque): + return collections.deque(*args, **kwds) + return _generic_new(collections.deque, cls, *args, **kwds) + + class Set(set, MutableSet[T], extra=set): __slots__ = () @@ -1816,7 +1952,61 @@ class ValuesView(MappingView[VT_co], extra=collections_abc.ValuesView): if hasattr(contextlib, 'AbstractContextManager'): class ContextManager(Generic[T_co], extra=contextlib.AbstractContextManager): __slots__ = () - __all__.append('ContextManager') +else: + class ContextManager(Generic[T_co]): + __slots__ = () + + def __enter__(self): + return self + + @abc.abstractmethod + def __exit__(self, exc_type, exc_value, traceback): + return None + + @classmethod + def __subclasshook__(cls, C): + if cls is ContextManager: + # In Python 3.6+, it is possible to set a method to None to + # explicitly indicate that the class does not implement an ABC + # (https://bugs.python.org/issue25958), but we do not support + # that pattern here because this fallback class is only used + # in Python 3.5 and earlier. + if (any("__enter__" in B.__dict__ for B in C.__mro__) and + any("__exit__" in B.__dict__ for B in C.__mro__)): + return True + return NotImplemented + + +if hasattr(contextlib, 'AbstractAsyncContextManager'): + class AsyncContextManager(Generic[T_co], + extra=contextlib.AbstractAsyncContextManager): + __slots__ = () + + __all__.append('AsyncContextManager') +elif sys.version_info[:2] >= (3, 5): + exec(""" +class AsyncContextManager(Generic[T_co]): + __slots__ = () + + async def __aenter__(self): + return self + + @abc.abstractmethod + async def __aexit__(self, exc_type, exc_value, traceback): + return None + + @classmethod + def __subclasshook__(cls, C): + if cls is AsyncContextManager: + if sys.version_info[:2] >= (3, 6): + return _collections_abc._check_methods(C, "__aenter__", "__aexit__") + if (any("__aenter__" in B.__dict__ for B in C.__mro__) and + any("__aexit__" in B.__dict__ for B in C.__mro__)): + return True + return NotImplemented + +__all__.append('AsyncContextManager') +""") class Dict(dict, MutableMapping[KT, VT], extra=dict): @@ -1829,6 +2019,7 @@ class Dict(dict, MutableMapping[KT, VT], extra=dict): "use dict() instead") return _generic_new(dict, cls, *args, **kwds) + class DefaultDict(collections.defaultdict, MutableMapping[KT, VT], extra=collections.defaultdict): @@ -1836,10 +2027,35 @@ class DefaultDict(collections.defaultdict, MutableMapping[KT, VT], def __new__(cls, *args, **kwds): if _geqv(cls, DefaultDict): - raise TypeError("Type DefaultDict cannot be instantiated; " - "use collections.defaultdict() instead") + return collections.defaultdict(*args, **kwds) return _generic_new(collections.defaultdict, cls, *args, **kwds) + +class Counter(collections.Counter, Dict[T, int], extra=collections.Counter): + + __slots__ = () + + def __new__(cls, *args, **kwds): + if _geqv(cls, Counter): + return collections.Counter(*args, **kwds) + return _generic_new(collections.Counter, cls, *args, **kwds) + + +if hasattr(collections, 'ChainMap'): + # ChainMap only exists in 3.3+ + __all__.append('ChainMap') + + class ChainMap(collections.ChainMap, MutableMapping[KT, VT], + extra=collections.ChainMap): + + __slots__ = () + + def __new__(cls, *args, **kwds): + if _geqv(cls, ChainMap): + return collections.ChainMap(*args, **kwds) + return _generic_new(collections.ChainMap, cls, *args, **kwds) + + # Determine what base class to use for Generator. if hasattr(collections_abc, 'Generator'): # Sufficiently recent versions of 3.5 have a Generator ABC. @@ -1860,6 +2076,14 @@ class Generator(Iterator[T_co], Generic[T_co, T_contra, V_co], return _generic_new(_G_base, cls, *args, **kwds) +if hasattr(collections_abc, 'AsyncGenerator'): + class AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra], + extra=collections_abc.AsyncGenerator): + __slots__ = () + + __all__.append('AsyncGenerator') + + # Internal type variable used for Type[]. CT_co = TypeVar('CT_co', covariant=True, bound=type) @@ -1896,7 +2120,9 @@ def _make_nmtuple(name, types): msg = "NamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a type" types = [(n, _type_check(t, msg)) for n, t in types] nm_tpl = collections.namedtuple(name, [n for n, t in types]) - nm_tpl._field_types = dict(types) + # Prior to PEP 526, only _field_types attribute was assigned. + # Now, both __annotations__ and _field_types are used to maintain compatibility. + nm_tpl.__annotations__ = nm_tpl._field_types = collections.OrderedDict(types) try: nm_tpl.__module__ = sys._getframe(2).f_globals.get('__name__', '__main__') except (AttributeError, ValueError): @@ -1906,6 +2132,13 @@ def _make_nmtuple(name, types): _PY36 = sys.version_info[:2] >= (3, 6) +# attributes prohibited to set in NamedTuple class syntax +_prohibited = ('__new__', '__init__', '__slots__', '__getnewargs__', + '_fields', '_field_defaults', '_field_types', + '_make', '_replace', '_asdict', '_source') + +_special = ('__module__', '__name__', '__qualname__', '__annotations__') + class NamedTupleMeta(type): @@ -1916,7 +2149,29 @@ class NamedTupleMeta(type): raise TypeError("Class syntax for NamedTuple is only supported" " in Python 3.6+") types = ns.get('__annotations__', {}) - return _make_nmtuple(typename, types.items()) + nm_tpl = _make_nmtuple(typename, types.items()) + defaults = [] + defaults_dict = {} + for field_name in types: + if field_name in ns: + default_value = ns[field_name] + defaults.append(default_value) + defaults_dict[field_name] = default_value + elif defaults: + raise TypeError("Non-default namedtuple field {field_name} cannot " + "follow default field(s) {default_names}" + .format(field_name=field_name, + default_names=', '.join(defaults_dict.keys()))) + nm_tpl.__new__.__defaults__ = tuple(defaults) + nm_tpl._field_defaults = defaults_dict + # update from user namespace without overriding special namedtuple attributes + for key in ns: + if key in _prohibited: + raise AttributeError("Cannot overwrite NamedTuple attribute " + key) + elif key not in _special and key not in nm_tpl._fields: + setattr(nm_tpl, key, ns[key]) + return nm_tpl + class NamedTuple(metaclass=NamedTupleMeta): """Typed version of namedtuple. @@ -1931,8 +2186,10 @@ class NamedTuple(metaclass=NamedTupleMeta): Employee = collections.namedtuple('Employee', ['name', 'id']) - The resulting class has one extra attribute: _field_types, - giving a dict mapping field names to types. (The field names + The resulting class has extra __annotations__ and _field_types + attributes, giving an ordered dict mapping field names to types. + __annotations__ should be preferred, while _field_types + is kept to maintain pre PEP 526 compatibility. (The field names are in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:: @@ -2139,6 +2396,7 @@ class io: TextIO = TextIO BinaryIO = BinaryIO + io.__name__ = __name__ + '.io' sys.modules[io.__name__] = io @@ -2156,5 +2414,6 @@ class re: Pattern = Pattern Match = Match + re.__name__ = __name__ + '.re' sys.modules[re.__name__] = re diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py index b523f73..f4dbc52 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -153,28 +153,32 @@ class _AssertRaisesBaseContext(_BaseTestCaseContext): If args is not empty, call a callable passing positional and keyword arguments. """ - if not _is_subtype(self.expected, self._base_type): - raise TypeError('%s() arg 1 must be %s' % - (name, self._base_type_str)) - if args and args[0] is None: - warnings.warn("callable is None", - DeprecationWarning, 3) - args = () - if not args: - self.msg = kwargs.pop('msg', None) - if kwargs: - warnings.warn('%r is an invalid keyword argument for ' - 'this function' % next(iter(kwargs)), - DeprecationWarning, 3) - return self - - callable_obj, *args = args try: - self.obj_name = callable_obj.__name__ - except AttributeError: - self.obj_name = str(callable_obj) - with self: - callable_obj(*args, **kwargs) + if not _is_subtype(self.expected, self._base_type): + raise TypeError('%s() arg 1 must be %s' % + (name, self._base_type_str)) + if args and args[0] is None: + warnings.warn("callable is None", + DeprecationWarning, 3) + args = () + if not args: + self.msg = kwargs.pop('msg', None) + if kwargs: + warnings.warn('%r is an invalid keyword argument for ' + 'this function' % next(iter(kwargs)), + DeprecationWarning, 3) + return self + + callable_obj, *args = args + try: + self.obj_name = callable_obj.__name__ + except AttributeError: + self.obj_name = str(callable_obj) + with self: + callable_obj(*args, **kwargs) + finally: + # bpo-23890: manually break a reference cycle + self = None class _AssertRaisesContext(_AssertRaisesBaseContext): @@ -725,7 +729,11 @@ class TestCase(object): self.assertEqual(the_exception.error_code, 3) """ context = _AssertRaisesContext(expected_exception, self) - return context.handle('assertRaises', args, kwargs) + try: + return context.handle('assertRaises', args, kwargs) + finally: + # bpo-23890: manually break a reference cycle + context = None def assertWarns(self, expected_warning, *args, **kwargs): """Fail unless a warning of class warnClass is triggered diff --git a/Lib/unittest/loader.py b/Lib/unittest/loader.py index eb447d7..e860deb 100644 --- a/Lib/unittest/loader.py +++ b/Lib/unittest/loader.py @@ -81,7 +81,7 @@ class TestLoader(object): self._loading_packages = set() def loadTestsFromTestCase(self, testCaseClass): - """Return a suite of all tests cases contained in testCaseClass""" + """Return a suite of all test cases contained in testCaseClass""" if issubclass(testCaseClass, suite.TestSuite): raise TypeError("Test cases should not be derived from " "TestSuite. Maybe you meant to derive from " @@ -95,7 +95,7 @@ class TestLoader(object): # XXX After Python 3.5, remove backward compatibility hacks for # use_load_tests deprecation via *args and **kws. See issue 16662. def loadTestsFromModule(self, module, *args, pattern=None, **kws): - """Return a suite of all tests cases contained in the given module""" + """Return a suite of all test cases contained in the given module""" # This method used to take an undocumented and unofficial # use_load_tests argument. For backward compatibility, we still # accept the argument (which can also be the first position) but we @@ -135,7 +135,7 @@ class TestLoader(object): return tests def loadTestsFromName(self, name, module=None): - """Return a suite of all tests cases given a string specifier. + """Return a suite of all test cases given a string specifier. The name may resolve either to a module, a test case class, a test method within a test case class, or a callable object which @@ -213,7 +213,7 @@ class TestLoader(object): raise TypeError("don't know how to make test from: %s" % obj) def loadTestsFromNames(self, names, module=None): - """Return a suite of all tests cases found using the given sequence + """Return a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. """ suites = [self.loadTestsFromName(name, module) for name in names] diff --git a/Lib/unittest/main.py b/Lib/unittest/main.py index 09fefe1..807604f 100644 --- a/Lib/unittest/main.py +++ b/Lib/unittest/main.py @@ -14,6 +14,7 @@ Examples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method + %(prog)s path/to/test_file.py - run tests from test_file.py """ MODULE_EXAMPLES = """\ diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 669890a..067df81 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -177,7 +177,7 @@ def _set_signature(mock, original, instance=False): skipfirst = isinstance(original, type) result = _get_signature_object(original, instance, skipfirst) if result is None: - return + return mock func, sig = result def checksig(*args, **kwargs): sig.bind(*args, **kwargs) @@ -795,8 +795,8 @@ class NonCallableMock(Base): def assert_called_once_with(_mock_self, *args, **kwargs): - """assert that the mock was called exactly once and with the specified - arguments.""" + """assert that the mock was called exactly once and that that call was + with the specified arguments.""" self = _mock_self if not self.call_count == 1: msg = ("Expected '%s' to be called once. Called %s times." % @@ -1749,14 +1749,18 @@ def _get_eq(self): ret_val = self.__eq__._mock_return_value if ret_val is not DEFAULT: return ret_val - return self is other + if self is other: + return True + return NotImplemented return __eq__ def _get_ne(self): def __ne__(other): if self.__ne__._mock_return_value is not DEFAULT: return DEFAULT - return self is not other + if self is other: + return False + return NotImplemented return __ne__ def _get_iter(self): @@ -1941,9 +1945,8 @@ class _Call(tuple): If the _Call has no name then it will match any name. """ - def __new__(cls, value=(), name=None, parent=None, two=False, + def __new__(cls, value=(), name='', parent=None, two=False, from_kall=True): - name = '' args = () kwargs = {} _len = len(value) diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py index 8f752b8..b849591 100644 --- a/Lib/unittest/test/test_case.py +++ b/Lib/unittest/test/test_case.py @@ -1273,6 +1273,19 @@ test case with self.assertRaises(TypeError): self.assertRaises((ValueError, object)) + def testAssertRaisesRefcount(self): + # bpo-23890: assertRaises() must not keep objects alive longer + # than expected + def func() : + try: + raise ValueError + except ValueError: + raise ValueError + + refcount = sys.getrefcount(func) + self.assertRaises(ValueError, func) + self.assertEqual(refcount, sys.getrefcount(func)) + def testAssertRaisesRegex(self): class ExceptionMock(Exception): pass diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py index 1996a8e..48d8fe9 100644 --- a/Lib/unittest/test/test_discovery.py +++ b/Lib/unittest/test/test_discovery.py @@ -528,6 +528,9 @@ class TestDiscovery(unittest.TestCase): pickle.loads(pickle.dumps(test, proto)) def test_discover_with_module_that_raises_SkipTest_on_import(self): + if not unittest.BaseTestSuite._cleanup: + raise unittest.SkipTest("Suite cleanup is disabled") + loader = unittest.TestLoader() def _get_module_from_name(name): @@ -548,6 +551,9 @@ class TestDiscovery(unittest.TestCase): pickle.loads(pickle.dumps(suite, proto)) def test_discover_with_init_module_that_raises_SkipTest_on_import(self): + if not unittest.BaseTestSuite._cleanup: + raise unittest.SkipTest("Suite cleanup is disabled") + vfs = {abspath('/foo'): ['my_package'], abspath('/foo/my_package'): ['__init__.py', 'test_module.py']} self.setup_import_issue_package_tests(vfs) diff --git a/Lib/unittest/test/test_loader.py b/Lib/unittest/test/test_loader.py index 4b97882..31e2f0f 100644 --- a/Lib/unittest/test/test_loader.py +++ b/Lib/unittest/test/test_loader.py @@ -35,7 +35,7 @@ class Test_TestLoader(unittest.TestCase): ### Tests for TestLoader.loadTestsFromTestCase ################################################################ - # "Return a suite of all tests cases contained in the TestCase-derived + # "Return a suite of all test cases contained in the TestCase-derived # class testCaseClass" def test_loadTestsFromTestCase(self): class Foo(unittest.TestCase): @@ -48,7 +48,7 @@ class Test_TestLoader(unittest.TestCase): loader = unittest.TestLoader() self.assertEqual(loader.loadTestsFromTestCase(Foo), tests) - # "Return a suite of all tests cases contained in the TestCase-derived + # "Return a suite of all test cases contained in the TestCase-derived # class testCaseClass" # # Make sure it does the right thing even if no tests were found @@ -61,7 +61,7 @@ class Test_TestLoader(unittest.TestCase): loader = unittest.TestLoader() self.assertEqual(loader.loadTestsFromTestCase(Foo), empty_suite) - # "Return a suite of all tests cases contained in the TestCase-derived + # "Return a suite of all test cases contained in the TestCase-derived # class testCaseClass" # # What happens if loadTestsFromTestCase() is given an object @@ -82,7 +82,7 @@ class Test_TestLoader(unittest.TestCase): else: self.fail('Should raise TypeError') - # "Return a suite of all tests cases contained in the TestCase-derived + # "Return a suite of all test cases contained in the TestCase-derived # class testCaseClass" # # Make sure loadTestsFromTestCase() picks up the default test method diff --git a/Lib/unittest/test/testmock/testhelpers.py b/Lib/unittest/test/testmock/testhelpers.py index 3477634..7919482 100644 --- a/Lib/unittest/test/testmock/testhelpers.py +++ b/Lib/unittest/test/testmock/testhelpers.py @@ -1,3 +1,5 @@ +import time +import types import unittest from unittest.mock import ( @@ -306,6 +308,11 @@ class CallTest(unittest.TestCase): other_args = _Call(((1, 2), {'a': 3})) self.assertEqual(args, other_args) + def test_call_with_name(self): + self.assertEqual(_Call((), 'foo')[0], 'foo') + self.assertEqual(_Call((('bar', 'barz'),),)[0], '') + self.assertEqual(_Call((('bar', 'barz'), {'hello': 'world'}),)[0], '') + class SpecSignatureTest(unittest.TestCase): @@ -851,6 +858,19 @@ class SpecSignatureTest(unittest.TestCase): check_data_descriptor(foo.desc) + def test_autospec_on_bound_builtin_function(self): + meth = types.MethodType(time.ctime, time.time()) + self.assertIsInstance(meth(), str) + mocked = create_autospec(meth) + + # no signature, so no spec to check against + mocked() + mocked.assert_called_once_with() + mocked.reset_mock() + mocked(4, 5, 6) + mocked.assert_called_once_with(4, 5, 6) + + class TestCallList(unittest.TestCase): def test_args_list_contains_call_list(self): diff --git a/Lib/unittest/test/testmock/testmock.py b/Lib/unittest/test/testmock/testmock.py index 5f82b82..a96ec68 100644 --- a/Lib/unittest/test/testmock/testmock.py +++ b/Lib/unittest/test/testmock/testmock.py @@ -306,13 +306,24 @@ class MockTest(unittest.TestCase): def test_calls_equal_with_any(self): - call1 = mock.call(mock.MagicMock()) - call2 = mock.call(mock.ANY) - # Check that equality and non-equality is consistent even when # comparing with mock.ANY + mm = mock.MagicMock() + self.assertTrue(mm == mm) + self.assertFalse(mm != mm) + self.assertFalse(mm == mock.MagicMock()) + self.assertTrue(mm != mock.MagicMock()) + self.assertTrue(mm == mock.ANY) + self.assertFalse(mm != mock.ANY) + self.assertTrue(mock.ANY == mm) + self.assertFalse(mock.ANY != mm) + + call1 = mock.call(mock.MagicMock()) + call2 = mock.call(mock.ANY) self.assertTrue(call1 == call2) self.assertFalse(call1 != call2) + self.assertTrue(call2 == call1) + self.assertFalse(call2 != call1) def test_assert_called_with(self): diff --git a/Lib/urllib/error.py b/Lib/urllib/error.py index c5b675d..851515b 100644 --- a/Lib/urllib/error.py +++ b/Lib/urllib/error.py @@ -16,10 +16,6 @@ import urllib.response __all__ = ['URLError', 'HTTPError', 'ContentTooShortError'] -# do these error classes make sense? -# make sure all of the OSError stuff is overridden. we just want to be -# subtypes. - class URLError(OSError): # URLError is a sub-type of OSError, but it doesn't share any of # the implementation. need to override __init__ and __str__. diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index 566fbf7..62e8ddf 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -38,29 +38,37 @@ __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag", "DefragResult", "ParseResult", "SplitResult", "DefragResultBytes", "ParseResultBytes", "SplitResultBytes"] -# A classification of schemes ('' means apply by default) -uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', +# A classification of schemes. +# The empty string classifies URLs with no scheme specified, +# being the default value returned by “urlsplit” and “urlparse”. + +uses_relative = ['', 'ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file', 'https', 'shttp', 'mms', - 'prospero', 'rtsp', 'rtspu', '', 'sftp', + 'prospero', 'rtsp', 'rtspu', 'sftp', 'svn', 'svn+ssh', 'ws', 'wss'] -uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', + +uses_netloc = ['', 'ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', - 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '', + 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', 'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh', 'ws', 'wss'] -uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap', + +uses_params = ['', 'ftp', 'hdl', 'prospero', 'http', 'imap', 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips', - 'mms', '', 'sftp', 'tel'] + 'mms', 'sftp', 'tel'] # These are not actually used anymore, but should stay for backwards # compatibility. (They are undocumented, but have a public-looking name.) + non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips'] -uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms', - 'gopher', 'rtsp', 'rtspu', 'sip', 'sips', ''] -uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news', + +uses_query = ['', 'http', 'wais', 'imap', 'https', 'shttp', 'mms', + 'gopher', 'rtsp', 'rtspu', 'sip', 'sips'] + +uses_fragment = ['', 'ftp', 'hdl', 'http', 'gopher', 'news', 'nntp', 'wais', 'https', 'shttp', 'snews', - 'file', 'prospero', ''] + 'file', 'prospero'] # Characters valid in scheme names scheme_chars = ('abcdefghijklmnopqrstuvwxyz' @@ -550,6 +558,7 @@ def unquote(string, encoding='utf-8', errors='replace'): append(bits[i + 1]) return ''.join(res) + def parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace'): """Parse a query given as a string argument. @@ -571,6 +580,8 @@ def parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding and errors: specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. + + Returns a dictionary. """ parsed_result = {} pairs = parse_qsl(qs, keep_blank_values, strict_parsing, @@ -582,28 +593,29 @@ def parse_qs(qs, keep_blank_values=False, strict_parsing=False, parsed_result[name] = [value] return parsed_result + def parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace'): """Parse a query given as a string argument. - Arguments: + Arguments: - qs: percent-encoded query string to be parsed + qs: percent-encoded query string to be parsed - keep_blank_values: flag indicating whether blank values in - percent-encoded queries should be treated as blank strings. A - true value indicates that blanks should be retained as blank - strings. The default false value indicates that blank values - are to be ignored and treated as if they were not included. + keep_blank_values: flag indicating whether blank values in + percent-encoded queries should be treated as blank strings. + A true value indicates that blanks should be retained as blank + strings. The default false value indicates that blank values + are to be ignored and treated as if they were not included. - strict_parsing: flag indicating what to do with parsing errors. If - false (the default), errors are silently ignored. If true, - errors raise a ValueError exception. + strict_parsing: flag indicating what to do with parsing errors. If + false (the default), errors are silently ignored. If true, + errors raise a ValueError exception. - encoding and errors: specify how to decode percent-encoded sequences - into Unicode characters, as accepted by the bytes.decode() method. + encoding and errors: specify how to decode percent-encoded sequences + into Unicode characters, as accepted by the bytes.decode() method. - Returns a list, as G-d intended. + Returns a list, as G-d intended. """ qs, _coerce_result = _coerce_args(qs) pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')] @@ -870,7 +882,7 @@ def splithost(url): """splithost('//host[:port]/path') --> 'host[:port]', '/path'.""" global _hostprog if _hostprog is None: - _hostprog = re.compile('//([^/?]*)(.*)', re.DOTALL) + _hostprog = re.compile('//([^/#?]*)(.*)', re.DOTALL) match = _hostprog.match(url) if match: diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index a4bf97d..e98be0c 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1424,7 +1424,6 @@ class FileHandler(BaseHandler): origurl = 'file://' + filename return addinfourl(open(localfile, 'rb'), headers, origurl) except OSError as exp: - # users shouldn't expect OSErrors coming from urlopen() raise URLError(exp) raise URLError('file not on local host') @@ -1594,14 +1593,10 @@ else: of the 'file' scheme; not recommended for general use.""" return quote(pathname) -# This really consists of two pieces: -# (1) a class which handles opening of all sorts of URLs -# (plus assorted utilities etc.) -# (2) a set of functions for parsing URLs -# XXX Should these be separated out into different modules? - ftpcache = {} + + class URLopener: """Class to open URLs. This is a class rather than just a subroutine because we may need @@ -2450,6 +2445,7 @@ def proxy_bypass_environment(host, proxies=None): no_proxy_list = [proxy.strip() for proxy in no_proxy.split(',')] for name in no_proxy_list: if name: + name = name.lstrip('.') # ignore leading dots name = re.escape(name) pattern = r'(.+\.)?%s$' % name if (re.match(pattern, hostonly, re.I) diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py index 74245ab..6bb99cb 100644 --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -77,6 +77,10 @@ class EnvBuilder: """ env_dir = os.path.abspath(env_dir) context = self.ensure_directories(env_dir) + # See issue 24875. We need system_site_packages to be False + # until after pip is installed. + true_system_site_packages = self.system_site_packages + self.system_site_packages = False self.create_configuration(context) self.setup_python(context) if self.with_pip: @@ -84,6 +88,11 @@ class EnvBuilder: if not self.upgrade: self.setup_scripts(context) self.post_setup(context) + if true_system_site_packages: + # We had set it to False before, now + # restore it and rewrite the configuration + self.system_site_packages = True + self.create_configuration(context) def clear_directory(self, path): for fn in os.listdir(path): @@ -330,19 +339,17 @@ class EnvBuilder: dstfile = os.path.join(dstdir, f) with open(srcfile, 'rb') as f: data = f.read() - if srcfile.endswith('.exe'): - mode = 'wb' - else: - mode = 'w' + if not srcfile.endswith('.exe'): try: data = data.decode('utf-8') data = self.replace_variables(data, context) - except UnicodeDecodeError as e: + data = data.encode('utf-8') + except UnicodeError as e: data = None logger.warning('unable to copy script %r, ' 'may be binary: %s', srcfile, e) if data is not None: - with open(dstfile, mode) as f: + with open(dstfile, 'wb') as f: f.write(data) shutil.copymode(srcfile, dstfile) diff --git a/Lib/venv/scripts/posix/activate b/Lib/venv/scripts/common/activate similarity index 100% rename from Lib/venv/scripts/posix/activate rename to Lib/venv/scripts/common/activate diff --git a/Lib/venv/scripts/nt/Activate.ps1 b/Lib/venv/scripts/nt/Activate.ps1 index b15decb..85646c8 100644 --- a/Lib/venv/scripts/nt/Activate.ps1 +++ b/Lib/venv/scripts/nt/Activate.ps1 @@ -26,16 +26,18 @@ function global:deactivate ([switch]$NonDestructive) { } deactivate -nondestructive - + $env:VIRTUAL_ENV="__VENV_DIR__" -# Set the prompt to include the env name -# Make sure _OLD_VIRTUAL_PROMPT is global -function global:_OLD_VIRTUAL_PROMPT {""} -copy-item function:prompt function:_OLD_VIRTUAL_PROMPT -function global:prompt { - Write-Host -NoNewline -ForegroundColor Green '__VENV_PROMPT__' - _OLD_VIRTUAL_PROMPT +if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) { + # Set the prompt to include the env name + # Make sure _OLD_VIRTUAL_PROMPT is global + function global:_OLD_VIRTUAL_PROMPT {""} + copy-item function:prompt function:_OLD_VIRTUAL_PROMPT + function global:prompt { + Write-Host -NoNewline -ForegroundColor Green '__VENV_PROMPT__' + _OLD_VIRTUAL_PROMPT + } } # Clear PYTHONHOME diff --git a/Lib/weakref.py b/Lib/weakref.py index aaebd0c..787e33a 100644 --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -106,7 +106,7 @@ class WeakValueDictionary(collections.MutableMapping): self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) - def remove(wr, selfref=ref(self)): + def remove(wr, selfref=ref(self), _atomic_removal=_remove_dead_weakref): self = selfref() if self is not None: if self._iterating: @@ -114,7 +114,7 @@ class WeakValueDictionary(collections.MutableMapping): else: # Atomic removal is necessary since this function # can be called asynchronously by the GC - _remove_dead_weakref(d, wr.key) + _atomic_removal(d, wr.key) self._remove = remove # A list of keys to be removed self._pending_removals = [] diff --git a/Lib/xml/sax/expatreader.py b/Lib/xml/sax/expatreader.py index 98b5ca9..421358f 100644 --- a/Lib/xml/sax/expatreader.py +++ b/Lib/xml/sax/expatreader.py @@ -105,9 +105,16 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): source = saxutils.prepare_input_source(source) self._source = source - self.reset() - self._cont_handler.setDocumentLocator(ExpatLocator(self)) - xmlreader.IncrementalParser.parse(self, source) + try: + self.reset() + self._cont_handler.setDocumentLocator(ExpatLocator(self)) + xmlreader.IncrementalParser.parse(self, source) + except: + # bpo-30264: Close the source on error to not leak resources: + # xml.sax.parse() doesn't give access to the underlying parser + # to the caller + self._close_source() + raise def prepareParser(self, source): if source.getSystemId() is not None: @@ -213,6 +220,17 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): # FIXME: when to invoke error()? self._err_handler.fatalError(exc) + def _close_source(self): + source = self._source + try: + file = source.getCharacterStream() + if file is not None: + file.close() + finally: + file = source.getByteStream() + if file is not None: + file.close() + def close(self): if (self._entity_stack or self._parser is None or isinstance(self._parser, _ClosedParser)): @@ -232,14 +250,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): parser.ErrorColumnNumber = self._parser.ErrorColumnNumber parser.ErrorLineNumber = self._parser.ErrorLineNumber self._parser = parser - try: - file = self._source.getCharacterStream() - if file is not None: - file.close() - finally: - file = self._source.getByteStream() - if file is not None: - file.close() + self._close_source() def _reset_cont_handler(self): self._parser.ProcessingInstructionHandler = \ diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py index 7817693..276394d 100644 --- a/Lib/xmlrpc/server.py +++ b/Lib/xmlrpc/server.py @@ -386,31 +386,36 @@ class SimpleXMLRPCDispatcher: not be called. """ - func = None try: - # check to see if a matching function has been registered + # call the matching registered function func = self.funcs[method] except KeyError: - if self.instance is not None: - # check for a _dispatch method - if hasattr(self.instance, '_dispatch'): - return self.instance._dispatch(method, params) - else: - # call instance method directly - try: - func = resolve_dotted_attribute( - self.instance, - method, - self.allow_dotted_names - ) - except AttributeError: - pass - - if func is not None: - return func(*params) + pass else: + if func is not None: + return func(*params) raise Exception('method "%s" is not supported' % method) + if self.instance is not None: + if hasattr(self.instance, '_dispatch'): + # call the `_dispatch` method on the instance + return self.instance._dispatch(method, params) + + # call the instance's method directly + try: + func = resolve_dotted_attribute( + self.instance, + method, + self.allow_dotted_names + ) + except AttributeError: + pass + else: + if func is not None: + return func(*params) + + raise Exception('method "%s" is not supported' % method) + class SimpleXMLRPCRequestHandler(BaseHTTPRequestHandler): """Simple XML-RPC request handler class. diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 048f60a..56a2479 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -1028,7 +1028,6 @@ class ZipFile: # set the modified flag so central directory gets written # even if no files are added to the archive self._didModify = True - self._start_disk = 0 try: self.start_dir = self.fp.tell() except (AttributeError, OSError): @@ -1054,7 +1053,7 @@ class ZipFile: # set the modified flag so central directory gets written # even if no files are added to the archive self._didModify = True - self.start_dir = self._start_disk = self.fp.tell() + self.start_dir = self.fp.tell() else: raise RuntimeError("Mode must be 'r', 'w', 'x', or 'a'") except: @@ -1098,18 +1097,17 @@ class ZipFile: offset_cd = endrec[_ECD_OFFSET] # offset of central directory self._comment = endrec[_ECD_COMMENT] # archive comment - # self._start_disk: Position of the start of ZIP archive - # It is zero, unless ZIP was concatenated to another file - self._start_disk = endrec[_ECD_LOCATION] - size_cd - offset_cd + # "concat" is zero, unless zip was concatenated to another file + concat = endrec[_ECD_LOCATION] - size_cd - offset_cd if endrec[_ECD_SIGNATURE] == stringEndArchive64: # If Zip64 extension structures are present, account for them - self._start_disk -= (sizeEndCentDir64 + sizeEndCentDir64Locator) + concat -= (sizeEndCentDir64 + sizeEndCentDir64Locator) if self.debug > 2: - inferred = self._start_disk + offset_cd - print("given, inferred, offset", offset_cd, inferred, self._start_disk) + inferred = concat + offset_cd + print("given, inferred, offset", offset_cd, inferred, concat) # self.start_dir: Position of start of central directory - self.start_dir = offset_cd + self._start_disk + self.start_dir = offset_cd + concat fp.seek(self.start_dir, 0) data = fp.read(size_cd) fp = io.BytesIO(data) @@ -1149,7 +1147,7 @@ class ZipFile: t>>11, (t>>5)&0x3F, (t&0x1F) * 2 ) x._decodeExtra() - x.header_offset = x.header_offset + self._start_disk + x.header_offset = x.header_offset + concat self.filelist.append(x) self.NameToInfo[x.filename] = x @@ -1629,10 +1627,11 @@ class ZipFile: file_size = zinfo.file_size compress_size = zinfo.compress_size - header_offset = zinfo.header_offset - self._start_disk - if header_offset > ZIP64_LIMIT: - extra.append(header_offset) + if zinfo.header_offset > ZIP64_LIMIT: + extra.append(zinfo.header_offset) header_offset = 0xffffffff + else: + header_offset = zinfo.header_offset extra_data = zinfo.extra min_version = 0 @@ -1679,7 +1678,7 @@ class ZipFile: # Write end-of-zip-archive record centDirCount = len(self.filelist) centDirSize = pos2 - self.start_dir - centDirOffset = self.start_dir - self._start_disk + centDirOffset = self.start_dir requires_zip64 = None if centDirCount > ZIP_FILECOUNT_LIMIT: requires_zip64 = "Files count" diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index c76c4f1..518eeb9 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -13,7 +13,7 @@ sphinx-build and the current versions of Sphinx now require at least Python 2.6. In addition to what is supplied with OS X 10.5+ and Xcode 3+, the script -requires an installed version of hg and a third-party version of +requires an installed third-party version of Tcl/Tk 8.4 (for OS X 10.4 and 10.5 deployment targets) or Tcl/TK 8.5 (for 10.6 or later) installed in /Library/Frameworks. When installed, the Python built by this script will attempt to dynamically link first to @@ -23,7 +23,7 @@ installing the most recent ActiveTcl 8.4 or 8.5 version. 32-bit-only installer builds are still possible on OS X 10.4 with Xcode 2.5 and the installation of additional components, such as a newer Python -(2.5 is needed for Python parser updates), hg, and for the documentation +(2.5 is needed for Python parser updates) and for the documentation build either svn (pre-3.4.1) or sphinx-build (3.4.1 and later). Usage: see USAGE variable in the script. @@ -242,9 +242,9 @@ def library_recipes(): result.extend([ dict( - name="OpenSSL 1.0.2j", - url="https://www.openssl.org/source/openssl-1.0.2j.tar.gz", - checksum='96322138f0b69e61b7212bc53d5e912b', + name="OpenSSL 1.0.2k", + url="https://www.openssl.org/source/openssl-1.0.2k.tar.gz", + checksum='f965fc0bf01bf882b31314b61391ae65', patches=[ "openssl_sdk_makedepend.patch", ], @@ -663,9 +663,8 @@ def checkEnvironment(): base_path = base_path + ':' + OLD_DEVELOPER_TOOLS os.environ['PATH'] = base_path print("Setting default PATH: %s"%(os.environ['PATH'])) - # Ensure ws have access to hg and to sphinx-build. - # You may have to create links in /usr/bin for them. - runCommand('hg --version') + # Ensure we have access to sphinx-build. + # You may have to create a link in /usr/bin for it. runCommand('sphinx-build --version') def parseOptions(args=None): @@ -1115,10 +1114,10 @@ def buildPythonDocs(): docdir = os.path.join(rootDir, 'pydocs') curDir = os.getcwd() os.chdir(buildDir) - # The Doc build changed for 3.4 (technically, for 3.4.1) and for 2.7.9 runCommand('make clean') - # Assume sphinx-build is on our PATH, checked in checkEnvironment - runCommand('make html') + # Create virtual environment for docs builds with blurb and sphinx + runCommand('make venv') + runCommand('make html PYTHON=venv/bin/python') os.chdir(curDir) if not os.path.exists(docdir): os.mkdir(docdir) @@ -1168,11 +1167,25 @@ def buildPython(): shellQuote(WORKDIR)[1:-1], shellQuote(WORKDIR)[1:-1])) - print("Running make touch") - runCommand("make touch") - - print("Running make") - runCommand("make") + # Look for environment value BUILDINSTALLER_BUILDPYTHON_MAKE_EXTRAS + # and, if defined, append its value to the make command. This allows + # us to pass in version control tags, like GITTAG, to a build from a + # tarball rather than from a vcs checkout, thus eliminating the need + # to have a working copy of the vcs program on the build machine. + # + # A typical use might be: + # export BUILDINSTALLER_BUILDPYTHON_MAKE_EXTRAS=" \ + # GITVERSION='echo 123456789a' \ + # GITTAG='echo v3.6.0' \ + # GITBRANCH='echo 3.6'" + + make_extras = os.getenv("BUILDINSTALLER_BUILDPYTHON_MAKE_EXTRAS") + if make_extras: + make_cmd = "make " + make_extras + else: + make_cmd = "make" + print("Running " + make_cmd) + runCommand(make_cmd) print("Running make install") runCommand("make install DESTDIR=%s"%( diff --git a/Mac/BuildScript/openssl_sdk_makedepend.patch b/Mac/BuildScript/openssl_sdk_makedepend.patch index e22d67e..0caac0a 100644 --- a/Mac/BuildScript/openssl_sdk_makedepend.patch +++ b/Mac/BuildScript/openssl_sdk_makedepend.patch @@ -1,6 +1,6 @@ # HG changeset patch # -# using openssl 1.0.2j +# using openssl 1.0.2k # # - support building with an OS X SDK diff --git a/Makefile.pre.in b/Makefile.pre.in index a88b7d5..144c1f8 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -41,9 +41,9 @@ RANLIB= @RANLIB@ READELF= @READELF@ SOABI= @SOABI@ LDVERSION= @LDVERSION@ -HGVERSION= @HGVERSION@ -HGTAG= @HGTAG@ -HGBRANCH= @HGBRANCH@ +GITVERSION= @GITVERSION@ +GITTAG= @GITTAG@ +GITBRANCH= @GITBRANCH@ PGO_PROF_GEN_FLAG=@PGO_PROF_GEN_FLAG@ PGO_PROF_USE_FLAG=@PGO_PROF_USE_FLAG@ LLVM_PROF_MERGER=@LLVM_PROF_MERGER@ @@ -103,6 +103,8 @@ ARFLAGS= @ARFLAGS@ CFLAGSFORSHARED=@CFLAGSFORSHARED@ # C flags used for building the interpreter object files PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE +# Strict or non-strict aliasing flags used to compile dtoa.c, see above +CFLAGS_ALIASING=@CFLAGS_ALIASING@ # Machine-dependent subdirectories @@ -222,7 +224,7 @@ LIBOBJS= @LIBOBJS@ PYTHON= python$(EXE) BUILDPYTHON= python$(BUILDEXE) -PYTHON_FOR_GEN=@PYTHON_FOR_GEN@ +PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN@ PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@ BUILD_GNU_TYPE= @build@ @@ -269,11 +271,6 @@ IO_OBJS= \ Modules/_io/stringio.o ########################################################################## -# Grammar -GRAMMAR_H= Include/graminit.h -GRAMMAR_C= Python/graminit.c -GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar - LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ @@ -336,37 +333,8 @@ PGENSRCS= $(PSRCS) $(PGSRCS) PGENOBJS= $(POBJS) $(PGOBJS) ########################################################################## -# opcode.h generation -OPCODE_H_DIR= $(srcdir)/Include -OPCODE_H_SCRIPT= $(srcdir)/Tools/scripts/generate_opcode_h.py -OPCODE_H= $(OPCODE_H_DIR)/opcode.h -OPCODE_H_GEN= $(PYTHON_FOR_GEN) $(OPCODE_H_SCRIPT) $(srcdir)/Lib/opcode.py $(OPCODE_H) -# -########################################################################## -# AST -AST_H_DIR= Include -AST_H= $(AST_H_DIR)/Python-ast.h -AST_C_DIR= Python -AST_C= $(AST_C_DIR)/Python-ast.c -AST_ASDL= $(srcdir)/Parser/Python.asdl - -ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py -# Note that a build now requires Python to exist before the build starts. -# Use "hg touch" to fix up screwed up file mtimes in a checkout. -ASDLGEN= $(PYTHON_FOR_GEN) $(srcdir)/Parser/asdl_c.py - -########################################################################## # Python -OPCODETARGETS_H= \ - Python/opcode_targets.h - -OPCODETARGETGEN= \ - $(srcdir)/Python/makeopcodetargets.py - -OPCODETARGETGEN_FILES= \ - $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py - PYTHON_OBJS= \ Python/_warnings.o \ Python/Python-ast.o \ @@ -549,7 +517,8 @@ coverage-lcov: @echo "lcov report at $(COVERAGE_REPORT)/index.html" @echo -coverage-report: +# Force regeneration of parser and importlib +coverage-report: regen-grammar regen-importlib : # force rebuilding of parser and importlib @touch $(GRAMMAR_INPUT) @touch $(srcdir)/Lib/importlib/_bootstrap.py @@ -719,14 +688,24 @@ Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) -Python/importlib_external.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib +.PHONY: regen-importlib +regen-importlib: Programs/_freeze_importlib + # Regenerate Python/importlib_external.h + # from Lib/importlib/_bootstrap_external.py using _freeze_importlib ./Programs/_freeze_importlib \ - $(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h - -Python/importlib.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib + $(srcdir)/Lib/importlib/_bootstrap_external.py \ + $(srcdir)/Python/importlib_external.h + # Regenerate Python/importlib.h from Lib/importlib/_bootstrap.py + # using _freeze_importlib ./Programs/_freeze_importlib \ - $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h + $(srcdir)/Lib/importlib/_bootstrap.py \ + $(srcdir)/Python/importlib.h + + +############################################################################ +# Regenerate all generated files +regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar regen-ast regen-importlib ############################################################################ # Special rules for object files @@ -739,9 +718,9 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \ $(MODOBJS) \ $(srcdir)/Modules/getbuildinfo.c $(CC) -c $(PY_CORE_CFLAGS) \ - -DHGVERSION="\"`LC_ALL=C $(HGVERSION)`\"" \ - -DHGTAG="\"`LC_ALL=C $(HGTAG)`\"" \ - -DHGBRANCH="\"`LC_ALL=C $(HGBRANCH)`\"" \ + -DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \ + -DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \ + -DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \ -o $@ $(srcdir)/Modules/getbuildinfo.c Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile @@ -785,15 +764,18 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(IO_OBJS): $(IO_H) -$(GRAMMAR_H): @GENERATED_COMMENT@ $(GRAMMAR_INPUT) $(PGEN) - @$(MKDIR_P) Include - $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) -$(GRAMMAR_C): @GENERATED_COMMENT@ $(GRAMMAR_H) - touch $(GRAMMAR_C) - $(PGEN): $(PGENOBJS) $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) +.PHONY: regen-grammar +regen-grammar: $(PGEN) + # Regenerate Include/graminit.h and Python/graminit.c + # from Grammar/Grammar using pgen + @$(MKDIR_P) Include + $(PGEN) $(srcdir)/Grammar/Grammar \ + $(srcdir)/Include/graminit.h \ + $(srcdir)/Python/graminit.c + Parser/grammar.o: $(srcdir)/Parser/grammar.c \ $(srcdir)/Include/token.h \ $(srcdir)/Include/grammar.h @@ -805,18 +787,28 @@ Parser/printgrammar.o: $(srcdir)/Parser/printgrammar.c Parser/pgenmain.o: $(srcdir)/Include/parsetok.h -$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES) - $(MKDIR_P) $(AST_H_DIR) - $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL) - -$(AST_C): $(AST_H) $(AST_ASDL) $(ASDLGEN_FILES) - $(MKDIR_P) $(AST_C_DIR) - $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL) - -$(OPCODE_H): $(srcdir)/Lib/opcode.py $(OPCODE_H_SCRIPT) - $(OPCODE_H_GEN) - -Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H) +.PHONY=regen-ast +regen-ast: + # Regenerate Include/Python-ast.h using Parser/asdl_c.py -h + $(MKDIR_P) $(srcdir)/Include + $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \ + -h $(srcdir)/Include \ + $(srcdir)/Parser/Python.asdl + # Regenerate Python/Python-ast.c using Parser/asdl_c.py -c + $(MKDIR_P) $(srcdir)/Python + $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \ + -c $(srcdir)/Python \ + $(srcdir)/Parser/Python.asdl + +.PHONY: regen-opcode +regen-opcode: + # Regenerate Include/opcode.h from Lib/opcode.py + # using Tools/scripts/generate_opcode_h.py + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_opcode_h.py \ + $(srcdir)/Lib/opcode.py \ + $(srcdir)/Include/opcode.h + +Python/compile.o Python/symtable.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h Python/getplatform.o: $(srcdir)/Python/getplatform.c $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c @@ -865,16 +857,26 @@ Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c $(UNICODE_DEPS) Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h -$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES) - $(PYTHON_FOR_GEN) $(OPCODETARGETGEN) $(OPCODETARGETS_H) +.PHONY: regen-opcode-targets +regen-opcode-targets: + # Regenerate Python/opcode_targets.h from Lib/opcode.py + # using Python/makeopcodetargets.py + $(PYTHON_FOR_REGEN) $(srcdir)/Python/makeopcodetargets.py \ + $(srcdir)/Python/opcode_targets.h -Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h +Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h -Python/frozen.o: Python/importlib.h Python/importlib_external.h +Python/frozen.o: $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib_external.h Objects/typeobject.o: Objects/typeslots.inc -Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py - $(PYTHON_FOR_GEN) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h Objects/typeslots.inc + +.PHONY: regen-typeslots +regen-typeslots: + # Regenerate Objects/typeslots.inc from Include/typeslotsh + # using Objects/typeslots.py + $(PYTHON_FOR_REGEN) $(srcdir)/Objects/typeslots.py \ + < $(srcdir)/Include/typeslots.h \ + $(srcdir)/Objects/typeslots.inc ############################################################################ # Header files @@ -927,7 +929,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/node.h \ $(srcdir)/Include/object.h \ $(srcdir)/Include/objimpl.h \ - $(OPCODE_H) \ + $(srcdir)/Include/opcode.h \ $(srcdir)/Include/osdefs.h \ $(srcdir)/Include/patchlevel.h \ $(srcdir)/Include/pgen.h \ @@ -968,7 +970,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/weakrefobject.h \ pyconfig.h \ $(PARSER_HEADERS) \ - $(AST_H) + $(srcdir)/Include/Python-ast.h $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS) @@ -982,7 +984,7 @@ TESTTIMEOUT= 3600 # Run a basic set of regression tests. # This excludes some tests that are particularly resource-intensive. -test: all platform +test: @DEF_MAKE_RULE@ platform $(TESTRUNNER) $(TESTOPTS) # Run the full test suite twice - once without .pyc files, and once with. @@ -992,7 +994,7 @@ test: all platform # the bytecode read from a .pyc file had the bug, sometimes the directly # generated bytecode. This is sometimes a very shy bug needing a lot of # sample data. -testall: all platform +testall: @DEF_MAKE_RULE@ platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f $(TESTPYTHON) -E $(srcdir)/Lib/compileall.py -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f @@ -1001,7 +1003,7 @@ testall: all platform # Run the test suite for both architectures in a Universal build on OSX. # Must be run on an Intel box. -testuniversal: all platform +testuniversal: @DEF_MAKE_RULE@ platform if [ `arch` != 'i386' ];then \ echo "This can only be used on OSX/i386" ;\ exit 1 ;\ @@ -1024,7 +1026,7 @@ QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \ test_multiprocessing_forkserver \ test_mailbox test_socket test_poll \ test_select test_zipfile test_concurrent_futures -quicktest: all platform +quicktest: @DEF_MAKE_RULE@ platform $(TESTRUNNER) $(QUICKTESTOPTS) @@ -1226,7 +1228,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \ turtledemo \ multiprocessing multiprocessing/dummy \ unittest unittest/test unittest/test/testmock \ - venv venv/scripts venv/scripts/posix \ + venv venv/scripts venv/scripts/common venv/scripts/posix \ curses pydoc_data $(MACHDEPS) libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c @for i in $(SCRIPTDIR) $(LIBDEST); \ @@ -1376,7 +1378,7 @@ LIBPL= @LIBPL@ # pkgconfig directory LIBPC= $(LIBDIR)/pkgconfig -libainstall: all python-config +libainstall: @DEF_MAKE_RULE@ python-config @for i in $(LIBDIR) $(LIBPL) $(LIBPC); \ do \ if test ! -d $(DESTDIR)$$i; then \ @@ -1532,6 +1534,13 @@ config.status: $(srcdir)/configure .c.o: $(CC) -c $(PY_CORE_CFLAGS) -o $@ $< +# bpo-30104: dtoa.c uses union to cast double to unsigned long[2]. clang 4.0 +# with -O2 or higher and strict aliasing miscompiles the ratio() function +# causing rounding issues. Compile dtoa.c using -fno-strict-aliasing on clang. +# https://bugs.llvm.org//show_bug.cgi?id=31928 +Python/dtoa.o: Python/dtoa.c + $(CC) -c $(PY_CORE_CFLAGS) $(CFLAGS_ALIASING) -o $@ $< + # Run reindent on the library reindent: ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib @@ -1542,9 +1551,12 @@ recheck: $(SHELL) config.status --recheck $(SHELL) config.status -# Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in +# Regenerate configure and pyconfig.h.in +.PHONY: autoconf autoconf: + # Regenerate the configure script from configure.ac using autoconf (cd $(srcdir); autoconf -Wall) + # Regenerate pyconfig.h.in from configure.ac using autoheader (cd $(srcdir); autoheader -Wall) # Create a tags file for vi @@ -1561,14 +1573,6 @@ TAGS:: etags Include/*.h; \ for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done -# This fixes up the mtimes of checked-in generated files, assuming that they -# only *appear* to be outdated because of checkout order. -# This is run while preparing a source release tarball, and can be run manually -# to avoid bootstrap issues. -touch: - cd $(srcdir); \ - hg --config extensions.touch=Tools/hg/hgtouch.py touch -v - # Sanitation targets -- clean leaves libraries, executables and tags # files, which clobber removes as well pycremoval: @@ -1635,7 +1639,7 @@ distclean: clobber -exec rm -f {} ';' # Check for smelly exported symbols (not starting with Py/_Py) -smelly: all +smelly: @DEF_MAKE_RULE@ nm -p $(LIBRARY) | \ sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \ @@ -1673,7 +1677,7 @@ funny: -o -print # Perform some verification checks on any modified files. -patchcheck: all +patchcheck: @DEF_MAKE_RULE@ $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py # Dependencies @@ -1686,7 +1690,7 @@ Python/thread.o: @THREADHEADERS@ .PHONY: maninstall libinstall inclinstall libainstall sharedinstall .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools -.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean +.PHONY: frameworkaltinstallunixtools recheck clean clobber distclean .PHONY: smelly funny patchcheck touch altmaninstall commoninstall .PHONY: gdbhooks diff --git a/Misc/ACKS b/Misc/ACKS index 59b7704..fbf110d 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -56,6 +56,7 @@ Ankur Ankan Heidi Annexstad Ramchandra Apte Éric Araujo +Alexandru Ardelean Alicia Arlen Jeffrey Armstrong Jason Asbahr @@ -218,6 +219,7 @@ Alastair Burt Tarn Weisner Burton Lee Busby Katherine Busch +Matthias Bussonnier Ralph Butler Laurent De Buyst Zach Byrne @@ -303,6 +305,7 @@ Garrett Cooper Greg Copeland Ian Cordasco Aldo Cortesi +Mircea Cosbuc David Costanzo Scott Cotton Greg Couch @@ -340,6 +343,7 @@ A. Jesse Jiryu Davis Merlijn van Deen John DeGood Ned Deily +Jim DeLaHunt Vincent Delft Arnaud Delobelle Konrad Delong @@ -532,6 +536,7 @@ Tim Graham Kim Gräsman Nathaniel Gray Eddy De Greef +Duane Griffin Grant Griffin Andrea Griffini Duncan Grisby @@ -541,6 +546,7 @@ Eric Groo Daniel Andrade Groppe Dag Gruneau Filip Gruszczyński +Grzegorz Grzywacz Thomas Guettler Yuyang Guo Anuj Gupta @@ -606,6 +612,7 @@ Wouter van Heyst Kelsey Hightower Jason Hildebrand Aaron Hill +Joel Hillacre Richie Hindle Konrad Hinsen David Hobley @@ -757,11 +764,13 @@ Lawrence Kesteloot Vivek Khera Dhiru Kholia Akshit Khurana +Sanyam Khurana Mads Kiilerich Jason Killen Jan Kim Taek Joo Kim Sam Kimbrel +Tomohiko Kinebuchi James King W. Trevor King Paul Kippes @@ -1048,11 +1057,13 @@ Vilmos Nebehaj Fredrik Nehr Tony Nelson Trent Nelson +Osvaldo Santana Neto Chad Netzer Max Neunhöffer Anthon van der Neut George Neville-Neil Hieu Nguyen +Nam Nguyen Johannes Nicolai Samuel Nicolary Jonathan Niehof @@ -1084,6 +1095,7 @@ Milan Oberkirch Pascal Oberndoerfer Jeffrey Ollie Adam Olsen +Bryan Olson Grant Olson Koray Oner Piet van Oostrum @@ -1092,7 +1104,9 @@ Jason Orendorff Douglas Orr William Orr Michele Orrù +Tomáš Orsava Oleg Oshmyan +Denis Osipov Denis S. Otkidach Peter Otten Michael Otteneder @@ -1346,6 +1360,7 @@ Federico Schwindt Barry Scott Steven Scott Nick Seidenman +Michael Seifert Žiga Seilnacht Yury Selivanov Fred Sells @@ -1676,6 +1691,7 @@ Artur Zaprzala Mike Zarnstorff Yury V. Zaytsev Siebren van der Zee +Christophe Zeitouny Nickolai Zeldovich Yuxiao Zeng Uwe Zessin diff --git a/Misc/HISTORY b/Misc/HISTORY index 9655d4c..38f3db5 100644 --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -3285,7 +3285,7 @@ Library - Issue #11382: Trivial system calls, such as dup() or pipe(), needn't release the GIL. Patch by Charles-François Natali. -- Issue #11223: Add threading._info() function providing informations about +- Issue #11223: Add threading._info() function providing information about the thread implementation. - Issue #11731: simplify/enhance email parser/generator API by introducing diff --git a/Misc/NEWS b/Misc/NEWS index 41cfdba..0643937 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,430 +2,857 @@ Python News +++++++++++ -What's New in Python 3.5.3? -=========================== +What's New in Python 3.5.4 final? +================================= + +*Release date: 2017-08-07* + +Library +------- + +- bpo-30119: ftplib.FTP.putline() now throws ValueError on commands that + contains CR or LF. Patch by Dong-hee Na. + + +What's New in Python 3.5.4 release candidate 1? +=============================================== + +*Release date: 2017-07-23* + +Security +-------- + +- bpo-30730: Prevent environment variables injection in subprocess on + Windows. Prevent passing other environment variables and command + arguments. + +- bpo-30694: Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes of multiple + security vulnerabilities including: CVE-2017-9233 (External entity + infinite loop DoS), CVE-2016-9063 (Integer overflow, re-fix), + CVE-2016-0718 (Fix regression bugs from 2.2.0's fix to CVE-2016-0718) and + CVE-2012-0876 (Counter hash flooding with SipHash). Note: the + CVE-2016-5300 (Use os- specific entropy sources like getrandom) doesn't + impact Python, since Python already gets entropy from the OS to set the + expat secret using ``XML_SetHashSalt()``. + +- bpo-30500: Fix urllib.parse.splithost() to correctly parse fragments. For + example, ``splithost('//127.0.0.1#@evil.com/')`` now correctly returns the + ``127.0.0.1`` host, instead of treating ``@evil.com`` as the host in an + authentification (``login@host``). + +- bpo-29591: Update expat copy from 2.1.1 to 2.2.0 to get fixes of + CVE-2016-0718 and CVE-2016-4472. See + https://sourceforge.net/p/expat/bugs/537/ for more information. + +Core and Builtins +----------------- + +- bpo-30876: Relative import from unloaded package now reimports the package + instead of failing with SystemError. Relative import from non-package now + fails with ImportError rather than SystemError. + +- bpo-30765: Avoid blocking in pthread_mutex_lock() when + PyThread_acquire_lock() is asked not to block. + +- bpo-27945: Fixed various segfaults with dict when input collections are + mutated during searching, inserting or comparing. Based on patches by + Duane Griffin and Tim Mitchell. + +- bpo-25794: Fixed type.__setattr__() and type.__delattr__() for non- + interned attribute names. Based on patch by Eryk Sun. + +- bpo-29935: Fixed error messages in the index() method of tuple, list and + deque when pass indices of wrong type. + +- bpo-28876: ``bool(range)`` works even if ``len(range)`` raises + :exc:`OverflowError`. + +- bpo-29600: Fix wrapping coroutine return values in StopIteration. + +- bpo-29537: Restore runtime compatibility with bytecode files generated by + CPython 3.5.0 to 3.5.2, and adjust the eval loop to avoid the problems + that could be caused by the malformed variant of the + BUILD_MAP_UNPACK_WITH_CALL opcode that they may contain. Patch by Petr + Viktorin, Serhiy Storchaka, and Nick Coghlan. + +- bpo-28598: Support __rmod__ for subclasses of str being called before + str.__mod__. Patch by Martijn Pieters. + +- bpo-29602: Fix incorrect handling of signed zeros in complex constructor + for complex subclasses and for inputs having a __complex__ method. Patch + by Serhiy Storchaka. + +- bpo-29347: Fixed possibly dereferencing undefined pointers when creating + weakref objects. + +- bpo-29438: Fixed use-after-free problem in key sharing dict. + +- bpo-29319: Prevent RunMainFromImporter overwriting sys.path[0]. + +- bpo-29337: Fixed possible BytesWarning when compare the code objects. + Warnings could be emitted at compile time. + +- bpo-29478: If max_line_length=None is specified while using the Compat32 + policy, it is no longer ignored. Patch by Mircea Cosbuc. + +Library +------- + +- bpo-29403: Fix ``unittest.mock``'s autospec to not fail on method-bound + builtin functions. Patch by Aaron Gallagher. + +- bpo-30961: Fix decrementing a borrowed reference in tracemalloc. + +- bpo-30886: Fix multiprocessing.Queue.join_thread(): it now waits until the + thread completes, even if the thread was started by the same process which + created the queue. + +- bpo-29854: Fix segfault in readline when using readline's history-size + option. Patch by Nir Soffer. + +- bpo-30807: signal.setitimer() may disable the timer when passed a tiny + value. + + Tiny values (such as 1e-6) are valid non-zero values for setitimer(), + which is specified as taking microsecond-resolution intervals. However, on + some platform, our conversion routine could convert 1e-6 into a zero + interval, therefore disabling the timer instead of (re-)scheduling it. + +- bpo-30441: Fix bug when modifying os.environ while iterating over it + +- bpo-30532: Fix email header value parser dropping folding white space in + certain cases. + +- bpo-29169: Update zlib to 1.2.11. + +- bpo-30879: os.listdir() and os.scandir() now emit bytes names when called + with bytes- like argument. + +- bpo-30746: Prohibited the '=' character in environment variable names in + ``os.putenv()`` and ``os.spawn*()``. + +- bpo-29755: Fixed the lgettext() family of functions in the gettext module. + They now always return bytes. + +- bpo-30645: Fix path calculation in imp.load_package(), fixing it for cases + when a package is only shipped with bytecodes. Patch by Alexandru + Ardelean. + +- bpo-23890: unittest.TestCase.assertRaises() now manually breaks a + reference cycle to not keep objects alive longer than expected. + +- bpo-30149: inspect.signature() now supports callables with variable- + argument parameters wrapped with partialmethod. Patch by Dong-hee Na. + +- bpo-29931: Fixed comparison check for ipaddress.ip_interface objects. + Patch by Sanjay Sundaresan. + +- bpo-24484: Avoid race condition in multiprocessing cleanup. + +- bpo-28994: The traceback no longer displayed for SystemExit raised in a + callback registered by atexit. + +- bpo-30508: Don't log exceptions if Task/Future "cancel()" method was + called. + +- bpo-28556: Updates to typing module: Add generic AsyncContextManager, add + support for ContextManager on all versions. Original PRs by Jelle Zijlstra + and Ivan Levkivskyi + +- bpo-29870: Fix ssl sockets leaks when connection is aborted in asyncio/ssl + implementation. Patch by Michaël Sghaïer. + +- bpo-29743: Closing transport during handshake process leaks open socket. + Patch by Nikolay Kim + +- bpo-27585: Fix waiter cancellation in asyncio.Lock. Patch by Mathieu + Sornay. + +- bpo-30418: On Windows, subprocess.Popen.communicate() now also ignore + EINVAL on stdin.write() if the child process is still running but closed + the pipe. + +- bpo-30378: Fix the problem that logging.handlers.SysLogHandler cannot + handle IPv6 addresses. + +- bpo-29960: Preserve generator state when _random.Random.setstate() raises + an exception. Patch by Bryan Olson. + +- bpo-30414: multiprocessing.Queue._feed background running thread do not + break from main loop on exception. + +- bpo-30003: Fix handling escape characters in HZ codec. Based on patch by + Ma Lin. + +- bpo-30301: Fix AttributeError when using SimpleQueue.empty() under *spawn* + and *forkserver* start methods. + +- bpo-30329: imaplib and poplib now catch the Windows socket WSAEINVAL error + (code 10022) on shutdown(SHUT_RDWR): An invalid operation was attempted. + This error occurs sometimes on SSL connections. + +- bpo-30375: Warnings emitted when compile a regular expression now always + point to the line in the user code. Previously they could point into + inners of the re module if emitted from inside of groups or conditionals. + +- bpo-30048: Fixed ``Task.cancel()`` can be ignored when the task is running + coroutine and the coroutine returned without any more ``await``. + +- bpo-29990: Fix range checking in GB18030 decoder. Original patch by Ma + Lin. + +- bpo-26293: Change resulted because of zipfile breakage. (See also: + bpo-29094) + +- bpo-30243: Removed the __init__ methods of _json's scanner and encoder. + Misusing them could cause memory leaks or crashes. Now scanner and + encoder objects are completely initialized in the __new__ methods. + +- bpo-30185: Avoid KeyboardInterrupt tracebacks in forkserver helper process + when Ctrl-C is received. + +- bpo-28556: Various updates to typing module: add typing.NoReturn type, use + WrapperDescriptorType, minor bug-fixes. Original PRs by Jim Fasarakis- + Hilliard and Ivan Levkivskyi. + +- bpo-30205: Fix getsockname() for unbound AF_UNIX sockets on Linux. + +- bpo-30070: Fixed leaks and crashes in errors handling in the parser + module. + +- bpo-30061: Fixed crashes in IOBase methods __next__() and readlines() when + readline() or __next__() respectively return non-sizeable object. Fixed + possible other errors caused by not checking results of PyObject_Size(), + PySequence_Size(), or PyMapping_Size(). + +- bpo-30068: _io._IOBase.readlines will check if it's closed first when hint + is present. -Release date: 2017-01-16 +- bpo-29694: Fixed race condition in pathlib mkdir with flags parents=True. + Patch by Armin Rigo. + +- bpo-29692: Fixed arbitrary unchaining of RuntimeError exceptions in + contextlib.contextmanager. Patch by Siddharth Velankar. + +- bpo-29998: Pickling and copying ImportError now preserves name and path + attributes. + +- bpo-29942: Fix a crash in itertools.chain.from_iterable when encountering + long runs of empty iterables. + +- bpo-27863: Fixed multiple crashes in ElementTree caused by race conditions + and wrong types. + +- bpo-28699: Fixed a bug in pools in multiprocessing.pool that raising an + exception at the very first of an iterable may swallow the exception or + make the program hang. Patch by Davin Potts and Xiang Zhang. + +- bpo-25803: Avoid incorrect errors raised by Path.mkdir(exist_ok=True) when + the OS gives priority to errors such as EACCES over EEXIST. + +- bpo-29861: Release references to tasks, their arguments and their results + as soon as they are finished in multiprocessing.Pool. + +- bpo-29884: faulthandler: Restore the old sigaltstack during teardown. + Patch by Christophe Zeitouny. + +- bpo-25455: Fixed crashes in repr of recursive buffered file-like objects. + +- bpo-29800: Fix crashes in partial.__repr__ if the keys of partial.keywords + are not strings. Patch by Michael Seifert. + +- bpo-29742: get_extra_info() raises exception if get called on closed ssl + transport. Patch by Nikolay Kim. + +- bpo-8256: Fixed possible failing or crashing input() if attributes + "encoding" or "errors" of sys.stdin or sys.stdout are not set or are not + strings. + +- bpo-28298: Fix a bug that prevented array 'Q', 'L' and 'I' from accepting + big intables (objects that have __int__) as elements. Patch by Oren + Milman. + +- bpo-29615: SimpleXMLRPCDispatcher no longer chains KeyError (or any other + exception) to exception(s) raised in the dispatched methods. Patch by Petr + Motejlek. + +- bpo-29704: asyncio.subprocess.SubprocessStreamProtocol no longer closes + before all pipes are closed. + +- bpo-29703: Fix asyncio to support instantiation of new event loops in + child processes. + +- bpo-29376: Fix assertion error in threading._DummyThread.is_alive(). + +- bpo-29110: Fix file object leak in aifc.open() when file is given as a + filesystem path and is not in valid AIFF format. Patch by Anthony Zhang. + +- bpo-28961: Fix unittest.mock._Call helper: don't ignore the name parameter + anymore. Patch written by Jiajun Huang. + +- bpo-29532: Altering a kwarg dictionary passed to functools.partial() no + longer affects a partial object after creation. + +- bpo-28556: Various updates to typing module: typing.Counter, + typing.ChainMap, improved ABC caching, etc. Original PRs by Jelle + Zijlstra, Ivan Levkivskyi, Manuel Krebber, and Łukasz Langa. + +- bpo-29100: Fix datetime.fromtimestamp() regression introduced in Python + 3.6.0: check minimum and maximum years. + +- bpo-29519: Fix weakref spewing exceptions during interpreter shutdown when + used with a rare combination of multiprocessing and custom codecs. + +- bpo-29416: Prevent infinite loop in pathlib.Path.mkdir + +- bpo-29444: Fixed out-of-bounds buffer access in the group() method of the + match object. Based on patch by WGH. + +- bpo-29335: Fix subprocess.Popen.wait() when the child process has exited + to a stopped instead of terminated state (ex: when under ptrace). + +- bpo-29290: Fix a regression in argparse that help messages would wrap at + non-breaking spaces. + +- bpo-28735: Fixed the comparison of mock.MagickMock with mock.ANY. + +- bpo-29011: Fix an important omission by adding Deque to the typing module. + +- bpo-29219: Fixed infinite recursion in the repr of uninitialized + ctypes.CDLL instances. + +- bpo-28969: Fixed race condition in C implementation of + functools.lru_cache. KeyError could be raised when cached function with + full cache was simultaneously called from differen threads with the same + uncached arguments. + +- bpo-29142: In urllib.request, suffixes in no_proxy environment variable + with leading dots could match related hostnames again (e.g. .b.c matches + a.b.c). Patch by Milan Oberkirch. + +Documentation +------------- + +- bpo-30176: Add missing attribute related constants in curses + documentation. + +- bpo-26985: Add missing info of code object in inspect documentation. + +- bpo-28929: Link the documentation to its source file on GitHub. + +- bpo-25008: Document smtpd.py as effectively deprecated and add a pointer + to aiosmtpd, a third-party asyncio-based replacement. + +- bpo-26355: Add canonical header link on each page to corresponding major + version of the documentation. Patch by Matthias Bussonnier. + +- bpo-29349: Fix Python 2 syntax in code for building the documentation. + +Tests +----- + +- bpo-30822: Fix regrtest command line parser to allow passing -u + extralargefile to run test_zipfile64. + +- bpo-30383: regrtest: Enhance regrtest and backport features from the + master branch. + + Add options: --coverage, --testdir, --list-tests (list test files, don't + run them), --list-cases (list test identifiers, don't run them, + :issue:`30523`), --matchfile (load a list of test filters from a text + file, :issue:`30540`), --slowest (alias to --slow). + + Enhance output: add timestamp, test result, currently running tests, + "Tests result: xxx" summary with total duration, etc. + + Fix reference leak hunting in regrtest, --huntrleaks: regrtest now warms + up caches, create explicitly all internal singletons which are created on + demand to prevent false positives when checking for reference leaks. + (:issue:`30675`). + +- bpo-30357: test_thread: setUp() now uses support.threading_setup() and + support.threading_cleanup() to wait until threads complete to avoid random + side effects on following tests. Initial patch written by Grzegorz + Grzywacz. + +- bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS. Skip + some tests of select.poll when running on macOS due to unresolved issues + with the underlying system poll function on some macOS versions. + +- bpo-30197: Enhanced functions swap_attr() and swap_item() in the + test.support module. They now work when delete replaced attribute or item + inside the with statement. The old value of the attribute or item (or + None if it doesn't exist) now will be assigned to the target of the "as" + clause, if there is one. + +- bpo-29571: to match the behaviour of the ``re.LOCALE`` flag, + test_re.test_locale_flag now uses ``locale.getpreferredencoding(False)`` + to determine the candidate encoding for the test regex (allowing it to + correctly skip the test when the default locale encoding is a multi-byte + encoding) + +Build +----- + +- bpo-29243: Prevent unnecessary rebuilding of Python during ``make test``, + ``make install`` and some other make targets when configured with + ``--enable- optimizations``. + +- bpo-23404: Don't regenerate generated files based on file modification + time anymore: the action is now explicit. Replace ``make touch`` with + ``make regen-all``. + +- bpo-29643: Fix ``--enable-optimization`` didn't work. + +Windows +------- + +- bpo-30687: Locate msbuild.exe on Windows when building rather than + vcvarsall.bat + +- bpo-29392: Prevent crash when passing invalid arguments into msvcrt + module. + +C API +----- + +- bpo-27867: Function PySlice_GetIndicesEx() is replaced with a macro if + Py_LIMITED_API is set to the value between 0x03050400 and 0x03060000 (not + including) or 0x03060100 or higher. + +- bpo-29083: Fixed the declaration of some public API functions. + PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not available in + limited API. PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and + Py_BuildValue() were not available in limited API of version < 3.3 when + PY_SSIZE_T_CLEAN is defined. + + +What's New in Python 3.5.3 final? +================================= + +*Release date: 2017-01-17* There were no code changes between 3.5.3rc1 and 3.5.3 final. + What's New in Python 3.5.3 release candidate 1? =============================================== -Release date: 2017-01-02 +*Release date: 2017-01-02* Core and Builtins ----------------- -- Issue #29073: bytearray formatting no longer truncates on first null byte. +- bpo-29073: bytearray formatting no longer truncates on first null byte. -- Issue #28932: Do not include if it does not exist. +- bpo-28932: Do not include if it does not exist. -- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() - must not convert combined table into split table. +- bpo-28147: Fix a memory leak in split-table dictionaries: setattr() must + not convert combined table into split table. -- Issue #25677: Correct the positioning of the syntax error caret for - indented blocks. Based on patch by Michael Layzell. +- bpo-25677: Correct the positioning of the syntax error caret for indented + blocks. Based on patch by Michael Layzell. -- Issue #29000: Fixed bytes formatting of octals with zero padding in alternate +- bpo-29000: Fixed bytes formatting of octals with zero padding in alternate form. -- Issue #28512: Fixed setting the offset attribute of SyntaxError by +- bpo-28512: Fixed setting the offset attribute of SyntaxError by PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). -- Issue #28991: functools.lru_cache() was susceptible to an obscure reentrancy +- bpo-28991: functools.lru_cache() was susceptible to an obscure reentrancy bug caused by a monkey-patched len() function. -- Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X +- bpo-28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode astral characters. Patch by Xiang Zhang. -- Issue #19398: Extra slash no longer added to sys.path components in case of - empty compile-time PYTHONPATH components. +- bpo-19398: Extra slash no longer added to sys.path components in case of + empty compile- time PYTHONPATH components. -- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug +- bpo-28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. -- Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exception +- bpo-23782: Fixed possible memory leak in _PyTraceback_Add() and exception loss in PyTraceBack_Here(). -- Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters(). +- bpo-28379: Added sanity checks and tests for PyUnicode_CopyCharacters(). Patch by Xiang Zhang. -- Issue #28376: The type of long range iterator is now registered as Iterator. +- bpo-28376: The type of long range iterator is now registered as Iterator. Patch by Oren Milman. -- Issue #28376: The constructor of range_iterator now checks that step is not 0. - Patch by Oren Milman. +- bpo-28376: The constructor of range_iterator now checks that step is not + 0. Patch by Oren Milman. -- Issue #26906: Resolving special methods of uninitialized type now causes +- bpo-26906: Resolving special methods of uninitialized type now causes implicit initialization of the type instead of a fail. -- Issue #18287: PyType_Ready() now checks that tp_name is not NULL. - Original patch by Niklas Koep. +- bpo-18287: PyType_Ready() now checks that tp_name is not NULL. Original + patch by Niklas Koep. -- Issue #24098: Fixed possible crash when AST is changed in process of +- bpo-24098: Fixed possible crash when AST is changed in process of compiling it. -- Issue #28350: String constants with null character no longer interned. +- bpo-28350: String constants with null character no longer interned. -- Issue #26617: Fix crash when GC runs during weakref callbacks. +- bpo-26617: Fix crash when GC runs during weakref callbacks. -- Issue #27942: String constants now interned recursively in tuples and frozensets. +- bpo-27942: String constants now interned recursively in tuples and + frozensets. -- Issue #21578: Fixed misleading error message when ImportError called with +- bpo-21578: Fixed misleading error message when ImportError called with invalid keyword args. -- Issue #28203: Fix incorrect type in error message from - ``complex(1.0, {2:3})``. Patch by Soumya Sharma. +- bpo-28203: Fix incorrect type in error message from ``complex(1.0, + {2:3})``. Patch by Soumya Sharma. -- Issue #27955: Fallback on reading /dev/urandom device when the getrandom() +- bpo-27955: Fallback on reading /dev/urandom device when the getrandom() syscall fails with EPERM, for example when blocked by SECCOMP. -- Issue #28131: Fix a regression in zipimport's compile_source(). zipimport +- bpo-28131: Fix a regression in zipimport's compile_source(). zipimport should use the same optimization level as the interpreter. -- Issue #25221: Fix corrupted result from PyLong_FromLong(0) when - Python is compiled with NSMALLPOSINTS = 0. +- bpo-25221: Fix corrupted result from PyLong_FromLong(0) when Python is + compiled with NSMALLPOSINTS = 0. -- Issue #25758: Prevents zipimport from unnecessarily encoding a filename +- bpo-25758: Prevents zipimport from unnecessarily encoding a filename (patch by Eryk Sun) -- Issue #28189: dictitems_contains no longer swallows compare errors. - (Patch by Xiang Zhang) +- bpo-28189: dictitems_contains no longer swallows compare errors. (Patch by + Xiang Zhang) -- Issue #27812: Properly clear out a generator's frame's backreference to the +- bpo-27812: Properly clear out a generator's frame's backreference to the generator to prevent crashes in frame.clear(). -- Issue #27811: Fix a crash when a coroutine that has not been awaited is +- bpo-27811: Fix a crash when a coroutine that has not been awaited is finalized with warnings-as-errors enabled. -- Issue #27587: Fix another issue found by PVS-Studio: Null pointer check - after use of 'def' in _PyState_AddModule(). - Initial patch by Christian Heimes. +- bpo-27587: Fix another issue found by PVS-Studio: Null pointer check after + use of 'def' in _PyState_AddModule(). Initial patch by Christian Heimes. -- Issue #26020: set literal evaluation order did not match documented behaviour. +- bpo-26020: set literal evaluation order did not match documented + behaviour. -- Issue #27782: Multi-phase extension module import now correctly allows the +- bpo-27782: Multi-phase extension module import now correctly allows the ``m_methods`` field to be used to add module level functions to instances of non-module types returned from ``Py_create_mod``. Patch by Xiang Zhang. -- Issue #27936: The round() function accepted a second None argument - for some types but not for others. Fixed the inconsistency by - accepting None for all numeric types. +- bpo-27936: The round() function accepted a second None argument for some + types but not for others. Fixed the inconsistency by accepting None for + all numeric types. -- Issue #27487: Warn if a submodule argument to "python -m" or +- bpo-27487: Warn if a submodule argument to "python -m" or runpy.run_module() is found in sys.modules after parent packages are imported, but before the submodule is executed. -- Issue #27558: Fix a SystemError in the implementation of "raise" statement. +- bpo-27558: Fix a SystemError in the implementation of "raise" statement. In a brand new thread, raise a RuntimeError since there is no active exception to reraise. Patch written by Xiang Zhang. -- Issue #27419: Standard __import__() no longer look up "__import__" in globals +- bpo-27419: Standard __import__() no longer look up "__import__" in globals or builtins for importing submodules or "from import". Fixed handling an - error of non-string package name. + error of non- string package name. -- Issue #27083: Respect the PYTHONCASEOK environment variable under Windows. +- bpo-27083: Respect the PYTHONCASEOK environment variable under Windows. -- Issue #27514: Make having too many statically nested blocks a SyntaxError +- bpo-27514: Make having too many statically nested blocks a SyntaxError instead of SystemError. -- Issue #27473: Fixed possible integer overflow in bytes and bytearray - concatenations. Patch by Xiang Zhang. +- bpo-27473: Fixed possible integer overflow in bytes and bytearray + concatenations. Patch by Xiang Zhang. -- Issue #27507: Add integer overflow check in bytearray.extend(). Patch by +- bpo-27507: Add integer overflow check in bytearray.extend(). Patch by Xiang Zhang. -- Issue #27581: Don't rely on wrapping for overflow check in +- bpo-27581: Don't rely on wrapping for overflow check in PySequence_Tuple(). Patch by Xiang Zhang. -- Issue #27443: __length_hint__() of bytearray iterators no longer return a +- bpo-27443: __length_hint__() of bytearray iterators no longer return a negative integer for a resized bytearray. -- Issue #27942: Fix memory leak in codeobject.c +- bpo-27942: Fix memory leak in codeobject.c Library ------- -- Issue #15812: inspect.getframeinfo() now correctly shows the first line of - a context. Patch by Sam Breese. +- bpo-15812: inspect.getframeinfo() now correctly shows the first line of a + context. Patch by Sam Breese. -- Issue #29094: Offsets in a ZIP file created with extern file object and modes +- bpo-29094: Offsets in a ZIP file created with extern file object and modes "w" and "x" now are relative to the start of the file. -- Issue #13051: Fixed recursion errors in large or resized +- bpo-13051: Fixed recursion errors in large or resized curses.textpad.Textbox. Based on patch by Tycho Andersen. -- Issue #29119: Fix weakrefs in the pure python version of - collections.OrderedDict move_to_end() method. - Contributed by Andra Bogildea. +- bpo-29119: Fix weakrefs in the pure python version of + collections.OrderedDict move_to_end() method. Contributed by Andra + Bogildea. -- Issue #9770: curses.ascii predicates now work correctly with negative +- bpo-9770: curses.ascii predicates now work correctly with negative integers. -- Issue #28427: old keys should not remove new values from - WeakValueDictionary when collecting from another thread. +- bpo-28427: old keys should not remove new values from WeakValueDictionary + when collecting from another thread. -- Issue 28923: Remove editor artifacts from Tix.py. +- bpo-28923: Remove editor artifacts from Tix.py. -- Issue #28871: Fixed a crash when deallocate deep ElementTree. +- bpo-28871: Fixed a crash when deallocate deep ElementTree. -- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and - WeakValueDictionary.pop() when a GC collection happens in another - thread. +- bpo-19542: Fix bugs in WeakValueDictionary.setdefault() and + WeakValueDictionary.pop() when a GC collection happens in another thread. -- Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that +- bpo-20191: Fixed a crash in resource.prlimit() when pass a sequence that doesn't own its elements as limits. -- Issue #28779: multiprocessing.set_forkserver_preload() would crash the - forkserver process if a preloaded module instantiated some - multiprocessing objects such as locks. +- bpo-28779: multiprocessing.set_forkserver_preload() would crash the + forkserver process if a preloaded module instantiated some multiprocessing + objects such as locks. -- Issue #28847: dbm.dumb now supports reading read-only files and no longer +- bpo-28847: dbm.dumb now supports reading read-only files and no longer writes the index file when it is not changed. -- Issue #25659: In ctypes, prevent a crash calling the from_buffer() and +- bpo-25659: In ctypes, prevent a crash calling the from_buffer() and from_buffer_copy() methods on abstract classes like Array. -- Issue #28732: Fix crash in os.spawnv() with no elements in args +- bpo-28732: Fix crash in os.spawnv() with no elements in args -- Issue #28485: Always raise ValueError for negative +- bpo-28485: Always raise ValueError for negative compileall.compile_dir(workers=...) parameter, even when multithreading is unavailable. -- Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when - the garbage collector is invoked in other thread. Based on patch by - Sebastian Cufre. +- bpo-28387: Fixed possible crash in _io.TextIOWrapper deallocator when the + garbage collector is invoked in other thread. Based on patch by Sebastian + Cufre. -- Issue #27517: LZMA compressor and decompressor no longer raise exceptions if +- bpo-27517: LZMA compressor and decompressor no longer raise exceptions if given empty data twice. Patch by Benjamin Fogle. -- Issue #28549: Fixed segfault in curses's addch() with ncurses6. +- bpo-28549: Fixed segfault in curses's addch() with ncurses6. -- Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar - file with compression before trying to open it without compression. Otherwise - it had 50% chance failed with ignore_zeros=True. +- bpo-28449: tarfile.open() with mode "r" or "r:" now tries to open a tar + file with compression before trying to open it without compression. + Otherwise it had 50% chance failed with ignore_zeros=True. -- Issue #23262: The webbrowser module now supports Firefox 36+ and derived +- bpo-23262: The webbrowser module now supports Firefox 36+ and derived browsers. Based on patch by Oleg Broytman. -- Issue #27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused +- bpo-27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused by representing the scale as float value internally in Tk. tkinter.IntVar now works if float value is set to underlying Tk variable. -- Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space - at the start of new line after printing a month's calendar. Patch by - Xiang Zhang. +- bpo-28255: calendar.TextCalendar().prmonth() no longer prints a space at + the start of new line after printing a month's calendar. Patch by Xiang + Zhang. -- Issue #20491: The textwrap.TextWrapper class now honors non-breaking spaces. +- bpo-20491: The textwrap.TextWrapper class now honors non-breaking spaces. Based on patch by Kaarle Ritvanen. -- Issue #28353: os.fwalk() no longer fails on broken links. +- bpo-28353: os.fwalk() no longer fails on broken links. -- Issue #25464: Fixed HList.header_exists() in tkinter.tix module by addin - a workaround to Tix library bug. +- bpo-25464: Fixed HList.header_exists() in tkinter.tix module by addin a + workaround to Tix library bug. -- Issue #28488: shutil.make_archive() no longer add entry "./" to ZIP archive. +- bpo-28488: shutil.make_archive() no longer add entry "./" to ZIP archive. -- Issue #24452: Make webbrowser support Chrome on Mac OS X. +- bpo-24452: Make webbrowser support Chrome on Mac OS X. -- Issue #20766: Fix references leaked by pdb in the handling of SIGINT +- bpo-20766: Fix references leaked by pdb in the handling of SIGINT handlers. -- Issue #26293: Fixed writing ZIP files that starts not from the start of the +- bpo-26293: Fixed writing ZIP files that starts not from the start of the file. Offsets in ZIP file now are relative to the start of the archive in conforming to the specification. -- Issue #28321: Fixed writing non-BMP characters with binary format in plistlib. +- bpo-28321: Fixed writing non-BMP characters with binary format in + plistlib. -- Issue #28322: Fixed possible crashes when unpickle itertools objects from +- bpo-28322: Fixed possible crashes when unpickle itertools objects from incorrect pickle data. Based on patch by John Leitch. - Fix possible integer overflows and crashes in the mmap module with unusual usage patterns. -- Issue #1703178: Fix the ability to pass the --link-objects option to the +- bpo-1703178: Fix the ability to pass the --link-objects option to the distutils build_ext command. -- Issue #28253: Fixed calendar functions for extreme months: 0001-01 - and 9999-12. +- bpo-28253: Fixed calendar functions for extreme months: 0001-01 and + 9999-12. - Methods itermonthdays() and itermonthdays2() are reimplemented so - that they don't call itermonthdates() which can cause datetime.date + Methods itermonthdays() and itermonthdays2() are reimplemented so that + they don't call itermonthdates() which can cause datetime.date under/overflow. -- Issue #28275: Fixed possible use after free in the decompress() - methods of the LZMADecompressor and BZ2Decompressor classes. - Original patch by John Leitch. +- bpo-28275: Fixed possible use after free in the decompress() methods of + the LZMADecompressor and BZ2Decompressor classes. Original patch by John + Leitch. -- Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation() +- bpo-27897: Fixed possible crash in sqlite3.Connection.create_collation() if pass invalid string-like object as a name. Patch by Xiang Zhang. -- Issue #18893: Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. +- bpo-18893: Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. Patch by Madison May. -- Issue #27611: Fixed support of default root window in the tkinter.tix module. +- bpo-27611: Fixed support of default root window in the tkinter.tix module. -- Issue #27348: In the traceback module, restore the formatting of exception +- bpo-27348: In the traceback module, restore the formatting of exception messages like "Exception: None". This fixes a regression introduced in 3.5a2. -- Issue #25651: Allow falsy values to be used for msg parameter of subTest(). +- bpo-25651: Allow falsy values to be used for msg parameter of subTest(). -- Issue #27932: Prevent memory leak in win32_ver(). +- bpo-27932: Prevent memory leak in win32_ver(). - Fix UnboundLocalError in socket._sendfile_use_sendfile. -- Issue #28075: Check for ERROR_ACCESS_DENIED in Windows implementation of +- bpo-28075: Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat(). Patch by Eryk Sun. -- Issue #25270: Prevent codecs.escape_encode() from raising SystemError when - an empty bytestring is passed. +- bpo-25270: Prevent codecs.escape_encode() from raising SystemError when an + empty bytestring is passed. -- Issue #28181: Get antigravity over HTTPS. Patch by Kaartic Sivaraam. +- bpo-28181: Get antigravity over HTTPS. Patch by Kaartic Sivaraam. -- Issue #25895: Enable WebSocket URL schemes in urllib.parse.urljoin. - Patch by Gergely Imreh and Markus Holtermann. +- bpo-25895: Enable WebSocket URL schemes in urllib.parse.urljoin. Patch by + Gergely Imreh and Markus Holtermann. -- Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). +- bpo-27599: Fixed buffer overrun in binascii.b2a_qp() and + binascii.a2b_qp(). -- Issue #19003:m email.generator now replaces only \r and/or \n line +- bpo-19003: m email.generator now replaces only ``\r`` and/or ``\n`` line endings, per the RFC, instead of all unicode line endings. -- Issue #28019: itertools.count() no longer rounds non-integer step in range +- bpo-28019: itertools.count() no longer rounds non-integer step in range between 1.0 and 2.0 to 1. -- Issue #25969: Update the lib2to3 grammar to handle the unpacking +- bpo-25969: Update the lib2to3 grammar to handle the unpacking generalizations added in 3.5. -- Issue #14977: mailcap now respects the order of the lines in the mailcap +- bpo-14977: mailcap now respects the order of the lines in the mailcap files ("first match"), as required by RFC 1542. Patch by Michael Lazar. -- Issue #24594: Validates persist parameter when opening MSI database +- bpo-24594: Validates persist parameter when opening MSI database -- Issue #17582: xml.etree.ElementTree nows preserves whitespaces in attributes +- bpo-17582: xml.etree.ElementTree nows preserves whitespaces in attributes (Patch by Duane Griffin. Reviewed and approved by Stefan Behnel.) -- Issue #28047: Fixed calculation of line length used for the base64 CTE - in the new email policies. +- bpo-28047: Fixed calculation of line length used for the base64 CTE in the + new email policies. -- Issue #27445: Don't pass str(_charset) to MIMEText.set_payload(). - Patch by Claude Paroz. +- bpo-27445: Don't pass str(_charset) to MIMEText.set_payload(). Patch by + Claude Paroz. -- Issue #22450: urllib now includes an "Accept: */*" header among the - default headers. This makes the results of REST API requests more - consistent and predictable especially when proxy servers are involved. +- bpo-22450: urllib now includes an ``Accept: */*`` header among the default + headers. This makes the results of REST API requests more consistent and + predictable especially when proxy servers are involved. - lib2to3.pgen3.driver.load_grammar() now creates a stable cache file between runs given the same Grammar.txt input regardless of the hash randomization setting. -- Issue #27570: Avoid zero-length memcpy() etc calls with null source - pointers in the "ctypes" and "array" modules. +- bpo-27570: Avoid zero-length memcpy() etc calls with null source pointers + in the "ctypes" and "array" modules. -- Issue #22233: Break email header lines *only* on the RFC specified CR and LF - characters, not on arbitrary unicode line breaks. This also fixes a bug in - HTTP header parsing. +- bpo-22233: Break email header lines *only* on the RFC specified CR and LF + characters, not on arbitrary unicode line breaks. This also fixes a bug + in HTTP header parsing. -- Issue 27988: Fix email iter_attachments incorrect mutation of payload list. +- bpo-27988: Fix email iter_attachments incorrect mutation of payload list. -- Issue #27691: Fix ssl module's parsing of GEN_RID subject alternative name +- bpo-27691: Fix ssl module's parsing of GEN_RID subject alternative name fields in X.509 certs. -- Issue #27850: Remove 3DES from ssl module's default cipher list to counter +- bpo-27850: Remove 3DES from ssl module's default cipher list to counter measure sweet32 attack (CVE-2016-2183). -- Issue #27766: Add ChaCha20 Poly1305 to ssl module's default ciper list. +- bpo-27766: Add ChaCha20 Poly1305 to ssl module's default ciper list. (Required OpenSSL 1.1.0 or LibreSSL). -- Issue #26470: Port ssl and hashlib module to OpenSSL 1.1.0. +- bpo-26470: Port ssl and hashlib module to OpenSSL 1.1.0. -- Remove support for passing a file descriptor to os.access. It never worked but - previously didn't raise. +- Remove support for passing a file descriptor to os.access. It never worked + but previously didn't raise. -- Issue #12885: Fix error when distutils encounters symlink. +- bpo-12885: Fix error when distutils encounters symlink. -- Issue #27881: Fixed possible bugs when setting sqlite3.Connection.isolation_level. - Based on patch by Xiang Zhang. +- bpo-27881: Fixed possible bugs when setting + sqlite3.Connection.isolation_level. Based on patch by Xiang Zhang. -- Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory +- bpo-27861: Fixed a crash in sqlite3.Connection.cursor() when a factory creates not a cursor. Patch by Xiang Zhang. -- Issue #19884: Avoid spurious output on OS X with Gnu Readline. +- bpo-19884: Avoid spurious output on OS X with Gnu Readline. -- Issue #27706: Restore deterministic behavior of random.Random().seed() - for string seeds using seeding version 1. Allows sequences of calls - to random() to exactly match those obtained in Python 2. - Patch by Nofar Schnider. +- bpo-27706: Restore deterministic behavior of random.Random().seed() for + string seeds using seeding version 1. Allows sequences of calls to + random() to exactly match those obtained in Python 2. Patch by Nofar + Schnider. -- Issue #10513: Fix a regression in Connection.commit(). Statements should - not be reset after a commit. +- bpo-10513: Fix a regression in Connection.commit(). Statements should not + be reset after a commit. -- A new version of typing.py from https://github.com/python/typing: - - Collection (only for 3.6) (Issue #27598) - - Add FrozenSet to __all__ (upstream #261) - - fix crash in _get_type_vars() (upstream #259) - - Remove the dict constraint in ForwardRef._eval_type (upstream #252) +- A new version of typing.py from https://github.com/python/typing: - + Collection (only for 3.6) (Issue #27598) - Add FrozenSet to __all__ + (upstream #261) - fix crash in _get_type_vars() (upstream #259) - Remove + the dict constraint in ForwardRef._eval_type (upstream #252) -- Issue #27539: Fix unnormalised ``Fraction.__pow__`` result in the case - of negative exponent and negative base. +- bpo-27539: Fix unnormalised ``Fraction.__pow__`` result in the case of + negative exponent and negative base. -- Issue #21718: cursor.description is now available for queries using CTEs. +- bpo-21718: cursor.description is now available for queries using CTEs. -- Issue #2466: posixpath.ismount now correctly recognizes mount points which +- bpo-2466: posixpath.ismount now correctly recognizes mount points which the user does not have permission to access. -- Issue #27773: Correct some memory management errors server_hostname in +- bpo-27773: Correct some memory management errors server_hostname in _ssl.wrap_socket(). -- Issue #26750: unittest.mock.create_autospec() now works properly for +- bpo-26750: unittest.mock.create_autospec() now works properly for subclasses of property() and other data descriptors. -- In the curses module, raise an error if window.getstr() or window.instr() is - passed a negative value. +- In the curses module, raise an error if window.getstr() or window.instr() + is passed a negative value. -- Issue #27783: Fix possible usage of uninitialized memory in +- bpo-27783: Fix possible usage of uninitialized memory in operator.methodcaller. -- Issue #27774: Fix possible Py_DECREF on unowned object in _sre. +- bpo-27774: Fix possible Py_DECREF on unowned object in _sre. -- Issue #27760: Fix possible integer overflow in binascii.b2a_qp. +- bpo-27760: Fix possible integer overflow in binascii.b2a_qp. -- Issue #27758: Fix possible integer overflow in the _csv module for large +- bpo-27758: Fix possible integer overflow in the _csv module for large record lengths. -- Issue #27568: Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the - HTTP_PROXY variable when REQUEST_METHOD environment is set, which indicates - that the script is in CGI mode. +- bpo-27568: Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the + HTTP_PROXY variable when REQUEST_METHOD environment is set, which + indicates that the script is in CGI mode. -- Issue #27656: Do not assume sched.h defines any SCHED_* constants. +- bpo-27656: Do not assume sched.h defines any SCHED_* constants. -- Issue #27130: In the "zlib" module, fix handling of large buffers - (typically 4 GiB) when compressing and decompressing. Previously, inputs - were limited to 4 GiB, and compression and decompression operations did not +- bpo-27130: In the "zlib" module, fix handling of large buffers (typically + 4 GiB) when compressing and decompressing. Previously, inputs were + limited to 4 GiB, and compression and decompression operations did not properly handle results of 4 GiB. -- Issue #27533: Release GIL in nt._isdir +- bpo-27533: Release GIL in nt._isdir -- Issue #17711: Fixed unpickling by the persistent ID with protocol 0. - Original patch by Alexandre Vassalotti. +- bpo-17711: Fixed unpickling by the persistent ID with protocol 0. Original + patch by Alexandre Vassalotti. -- Issue #27522: Avoid an unintentional reference cycle in email.feedparser. +- bpo-27522: Avoid an unintentional reference cycle in email.feedparser. -- Issue #26844: Fix error message for imp.find_module() to refer to 'path' +- bpo-26844: Fix error message for imp.find_module() to refer to 'path' instead of 'name'. Patch by Lev Maximov. -- Issue #23804: Fix SSL zero-length recv() calls to not block and not raise - an error about unclean EOF. +- bpo-23804: Fix SSL zero-length recv() calls to not block and not raise an + error about unclean EOF. -- Issue #27466: Change time format returned by http.cookie.time2netscape, +- bpo-27466: Change time format returned by http.cookie.time2netscape, confirming the netscape cookie format and making it consistent with documentation. -- Issue #26664: Fix activate.fish by removing mis-use of ``$``. +- bpo-26664: Fix activate.fish by removing mis-use of ``$``. -- Issue #22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong +- bpo-22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong mode no longer break tracing, trace_vinfo() now always returns a list of pairs of strings, tracing in the "u" mode now works. @@ -433,1340 +860,1373 @@ Library UnboundLocalError when lazy-loading a module that was already put into sys.modules. -- Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). +- bpo-27079: Fixed curses.ascii functions isblank(), iscntrl() and + ispunct(). -- Issue #26754: Some functions (compile() etc) accepted a filename argument +- bpo-26754: Some functions (compile() etc) accepted a filename argument encoded as an iterable of integers. Now only strings and byte-like objects are accepted. -- Issue #27048: Prevents distutils failing on Windows when environment +- bpo-27048: Prevents distutils failing on Windows when environment variables contain non-ASCII characters -- Issue #27330: Fixed possible leaks in the ctypes module. +- bpo-27330: Fixed possible leaks in the ctypes module. -- Issue #27238: Got rid of bare excepts in the turtle module. Original patch +- bpo-27238: Got rid of bare excepts in the turtle module. Original patch by Jelle Zijlstra. -- Issue #27122: When an exception is raised within the context being managed - by a contextlib.ExitStack() and one of the exit stack generators - catches and raises it in a chain, do not re-raise the original exception - when exiting, let the new chained one through. This avoids the PEP 479 - bug described in issue25782. +- bpo-27122: When an exception is raised within the context being managed by + a contextlib.ExitStack() and one of the exit stack generators catches and + raises it in a chain, do not re-raise the original exception when exiting, + let the new chained one through. This avoids the PEP 479 bug described in + issue25782. + +Security +-------- -- [Security] Issue #27278: Fix os.urandom() implementation using getrandom() on - Linux. Truncate size to INT_MAX and loop until we collected enough random - bytes, instead of casting a directly Py_ssize_t to int. +- bpo-27278: Fix os.urandom() implementation using getrandom() on Linux. + Truncate size to INT_MAX and loop until we collected enough random bytes, + instead of casting a directly Py_ssize_t to int. -- Issue #26386: Fixed ttk.TreeView selection operations with item id's +Library +------- + +- bpo-26386: Fixed ttk.TreeView selection operations with item id's containing spaces. -- [Security] Issue #22636: Avoid shell injection problems with - ctypes.util.find_library(). +Security +-------- + +- bpo-22636: Avoid shell injection problems with ctypes.util.find_library(). + +Library +------- -- Issue #16182: Fix various functions in the "readline" module to use the - locale encoding, and fix get_begidx() and get_endidx() to return code point - indexes. +- bpo-16182: Fix various functions in the "readline" module to use the + locale encoding, and fix get_begidx() and get_endidx() to return code + point indexes. -- Issue #27392: Add loop.connect_accepted_socket(). - Patch by Jim Fulton. +- bpo-27392: Add loop.connect_accepted_socket(). Patch by Jim Fulton. -- Issue #27930: Improved behaviour of logging.handlers.QueueListener. - Thanks to Paulo Andrade and Petr Viktorin for the analysis and patch. +- bpo-27930: Improved behaviour of logging.handlers.QueueListener. Thanks to + Paulo Andrade and Petr Viktorin for the analysis and patch. -- Issue #21201: Improves readability of multiprocessing error message. Thanks +- bpo-21201: Improves readability of multiprocessing error message. Thanks to Wojciech Walczak for patch. -- Issue #27456: asyncio: Set TCP_NODELAY by default. +- bpo-27456: asyncio: Set TCP_NODELAY by default. -- Issue #27906: Fix socket accept exhaustion during high TCP traffic. - Patch by Kevin Conway. +- bpo-27906: Fix socket accept exhaustion during high TCP traffic. Patch by + Kevin Conway. -- Issue #28174: Handle when SO_REUSEPORT isn't properly supported. - Patch by Seth Michael Larson. +- bpo-28174: Handle when SO_REUSEPORT isn't properly supported. Patch by + Seth Michael Larson. -- Issue #26654: Inspect functools.partial in asyncio.Handle.__repr__. - Patch by iceboy. +- bpo-26654: Inspect functools.partial in asyncio.Handle.__repr__. Patch by + iceboy. -- Issue #26909: Fix slow pipes IO in asyncio. - Patch by INADA Naoki. +- bpo-26909: Fix slow pipes IO in asyncio. Patch by INADA Naoki. -- Issue #28176: Fix callbacks race in asyncio.SelectorLoop.sock_connect. +- bpo-28176: Fix callbacks race in asyncio.SelectorLoop.sock_connect. -- Issue #27759: Fix selectors incorrectly retain invalid file descriptors. +- bpo-27759: Fix selectors incorrectly retain invalid file descriptors. Patch by Mark Williams. -- Issue #28368: Refuse monitoring processes if the child watcher has - no loop attached. - Patch by Vincent Michel. +- bpo-28368: Refuse monitoring processes if the child watcher has no loop + attached. Patch by Vincent Michel. -- Issue #28369: Raise RuntimeError when transport's FD is used with - add_reader, add_writer, etc. +- bpo-28369: Raise RuntimeError when transport's FD is used with add_reader, + add_writer, etc. -- Issue #28370: Speedup asyncio.StreamReader.readexactly. - Patch by Коренберг Марк. +- bpo-28370: Speedup asyncio.StreamReader.readexactly. Patch by Коренберг + Марк. -- Issue #28371: Deprecate passing asyncio.Handles to run_in_executor. +- bpo-28371: Deprecate passing asyncio.Handles to run_in_executor. -- Issue #28372: Fix asyncio to support formatting of non-python coroutines. +- bpo-28372: Fix asyncio to support formatting of non-python coroutines. -- Issue #28399: Remove UNIX socket from FS before binding. - Patch by Коренберг Марк. +- bpo-28399: Remove UNIX socket from FS before binding. Patch by Коренберг + Марк. -- Issue #27972: Prohibit Tasks to await on themselves. +- bpo-27972: Prohibit Tasks to await on themselves. -- Issue #26923: Fix asyncio.Gather to refuse being cancelled once all - children are done. - Patch by Johannes Ebke. +- bpo-26923: Fix asyncio.Gather to refuse being cancelled once all children + are done. Patch by Johannes Ebke. -- Issue #26796: Don't configure the number of workers for default - threadpool executor. - Initial patch by Hans Lawrenz. +- bpo-26796: Don't configure the number of workers for default threadpool + executor. Initial patch by Hans Lawrenz. -- Issue #28600: Optimize loop.call_soon(). +- bpo-28600: Optimize loop.call_soon(). -- Issue #28613: Fix get_event_loop() return the current loop if - called from coroutines/callbacks. +- bpo-28613: Fix get_event_loop() return the current loop if called from + coroutines/callbacks. -- Issue #28639: Fix inspect.isawaitable to always return bool - Patch by Justin Mayfield. +- bpo-28639: Fix inspect.isawaitable to always return bool Patch by Justin + Mayfield. -- Issue #28652: Make loop methods reject socket kinds they do not support. +- bpo-28652: Make loop methods reject socket kinds they do not support. -- Issue #28653: Fix a refleak in functools.lru_cache. +- bpo-28653: Fix a refleak in functools.lru_cache. -- Issue #28703: Fix asyncio.iscoroutinefunction to handle Mock objects. +- bpo-28703: Fix asyncio.iscoroutinefunction to handle Mock objects. -- Issue #24142: Reading a corrupt config file left the parser in an - invalid state. Original patch by Florian Höch. +- bpo-24142: Reading a corrupt config file left the parser in an invalid + state. Original patch by Florian Höch. -- Issue #28990: Fix SSL hanging if connection is closed before handshake - completed. - (Patch by HoHo-Ho) +- bpo-28990: Fix SSL hanging if connection is closed before handshake + completed. (Patch by HoHo-Ho) IDLE ---- -- Issue #15308: Add 'interrupt execution' (^C) to Shell menu. - Patch by Roger Serwy, updated by Bayard Randel. +- bpo-15308: Add 'interrupt execution' (^C) to Shell menu. Patch by Roger + Serwy, updated by Bayard Randel. -- Issue #27922: Stop IDLE tests from 'flashing' gui widgets on the screen. +- bpo-27922: Stop IDLE tests from 'flashing' gui widgets on the screen. - Add version to title of IDLE help window. -- Issue #25564: In section on IDLE -- console differences, mention that - using exec means that __builtins__ is defined for each statement. +- bpo-25564: In section on IDLE -- console differences, mention that using + exec means that __builtins__ is defined for each statement. -- Issue #27714: text_textview and test_autocomplete now pass when re-run - in the same process. This occurs when test_idle fails when run with the - -w option but without -jn. Fix warning from test_config. +- bpo-27714: text_textview and test_autocomplete now pass when re-run in the + same process. This occurs when test_idle fails when run with the -w + option but without -jn. Fix warning from test_config. -- Issue #25507: IDLE no longer runs buggy code because of its tkinter imports. +- bpo-25507: IDLE no longer runs buggy code because of its tkinter imports. Users must include the same imports required to run directly in Python. -- Issue #27452: add line counter and crc to IDLE configHandler test dump. +- bpo-27452: add line counter and crc to IDLE configHandler test dump. -- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. +- bpo-27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. -- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. +- bpo-27245: IDLE: Cleanly delete custom themes and key bindings. Previously, when IDLE was started from a console or by import, a cascade - of warnings was emitted. Patch by Serhiy Storchaka. + of warnings was emitted. Patch by Serhiy Storchaka. C API ----- -- Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. +- bpo-28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. -- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as - an iterable of integers. Now only strings and bytes-like objects are accepted. +- bpo-26754: PyUnicode_FSDecoder() accepted a filename argument encoded as + an iterable of integers. Now only strings and bytes-like objects are + accepted. Documentation ------------- -- Issue #28513: Documented command-line interface of zipfile. +- bpo-28513: Documented command-line interface of zipfile. Tests ----- -- Issue #28950: Disallow -j0 to be combined with -T/-l/-M in regrtest - command line arguments. +- bpo-28950: Disallow -j0 to be combined with -T/-l/-M in regrtest command + line arguments. -- Issue #28666: Now test.support.rmtree is able to remove unwritable or +- bpo-28666: Now test.support.rmtree is able to remove unwritable or unreadable directories. -- Issue #23839: Various caches now are cleared before running every test file. +- bpo-23839: Various caches now are cleared before running every test file. -- Issue #28409: regrtest: fix the parser of command line arguments. +- bpo-28409: regrtest: fix the parser of command line arguments. -- Issue #27787: Call gc.collect() before checking each test for "dangling +- bpo-27787: Call gc.collect() before checking each test for "dangling threads", since the dangling threads are weak references. -- Issue #27369: In test_pyexpat, avoid testing an error message detail that +- bpo-27369: In test_pyexpat, avoid testing an error message detail that changed in Expat 2.2.0. Tools/Demos ----------- -- Issue #27952: Get Tools/scripts/fixcid.py working with Python 3 and the +- bpo-27952: Get Tools/scripts/fixcid.py working with Python 3 and the current "re" module, avoid invalid Python backslash escapes, and fix a bug parsing escaped C quote signs. -- Issue #27332: Fixed the type of the first argument of module-level functions +- bpo-27332: Fixed the type of the first argument of module-level functions generated by Argument Clinic. Patch by Petr Viktorin. -- Issue #27418: Fixed Tools/importbench/importbench.py. +- bpo-27418: Fixed Tools/importbench/importbench.py. Windows ------- -- Issue #28251: Improvements to help manuals on Windows. +- bpo-28251: Improvements to help manuals on Windows. -- Issue #28110: launcher.msi has different product codes between 32-bit and +- bpo-28110: launcher.msi has different product codes between 32-bit and 64-bit -- Issue #25144: Ensures TargetDir is set before continuing with custom - install. +- bpo-25144: Ensures TargetDir is set before continuing with custom install. -- Issue #27469: Adds a shell extension to the launcher so that drag and drop +- bpo-27469: Adds a shell extension to the launcher so that drag and drop works correctly. -- Issue #27309: Enabled proper Windows styles in python[w].exe manifest. +- bpo-27309: Enabled proper Windows styles in python[w].exe manifest. Build ----- -- Issue #29080: Removes hard dependency on hg.exe from PCBuild/build.bat +- bpo-29080: Removes hard dependency on hg.exe from PCBuild/build.bat -- Issue #23903: Added missed names to PC/python3.def. +- bpo-23903: Added missed names to PC/python3.def. -- Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and +- bpo-10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael Haubenwallner. -- Issue #26359: Rename --with-optimiations to --enable-optimizations. +- bpo-26359: Rename --with-optimiations to --enable-optimizations. -- Issue #28444: Fix missing extensions modules when cross compiling. +- bpo-28444: Fix missing extensions modules when cross compiling. -- Issue #28248: Update Windows build and OS X installers to use OpenSSL 1.0.2j. +- bpo-28248: Update Windows build and OS X installers to use OpenSSL 1.0.2j. -- Issue #28258: Fixed build with Estonian locale (python-config and distclean +- bpo-28258: Fixed build with Estonian locale (python-config and distclean targets in Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. -- Issue #26661: setup.py now detects system libffi with multiarch wrapper. +- bpo-26661: setup.py now detects system libffi with multiarch wrapper. -- Issue #28066: Fix the logic that searches build directories for generated +- bpo-28066: Fix the logic that searches build directories for generated include files when building outside the source tree. -- Issue #15819: Remove redundant include search directory option for building +- bpo-15819: Remove redundant include search directory option for building outside the source tree. -- Issue #27566: Fix clean target in freeze makefile (patch by Lisa Roach) +- bpo-27566: Fix clean target in freeze makefile (patch by Lisa Roach) -- Issue #27705: Update message in validate_ucrtbase.py +- bpo-27705: Update message in validate_ucrtbase.py -- Issue #27983: Cause lack of llvm-profdata tool when using clang as - required for PGO linking to be a configure time error rather than - make time when --with-optimizations is enabled. Also improve our - ability to find the llvm-profdata tool on MacOS and some Linuxes. +- bpo-27983: Cause lack of llvm-profdata tool when using clang as required + for PGO linking to be a configure time error rather than make time when + --with- optimizations is enabled. Also improve our ability to find the + llvm- profdata tool on MacOS and some Linuxes. -- Issue #26307: The profile-opt build now applies PGO to the built-in modules. +- bpo-26307: The profile-opt build now applies PGO to the built-in modules. -- Issue #26359: Add the --with-optimizations configure flag. +- bpo-26359: Add the --with-optimizations configure flag. -- Issue #27713: Suppress spurious build warnings when updating importlib's - bootstrap files. Patch by Xiang Zhang +- bpo-27713: Suppress spurious build warnings when updating importlib's + bootstrap files. Patch by Xiang Zhang -- Issue #25825: Correct the references to Modules/python.exp and ld_so_aix, - which are required on AIX. This updates references to an installation path - that was changed in 3.2a4, and undoes changed references to the build tree - that were made in 3.5.0a1. +- bpo-25825: Correct the references to Modules/python.exp and ld_so_aix, + which are required on AIX. This updates references to an installation + path that was changed in 3.2a4, and undoes changed references to the build + tree that were made in 3.5.0a1. -- Issue #27453: CPP invocation in configure must use CPPFLAGS. Patch by - Chi Hsuan Yen. +- bpo-27453: CPP invocation in configure must use CPPFLAGS. Patch by Chi + Hsuan Yen. -- Issue #27641: The configure script now inserts comments into the makefile - to prevent the pgen and _freeze_importlib executables from being cross- +- bpo-27641: The configure script now inserts comments into the makefile to + prevent the pgen and _freeze_importlib executables from being cross- compiled. -- Issue #26662: Set PYTHON_FOR_GEN in configure as the Python program to be +- bpo-26662: Set PYTHON_FOR_GEN in configure as the Python program to be used for file generation during the build. -- Issue #10910: Avoid C++ compilation errors on FreeBSD and OS X. - Also update FreedBSD version checks for the original ctype UTF-8 workaround. +- bpo-10910: Avoid C++ compilation errors on FreeBSD and OS X. Also update + FreedBSD version checks for the original ctype UTF-8 workaround. -- Issue #28676: Prevent missing 'getentropy' declaration warning on macOS. +- bpo-28676: Prevent missing 'getentropy' declaration warning on macOS. Patch by Gareth Rees. -What's New in Python 3.5.2? -=========================== +What's New in Python 3.5.2 final? +================================= -Release date: 2016-06-26 +*Release date: 2016-06-26* Core and Builtins ----------------- -- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. +- bpo-26930: Update Windows builds to use OpenSSL 1.0.2h. Tests ----- -- Issue #26867: Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. +- bpo-26867: Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. IDLE ---- -- Issue #27365: Allow non-ascii in idlelib/NEWS.txt - minimal part for 3.5.2. +- bpo-27365: Allow non-ascii in idlelib/NEWS.txt - minimal part for 3.5.2. What's New in Python 3.5.2 release candidate 1? =============================================== -Release date: 2016-06-12 +*Release date: 2016-06-12* Core and Builtins ----------------- -- Issue #27066: Fixed SystemError if a custom opener (for open()) returns a +- bpo-27066: Fixed SystemError if a custom opener (for open()) returns a negative number without setting an exception. -- Issue #20041: Fixed TypeError when frame.f_trace is set to None. - Patch by Xavier de Gaye. +- bpo-20041: Fixed TypeError when frame.f_trace is set to None. Patch by + Xavier de Gaye. -- Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" +- bpo-26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. -- Issue #26991: Fix possible refleak when creating a function with annotations. +- bpo-26991: Fix possible refleak when creating a function with annotations. -- Issue #27039: Fixed bytearray.remove() for values greater than 127. Patch by +- bpo-27039: Fixed bytearray.remove() for values greater than 127. Patch by Joe Jevnik. -- Issue #23640: int.from_bytes() no longer bypasses constructors for subclasses. +- bpo-23640: int.from_bytes() no longer bypasses constructors for + subclasses. -- Issue #26811: gc.get_objects() no longer contains a broken tuple with NULL +- bpo-26811: gc.get_objects() no longer contains a broken tuple with NULL pointer. -- Issue #20120: Use RawConfigParser for .pypirc parsing, - removing support for interpolation unintentionally added - with move to Python 3. Behavior no longer does any - interpolation in .pypirc files, matching behavior in Python - 2.7 and Setuptools 19.0. +- bpo-20120: Use RawConfigParser for .pypirc parsing, removing support for + interpolation unintentionally added with move to Python 3. Behavior no + longer does any interpolation in .pypirc files, matching behavior in + Python 2.7 and Setuptools 19.0. -- Issue #26659: Make the builtin slice type support cycle collection. +- bpo-26659: Make the builtin slice type support cycle collection. -- Issue #26718: super.__init__ no longer leaks memory if called multiple times. +- bpo-26718: super.__init__ no longer leaks memory if called multiple times. NOTE: A direct call of super.__init__ is not endorsed! -- Issue #25339: PYTHONIOENCODING now has priority over locale in setting the +- bpo-25339: PYTHONIOENCODING now has priority over locale in setting the error handler for stdin and stdout. -- Issue #26494: Fixed crash on iterating exhausting iterators. - Affected classes are generic sequence iterators, iterators of str, bytes, - bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding - views and os.scandir() iterator. +- bpo-26494: Fixed crash on iterating exhausting iterators. Affected classes + are generic sequence iterators, iterators of str, bytes, bytearray, list, + tuple, set, frozenset, dict, OrderedDict, corresponding views and + os.scandir() iterator. -- Issue #26581: If coding cookie is specified multiple times on a line in +- bpo-26581: If coding cookie is specified multiple times on a line in Python source code file, only the first one is taken to account. -- Issue #26464: Fix str.translate() when string is ASCII and first replacements +- bpo-26464: Fix str.translate() when string is ASCII and first replacements removes character, but next replacement uses a non-ASCII character or a string longer than 1 character. Regression introduced in Python 3.5.0. -- Issue #22836: Ensure exception reports from PyErr_Display() and +- bpo-22836: Ensure exception reports from PyErr_Display() and PyErr_WriteUnraisable() are sensible even when formatting them produces secondary errors. This affects the reports produced by sys.__excepthook__() and when __del__() raises an exception. -- Issue #26302: Correct behavior to reject comma as a legal character for +- bpo-26302: Correct behavior to reject comma as a legal character for cookie names. -- Issue #4806: Avoid masking the original TypeError exception when using star - (*) unpacking in function calls. Based on patch by Hagen Fürstenau and - Daniel Urban. +- bpo-4806: Avoid masking the original TypeError exception when using star + (``*``) unpacking in function calls. Based on patch by Hagen Fürstenau + and Daniel Urban. -- Issue #27138: Fix the doc comment for FileFinder.find_spec(). +- bpo-27138: Fix the doc comment for FileFinder.find_spec(). -- Issue #26154: Add a new private _PyThreadState_UncheckedGet() function to get - the current Python thread state, but don't issue a fatal error if it is NULL. - This new function must be used instead of accessing directly the +- bpo-26154: Add a new private _PyThreadState_UncheckedGet() function to get + the current Python thread state, but don't issue a fatal error if it is + NULL. This new function must be used instead of accessing directly the _PyThreadState_Current variable. The variable is no more exposed since Python 3.5.1 to hide the exact implementation of atomic C types, to avoid compiler issues. -- Issue #26194: Deque.insert() gave odd results for bounded deques that had - reached their maximum size. Now an IndexError will be raised when attempting - to insert into a full deque. +- bpo-26194: Deque.insert() gave odd results for bounded deques that had + reached their maximum size. Now an IndexError will be raised when + attempting to insert into a full deque. -- Issue #25843: When compiling code, don't merge constants if they are equal - but have a different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` - is now correctly compiled to two different functions: ``f1()`` returns ``1`` - (``int``) and ``f2()`` returns ``1.0`` (``int``), even if ``1`` and ``1.0`` - are equal. +- bpo-25843: When compiling code, don't merge constants if they are equal + but have a different types. For example, ``f1, f2 = lambda: 1, lambda: + 1.0`` is now correctly compiled to two different functions: ``f1()`` + returns ``1`` (``int``) and ``f2()`` returns ``1.0`` (``int``), even if + ``1`` and ``1.0`` are equal. -- Issue #22995: [UPDATE] Comment out the one of the pickleability tests in +- bpo-22995: [UPDATE] Comment out the one of the pickleability tests in _PyObject_GetState() due to regressions observed in Cython-based projects. -- Issue #25961: Disallowed null characters in the type name. +- bpo-25961: Disallowed null characters in the type name. -- Issue #25973: Fix segfault when an invalid nonlocal statement binds a name +- bpo-25973: Fix segfault when an invalid nonlocal statement binds a name starting with two underscores. -- Issue #22995: Instances of extension types with a state that aren't +- bpo-22995: Instances of extension types with a state that aren't subclasses of list or dict and haven't implemented any pickle-related - methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__, - or __getstate__), can no longer be pickled. Including memoryview. + methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__, or + __getstate__), can no longer be pickled. Including memoryview. -- Issue #20440: Massive replacing unsafe attribute setting code with special +- bpo-20440: Massive replacing unsafe attribute setting code with special macro Py_SETREF. -- Issue #25766: Special method __bytes__() now works in str subclasses. +- bpo-25766: Special method __bytes__() now works in str subclasses. -- Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size. +- bpo-25421: __sizeof__ methods of builtin types now use dynamic basic size. This allows sys.getsize() to work correctly with their subclasses with __slots__ defined. -- Issue #25709: Fixed problem with in-place string concatenation and utf-8 +- bpo-25709: Fixed problem with in-place string concatenation and utf-8 cache. -- Issue #27147: Mention PEP 420 in the importlib docs. +- bpo-27147: Mention PEP 420 in the importlib docs. -- Issue #24097: Fixed crash in object.__reduce__() if slot name is freed inside +- bpo-24097: Fixed crash in object.__reduce__() if slot name is freed inside __getattr__. -- Issue #24731: Fixed crash on converting objects with special methods +- bpo-24731: Fixed crash on converting objects with special methods __bytes__, __trunc__, and __float__ returning instances of subclasses of - bytes, int, and float to subclasses of bytes, int, and float correspondingly. + bytes, int, and float to subclasses of bytes, int, and float + correspondingly. -- Issue #26478: Fix semantic bugs when using binary operators with dictionary +- bpo-26478: Fix semantic bugs when using binary operators with dictionary views and tuples. -- Issue #26171: Fix possible integer overflow and heap corruption in +- bpo-26171: Fix possible integer overflow and heap corruption in zipimporter.get_data(). -- Issue #25660: Fix TAB key behaviour in REPL with readline. +- bpo-25660: Fix TAB key behaviour in REPL with readline. -- Issue #25887: Raise a RuntimeError when a coroutine object is awaited - more than once. +- bpo-25887: Raise a RuntimeError when a coroutine object is awaited more + than once. -- Issue #27243: Update the __aiter__ protocol: instead of returning - an awaitable that resolves to an asynchronous iterator, the asynchronous +- bpo-27243: Update the __aiter__ protocol: instead of returning an + awaitable that resolves to an asynchronous iterator, the asynchronous iterator should be returned directly. Doing the former will trigger a PendingDeprecationWarning. +Security +-------- -Library -------- +- bpo-26556: Update expat to 2.1.1, fixes CVE-2015-1283. -- [Security] Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. +- Fix TLS stripping vulnerability in smtplib, CVE-2016-0772. Reported by + Team Oststrom -- [Security] Fix TLS stripping vulnerability in smtplib, CVE-2016-0772. - Reported by Team Oststrom +Library +------- -- Issue #21386: Implement missing IPv4Address.is_global property. It was +- bpo-21386: Implement missing IPv4Address.is_global property. It was documented since 07a5610bae9d. Initial patch by Roger Luethi. -- Issue #20900: distutils register command now decodes HTTP responses +- bpo-20900: distutils register command now decodes HTTP responses correctly. Initial patch by ingrid. -- A new version of typing.py provides several new classes and - features: @overload outside stubs, Reversible, DefaultDict, Text, - ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug - fixes (note that some of the new features are not yet implemented in - mypy or other static analyzers). Also classes for PEP 492 - (Awaitable, AsyncIterable, AsyncIterator) have been added (in fact - they made it into 3.5.1 but were never mentioned). +- A new version of typing.py provides several new classes and features: + @overload outside stubs, Reversible, DefaultDict, Text, ContextManager, + Type[], NewType(), TYPE_CHECKING, and numerous bug fixes (note that some + of the new features are not yet implemented in mypy or other static + analyzers). Also classes for PEP 492 (Awaitable, AsyncIterable, + AsyncIterator) have been added (in fact they made it into 3.5.1 but were + never mentioned). -- Issue #25738: Stop http.server.BaseHTTPRequestHandler.send_error() from +- bpo-25738: Stop http.server.BaseHTTPRequestHandler.send_error() from sending a message body for 205 Reset Content. Also, don't send Content header fields in responses that don't have a body. Patch by Susumu Koshiba. -- Issue #21313: Fix the "platform" module to tolerate when sys.version - contains truncated build information. +- bpo-21313: Fix the "platform" module to tolerate when sys.version contains + truncated build information. + +Security +-------- -- [Security] Issue #26839: On Linux, :func:`os.urandom` now calls - ``getrandom()`` with ``GRND_NONBLOCK`` to fall back on reading - ``/dev/urandom`` if the urandom entropy pool is not initialized yet. Patch - written by Colm Buckley. +- bpo-26839: On Linux, :func:`os.urandom` now calls ``getrandom()`` with + ``GRND_NONBLOCK`` to fall back on reading ``/dev/urandom`` if the urandom + entropy pool is not initialized yet. Patch written by Colm Buckley. -- Issue #27164: In the zlib module, allow decompressing raw Deflate streams +Library +------- + +- bpo-27164: In the zlib module, allow decompressing raw Deflate streams with a predefined zdict. Based on patch by Xiang Zhang. -- Issue #24291: Fix wsgiref.simple_server.WSGIRequestHandler to completely +- bpo-24291: Fix wsgiref.simple_server.WSGIRequestHandler to completely write data to the client. Previously it could do partial writes and truncate data. Also, wsgiref.handler.ServerHandler can now handle stdout doing partial writes, but this is deprecated. -- Issue #26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. +- bpo-26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. -- Issue #26373: subprocess.Popen.communicate now correctly ignores - BrokenPipeError when the child process dies before .communicate() - is called in more/all circumstances. +- bpo-26373: subprocess.Popen.communicate now correctly ignores + BrokenPipeError when the child process dies before .communicate() is + called in more/all circumstances. -- Issue #21776: distutils.upload now correctly handles HTTPError. - Initial patch by Claudiu Popa. +- bpo-21776: distutils.upload now correctly handles HTTPError. Initial patch + by Claudiu Popa. -- Issue #27114: Fix SSLContext._load_windows_store_certs fails with +- bpo-27114: Fix SSLContext._load_windows_store_certs fails with PermissionError -- Issue #18383: Avoid creating duplicate filters when using filterwarnings - and simplefilter. Based on patch by Alex Shkop. +- bpo-18383: Avoid creating duplicate filters when using filterwarnings and + simplefilter. Based on patch by Alex Shkop. -- Issue #27057: Fix os.set_inheritable() on Android, ioctl() is blocked by +- bpo-27057: Fix os.set_inheritable() on Android, ioctl() is blocked by SELinux and fails with EACCESS. The function now falls back to fcntl(). Patch written by Michał Bednarski. -- Issue #27014: Fix infinite recursion using typing.py. Thanks to Kalle Tuure! +- bpo-27014: Fix infinite recursion using typing.py. Thanks to Kalle Tuure! -- Issue #14132: Fix urllib.request redirect handling when the target only has - a query string. Original fix by Ján Janech. +- bpo-14132: Fix urllib.request redirect handling when the target only has a + query string. Original fix by Ján Janech. -- Issue #17214: The "urllib.request" module now percent-encodes non-ASCII - bytes found in redirect target URLs. Some servers send Location header - fields with non-ASCII bytes, but "http.client" requires the request target - to be ASCII-encodable, otherwise a UnicodeEncodeError is raised. Based on +- bpo-17214: The "urllib.request" module now percent-encodes non-ASCII bytes + found in redirect target URLs. Some servers send Location header fields + with non- ASCII bytes, but "http.client" requires the request target to be + ASCII- encodable, otherwise a UnicodeEncodeError is raised. Based on patch by Christian Heimes. -- Issue #26892: Honor debuglevel flag in urllib.request.HTTPHandler. Patch +- bpo-26892: Honor debuglevel flag in urllib.request.HTTPHandler. Patch contributed by Chi Hsuan Yen. -- Issue #22274: In the subprocess module, allow stderr to be redirected to +- bpo-22274: In the subprocess module, allow stderr to be redirected to stdout even when stdout is not redirected. Patch by Akira Li. -- Issue #26807: mock_open 'files' no longer error on readline at end of file. +- bpo-26807: mock_open 'files' no longer error on readline at end of file. Patch from Yolanda Robla. -- Issue #25745: Fixed leaking a userptr in curses panel destructor. +- bpo-25745: Fixed leaking a userptr in curses panel destructor. -- Issue #26977: Removed unnecessary, and ignored, call to sum of squares helper +- bpo-26977: Removed unnecessary, and ignored, call to sum of squares helper in statistics.pvariance. -- Issue #26881: The modulefinder module now supports extended opcode arguments. +- bpo-26881: The modulefinder module now supports extended opcode arguments. -- Issue #23815: Fixed crashes related to directly created instances of types in +- bpo-23815: Fixed crashes related to directly created instances of types in _tkinter and curses.panel modules. -- Issue #17765: weakref.ref() no longer silently ignores keyword arguments. +- bpo-17765: weakref.ref() no longer silently ignores keyword arguments. Patch by Georg Brandl. -- Issue #26873: xmlrpc now raises ResponseError on unsupported type tags +- bpo-26873: xmlrpc now raises ResponseError on unsupported type tags instead of silently return incorrect result. -- Issue #26711: Fixed the comparison of plistlib.Data with other types. +- bpo-26711: Fixed the comparison of plistlib.Data with other types. -- Issue #24114: Fix an uninitialized variable in `ctypes.util`. +- bpo-24114: Fix an uninitialized variable in `ctypes.util`. - The bug only occurs on SunOS when the ctypes implementation searches - for the `crle` program. Patch by Xiang Zhang. Tested on SunOS by - Kees Bos. + The bug only occurs on SunOS when the ctypes implementation searches for + the `crle` program. Patch by Xiang Zhang. Tested on SunOS by Kees Bos. -- Issue #26864: In urllib.request, change the proxy bypass host checking +- bpo-26864: In urllib.request, change the proxy bypass host checking against no_proxy to be case-insensitive, and to not match unrelated host names that happen to have a bypassed hostname as a suffix. Patch by Xiang Zhang. -- Issue #26634: recursive_repr() now sets __qualname__ of wrapper. Patch by +- bpo-26634: recursive_repr() now sets __qualname__ of wrapper. Patch by Xiang Zhang. -- Issue #26804: urllib.request will prefer lower_case proxy environment - variables over UPPER_CASE or Mixed_Case ones. Patch contributed by Hans-Peter - Jansen. +- bpo-26804: urllib.request will prefer lower_case proxy environment + variables over UPPER_CASE or Mixed_Case ones. Patch contributed by Hans- + Peter Jansen. -- Issue #26837: assertSequenceEqual() now correctly outputs non-stringified - differing items (like bytes in the -b mode). This affects assertListEqual() - and assertTupleEqual(). +- bpo-26837: assertSequenceEqual() now correctly outputs non-stringified + differing items (like bytes in the -b mode). This affects + assertListEqual() and assertTupleEqual(). -- Issue #26041: Remove "will be removed in Python 3.7" from deprecation - messages of platform.dist() and platform.linux_distribution(). - Patch by Kumaripaba Miyurusara Athukorala. +- bpo-26041: Remove "will be removed in Python 3.7" from deprecation + messages of platform.dist() and platform.linux_distribution(). Patch by + Kumaripaba Miyurusara Athukorala. -- Issue #26822: itemgetter, attrgetter and methodcaller objects no longer +- bpo-26822: itemgetter, attrgetter and methodcaller objects no longer silently ignore keyword arguments. -- Issue #26733: Disassembling a class now disassembles class and static methods. - Patch by Xiang Zhang. +- bpo-26733: Disassembling a class now disassembles class and static + methods. Patch by Xiang Zhang. -- Issue #26801: Fix error handling in :func:`shutil.get_terminal_size`, catch - :exc:`AttributeError` instead of :exc:`NameError`. Patch written by Emanuel - Barry. +- bpo-26801: Fix error handling in :func:`shutil.get_terminal_size`, catch + :exc:`AttributeError` instead of :exc:`NameError`. Patch written by + Emanuel Barry. -- Issue #24838: tarfile's ustar and gnu formats now correctly calculate name +- bpo-24838: tarfile's ustar and gnu formats now correctly calculate name and link field limits for multibyte character encodings like utf-8. -- [Security] Issue #26657: Fix directory traversal vulnerability with - http.server on Windows. This fixes a regression that was introduced in - 3.3.4rc1 and 3.4.0rc1. Based on patch by Philipp Hagemeister. +Security +-------- + +- bpo-26657: Fix directory traversal vulnerability with http.server on + Windows. This fixes a regression that was introduced in 3.3.4rc1 and + 3.4.0rc1. Based on patch by Philipp Hagemeister. -- Issue #26717: Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by +Library +------- + +- bpo-26717: Stop encoding Latin-1-ized WSGI paths with UTF-8. Patch by Anthony Sottile. -- Issue #26735: Fix :func:`os.urandom` on Solaris 11.3 and newer when reading +- bpo-26735: Fix :func:`os.urandom` on Solaris 11.3 and newer when reading more than 1,024 bytes: call ``getrandom()`` multiple times with a limit of 1024 bytes per call. -- Issue #16329: Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. +- bpo-16329: Add .webm to mimetypes.types_map. Patch by Giampaolo Rodola'. -- Issue #13952: Add .csv to mimetypes.types_map. Patch by Geoff Wilson. +- bpo-13952: Add .csv to mimetypes.types_map. Patch by Geoff Wilson. -- Issue #26709: Fixed Y2038 problem in loading binary PLists. +- bpo-26709: Fixed Y2038 problem in loading binary PLists. -- Issue #23735: Handle terminal resizing with Readline 6.3+ by installing our +- bpo-23735: Handle terminal resizing with Readline 6.3+ by installing our own SIGWINCH handler. Patch by Eric Price. -- Issue #26586: In http.server, respond with "413 Request header fields too +- bpo-26586: In http.server, respond with "413 Request header fields too large" if there are too many header fields to parse, rather than killing the connection and raising an unhandled exception. Patch by Xiang Zhang. -- Issue #22854: Change BufferedReader.writable() and - BufferedWriter.readable() to always return False. +- bpo-22854: Change BufferedReader.writable() and BufferedWriter.readable() + to always return False. -- Issue #25195: Fix a regression in mock.MagicMock. _Call is a subclass of +- bpo-25195: Fix a regression in mock.MagicMock. _Call is a subclass of tuple (changeset 3603bae63c13 only works for classes) so we need to implement __ne__ ourselves. Patch by Andrew Plummer. -- Issue #26644: Raise ValueError rather than SystemError when a negative - length is passed to SSLSocket.recv() or read(). +- bpo-26644: Raise ValueError rather than SystemError when a negative length + is passed to SSLSocket.recv() or read(). -- Issue #23804: Fix SSL recv(0) and read(0) methods to return zero bytes +- bpo-23804: Fix SSL recv(0) and read(0) methods to return zero bytes instead of up to 1024. -- Issue #26616: Fixed a bug in datetime.astimezone() method. +- bpo-26616: Fixed a bug in datetime.astimezone() method. -- Issue #21925: :func:`warnings.formatwarning` now catches exceptions on - ``linecache.getline(...)`` to be able to log :exc:`ResourceWarning` emitted - late during the Python shutdown process. +- bpo-21925: :func:`warnings.formatwarning` now catches exceptions on + ``linecache.getline(...)`` to be able to log :exc:`ResourceWarning` + emitted late during the Python shutdown process. -- Issue #24266: Ctrl+C during Readline history search now cancels the search +- bpo-24266: Ctrl+C during Readline history search now cancels the search mode when compiled with Readline 7. -- Issue #26560: Avoid potential ValueError in BaseHandler.start_response. +- bpo-26560: Avoid potential ValueError in BaseHandler.start_response. Initial patch by Peter Inglesby. -- [Security] Issue #26313: ssl.py _load_windows_store_certs fails if windows - cert store is empty. Patch by Baji. +Security +-------- + +- bpo-26313: ssl.py _load_windows_store_certs fails if windows cert store is + empty. Patch by Baji. + +Library +------- -- Issue #26569: Fix :func:`pyclbr.readmodule` and :func:`pyclbr.readmodule_ex` +- bpo-26569: Fix :func:`pyclbr.readmodule` and :func:`pyclbr.readmodule_ex` to support importing packages. -- Issue #26499: Account for remaining Content-Length in - HTTPResponse.readline() and read1(). Based on patch by Silent Ghost. - Also document that HTTPResponse now supports these methods. +- bpo-26499: Account for remaining Content-Length in HTTPResponse.readline() + and read1(). Based on patch by Silent Ghost. Also document that + HTTPResponse now supports these methods. -- Issue #25320: Handle sockets in directories unittest discovery is scanning. +- bpo-25320: Handle sockets in directories unittest discovery is scanning. Patch from Victor van den Elzen. -- Issue #16181: cookiejar.http2time() now returns None if year is higher than +- bpo-16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR. -- Issue #26513: Fixes platform module detection of Windows Server +- bpo-26513: Fixes platform module detection of Windows Server -- Issue #23718: Fixed parsing time in week 0 before Jan 1. Original patch by +- bpo-23718: Fixed parsing time in week 0 before Jan 1. Original patch by Tamás Bence Gedai. -- Issue #20589: Invoking Path.owner() and Path.group() on Windows now raise +- bpo-20589: Invoking Path.owner() and Path.group() on Windows now raise NotImplementedError instead of ImportError. -- Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets. +- bpo-26177: Fixed the keys() method for Canvas and Scrollbar widgets. -- Issue #15068: Got rid of excessive buffering in the fileinput module. - The bufsize parameter is no longer used. +- bpo-15068: Got rid of excessive buffering in the fileinput module. The + bufsize parameter is no longer used. -- Issue #2202: Fix UnboundLocalError in - AbstractDigestAuthHandler.get_algorithm_impls. Initial patch by Mathieu +- bpo-2202: Fix UnboundLocalError in + AbstractDigestAuthHandler.get_algorithm_impls. Initial patch by Mathieu Dupuy. -- Issue #25718: Fixed pickling and copying the accumulate() iterator with - total is None. +- bpo-25718: Fixed pickling and copying the accumulate() iterator with total + is None. -- Issue #26475: Fixed debugging output for regular expressions with the (?x) +- bpo-26475: Fixed debugging output for regular expressions with the (?x) flag. -- Issue #26457: Fixed the subnets() methods in IP network classes for the case - when resulting prefix length is equal to maximal prefix length. - Based on patch by Xiang Zhang. +- bpo-26457: Fixed the subnets() methods in IP network classes for the case + when resulting prefix length is equal to maximal prefix length. Based on + patch by Xiang Zhang. -- Issue #26385: Remove the file if the internal open() call in - NamedTemporaryFile() fails. Patch by Silent Ghost. +- bpo-26385: Remove the file if the internal open() call in + NamedTemporaryFile() fails. Patch by Silent Ghost. -- Issue #26402: Fix XML-RPC client to retry when the server shuts down a +- bpo-26402: Fix XML-RPC client to retry when the server shuts down a persistent connection. This was a regression related to the new http.client.RemoteDisconnected exception in 3.5.0a4. -- Issue #25913: Leading ``<~`` is optional now in base64.a85decode() with +- bpo-25913: Leading ``<~`` is optional now in base64.a85decode() with adobe=True. Patch by Swati Jaiswal. -- Issue #26186: Remove an invalid type check in importlib.util.LazyLoader. +- bpo-26186: Remove an invalid type check in importlib.util.LazyLoader. -- Issue #26367: importlib.__import__() raises SystemError like - builtins.__import__() when ``level`` is specified but without an accompanying - package specified. +- bpo-26367: importlib.__import__() raises SystemError like + builtins.__import__() when ``level`` is specified but without an + accompanying package specified. -- Issue #26309: In the "socketserver" module, shut down the request (closing +- bpo-26309: In the "socketserver" module, shut down the request (closing the connected socket) when verify_request() returns false. Patch by Aviv Palivoda. -- [Security] Issue #25939: On Windows open the cert store readonly in +Security +-------- + +- bpo-25939: On Windows open the cert store readonly in ssl.enum_certificates. -- Issue #25995: os.walk() no longer uses FDs proportional to the tree depth. +Library +------- + +- bpo-25995: os.walk() no longer uses FDs proportional to the tree depth. -- Issue #26117: The os.scandir() iterator now closes file descriptor not only +- bpo-26117: The os.scandir() iterator now closes file descriptor not only when the iteration is finished, but when it was failed with error. -- Issue #25911: Restored support of bytes paths in os.walk() on Windows. +- bpo-25911: Restored support of bytes paths in os.walk() on Windows. -- Issue #26045: Add UTF-8 suggestion to error message when posting a - non-Latin-1 string with http.client. +- bpo-26045: Add UTF-8 suggestion to error message when posting a non- + Latin-1 string with http.client. -- Issue #12923: Reset FancyURLopener's redirect counter even if there is an - exception. Based on patches by Brian Brazil and Daniel Rocco. +- bpo-12923: Reset FancyURLopener's redirect counter even if there is an + exception. Based on patches by Brian Brazil and Daniel Rocco. -- Issue #25945: Fixed a crash when unpickle the functools.partial object with - wrong state. Fixed a leak in failed functools.partial constructor. - "args" and "keywords" attributes of functools.partial have now always types - tuple and dict correspondingly. +- bpo-25945: Fixed a crash when unpickle the functools.partial object with + wrong state. Fixed a leak in failed functools.partial constructor. "args" + and "keywords" attributes of functools.partial have now always types tuple + and dict correspondingly. -- Issue #26202: copy.deepcopy() now correctly copies range() objects with - non-atomic attributes. +- bpo-26202: copy.deepcopy() now correctly copies range() objects with non- + atomic attributes. -- Issue #23076: Path.glob() now raises a ValueError if it's called with an - invalid pattern. Patch by Thomas Nyberg. +- bpo-23076: Path.glob() now raises a ValueError if it's called with an + invalid pattern. Patch by Thomas Nyberg. -- Issue #19883: Fixed possible integer overflows in zipimport. +- bpo-19883: Fixed possible integer overflows in zipimport. -- Issue #26227: On Windows, getnameinfo(), gethostbyaddr() and +- bpo-26227: On Windows, getnameinfo(), gethostbyaddr() and gethostbyname_ex() functions of the socket module now decode the hostname from the ANSI code page rather than UTF-8. -- Issue #26147: xmlrpc now works with strings not encodable with used - non-UTF-8 encoding. +- bpo-26147: xmlrpc now works with strings not encodable with used non-UTF-8 + encoding. -- Issue #25935: Garbage collector now breaks reference loops with OrderedDict. +- bpo-25935: Garbage collector now breaks reference loops with OrderedDict. -- Issue #16620: Fixed AttributeError in msilib.Directory.glob(). +- bpo-16620: Fixed AttributeError in msilib.Directory.glob(). -- Issue #26013: Added compatibility with broken protocol 2 pickles created - in old Python 3 versions (3.4.3 and lower). +- bpo-26013: Added compatibility with broken protocol 2 pickles created in + old Python 3 versions (3.4.3 and lower). -- Issue #25850: Use cross-compilation by default for 64-bit Windows. +- bpo-25850: Use cross-compilation by default for 64-bit Windows. -- Issue #17633: Improve zipimport's support for namespace packages. +- bpo-17633: Improve zipimport's support for namespace packages. -- Issue #24705: Fix sysconfig._parse_makefile not expanding ${} vars - appearing before $() vars. +- bpo-24705: Fix sysconfig._parse_makefile not expanding ${} vars appearing + before $() vars. -- Issue #22138: Fix mock.patch behavior when patching descriptors. Restore +- bpo-22138: Fix mock.patch behavior when patching descriptors. Restore original values after patching. Patch contributed by Sean McCully. -- Issue #25672: In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode +- bpo-25672: In the ssl module, enable the SSL_MODE_RELEASE_BUFFERS mode option if it is safe to do so. -- Issue #26012: Don't traverse into symlinks for ** pattern in +- bpo-26012: Don't traverse into symlinks for ``**`` pattern in pathlib.Path.[r]glob(). -- Issue #24120: Ignore PermissionError when traversing a tree with - pathlib.Path.[r]glob(). Patch by Ulrich Petri. +- bpo-24120: Ignore PermissionError when traversing a tree with + pathlib.Path.[r]glob(). Patch by Ulrich Petri. -- Issue #25447: fileinput now uses sys.stdin as-is if it does not have a - buffer attribute (restores backward compatibility). +- bpo-25447: fileinput now uses sys.stdin as-is if it does not have a buffer + attribute (restores backward compatibility). -- Issue #25447: Copying the lru_cache() wrapper object now always works, - independedly from the type of the wrapped object (by returning the original - object unchanged). +- bpo-25447: Copying the lru_cache() wrapper object now always works, + independedly from the type of the wrapped object (by returning the + original object unchanged). -- Issue #24103: Fixed possible use after free in ElementTree.XMLPullParser. +- bpo-24103: Fixed possible use after free in ElementTree.XMLPullParser. -- Issue #25860: os.fwalk() no longer skips remaining directories when error - occurs. Original patch by Samson Lee. +- bpo-25860: os.fwalk() no longer skips remaining directories when error + occurs. Original patch by Samson Lee. -- Issue #25914: Fixed and simplified OrderedDict.__sizeof__. +- bpo-25914: Fixed and simplified OrderedDict.__sizeof__. -- Issue #25902: Fixed various refcount issues in ElementTree iteration. +- bpo-25902: Fixed various refcount issues in ElementTree iteration. -- Issue #25717: Restore the previous behaviour of tolerating most fstat() +- bpo-25717: Restore the previous behaviour of tolerating most fstat() errors when opening files. This was a regression in 3.5a1, and stopped anonymous temporary files from working in special cases. -- Issue #24903: Fix regression in number of arguments compileall accepts when +- bpo-24903: Fix regression in number of arguments compileall accepts when '-d' is specified. The check on the number of arguments has been dropped completely as it never worked correctly anyway. -- Issue #25764: In the subprocess module, preserve any exception caused by +- bpo-25764: In the subprocess module, preserve any exception caused by fork() failure when preexec_fn is used. -- Issue #6478: _strptime's regexp cache now is reset after changing timezone +- bpo-6478: _strptime's regexp cache now is reset after changing timezone with time.tzset(). -- Issue #14285: When executing a package with the "python -m package" option, +- bpo-14285: When executing a package with the "python -m package" option, and package initialization fails, a proper traceback is now reported. The - "runpy" module now lets exceptions from package initialization pass back to - the caller, rather than raising ImportError. + "runpy" module now lets exceptions from package initialization pass back + to the caller, rather than raising ImportError. -- Issue #19771: Also in runpy and the "-m" option, omit the irrelevant - message ". . . is a package and cannot be directly executed" if the package - could not even be initialized (e.g. due to a bad ``*.pyc`` file). +- bpo-19771: Also in runpy and the "-m" option, omit the irrelevant message + ". . . is a package and cannot be directly executed" if the package could + not even be initialized (e.g. due to a bad ``*.pyc`` file). -- Issue #25177: Fixed problem with the mean of very small and very large +- bpo-25177: Fixed problem with the mean of very small and very large numbers. As a side effect, statistics.mean and statistics.variance should be significantly faster. -- Issue #25718: Fixed copying object with state with boolean value is false. +- bpo-25718: Fixed copying object with state with boolean value is false. -- Issue #10131: Fixed deep copying of minidom documents. Based on patch - by Marian Ganisin. +- bpo-10131: Fixed deep copying of minidom documents. Based on patch by + Marian Ganisin. -- Issue #25725: Fixed a reference leak in pickle.loads() when unpickling +- bpo-25725: Fixed a reference leak in pickle.loads() when unpickling invalid data including tuple instructions. -- Issue #25663: In the Readline completer, avoid listing duplicate global +- bpo-25663: In the Readline completer, avoid listing duplicate global names, and search the global namespace before searching builtins. -- Issue #25688: Fixed file leak in ElementTree.iterparse() raising an error. +- bpo-25688: Fixed file leak in ElementTree.iterparse() raising an error. -- Issue #23914: Fixed SystemError raised by unpickler on broken pickle data. +- bpo-23914: Fixed SystemError raised by unpickler on broken pickle data. -- Issue #25691: Fixed crash on deleting ElementTree.Element attributes. +- bpo-25691: Fixed crash on deleting ElementTree.Element attributes. -- Issue #25624: ZipFile now always writes a ZIP_STORED header for directory +- bpo-25624: ZipFile now always writes a ZIP_STORED header for directory entries. Patch by Dingyuan Wang. -- Skip getaddrinfo if host is already resolved. - Patch by A. Jesse Jiryu Davis. +- Skip getaddrinfo if host is already resolved. Patch by A. Jesse Jiryu + Davis. -- Issue #26050: Add asyncio.StreamReader.readuntil() method. - Patch by Марк Коренберг. +- bpo-26050: Add asyncio.StreamReader.readuntil() method. Patch by Марк + Коренберг. -- Issue #25924: Avoid unnecessary serialization of getaddrinfo(3) calls on - OS X versions 10.5 or higher. Original patch by A. Jesse Jiryu Davis. +- bpo-25924: Avoid unnecessary serialization of getaddrinfo(3) calls on OS X + versions 10.5 or higher. Original patch by A. Jesse Jiryu Davis. -- Issue #26406: Avoid unnecessary serialization of getaddrinfo(3) calls on +- bpo-26406: Avoid unnecessary serialization of getaddrinfo(3) calls on current versions of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis. -- Issue #26848: Fix asyncio/subprocess.communicate() to handle empty input. +- bpo-26848: Fix asyncio/subprocess.communicate() to handle empty input. Patch by Jack O'Connor. -- Issue #27040: Add loop.get_exception_handler method +- bpo-27040: Add loop.get_exception_handler method -- Issue #27041: asyncio: Add loop.create_future method +- bpo-27041: asyncio: Add loop.create_future method -- Issue #27223: asyncio: Fix _read_ready and _write_ready to respect - _conn_lost. - Patch by Łukasz Langa. +- bpo-27223: asyncio: Fix _read_ready and _write_ready to respect + _conn_lost. Patch by Łukasz Langa. -- Issue #22970: asyncio: Fix inconsistency cancelling Condition.wait. - Patch by David Coles. +- bpo-22970: asyncio: Fix inconsistency cancelling Condition.wait. Patch by + David Coles. IDLE ---- -- Issue #5124: Paste with text selected now replaces the selection on X11. - This matches how paste works on Windows, Mac, most modern Linux apps, - and ttk widgets. Original patch by Serhiy Storchaka. +- bpo-5124: Paste with text selected now replaces the selection on X11. This + matches how paste works on Windows, Mac, most modern Linux apps, and ttk + widgets. Original patch by Serhiy Storchaka. -- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory - is a private implementation of test.test_idle and tool for maintainers. +- bpo-24759: Make clear in idlelib.idle_test.__init__ that the directory is + a private implementation of test.test_idle and tool for maintainers. -- Issue #27196: Stop 'ThemeChanged' warnings when running IDLE tests. - These persisted after other warnings were suppressed in #20567. - Apply Serhiy Storchaka's update_idletasks solution to four test files. - Record this additional advice in idle_test/README.txt +- bpo-27196: Stop 'ThemeChanged' warnings when running IDLE tests. These + persisted after other warnings were suppressed in #20567. Apply Serhiy + Storchaka's update_idletasks solution to four test files. Record this + additional advice in idle_test/README.txt -- Issue #20567: Revise idle_test/README.txt with advice about avoiding - tk warning messages from tests. Apply advice to several IDLE tests. +- bpo-20567: Revise idle_test/README.txt with advice about avoiding tk + warning messages from tests. Apply advice to several IDLE tests. -- Issue #27117: Make colorizer htest and turtledemo work with dark themes. - Move code for configuring text widget colors to a new function. +- bpo-27117: Make colorizer htest and turtledemo work with dark themes. Move + code for configuring text widget colors to a new function. -- Issue #26673: When tk reports font size as 0, change to size 10. - Such fonts on Linux prevented the configuration dialog from opening. +- bpo-26673: When tk reports font size as 0, change to size 10. Such fonts + on Linux prevented the configuration dialog from opening. -- Issue #21939: Add test for IDLE's percolator. - Original patch by Saimadhav Heblikar. +- bpo-21939: Add test for IDLE's percolator. Original patch by Saimadhav + Heblikar. -- Issue #21676: Add test for IDLE's replace dialog. - Original patch by Saimadhav Heblikar. +- bpo-21676: Add test for IDLE's replace dialog. Original patch by Saimadhav + Heblikar. -- Issue #18410: Add test for IDLE's search dialog. - Original patch by Westley Martínez. +- bpo-18410: Add test for IDLE's search dialog. Original patch by Westley + Martínez. -- Issue #21703: Add test for IDLE's undo delegator. - Original patch by Saimadhav Heblikar . +- bpo-21703: Add test for IDLE's undo delegator. Original patch by Saimadhav + Heblikar . -- Issue #27044: Add ConfigDialog.remove_var_callbacks to stop memory leaks. +- bpo-27044: Add ConfigDialog.remove_var_callbacks to stop memory leaks. -- Issue #23977: Add more asserts to test_delegator. +- bpo-23977: Add more asserts to test_delegator. -- Issue #20640: Add tests for idlelib.configHelpSourceEdit. - Patch by Saimadhav Heblikar. +- bpo-20640: Add tests for idlelib.configHelpSourceEdit. Patch by Saimadhav + Heblikar. -- In the 'IDLE-console differences' section of the IDLE doc, clarify - how running with IDLE affects sys.modules and the standard streams. +- In the 'IDLE-console differences' section of the IDLE doc, clarify how + running with IDLE affects sys.modules and the standard streams. -- Issue #25507: fix incorrect change in IOBinding that prevented printing. +- bpo-25507: fix incorrect change in IOBinding that prevented printing. Augment IOBinding htest to include all major IOBinding functions. -- Issue #25905: Revert unwanted conversion of ' to ’ RIGHT SINGLE QUOTATION - MARK in README.txt and open this and NEWS.txt with 'ascii'. - Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'. +- bpo-25905: Revert unwanted conversion of ' to ’ RIGHT SINGLE QUOTATION + MARK in README.txt and open this and NEWS.txt with 'ascii'. Re-encode + CREDITS.txt to utf-8 and open it with 'utf-8'. Documentation ------------- -- Issue #19489: Moved the search box from the sidebar to the header and footer - of each page. Patch by Ammar Askar. +- bpo-19489: Moved the search box from the sidebar to the header and footer + of each page. Patch by Ammar Askar. -- Issue #24136: Document the new PEP 448 unpacking syntax of 3.5. +- bpo-24136: Document the new PEP 448 unpacking syntax of 3.5. -- Issue #26736: Used HTTPS for external links in the documentation if possible. +- bpo-26736: Used HTTPS for external links in the documentation if possible. -- Issue #6953: Rework the Readline module documentation to group related +- bpo-6953: Rework the Readline module documentation to group related functions together, and add more details such as what underlying Readline functions and variables are accessed. -- Issue #23606: Adds note to ctypes documentation regarding cdll.msvcrt. +- bpo-23606: Adds note to ctypes documentation regarding cdll.msvcrt. -- Issue #25500: Fix documentation to not claim that __import__ is searched for +- bpo-25500: Fix documentation to not claim that __import__ is searched for in the global scope. -- Issue #26014: Update 3.x packaging documentation: - * "See also" links to the new docs are now provided in the legacy pages - * links to setuptools documentation have been updated +- bpo-26014: Update 3.x packaging documentation: * "See also" links to the + new docs are now provided in the legacy pages * links to setuptools + documentation have been updated Tests ----- -- Issue #21916: Added tests for the turtle module. Patch by ingrid, - Gregory Loyse and Jelle Zijlstra. +- bpo-21916: Added tests for the turtle module. Patch by ingrid, Gregory + Loyse and Jelle Zijlstra. -- Issue #26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) +- bpo-26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. -- Issue #26015: Added new tests for pickling iterators of mutable sequences. +- bpo-26015: Added new tests for pickling iterators of mutable sequences. -- Issue #26325: Added test.support.check_no_resource_warning() to check that - no ResourceWarning is emitted. +- bpo-26325: Added test.support.check_no_resource_warning() to check that no + ResourceWarning is emitted. -- Issue #25940: Changed test_ssl to use self-signed.pythontest.net. This +- bpo-25940: Changed test_ssl to use self-signed.pythontest.net. This avoids relying on svn.python.org, which recently changed root certificate. -- Issue #25616: Tests for OrderedDict are extracted from test_collections - into separate file test_ordered_dict. +- bpo-25616: Tests for OrderedDict are extracted from test_collections into + separate file test_ordered_dict. -- Issue #26583: Skip test_timestamp_overflow in test_import if bytecode - files cannot be written. +- bpo-26583: Skip test_timestamp_overflow in test_import if bytecode files + cannot be written. Build ----- -- Issue #26884: Fix linking extension modules for cross builds. - Patch by Xavier de Gaye. +- bpo-26884: Fix linking extension modules for cross builds. Patch by Xavier + de Gaye. -- Issue #22359: Disable the rules for running _freeze_importlib and pgen when - cross-compiling. The output of these programs is normally saved with the +- bpo-22359: Disable the rules for running _freeze_importlib and pgen when + cross- compiling. The output of these programs is normally saved with the source code anyway, and is still regenerated when doing a native build. Patch by Xavier de Gaye. -- Issue #27229: Fix the cross-compiling pgen rule for in-tree builds. Patch - by Xavier de Gaye. +- bpo-27229: Fix the cross-compiling pgen rule for in-tree builds. Patch by + Xavier de Gaye. -- Issue #21668: Link audioop, _datetime, _ctypes_test modules to libm, - except on Mac OS X. Patch written by Xavier de Gaye. +- bpo-21668: Link audioop, _datetime, _ctypes_test modules to libm, except + on Mac OS X. Patch written by Xavier de Gaye. -- Issue #25702: A --with-lto configure option has been added that will - enable link time optimizations at build time during a make profile-opt. - Some compilers and toolchains are known to not produce stable code when - using LTO, be sure to test things thoroughly before relying on it. - It can provide a few % speed up over profile-opt alone. +- bpo-25702: A --with-lto configure option has been added that will enable + link time optimizations at build time during a make profile-opt. Some + compilers and toolchains are known to not produce stable code when using + LTO, be sure to test things thoroughly before relying on it. It can + provide a few % speed up over profile-opt alone. -- Issue #26624: Adds validation of ucrtbase[d].dll version with warning - for old versions. +- bpo-26624: Adds validation of ucrtbase[d].dll version with warning for old + versions. -- Issue #17603: Avoid error about nonexistant fileblocks.o file by using a +- bpo-17603: Avoid error about nonexistant fileblocks.o file by using a lower-level check for st_blocks in struct stat. -- Issue #26079: Fixing the build output folder for tix-8.4.3.6. Patch by - Bjoern Thiel. +- bpo-26079: Fixing the build output folder for tix-8.4.3.6. Patch by Bjoern + Thiel. -- Issue #26465: Update Windows builds to use OpenSSL 1.0.2g. +- bpo-26465: Update Windows builds to use OpenSSL 1.0.2g. -- Issue #24421: Compile Modules/_math.c once, before building extensions. +- bpo-24421: Compile Modules/_math.c once, before building extensions. Previously it could fail to compile properly if the math and cmath builds were concurrent. -- Issue #25348: Added ``--pgo`` and ``--pgo-job`` arguments to +- bpo-25348: Added ``--pgo`` and ``--pgo-job`` arguments to ``PCbuild\build.bat`` for building with Profile-Guided Optimization. The old ``PCbuild\build_pgo.bat`` script is now deprecated, and simply calls ``PCbuild\build.bat --pgo %*``. -- Issue #25827: Add support for building with ICC to ``configure``, including - a new ``--with-icc`` flag. +- bpo-25827: Add support for building with ICC to ``configure``, including a + new ``--with-icc`` flag. -- Issue #25696: Fix installation of Python on UNIX with make -j9. +- bpo-25696: Fix installation of Python on UNIX with make -j9. -- Issue #26930: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2h. +- bpo-26930: Update OS X 10.5+ 32-bit-only installer to build and link with + OpenSSL 1.0.2h. -- Issue #26268: Update Windows builds to use OpenSSL 1.0.2f. +- bpo-26268: Update Windows builds to use OpenSSL 1.0.2f. -- Issue #25136: Support Apple Xcode 7's new textual SDK stub libraries. +- bpo-25136: Support Apple Xcode 7's new textual SDK stub libraries. -- Issue #24324: Do not enable unreachable code warnings when using - gcc as the option does not work correctly in older versions of gcc - and has been silently removed as of gcc-4.5. +- bpo-24324: Do not enable unreachable code warnings when using gcc as the + option does not work correctly in older versions of gcc and has been + silently removed as of gcc-4.5. Windows ------- -- Issue #27053: Updates make_zip.py to correctly generate library ZIP file. +- bpo-27053: Updates make_zip.py to correctly generate library ZIP file. -- Issue #26268: Update the prepare_ssl.py script to handle OpenSSL releases +- bpo-26268: Update the prepare_ssl.py script to handle OpenSSL releases that don't include the contents of the include directory (that is, 1.0.2e and later). -- Issue #26071: bdist_wininst created binaries fail to start and find - 32bit Python +- bpo-26071: bdist_wininst created binaries fail to start and find 32bit + Python -- Issue #26073: Update the list of magic numbers in launcher +- bpo-26073: Update the list of magic numbers in launcher -- Issue #26065: Excludes venv from library when generating embeddable - distro. +- bpo-26065: Excludes venv from library when generating embeddable distro. Tools/Demos ----------- -- Issue #26799: Fix python-gdb.py: don't get C types once when the Python code - is loaded, but get C types on demand. The C types can change if - python-gdb.py is loaded before the Python executable. Patch written by Thomas +- bpo-26799: Fix python-gdb.py: don't get C types once when the Python code + is loaded, but get C types on demand. The C types can change if python- + gdb.py is loaded before the Python executable. Patch written by Thomas Ilsche. -- Issue #26271: Fix the Freeze tool to properly use flags passed through +- bpo-26271: Fix the Freeze tool to properly use flags passed through configure. Patch by Daniel Shaulov. -- Issue #26489: Add dictionary unpacking support to Tools/parser/unparse.py. +- bpo-26489: Add dictionary unpacking support to Tools/parser/unparse.py. Patch by Guo Ci Teo. -- Issue #26316: Fix variable name typo in Argument Clinic. +- bpo-26316: Fix variable name typo in Argument Clinic. -Misc ----- +Windows +------- -- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove - unused and outdated icons. +- bpo-17500: Remove unused and outdated icons. (See also: + https://github.com/python/pythondotorg/issues/945) What's New in Python 3.5.1 final? ================================= -Release date: 2015-12-06 +*Release date: 2015-12-06* Core and Builtins ----------------- -- Issue #25709: Fixed problem with in-place string concatenation and - utf-8 cache. +- bpo-25709: Fixed problem with in-place string concatenation and utf-8 + cache. Windows ------- -- Issue #25715: Python 3.5.1 installer shows wrong upgrade path and incorrect +- bpo-25715: Python 3.5.1 installer shows wrong upgrade path and incorrect logic for launcher detection. What's New in Python 3.5.1 release candidate 1? =============================================== -Release date: 2015-11-22 +*Release date: 2015-11-22* Core and Builtins ----------------- -- Issue #25630: Fix a possible segfault during argument parsing in functions +- bpo-25630: Fix a possible segfault during argument parsing in functions that accept filesystem paths. -- Issue #23564: Fixed a partially broken sanity check in the _posixsubprocess +- bpo-23564: Fixed a partially broken sanity check in the _posixsubprocess internals regarding how fds_to_pass were passed to the child. The bug had no actual impact as subprocess.py already avoided it. -- Issue #25388: Fixed tokenizer crash when processing undecodable source code +- bpo-25388: Fixed tokenizer crash when processing undecodable source code with a null byte. -- Issue #25462: The hash of the key now is calculated only once in most +- bpo-25462: The hash of the key now is calculated only once in most operations in C implementation of OrderedDict. -- Issue #22995: Default implementation of __reduce__ and __reduce_ex__ now +- bpo-22995: Default implementation of __reduce__ and __reduce_ex__ now rejects builtin types with not defined __new__. -- Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node +- bpo-25555: Fix parser and AST: fill lineno and col_offset of "arg" node when compiling AST from Python objects. -- Issue #24802: Avoid buffer overreads when int(), float(), compile(), exec() +- bpo-24802: Avoid buffer overreads when int(), float(), compile(), exec() and eval() are passed bytes-like objects. These objects are not - necessarily terminated by a null byte, but the functions assumed they were. + necessarily terminated by a null byte, but the functions assumed they + were. -- Issue #24726: Fixed a crash and leaking NULL in repr() of OrderedDict that +- bpo-24726: Fixed a crash and leaking NULL in repr() of OrderedDict that was mutated by direct calls of dict methods. -- Issue #25449: Iterating OrderedDict with keys with unstable hash now raises +- bpo-25449: Iterating OrderedDict with keys with unstable hash now raises KeyError in C implementations as well as in Python implementation. -- Issue #25395: Fixed crash when highly nested OrderedDict structures were +- bpo-25395: Fixed crash when highly nested OrderedDict structures were garbage collected. -- Issue #25274: sys.setrecursionlimit() now raises a RecursionError if the new - recursion limit is too low depending at the current recursion depth. Modify - also the "lower-water mark" formula to make it monotonic. This mark is used - to decide when the overflowed flag of the thread state is reset. +- bpo-25274: sys.setrecursionlimit() now raises a RecursionError if the new + recursion limit is too low depending at the current recursion depth. + Modify also the "lower-water mark" formula to make it monotonic. This mark + is used to decide when the overflowed flag of the thread state is reset. -- Issue #24402: Fix input() to prompt to the redirected stdout when +- bpo-24402: Fix input() to prompt to the redirected stdout when sys.stdout.fileno() fails. -- Issue #24806: Prevent builtin types that are not allowed to be subclassed from - being subclassed through multiple inheritance. +- bpo-24806: Prevent builtin types that are not allowed to be subclassed + from being subclassed through multiple inheritance. -- Issue #24848: Fixed a number of bugs in UTF-7 decoding of misformed data. +- bpo-24848: Fixed a number of bugs in UTF-7 decoding of misformed data. -- Issue #25280: Import trace messages emitted in verbose (-v) mode are no +- bpo-25280: Import trace messages emitted in verbose (-v) mode are no longer formatted twice. -- Issue #25003: On Solaris 11.3 or newer, os.urandom() now uses the - getrandom() function instead of the getentropy() function. The getentropy() - function is blocking to generate very good quality entropy, os.urandom() - doesn't need such high-quality entropy. +- bpo-25003: On Solaris 11.3 or newer, os.urandom() now uses the getrandom() + function instead of the getentropy() function. The getentropy() function + is blocking to generate very good quality entropy, os.urandom() doesn't + need such high- quality entropy. -- Issue #25182: The stdprinter (used as sys.stderr before the io module is +- bpo-25182: The stdprinter (used as sys.stderr before the io module is imported at startup) now uses the backslashreplace error handler. -- Issue #25131: Make the line number and column offset of set/dict literals and +- bpo-25131: Make the line number and column offset of set/dict literals and comprehensions correspond to the opening brace. -- Issue #25150: Hide the private _Py_atomic_xxx symbols from the public - Python.h header to fix a compilation error with OpenMP. PyThreadState_GET() - becomes an alias to PyThreadState_Get() to avoid ABI incompatibilies. +- bpo-25150: Hide the private _Py_atomic_xxx symbols from the public + Python.h header to fix a compilation error with OpenMP. + PyThreadState_GET() becomes an alias to PyThreadState_Get() to avoid ABI + incompatibilies. Library ------- -- Issue #25626: Change three zlib functions to accept sizes that fit in +- bpo-25626: Change three zlib functions to accept sizes that fit in Py_ssize_t, but internally cap those sizes to UINT_MAX. This resolves a - regression in 3.5 where GzipFile.read() failed to read chunks larger than 2 - or 4 GiB. The change affects the zlib.Decompress.decompress() max_length - parameter, the zlib.decompress() bufsize parameter, and the + regression in 3.5 where GzipFile.read() failed to read chunks larger than + 2 or 4 GiB. The change affects the zlib.Decompress.decompress() + max_length parameter, the zlib.decompress() bufsize parameter, and the zlib.Decompress.flush() length parameter. -- Issue #25583: Avoid incorrect errors raised by os.makedirs(exist_ok=True) +- bpo-25583: Avoid incorrect errors raised by os.makedirs(exist_ok=True) when the OS gives priority to errors such as EACCES over EEXIST. -- Issue #25593: Change semantics of EventLoop.stop() in asyncio. +- bpo-25593: Change semantics of EventLoop.stop() in asyncio. -- Issue #6973: When we know a subprocess.Popen process has died, do - not allow the send_signal(), terminate(), or kill() methods to do - anything as they could potentially signal a different process. +- bpo-6973: When we know a subprocess.Popen process has died, do not allow + the send_signal(), terminate(), or kill() methods to do anything as they + could potentially signal a different process. -- Issue #25590: In the Readline completer, only call getattr() once per +- bpo-25590: In the Readline completer, only call getattr() once per attribute. -- Issue #25498: Fix a crash when garbage-collecting ctypes objects created - by wrapping a memoryview. This was a regression made in 3.5a1. Based - on patch by Eryksun. +- bpo-25498: Fix a crash when garbage-collecting ctypes objects created by + wrapping a memoryview. This was a regression made in 3.5a1. Based on + patch by Eryksun. -- Issue #25584: Added "escape" to the __all__ list in the glob module. +- bpo-25584: Added "escape" to the __all__ list in the glob module. -- Issue #25584: Fixed recursive glob() with patterns starting with '\*\*'. +- bpo-25584: Fixed recursive glob() with patterns starting with ``**``. -- Issue #25446: Fix regression in smtplib's AUTH LOGIN support. +- bpo-25446: Fix regression in smtplib's AUTH LOGIN support. -- Issue #18010: Fix the pydoc web server's module search function to handle +- bpo-18010: Fix the pydoc web server's module search function to handle exceptions from importing packages. -- Issue #25554: Got rid of circular references in regular expression parsing. +- bpo-25554: Got rid of circular references in regular expression parsing. -- Issue #25510: fileinput.FileInput.readline() now returns b'' instead of '' - at the end if the FileInput was opened with binary mode. - Patch by Ryosuke Ito. +- bpo-25510: fileinput.FileInput.readline() now returns b'' instead of '' at + the end if the FileInput was opened with binary mode. Patch by Ryosuke + Ito. -- Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties. +- bpo-25503: Fixed inspect.getdoc() for inherited docstrings of properties. Original patch by John Mark Vandenberg. -- Issue #25515: Always use os.urandom as a source of randomness in uuid.uuid4. +- bpo-25515: Always use os.urandom as a source of randomness in uuid.uuid4. -- Issue #21827: Fixed textwrap.dedent() for the case when largest common - whitespace is a substring of smallest leading whitespace. - Based on patch by Robert Li. +- bpo-21827: Fixed textwrap.dedent() for the case when largest common + whitespace is a substring of smallest leading whitespace. Based on patch + by Robert Li. -- Issue #25447: The lru_cache() wrapper objects now can be copied and pickled +- bpo-25447: The lru_cache() wrapper objects now can be copied and pickled (by returning the original object unchanged). -- Issue #25390: typing: Don't crash on Union[str, Pattern]. +- bpo-25390: typing: Don't crash on Union[str, Pattern]. -- Issue #25441: asyncio: Raise error from drain() when socket is closed. +- bpo-25441: asyncio: Raise error from drain() when socket is closed. -- Issue #25410: Cleaned up and fixed minor bugs in C implementation of +- bpo-25410: Cleaned up and fixed minor bugs in C implementation of OrderedDict. -- Issue #25411: Improved Unicode support in SMTPHandler through better use of +- bpo-25411: Improved Unicode support in SMTPHandler through better use of the email package. Thanks to user simon04 for the patch. -- Issue #25407: Remove mentions of the formatter module being removed in - Python 3.6. +- bpo-25407: Remove mentions of the formatter module being removed in Python + 3.6. -- Issue #25406: Fixed a bug in C implementation of OrderedDict.move_to_end() +- bpo-25406: Fixed a bug in C implementation of OrderedDict.move_to_end() that caused segmentation fault or hang in iterating after moving several items to the start of ordered dict. -- Issue #25364: zipfile now works in threads disabled builds. +- bpo-25364: zipfile now works in threads disabled builds. -- Issue #25328: smtpd's SMTPChannel now correctly raises a ValueError if both +- bpo-25328: smtpd's SMTPChannel now correctly raises a ValueError if both decode_data and enable_SMTPUTF8 are set to true. -- Issue #25316: distutils raises OSError instead of DistutilsPlatformError - when MSVC is not installed. +- bpo-25316: distutils raises OSError instead of DistutilsPlatformError when + MSVC is not installed. -- Issue #25380: Fixed protocol for the STACK_GLOBAL opcode in +- bpo-25380: Fixed protocol for the STACK_GLOBAL opcode in pickletools.opcodes. -- Issue #23972: Updates asyncio datagram create method allowing reuseport - and reuseaddr socket options to be set prior to binding the socket. - Mirroring the existing asyncio create_server method the reuseaddr option - for datagram sockets defaults to True if the O/S is 'posix' (except if the +- bpo-23972: Updates asyncio datagram create method allowing reuseport and + reuseaddr socket options to be set prior to binding the socket. Mirroring + the existing asyncio create_server method the reuseaddr option for + datagram sockets defaults to True if the O/S is 'posix' (except if the platform is Cygwin). Patch by Chris Laws. -- Issue #25304: Add asyncio.run_coroutine_threadsafe(). This lets you - submit a coroutine to a loop from another thread, returning a +- bpo-25304: Add asyncio.run_coroutine_threadsafe(). This lets you submit a + coroutine to a loop from another thread, returning a concurrent.futures.Future. By Vincent Michel. -- Issue #25232: Fix CGIRequestHandler to split the query from the URL at the +- bpo-25232: Fix CGIRequestHandler to split the query from the URL at the first question mark (?) rather than the last. Patch from Xiang Zhang. -- Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the - query part of the URL as if it were a path. Patch from Xiang Zhang. +- bpo-24657: Prevent CGIRequestHandler from collapsing slashes in the query + part of the URL as if it were a path. Patch from Xiang Zhang. -- Issue #24483: C implementation of functools.lru_cache() now calculates key's +- bpo-24483: C implementation of functools.lru_cache() now calculates key's hash only once. -- Issue #22958: Constructor and update method of weakref.WeakValueDictionary +- bpo-22958: Constructor and update method of weakref.WeakValueDictionary now accept the self and the dict keyword arguments. -- Issue #22609: Constructor of collections.UserDict now accepts the self keyword - argument. +- bpo-22609: Constructor of collections.UserDict now accepts the self + keyword argument. -- Issue #25111: Fixed comparison of traceback.FrameSummary. +- bpo-25111: Fixed comparison of traceback.FrameSummary. -- Issue #25262: Added support for BINBYTES8 opcode in Python implementation of - unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8 - opcodes no longer silently ignored on 32-bit platforms in C implementation. +- bpo-25262: Added support for BINBYTES8 opcode in Python implementation of + unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8 + opcodes no longer silently ignored on 32-bit platforms in C + implementation. -- Issue #25034: Fix string.Formatter problem with auto-numbering and - nested format_specs. Patch by Anthon van der Neut. +- bpo-25034: Fix string.Formatter problem with auto-numbering and nested + format_specs. Patch by Anthon van der Neut. -- Issue #25233: Rewrite the guts of asyncio.Queue and - asyncio.Semaphore to be more understandable and correct. +- bpo-25233: Rewrite the guts of asyncio.Queue and asyncio.Semaphore to be + more understandable and correct. -- Issue #25203: Failed readline.set_completer_delims() no longer left the +- bpo-25203: Failed readline.set_completer_delims() no longer left the module in inconsistent state. -- Issue #23600: Default implementation of tzinfo.fromutc() was returning - wrong results in some cases. +- bpo-23600: Default implementation of tzinfo.fromutc() was returning wrong + results in some cases. -- Issue #23329: Allow the ssl module to be built with older versions of +- bpo-23329: Allow the ssl module to be built with older versions of LibreSSL. - Prevent overflow in _Unpickler_Read. -- Issue #25047: The XML encoding declaration written by Element Tree now +- bpo-25047: The XML encoding declaration written by Element Tree now respects the letter case given by the user. This restores the ability to write encoding names in uppercase like "UTF-8", which worked in Python 2. -- Issue #25135: Make deque_clear() safer by emptying the deque before clearing. +- bpo-25135: Make deque_clear() safer by emptying the deque before clearing. This helps avoid possible reentrancy issues. -- Issue #19143: platform module now reads Windows version from kernel32.dll to +- bpo-19143: platform module now reads Windows version from kernel32.dll to avoid compatibility shims. -- Issue #25092: Fix datetime.strftime() failure when errno was already set to +- bpo-25092: Fix datetime.strftime() failure when errno was already set to EINVAL. -- Issue #23517: Fix rounding in fromtimestamp() and utcfromtimestamp() methods +- bpo-23517: Fix rounding in fromtimestamp() and utcfromtimestamp() methods of datetime.datetime: microseconds are now rounded to nearest with ties going to nearest even integer (ROUND_HALF_EVEN), instead of being rounding - towards minus infinity (ROUND_FLOOR). It's important that these methods use - the same rounding mode than datetime.timedelta to keep the property: - (datetime(1970,1,1) + timedelta(seconds=t)) == datetime.utcfromtimestamp(t). - It also the rounding mode used by round(float) for example. + towards minus infinity (ROUND_FLOOR). It's important that these methods + use the same rounding mode than datetime.timedelta to keep the property: + (datetime(1970,1,1) + timedelta(seconds=t)) == + datetime.utcfromtimestamp(t). It also the rounding mode used by + round(float) for example. -- Issue #25155: Fix datetime.datetime.now() and datetime.datetime.utcnow() on +- bpo-25155: Fix datetime.datetime.now() and datetime.datetime.utcnow() on Windows to support date after year 2038. It was a regression introduced in Python 3.5.0. -- Issue #25108: Omitted internal frames in traceback functions print_stack(), +- bpo-25108: Omitted internal frames in traceback functions print_stack(), format_stack(), and extract_stack() called without arguments. -- Issue #25118: Fix a regression of Python 3.5.0 in os.waitpid() on Windows. +- bpo-25118: Fix a regression of Python 3.5.0 in os.waitpid() on Windows. -- Issue #24684: socket.socket.getaddrinfo() now calls +- bpo-24684: socket.socket.getaddrinfo() now calls PyUnicode_AsEncodedString() instead of calling the encode() method of the - host, to handle correctly custom string with an encode() method which doesn't - return a byte string. The encoder of the IDNA codec is now called directly - instead of calling the encode() method of the string. + host, to handle correctly custom string with an encode() method which + doesn't return a byte string. The encoder of the IDNA codec is now called + directly instead of calling the encode() method of the string. -- Issue #25060: Correctly compute stack usage of the BUILD_MAP opcode. +- bpo-25060: Correctly compute stack usage of the BUILD_MAP opcode. -- Issue #24857: Comparing call_args to a long sequence now correctly returns a +- bpo-24857: Comparing call_args to a long sequence now correctly returns a boolean result instead of raising an exception. Patch by A Kaptur. -- Issue #23144: Make sure that HTMLParser.feed() returns all the data, even +- bpo-23144: Make sure that HTMLParser.feed() returns all the data, even when convert_charrefs is True. -- Issue #24982: shutil.make_archive() with the "zip" format now adds entries +- bpo-24982: shutil.make_archive() with the "zip" format now adds entries for directories (including empty directories) in ZIP file. -- Issue #25019: Fixed a crash caused by setting non-string key of expat parser. +- bpo-25019: Fixed a crash caused by setting non-string key of expat parser. Based on patch by John Leitch. -- Issue #16180: Exit pdb if file has syntax error, instead of trapping user - in an infinite loop. Patch by Xavier de Gaye. +- bpo-16180: Exit pdb if file has syntax error, instead of trapping user in + an infinite loop. Patch by Xavier de Gaye. -- Issue #24891: Fix a race condition at Python startup if the file descriptor +- bpo-24891: Fix a race condition at Python startup if the file descriptor of stdin (0), stdout (1) or stderr (2) is closed while Python is creating sys.stdin, sys.stdout and sys.stderr objects. These attributes are now set - to None if the creation of the object failed, instead of raising an OSError - exception. Initial patch written by Marco Paolini. + to None if the creation of the object failed, instead of raising an + OSError exception. Initial patch written by Marco Paolini. -- Issue #24992: Fix error handling and a race condition (related to garbage +- bpo-24992: Fix error handling and a race condition (related to garbage collection) in collections.OrderedDict constructor. -- Issue #24881: Fixed setting binary mode in Python implementation of FileIO - on Windows and Cygwin. Patch from Akira Li. +- bpo-24881: Fixed setting binary mode in Python implementation of FileIO on + Windows and Cygwin. Patch from Akira Li. -- Issue #25578: Fix (another) memory leak in SSLSocket.getpeercer(). +- bpo-25578: Fix (another) memory leak in SSLSocket.getpeercer(). -- Issue #25530: Disable the vulnerable SSLv3 protocol by default when creating +- bpo-25530: Disable the vulnerable SSLv3 protocol by default when creating ssl.SSLContext. -- Issue #25569: Fix memory leak in SSLSocket.getpeercert(). +- bpo-25569: Fix memory leak in SSLSocket.getpeercert(). -- Issue #25471: Sockets returned from accept() shouldn't appear to be +- bpo-25471: Sockets returned from accept() shouldn't appear to be nonblocking. -- Issue #25319: When threading.Event is reinitialized, the underlying condition +- bpo-25319: When threading.Event is reinitialized, the underlying condition should use a regular lock rather than a recursive lock. -- Issue #21112: Fix regression in unittest.expectedFailure on subclasses. - Patch from Berker Peksag. +- bpo-21112: Fix regression in unittest.expectedFailure on subclasses. Patch + from Berker Peksag. -- Issue #24764: cgi.FieldStorage.read_multi() now ignores the Content-Length - header in part headers. Patch written by Peter Landry and reviewed by Pierre - Quentel. +- bpo-24764: cgi.FieldStorage.read_multi() now ignores the Content-Length + header in part headers. Patch written by Peter Landry and reviewed by + Pierre Quentel. -- Issue #24913: Fix overrun error in deque.index(). - Found by John Leitch and Bryce Darling. +- bpo-24913: Fix overrun error in deque.index(). Found by John Leitch and + Bryce Darling. -- Issue #24774: Fix docstring in http.server.test. Patch from Chiu-Hsiang Hsu. +- bpo-24774: Fix docstring in http.server.test. Patch from Chiu-Hsiang Hsu. -- Issue #21159: Improve message in configparser.InterpolationMissingOptionError. - Patch from Łukasz Langa. +- bpo-21159: Improve message in + configparser.InterpolationMissingOptionError. Patch from Łukasz Langa. -- Issue #20362: Honour TestCase.longMessage correctly in assertRegex. - Patch from Ilia Kurenkov. +- bpo-20362: Honour TestCase.longMessage correctly in assertRegex. Patch + from Ilia Kurenkov. -- Issue #23572: Fixed functools.singledispatch on classes with falsy +- bpo-23572: Fixed functools.singledispatch on classes with falsy metaclasses. Patch by Ethan Furman. - asyncio: ensure_future() now accepts awaitable objects. @@ -1774,3272 +2234,3286 @@ Library IDLE ---- -- Issue #15348: Stop the debugger engine (normally in a user process) - before closing the debugger window (running in the IDLE process). - This prevents the RuntimeErrors that were being caught and ignored. +- bpo-15348: Stop the debugger engine (normally in a user process) before + closing the debugger window (running in the IDLE process). This prevents + the RuntimeErrors that were being caught and ignored. -- Issue #24455: Prevent IDLE from hanging when a) closing the shell while the +- bpo-24455: Prevent IDLE from hanging when a) closing the shell while the debugger is active (15347); b) closing the debugger with the [X] button - (15348); and c) activating the debugger when already active (24455). - The patch by Mark Roseman does this by making two changes. - 1. Suspend and resume the gui.interaction method with the tcl vwait - mechanism intended for this purpose (instead of root.mainloop & .quit). - 2. In gui.run, allow any existing interaction to terminate first. + (15348); and c) activating the debugger when already active (24455). The + patch by Mark Roseman does this by making two changes. 1. Suspend and + resume the gui.interaction method with the tcl vwait mechanism intended + for this purpose (instead of root.mainloop & .quit). 2. In gui.run, allow + any existing interaction to terminate first. - Change 'The program' to 'Your program' in an IDLE 'kill program?' message to make it clearer that the program referred to is the currently running user program, not IDLE itself. -- Issue #24750: Improve the appearance of the IDLE editor window status bar. +- bpo-24750: Improve the appearance of the IDLE editor window status bar. Patch by Mark Roseman. -- Issue #25313: Change the handling of new built-in text color themes to better +- bpo-25313: Change the handling of new built-in text color themes to better address the compatibility problem introduced by the addition of IDLE Dark. Consistently use the revised idleConf.CurrentTheme everywhere in idlelib. -- Issue #24782: Extension configuration is now a tab in the IDLE Preferences +- bpo-24782: Extension configuration is now a tab in the IDLE Preferences dialog rather than a separate dialog. The former tabs are now a sorted list. Patch by Mark Roseman. -- Issue #22726: Re-activate the config dialog help button with some content +- bpo-22726: Re-activate the config dialog help button with some content about the other buttons and the new IDLE Dark theme. -- Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme. - It is more or less IDLE Classic inverted, with a cobalt blue background. - Strings, comments, keywords, ... are still green, red, orange, ... . - To use it with IDLEs released before November 2015, hit the - 'Save as New Custom Theme' button and enter a new name, - such as 'Custom Dark'. The custom theme will work with any IDLE - release, and can be modified. +- bpo-24820: IDLE now has an 'IDLE Dark' built-in text color theme. It is + more or less IDLE Classic inverted, with a cobalt blue background. + Strings, comments, keywords, ... are still green, red, orange, ... . To + use it with IDLEs released before November 2015, hit the 'Save as New + Custom Theme' button and enter a new name, such as 'Custom Dark'. The + custom theme will work with any IDLE release, and can be modified. -- Issue #25224: README.txt is now an idlelib index for IDLE developers and - curious users. The previous user content is now in the IDLE doc chapter. +- bpo-25224: README.txt is now an idlelib index for IDLE developers and + curious users. The previous user content is now in the IDLE doc chapter. 'IDLE' now means 'Integrated Development and Learning Environment'. -- Issue #24820: Users can now set breakpoint colors in - Settings -> Custom Highlighting. Original patch by Mark Roseman. +- bpo-24820: Users can now set breakpoint colors in Settings -> Custom + Highlighting. Original patch by Mark Roseman. -- Issue #24972: Inactive selection background now matches active selection +- bpo-24972: Inactive selection background now matches active selection background, as configured by users, on all systems. Found items are now always highlighted on Windows. Initial patch by Mark Roseman. -- Issue #24570: Idle: make calltip and completion boxes appear on Macs - affected by a tk regression. Initial patch by Mark Roseman. +- bpo-24570: Idle: make calltip and completion boxes appear on Macs affected + by a tk regression. Initial patch by Mark Roseman. -- Issue #24988: Idle ScrolledList context menus (used in debugger) - now work on Mac Aqua. Patch by Mark Roseman. +- bpo-24988: Idle ScrolledList context menus (used in debugger) now work on + Mac Aqua. Patch by Mark Roseman. -- Issue #24801: Make right-click for context menu work on Mac Aqua. - Patch by Mark Roseman. +- bpo-24801: Make right-click for context menu work on Mac Aqua. Patch by + Mark Roseman. -- Issue #25173: Associate tkinter messageboxes with a specific widget. - For Mac OSX, make them a 'sheet'. Patch by Mark Roseman. +- bpo-25173: Associate tkinter messageboxes with a specific widget. For Mac + OSX, make them a 'sheet'. Patch by Mark Roseman. -- Issue #25198: Enhance the initial html viewer now used for Idle Help. - * Properly indent fixed-pitch text (patch by Mark Roseman). - * Give code snippet a very Sphinx-like light blueish-gray background. - * Re-use initial width and height set by users for shell and editor. - * When the Table of Contents (TOC) menu is used, put the section header - at the top of the screen. +- bpo-25198: Enhance the initial html viewer now used for Idle Help. * + Properly indent fixed-pitch text (patch by Mark Roseman). * Give code + snippet a very Sphinx- like light blueish-gray background. * Re-use + initial width and height set by users for shell and editor. * When the + Table of Contents (TOC) menu is used, put the section header at the top of + the screen. -- Issue #25225: Condense and rewrite Idle doc section on text colors. +- bpo-25225: Condense and rewrite Idle doc section on text colors. -- Issue #21995: Explain some differences between IDLE and console Python. +- bpo-21995: Explain some differences between IDLE and console Python. -- Issue #22820: Explain need for *print* when running file from Idle editor. +- bpo-22820: Explain need for *print* when running file from Idle editor. -- Issue #25224: Doc: augment Idle feature list and no-subprocess section. +- bpo-25224: Doc: augment Idle feature list and no-subprocess section. -- Issue #25219: Update doc for Idle command line options. - Some were missing and notes were not correct. +- bpo-25219: Update doc for Idle command line options. Some were missing and + notes were not correct. -- Issue #24861: Most of idlelib is private and subject to change. - Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__. +- bpo-24861: Most of idlelib is private and subject to change. Use + idleib.idle.* to start Idle. See idlelib.__init__.__doc__. -- Issue #25199: Idle: add synchronization comments for future maintainers. +- bpo-25199: Idle: add synchronization comments for future maintainers. -- Issue #16893: Replace help.txt with help.html for Idle doc display. - The new idlelib/help.html is rstripped Doc/build/html/library/idle.html. - It looks better than help.txt and will better document Idle as released. - The tkinter html viewer that works for this file was written by Mark Roseman. - The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated. +- bpo-16893: Replace help.txt with help.html for Idle doc display. The new + idlelib/help.html is rstripped Doc/build/html/library/idle.html. It looks + better than help.txt and will better document Idle as released. The + tkinter html viewer that works for this file was written by Mark Roseman. + The now unused EditorWindow.HelpDialog class and helt.txt file are + deprecated. -- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6. +- bpo-24199: Deprecate unused idlelib.idlever with possible removal in 3.6. -- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts). +- bpo-24790: Remove extraneous code (which also create 2 & 3 conflicts). Documentation ------------- -- Issue #22558: Add remaining doc links to source code for Python-coded modules. - Patch by Yoni Lavi. +- bpo-22558: Add remaining doc links to source code for Python-coded + modules. Patch by Yoni Lavi. -- Issue #12067: Rewrite Comparisons section in the Expressions chapter of the +- bpo-12067: Rewrite Comparisons section in the Expressions chapter of the language reference. Some of the details of comparing mixed types were incorrect or ambiguous. NotImplemented is only relevant at a lower level than the Expressions chapter. Added details of comparing range() objects, - and default behaviour and consistency suggestions for user-defined classes. - Patch from Andy Maier. + and default behaviour and consistency suggestions for user-defined + classes. Patch from Andy Maier. -- Issue #24952: Clarify the default size argument of stack_size() in - the "threading" and "_thread" modules. Patch from Mattip. +- bpo-24952: Clarify the default size argument of stack_size() in the + "threading" and "_thread" modules. Patch from Mattip. -- Issue #23725: Overhaul tempfile docs. Note deprecated status of mktemp. - Patch from Zbigniew Jędrzejewski-Szmek. +- bpo-23725: Overhaul tempfile docs. Note deprecated status of mktemp. Patch + from Zbigniew Jędrzejewski-Szmek. -- Issue #24808: Update the types of some PyTypeObject fields. Patch by - Joseph Weston. +- bpo-24808: Update the types of some PyTypeObject fields. Patch by Joseph + Weston. -- Issue #22812: Fix unittest discovery examples. - Patch from Pam McA'Nulty. +- bpo-22812: Fix unittest discovery examples. Patch from Pam McA'Nulty. Tests ----- -- Issue #25449: Added tests for OrderedDict subclasses. +- bpo-25449: Added tests for OrderedDict subclasses. -- Issue #25099: Make test_compileall not fail when an entry on sys.path cannot +- bpo-25099: Make test_compileall not fail when an entry on sys.path cannot be written to (commonly seen in administrative installs on Windows). -- Issue #23919: Prevents assert dialogs appearing in the test suite. +- bpo-23919: Prevents assert dialogs appearing in the test suite. -- ``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass along - to regrtest.py. Previously there was a limit of 9. +- ``PCbuild\rt.bat`` now accepts an unlimited number of arguments to pass + along to regrtest.py. Previously there was a limit of 9. Build ----- -- Issue #24915: Add LLVM support for PGO builds and use the test suite to +- bpo-24915: Add LLVM support for PGO builds and use the test suite to generate the profile data. Initial patch by Alecsandru Patrascu of Intel. -- Issue #24910: Windows MSIs now have unique display names. +- bpo-24910: Windows MSIs now have unique display names. -- Issue #24986: It is now possible to build Python on Windows without errors +- bpo-24986: It is now possible to build Python on Windows without errors when external libraries are not available. Windows ------- -- Issue #25450: Updates shortcuts to start Python in installation directory. +- bpo-25450: Updates shortcuts to start Python in installation directory. -- Issue #25164: Changes default all-users install directory to match per-user +- bpo-25164: Changes default all-users install directory to match per-user directory. -- Issue #25143: Improves installer error messages for unsupported platforms. +- bpo-25143: Improves installer error messages for unsupported platforms. -- Issue #25163: Display correct directory in installer when using non-default +- bpo-25163: Display correct directory in installer when using non-default settings. -- Issue #25361: Disables use of SSE2 instructions in Windows 32-bit build +- bpo-25361: Disables use of SSE2 instructions in Windows 32-bit build -- Issue #25089: Adds logging to installer for case where launcher is not +- bpo-25089: Adds logging to installer for case where launcher is not selected on upgrade. -- Issue #25165: Windows uninstallation should not remove launcher if other +- bpo-25165: Windows uninstallation should not remove launcher if other versions remain -- Issue #25112: py.exe launcher is missing icons +- bpo-25112: py.exe launcher is missing icons -- Issue #25102: Windows installer does not precompile for -O or -OO. +- bpo-25102: Windows installer does not precompile for -O or -OO. -- Issue #25081: Makes Back button in installer go back to upgrade page when +- bpo-25081: Makes Back button in installer go back to upgrade page when upgrading. -- Issue #25091: Increases font size of the installer. +- bpo-25091: Increases font size of the installer. -- Issue #25126: Clarifies that the non-web installer will download some +- bpo-25126: Clarifies that the non-web installer will download some components. -- Issue #25213: Restores requestedExecutionLevel to manifest to disable - UAC virtualization. +- bpo-25213: Restores requestedExecutionLevel to manifest to disable UAC + virtualization. -- Issue #25022: Removed very outdated PC/example_nt/ directory. +- bpo-25022: Removed very outdated PC/example_nt/ directory. Tools/Demos ----------- -- Issue #25440: Fix output of python-config --extension-suffix. +- bpo-25440: Fix output of python-config --extension-suffix. What's New in Python 3.5.0 final? ================================= -Release date: 2015-09-13 +*Release date: 2015-09-13* Build ----- -- Issue #25071: Windows installer should not require TargetDir - parameter when installing quietly. +- bpo-25071: Windows installer should not require TargetDir parameter when + installing quietly. What's New in Python 3.5.0 release candidate 4? =============================================== -Release date: 2015-09-09 +*Release date: 2015-09-09* Library ------- -- Issue #25029: Fixes MemoryError in test_strptime. +- bpo-25029: Fixes MemoryError in test_strptime. Build ----- -- Issue #25027: Reverts partial-static build options and adds - vcruntime140.dll to Windows installation. +- bpo-25027: Reverts partial-static build options and adds vcruntime140.dll + to Windows installation. What's New in Python 3.5.0 release candidate 3? =============================================== -Release date: 2015-09-07 +*Release date: 2015-09-07* Core and Builtins ----------------- -- Issue #24305: Prevent import subsystem stack frames from being counted - by the warnings.warn(stacklevel=) parameter. +- bpo-24305: Prevent import subsystem stack frames from being counted by the + warnings.warn(stacklevel=) parameter. -- Issue #24912: Prevent __class__ assignment to immutable built-in objects. +- bpo-24912: Prevent __class__ assignment to immutable built-in objects. -- Issue #24975: Fix AST compilation for PEP 448 syntax. +- bpo-24975: Fix AST compilation for PEP 448 syntax. Library ------- -- Issue #24917: time_strftime() buffer over-read. +- bpo-24917: time_strftime() buffer over-read. -- Issue #24748: To resolve a compatibility problem found with py2exe and +- bpo-24748: To resolve a compatibility problem found with py2exe and pywin32, imp.load_dynamic() once again ignores previously loaded modules to support Python modules replacing themselves with extension modules. Patch by Petr Viktorin. -- Issue #24635: Fixed a bug in typing.py where isinstance([], typing.Iterable) +- bpo-24635: Fixed a bug in typing.py where isinstance([], typing.Iterable) would return True once, then False on subsequent calls. -- Issue #24989: Fixed buffer overread in BytesIO.readline() if a position is +- bpo-24989: Fixed buffer overread in BytesIO.readline() if a position is set beyond size. Based on patch by John Leitch. -- Issue #24913: Fix overrun error in deque.index(). - Found by John Leitch and Bryce Darling. +- bpo-24913: Fix overrun error in deque.index(). Found by John Leitch and + Bryce Darling. What's New in Python 3.5.0 release candidate 2? =============================================== -Release date: 2015-08-25 +*Release date: 2015-08-25* Core and Builtins ----------------- -- Issue #24769: Interpreter now starts properly when dynamic loading - is disabled. Patch by Petr Viktorin. +- bpo-24769: Interpreter now starts properly when dynamic loading is + disabled. Patch by Petr Viktorin. -- Issue #21167: NAN operations are now handled correctly when python is +- bpo-21167: NAN operations are now handled correctly when python is compiled with ICC even if -fp-model strict is not specified. -- Issue #24492: A "package" lacking a __name__ attribute when trying to perform - a ``from .. import ...`` statement will trigger an ImportError instead of an - AttributeError. +- bpo-24492: A "package" lacking a __name__ attribute when trying to perform + a ``from .. import ...`` statement will trigger an ImportError instead of + an AttributeError. Library ------- -- Issue #24847: Removes vcruntime140.dll dependency from Tcl/Tk. +- bpo-24847: Removes vcruntime140.dll dependency from Tcl/Tk. -- Issue #24839: platform._syscmd_ver raises DeprecationWarning +- bpo-24839: platform._syscmd_ver raises DeprecationWarning -- Issue #24867: Fix Task.get_stack() for 'async def' coroutines +- bpo-24867: Fix Task.get_stack() for 'async def' coroutines What's New in Python 3.5.0 release candidate 1? =============================================== -Release date: 2015-08-09 +*Release date: 2015-08-09* Core and Builtins ----------------- -- Issue #24667: Resize odict in all cases that the underlying dict resizes. +- bpo-24667: Resize odict in all cases that the underlying dict resizes. Library ------- -- Issue #24824: Signatures of codecs.encode() and codecs.decode() now are +- bpo-24824: Signatures of codecs.encode() and codecs.decode() now are compatible with pydoc. -- Issue #24634: Importing uuid should not try to load libc on Windows +- bpo-24634: Importing uuid should not try to load libc on Windows -- Issue #24798: _msvccompiler.py doesn't properly support manifests +- bpo-24798: _msvccompiler.py doesn't properly support manifests -- Issue #4395: Better testing and documentation of binary operators. - Patch by Martin Panter. +- bpo-4395: Better testing and documentation of binary operators. Patch by + Martin Panter. -- Issue #23973: Update typing.py from GitHub repo. +- bpo-23973: Update typing.py from GitHub repo. -- Issue #23004: mock_open() now reads binary data correctly when the type of +- bpo-23004: mock_open() now reads binary data correctly when the type of read_data is bytes. Initial patch by Aaron Hill. -- Issue #23888: Handle fractional time in cookie expiry. Patch by ssh. +- bpo-23888: Handle fractional time in cookie expiry. Patch by ssh. -- Issue #23652: Make it possible to compile the select module against the - libc headers from the Linux Standard Base, which do not include some - EPOLL macros. Patch by Matt Frank. +- bpo-23652: Make it possible to compile the select module against the libc + headers from the Linux Standard Base, which do not include some EPOLL + macros. Patch by Matt Frank. -- Issue #22932: Fix timezones in email.utils.formatdate. - Patch from Dmitry Shachnev. +- bpo-22932: Fix timezones in email.utils.formatdate. Patch from Dmitry + Shachnev. -- Issue #23779: imaplib raises TypeError if authenticator tries to abort. - Patch from Craig Holmquist. +- bpo-23779: imaplib raises TypeError if authenticator tries to abort. Patch + from Craig Holmquist. -- Issue #23319: Fix ctypes.BigEndianStructure, swap correctly bytes. Patch +- bpo-23319: Fix ctypes.BigEndianStructure, swap correctly bytes. Patch written by Matthieu Gautier. -- Issue #23254: Document how to close the TCPServer listening socket. - Patch from Martin Panter. +- bpo-23254: Document how to close the TCPServer listening socket. Patch + from Martin Panter. -- Issue #19450: Update Windows and OS X installer builds to use SQLite 3.8.11. +- bpo-19450: Update Windows and OS X installer builds to use SQLite 3.8.11. -- Issue #17527: Add PATCH to wsgiref.validator. Patch from Luca Sbardella. +- bpo-17527: Add PATCH to wsgiref.validator. Patch from Luca Sbardella. -- Issue #24791: Fix grammar regression for call syntax: 'g(\*a or b)'. +- bpo-24791: Fix grammar regression for call syntax: 'g(\*a or b)'. IDLE ---- -- Issue #23672: Allow Idle to edit and run files with astral chars in name. +- bpo-23672: Allow Idle to edit and run files with astral chars in name. Patch by Mohd Sanad Zaki Rizvi. -- Issue #24745: Idle editor default font. Switch from Courier to - platform-sensitive TkFixedFont. This should not affect current customized - font selections. If there is a problem, edit $HOME/.idlerc/config-main.cfg - and remove 'fontxxx' entries from [Editor Window]. Patch by Mark Roseman. +- bpo-24745: Idle editor default font. Switch from Courier to platform- + sensitive TkFixedFont. This should not affect current customized font + selections. If there is a problem, edit $HOME/.idlerc/config-main.cfg and + remove 'fontxxx' entries from [Editor Window]. Patch by Mark Roseman. -- Issue #21192: Idle editor. When a file is run, put its name in the restart bar. - Do not print false prompts. Original patch by Adnan Umer. +- bpo-21192: Idle editor. When a file is run, put its name in the restart + bar. Do not print false prompts. Original patch by Adnan Umer. -- Issue #13884: Idle menus. Remove tearoff lines. Patch by Roger Serwy. +- bpo-13884: Idle menus. Remove tearoff lines. Patch by Roger Serwy. Documentation ------------- -- Issue #24129: Clarify the reference documentation for name resolution. - This includes removing the assumption that readers will be familiar with the +- bpo-24129: Clarify the reference documentation for name resolution. This + includes removing the assumption that readers will be familiar with the name resolution scheme Python used prior to the introduction of lexical scoping for function namespaces. Patch by Ivan Levkivskyi. -- Issue #20769: Improve reload() docs. Patch by Dorian Pula. +- bpo-20769: Improve reload() docs. Patch by Dorian Pula. -- Issue #23589: Remove duplicate sentence from the FAQ. Patch by Yongzhi Pan. +- bpo-23589: Remove duplicate sentence from the FAQ. Patch by Yongzhi Pan. -- Issue #24729: Correct IO tutorial to match implementation regarding - encoding parameter to open function. +- bpo-24729: Correct IO tutorial to match implementation regarding encoding + parameter to open function. Tests ----- -- Issue #24751: When running regrtest with the ``-w`` command line option, - a test run is no longer marked as a failure if all tests succeed when - re-run. +- bpo-24751: When running regrtest with the ``-w`` command line option, a + test run is no longer marked as a failure if all tests succeed when re- + run. What's New in Python 3.5.0 beta 4? ================================== -Release date: 2015-07-26 +*Release date: 2015-07-26* Core and Builtins ----------------- -- Issue #23573: Restored optimization of bytes.rfind() and bytearray.rfind() +- bpo-23573: Restored optimization of bytes.rfind() and bytearray.rfind() for single-byte argument on Linux. -- Issue #24569: Make PEP 448 dictionary evaluation more consistent. +- bpo-24569: Make PEP 448 dictionary evaluation more consistent. -- Issue #24583: Fix crash when set is mutated while being updated. +- bpo-24583: Fix crash when set is mutated while being updated. -- Issue #24407: Fix crash when dict is mutated while being updated. +- bpo-24407: Fix crash when dict is mutated while being updated. -- Issue #24619: New approach for tokenizing async/await. As a consequence, - it is now possible to have one-line 'async def foo(): await ..' functions. +- bpo-24619: New approach for tokenizing async/await. As a consequence, it + is now possible to have one-line 'async def foo(): await ..' functions. -- Issue #24687: Plug refleak on SyntaxError in function parameters - annotations. +- bpo-24687: Plug refleak on SyntaxError in function parameters annotations. -- Issue #15944: memoryview: Allow arbitrary formats when casting to bytes. +- bpo-15944: memoryview: Allow arbitrary formats when casting to bytes. Patch by Martin Panter. Library ------- -- Issue #23441: rcompleter now prints a tab character instead of displaying +- bpo-23441: rcompleter now prints a tab character instead of displaying possible completions for an empty word. Initial patch by Martin Sekera. -- Issue #24683: Fixed crashes in _json functions called with arguments of +- bpo-24683: Fixed crashes in _json functions called with arguments of inappropriate type. -- Issue #21697: shutil.copytree() now correctly handles symbolic links that +- bpo-21697: shutil.copytree() now correctly handles symbolic links that point to directories. Patch by Eduardo Seabra and Thomas Kluyver. -- Issue #14373: Fixed segmentation fault when gc.collect() is called during +- bpo-14373: Fixed segmentation fault when gc.collect() is called during constructing lru_cache (C implementation). -- Issue #24695: Fix a regression in traceback.print_exception(). If +- bpo-24695: Fix a regression in traceback.print_exception(). If exc_traceback is None we shouldn't print a traceback header like described in the documentation. -- Issue #24620: Random.setstate() now validates the value of state last element. +- bpo-24620: Random.setstate() now validates the value of state last + element. -- Issue #22485: Fixed an issue that caused `inspect.getsource` to return +- bpo-22485: Fixed an issue that caused `inspect.getsource` to return incorrect results on nested functions. -- Issue #22153: Improve unittest docs. Patch from Martin Panter and evilzero. +- bpo-22153: Improve unittest docs. Patch from Martin Panter and evilzero. -- Issue #24580: Symbolic group references to open group in re patterns now are +- bpo-24580: Symbolic group references to open group in re patterns now are explicitly forbidden as well as numeric group references. -- Issue #24206: Fixed __eq__ and __ne__ methods of inspect classes. +- bpo-24206: Fixed __eq__ and __ne__ methods of inspect classes. -- Issue #24631: Fixed regression in the timeit module with multiline setup. +- bpo-24631: Fixed regression in the timeit module with multiline setup. -- Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely. +- bpo-18622: unittest.mock.mock_open().reset_mock would recurse infinitely. Patch from Nicola Palumbo and Laurent De Buyst. -- Issue #23661: unittest.mock side_effects can now be exceptions again. This +- bpo-23661: unittest.mock side_effects can now be exceptions again. This was a regression vs Python 3.4. Patch from Ignacio Rossi -- Issue #24608: chunk.Chunk.read() now always returns bytes, not str. +- bpo-24608: chunk.Chunk.read() now always returns bytes, not str. -- Issue #18684: Fixed reading out of the buffer in the re module. +- bpo-18684: Fixed reading out of the buffer in the re module. -- Issue #24259: tarfile now raises a ReadError if an archive is truncated +- bpo-24259: tarfile now raises a ReadError if an archive is truncated inside a data segment. -- Issue #15014: SMTP.auth() and SMTP.login() now support RFC 4954's optional - initial-response argument to the SMTP AUTH command. +- bpo-15014: SMTP.auth() and SMTP.login() now support RFC 4954's optional + initial- response argument to the SMTP AUTH command. -- Issue #24669: Fix inspect.getsource() for 'async def' functions. - Patch by Kai Groner. +- bpo-24669: Fix inspect.getsource() for 'async def' functions. Patch by Kai + Groner. -- Issue #24688: ast.get_docstring() for 'async def' functions. +- bpo-24688: ast.get_docstring() for 'async def' functions. Build ----- -- Issue #24603: Update Windows builds and OS X 10.5 installer to use OpenSSL +- bpo-24603: Update Windows builds and OS X 10.5 installer to use OpenSSL 1.0.2d. What's New in Python 3.5.0 beta 3? ================================== -Release date: 2015-07-05 +*Release date: 2015-07-05* Core and Builtins ----------------- -- Issue #24467: Fixed possible buffer over-read in bytearray. The bytearray - object now always allocates place for trailing null byte and it's buffer now - is always null-terminated. +- bpo-24467: Fixed possible buffer over-read in bytearray. The bytearray + object now always allocates place for trailing null byte and it's buffer + now is always null-terminated. - Upgrade to Unicode 8.0.0. -- Issue #24345: Add Py_tp_finalize slot for the stable ABI. +- bpo-24345: Add Py_tp_finalize slot for the stable ABI. -- Issue #24400: Introduce a distinct type for PEP 492 coroutines; add - types.CoroutineType, inspect.getcoroutinestate, inspect.getcoroutinelocals; - coroutines no longer use CO_GENERATOR flag; sys.set_coroutine_wrapper - works only for 'async def' coroutines; inspect.iscoroutine no longer - uses collections.abc.Coroutine, it's intended to test for pure 'async def' - coroutines only; add new opcode: GET_YIELD_FROM_ITER; fix generators wrapper - used in types.coroutine to be instance of collections.abc.Generator; - collections.abc.Awaitable and collections.abc.Coroutine can no longer - be used to detect generator-based coroutines--use inspect.isawaitable - instead. +- bpo-24400: Introduce a distinct type for PEP 492 coroutines; add + types.CoroutineType, inspect.getcoroutinestate, + inspect.getcoroutinelocals; coroutines no longer use CO_GENERATOR flag; + sys.set_coroutine_wrapper works only for 'async def' coroutines; + inspect.iscoroutine no longer uses collections.abc.Coroutine, it's + intended to test for pure 'async def' coroutines only; add new opcode: + GET_YIELD_FROM_ITER; fix generators wrapper used in types.coroutine to be + instance of collections.abc.Generator; collections.abc.Awaitable and + collections.abc.Coroutine can no longer be used to detect generator-based + coroutines--use inspect.isawaitable instead. -- Issue #24450: Add gi_yieldfrom to generators and cr_await to coroutines. +- bpo-24450: Add gi_yieldfrom to generators and cr_await to coroutines. Contributed by Benno Leslie and Yury Selivanov. -- Issue #19235: Add new RecursionError exception. Patch by Georg Brandl. +- bpo-19235: Add new RecursionError exception. Patch by Georg Brandl. Library ------- -- Issue #21750: mock_open.read_data can now be read from each instance, as it +- bpo-21750: mock_open.read_data can now be read from each instance, as it could in Python 3.3. -- Issue #24552: Fix use after free in an error case of the _pickle module. +- bpo-24552: Fix use after free in an error case of the _pickle module. -- Issue #24514: tarfile now tolerates number fields consisting of only +- bpo-24514: tarfile now tolerates number fields consisting of only whitespace. -- Issue #19176: Fixed doctype() related bugs in C implementation of ElementTree. - A deprecation warning no longer issued by XMLParser subclass with default - doctype() method. Direct call of doctype() now issues a warning. Parser's - doctype() now is not called if target's doctype() is called. Based on patch - by Martin Panter. +- bpo-19176: Fixed doctype() related bugs in C implementation of + ElementTree. A deprecation warning no longer issued by XMLParser subclass + with default doctype() method. Direct call of doctype() now issues a + warning. Parser's doctype() now is not called if target's doctype() is + called. Based on patch by Martin Panter. -- Issue #20387: Restore semantic round-trip correctness in tokenize/untokenize - for tab-indented blocks. +- bpo-20387: Restore semantic round-trip correctness in tokenize/untokenize + for tab- indented blocks. -- Issue #24456: Fixed possible buffer over-read in adpcm2lin() and lin2adpcm() +- bpo-24456: Fixed possible buffer over-read in adpcm2lin() and lin2adpcm() functions of the audioop module. -- Issue #24336: The contextmanager decorator now works with functions with +- bpo-24336: The contextmanager decorator now works with functions with keyword arguments called "func" and "self". Patch by Martin Panter. -- Issue #24522: Fix possible integer overflow in json accelerator module. +- bpo-24522: Fix possible integer overflow in json accelerator module. -- Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar(). +- bpo-24489: ensure a previously set C errno doesn't disturb cmath.polar(). -- Issue #24408: Fixed AttributeError in measure() and metrics() methods of +- bpo-24408: Fixed AttributeError in measure() and metrics() methods of tkinter.Font. -- Issue #14373: C implementation of functools.lru_cache() now can be used with +- bpo-14373: C implementation of functools.lru_cache() now can be used with methods. -- Issue #24347: Set KeyError if PyDict_GetItemWithError returns NULL. +- bpo-24347: Set KeyError if PyDict_GetItemWithError returns NULL. -- Issue #24348: Drop superfluous incref/decref. +- bpo-24348: Drop superfluous incref/decref. -- Issue #24359: Check for changed OrderedDict size during iteration. +- bpo-24359: Check for changed OrderedDict size during iteration. -- Issue #24368: Support keyword arguments in OrderedDict methods. +- bpo-24368: Support keyword arguments in OrderedDict methods. -- Issue #24362: Simplify the C OrderedDict fast nodes resize logic. +- bpo-24362: Simplify the C OrderedDict fast nodes resize logic. -- Issue #24377: Fix a ref leak in OrderedDict.__repr__. +- bpo-24377: Fix a ref leak in OrderedDict.__repr__. -- Issue #24369: Defend against key-changes during iteration. +- bpo-24369: Defend against key-changes during iteration. Tests ----- -- Issue #24373: _testmultiphase and xxlimited now use tp_traverse and +- bpo-24373: _testmultiphase and xxlimited now use tp_traverse and tp_finalize to avoid reference leaks encountered when combining tp_dealloc with PyType_FromSpec (see issue #16690 for details) Documentation ------------- -- Issue #24458: Update documentation to cover multi-phase initialization for +- bpo-24458: Update documentation to cover multi-phase initialization for extension modules (PEP 489). Patch by Petr Viktorin. -- Issue #24351: Clarify what is meant by "identifier" in the context of +- bpo-24351: Clarify what is meant by "identifier" in the context of string.Template instances. Build ----- -- Issue #24432: Update Windows builds and OS X 10.5 installer to use OpenSSL +- bpo-24432: Update Windows builds and OS X 10.5 installer to use OpenSSL 1.0.2c. What's New in Python 3.5.0 beta 2? ================================== -Release date: 2015-05-31 +*Release date: 2015-05-31* Core and Builtins ----------------- -- Issue #24284: The startswith and endswith methods of the str class no longer - return True when finding the empty string and the indexes are completely out - of range. +- bpo-24284: The startswith and endswith methods of the str class no longer + return True when finding the empty string and the indexes are completely + out of range. -- Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(), +- bpo-24115: Update uses of PyObject_IsTrue(), PyObject_Not(), PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle errors correctly. -- Issue #24328: Fix importing one character extension modules. +- bpo-24328: Fix importing one character extension modules. -- Issue #11205: In dictionary displays, evaluate the key before the value. +- bpo-11205: In dictionary displays, evaluate the key before the value. -- Issue #24285: Fixed regression that prevented importing extension modules +- bpo-24285: Fixed regression that prevented importing extension modules from inside packages. Patch by Petr Viktorin. Library ------- -- Issue #23247: Fix a crash in the StreamWriter.reset() of CJK codecs. +- bpo-23247: Fix a crash in the StreamWriter.reset() of CJK codecs. -- Issue #24270: Add math.isclose() and cmath.isclose() functions as per PEP 485. - Contributed by Chris Barker and Tal Einat. +- bpo-24270: Add math.isclose() and cmath.isclose() functions as per PEP + 485. Contributed by Chris Barker and Tal Einat. -- Issue #5633: Fixed timeit when the statement is a string and the setup is not. +- bpo-5633: Fixed timeit when the statement is a string and the setup is + not. -- Issue #24326: Fixed audioop.ratecv() with non-default weightB argument. +- bpo-24326: Fixed audioop.ratecv() with non-default weightB argument. Original patch by David Moore. -- Issue #16991: Add a C implementation of OrderedDict. +- bpo-16991: Add a C implementation of OrderedDict. -- Issue #23934: Fix inspect.signature to fail correctly for builtin types +- bpo-23934: Fix inspect.signature to fail correctly for builtin types lacking signature information. Initial patch by James Powell. What's New in Python 3.5.0 beta 1? ================================== -Release date: 2015-05-24 +*Release date: 2015-05-24* Core and Builtins ----------------- -- Issue #24276: Fixed optimization of property descriptor getter. +- bpo-24276: Fixed optimization of property descriptor getter. -- Issue #24268: PEP 489: Multi-phase extension module initialization. - Patch by Petr Viktorin. +- bpo-24268: PEP 489: Multi-phase extension module initialization. Patch by + Petr Viktorin. -- Issue #23955: Add pyvenv.cfg option to suppress registry/environment - lookup for generating sys.path on Windows. +- bpo-23955: Add pyvenv.cfg option to suppress registry/environment lookup + for generating sys.path on Windows. -- Issue #24257: Fixed system error in the comparison of faked +- bpo-24257: Fixed system error in the comparison of faked types.SimpleNamespace. -- Issue #22939: Fixed integer overflow in iterator object. Patch by - Clement Rouault. +- bpo-22939: Fixed integer overflow in iterator object. Patch by Clement + Rouault. -- Issue #23985: Fix a possible buffer overrun when deleting a slice from - the front of a bytearray and then appending some other bytes data. +- bpo-23985: Fix a possible buffer overrun when deleting a slice from the + front of a bytearray and then appending some other bytes data. -- Issue #24102: Fixed exception type checking in standard error handlers. +- bpo-24102: Fixed exception type checking in standard error handlers. -- Issue #15027: The UTF-32 encoder is now 3x to 7x faster. +- bpo-15027: The UTF-32 encoder is now 3x to 7x faster. -- Issue #23290: Optimize set_merge() for cases where the target is empty. +- bpo-23290: Optimize set_merge() for cases where the target is empty. (Contributed by Serhiy Storchaka.) -- Issue #2292: PEP 448: Additional Unpacking Generalizations. +- bpo-2292: PEP 448: Additional Unpacking Generalizations. -- Issue #24096: Make warnings.warn_explicit more robust against mutation of the +- bpo-24096: Make warnings.warn_explicit more robust against mutation of the warnings.filters list. -- Issue #23996: Avoid a crash when a delegated generator raises an - unnormalized StopIteration exception. Patch by Stefan Behnel. +- bpo-23996: Avoid a crash when a delegated generator raises an unnormalized + StopIteration exception. Patch by Stefan Behnel. -- Issue #23910: Optimize property() getter calls. Patch by Joe Jevnik. +- bpo-23910: Optimize property() getter calls. Patch by Joe Jevnik. -- Issue #23911: Move path-based importlib bootstrap code to a separate - frozen module. +- bpo-23911: Move path-based importlib bootstrap code to a separate frozen + module. -- Issue #24192: Fix namespace package imports. +- bpo-24192: Fix namespace package imports. -- Issue #24022: Fix tokenizer crash when processing undecodable source code. +- bpo-24022: Fix tokenizer crash when processing undecodable source code. -- Issue #9951: Added a hex() method to bytes, bytearray, and memoryview. +- bpo-9951: Added a hex() method to bytes, bytearray, and memoryview. -- Issue #22906: PEP 479: Change StopIteration handling inside generators. +- bpo-22906: PEP 479: Change StopIteration handling inside generators. -- Issue #24017: PEP 492: Coroutines with async and await syntax. +- bpo-24017: PEP 492: Coroutines with async and await syntax. Library ------- -- Issue #14373: Added C implementation of functools.lru_cache(). Based on +- bpo-14373: Added C implementation of functools.lru_cache(). Based on patches by Matt Joiner and Alexey Kachayev. -- Issue #24230: The tempfile module now accepts bytes for prefix, suffix and dir - parameters and returns bytes in such situations (matching the os module APIs). +- bpo-24230: The tempfile module now accepts bytes for prefix, suffix and + dir parameters and returns bytes in such situations (matching the os + module APIs). -- Issue #22189: collections.UserString now supports __getnewargs__(), +- bpo-22189: collections.UserString now supports __getnewargs__(), __rmod__(), casefold(), format_map(), isprintable(), and maketrans(). Patch by Joe Jevnik. -- Issue #24244: Prevents termination when an invalid format string is +- bpo-24244: Prevents termination when an invalid format string is encountered on Windows in strftime. -- Issue #23973: PEP 484: Add the typing module. +- bpo-23973: PEP 484: Add the typing module. -- Issue #23086: The collections.abc.Sequence() abstract base class added - *start* and *stop* parameters to the index() mixin. - Patch by Devin Jeanpierre. +- bpo-23086: The collections.abc.Sequence() abstract base class added + *start* and *stop* parameters to the index() mixin. Patch by Devin + Jeanpierre. -- Issue #20035: Replaced the ``tkinter._fix`` module used for setting up the +- bpo-20035: Replaced the ``tkinter._fix`` module used for setting up the Tcl/Tk environment on Windows with a private function in the ``_tkinter`` module that makes no permanent changes to the environment. -- Issue #24257: Fixed segmentation fault in sqlite3.Row constructor with faked +- bpo-24257: Fixed segmentation fault in sqlite3.Row constructor with faked cursor type. -- Issue #15836: assertRaises(), assertRaisesRegex(), assertWarns() and - assertWarnsRegex() assertments now check the type of the first argument - to prevent possible user error. Based on patch by Daniel Wagner-Hall. +- bpo-15836: assertRaises(), assertRaisesRegex(), assertWarns() and + assertWarnsRegex() assertments now check the type of the first argument to + prevent possible user error. Based on patch by Daniel Wagner-Hall. -- Issue #9858: Add missing method stubs to _io.RawIOBase. Patch by Laura +- bpo-9858: Add missing method stubs to _io.RawIOBase. Patch by Laura Rupprecht. -- Issue #22955: attrgetter, itemgetter and methodcaller objects in the operator +- bpo-22955: attrgetter, itemgetter and methodcaller objects in the operator module now support pickling. Added readable and evaluable repr for these - objects. Based on patch by Josh Rosenberg. + objects. Based on patch by Josh Rosenberg. -- Issue #22107: tempfile.gettempdir() and tempfile.mkdtemp() now try again - when a directory with the chosen name already exists on Windows as well as - on Unix. tempfile.mkstemp() now fails early if parent directory is not - valid (not exists or is a file) on Windows. +- bpo-22107: tempfile.gettempdir() and tempfile.mkdtemp() now try again when + a directory with the chosen name already exists on Windows as well as on + Unix. tempfile.mkstemp() now fails early if parent directory is not valid + (not exists or is a file) on Windows. -- Issue #23780: Improved error message in os.path.join() with single argument. +- bpo-23780: Improved error message in os.path.join() with single argument. -- Issue #6598: Increased time precision and random number range in +- bpo-6598: Increased time precision and random number range in email.utils.make_msgid() to strengthen the uniqueness of the message ID. -- Issue #24091: Fixed various crashes in corner cases in C implementation of +- bpo-24091: Fixed various crashes in corner cases in C implementation of ElementTree. -- Issue #21931: msilib.FCICreate() now raises TypeError in the case of a bad - argument instead of a ValueError with a bogus FCI error number. - Patch by Jeffrey Armstrong. +- bpo-21931: msilib.FCICreate() now raises TypeError in the case of a bad + argument instead of a ValueError with a bogus FCI error number. Patch by + Jeffrey Armstrong. -- Issue #13866: *quote_via* argument added to urllib.parse.urlencode. +- bpo-13866: *quote_via* argument added to urllib.parse.urlencode. -- Issue #20098: New mangle_from policy option for email, default True - for compat32, but False for all other policies. +- bpo-20098: New mangle_from policy option for email, default True for + compat32, but False for all other policies. -- Issue #24211: The email library now supports RFC 6532: it can generate +- bpo-24211: The email library now supports RFC 6532: it can generate headers using utf-8 instead of encoded words. -- Issue #16314: Added support for the LZMA compression in distutils. +- bpo-16314: Added support for the LZMA compression in distutils. -- Issue #21804: poplib now supports RFC 6856 (UTF8). +- bpo-21804: poplib now supports RFC 6856 (UTF8). -- Issue #18682: Optimized pprint functions for builtin scalar types. +- bpo-18682: Optimized pprint functions for builtin scalar types. -- Issue #22027: smtplib now supports RFC 6531 (SMTPUTF8). +- bpo-22027: smtplib now supports RFC 6531 (SMTPUTF8). -- Issue #23488: Random generator objects now consume 2x less memory on 64-bit. +- bpo-23488: Random generator objects now consume 2x less memory on 64-bit. -- Issue #1322: platform.dist() and platform.linux_distribution() functions are +- bpo-1322: platform.dist() and platform.linux_distribution() functions are now deprecated. Initial patch by Vajrasky Kok. -- Issue #22486: Added the math.gcd() function. The fractions.gcd() function +- bpo-22486: Added the math.gcd() function. The fractions.gcd() function now is deprecated. Based on patch by Mark Dickinson. -- Issue #24064: Property() docstrings are now writeable. - (Patch by Berker Peksag.) +- bpo-24064: Property() docstrings are now writeable. (Patch by Berker + Peksag.) -- Issue #22681: Added support for the koi8_t encoding. +- bpo-22681: Added support for the koi8_t encoding. -- Issue #22682: Added support for the kz1048 encoding. +- bpo-22682: Added support for the kz1048 encoding. -- Issue #23796: peek and read1 methods of BufferedReader now raise ValueError +- bpo-23796: peek and read1 methods of BufferedReader now raise ValueError if they called on a closed object. Patch by John Hergenroeder. -- Issue #21795: smtpd now supports the 8BITMIME extension whenever - the new *decode_data* constructor argument is set to False. +- bpo-21795: smtpd now supports the 8BITMIME extension whenever the new + *decode_data* constructor argument is set to False. -- Issue #24155: optimize heapq.heapify() for better cache performance - when heapifying large lists. +- bpo-24155: optimize heapq.heapify() for better cache performance when + heapifying large lists. -- Issue #21800: imaplib now supports RFC 5161 (enable), RFC 6855 +- bpo-21800: imaplib now supports RFC 5161 (enable), RFC 6855 (utf8/internationalized email) and automatically encodes non-ASCII usernames and passwords to UTF8. -- Issue #20274: When calling a _sqlite.Connection, it now complains if passed +- bpo-20274: When calling a _sqlite.Connection, it now complains if passed any keyword arguments. Previously it silently ignored them. -- Issue #20274: Remove ignored and erroneous "kwargs" parameters from three +- bpo-20274: Remove ignored and erroneous "kwargs" parameters from three METH_VARARGS methods on _sqlite.Connection. -- Issue #24134: assertRaises(), assertRaisesRegex(), assertWarns() and +- bpo-24134: assertRaises(), assertRaisesRegex(), assertWarns() and assertWarnsRegex() checks now emits a deprecation warning when callable is - None or keyword arguments except msg is passed in the context manager mode. + None or keyword arguments except msg is passed in the context manager + mode. -- Issue #24018: Add a collections.abc.Generator abstract base class. +- bpo-24018: Add a collections.abc.Generator abstract base class. Contributed by Stefan Behnel. -- Issue #23880: Tkinter's getint() and getdouble() now support Tcl_Obj. +- bpo-23880: Tkinter's getint() and getdouble() now support Tcl_Obj. Tkinter's getdouble() now supports any numbers (in particular int). -- Issue #22619: Added negative limit support in the traceback module. - Based on patch by Dmitry Kazakov. +- bpo-22619: Added negative limit support in the traceback module. Based on + patch by Dmitry Kazakov. -- Issue #24094: Fix possible crash in json.encode with poorly behaved dict +- bpo-24094: Fix possible crash in json.encode with poorly behaved dict subclasses. -- Issue #9246: On POSIX, os.getcwd() now supports paths longer than 1025 bytes. +- bpo-9246: On POSIX, os.getcwd() now supports paths longer than 1025 bytes. Patch written by William Orr. -- Issue #17445: add difflib.diff_bytes() to support comparison of - byte strings (fixes a regression from Python 2). +- bpo-17445: add difflib.diff_bytes() to support comparison of byte strings + (fixes a regression from Python 2). -- Issue #23917: Fall back to sequential compilation when ProcessPoolExecutor - doesn't exist. Patch by Claudiu Popa. +- bpo-23917: Fall back to sequential compilation when ProcessPoolExecutor + doesn't exist. Patch by Claudiu Popa. -- Issue #23008: Fixed resolving attributes with boolean value is False in pydoc. +- bpo-23008: Fixed resolving attributes with boolean value is False in + pydoc. -- Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't - increment unfinished tasks (this bug was introduced when - JoinableQueue was merged with Queue). +- Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't increment + unfinished tasks (this bug was introduced when JoinableQueue was merged + with Queue). -- Issue #23908: os functions now reject paths with embedded null character - on Windows instead of silently truncating them. +- bpo-23908: os functions now reject paths with embedded null character on + Windows instead of silently truncating them. -- Issue #23728: binascii.crc_hqx() could return an integer outside of the range +- bpo-23728: binascii.crc_hqx() could return an integer outside of the range 0-0xffff for empty data. -- Issue #23887: urllib.error.HTTPError now has a proper repr() representation. +- bpo-23887: urllib.error.HTTPError now has a proper repr() representation. Patch by Berker Peksag. - asyncio: New event loop APIs: set_task_factory() and get_task_factory(). - asyncio: async() function is deprecated in favour of ensure_future(). -- Issue #24178: asyncio.Lock, Condition, Semaphore, and BoundedSemaphore +- bpo-24178: asyncio.Lock, Condition, Semaphore, and BoundedSemaphore support new 'async with' syntax. Contributed by Yury Selivanov. -- Issue #24179: Support 'async for' for asyncio.StreamReader. - Contributed by Yury Selivanov. - -- Issue #24184: Add AsyncIterator and AsyncIterable ABCs to - collections.abc. Contributed by Yury Selivanov. +- bpo-24179: Support 'async for' for asyncio.StreamReader. Contributed by + Yury Selivanov. -- Issue #22547: Implement informative __repr__ for inspect.BoundArguments. +- bpo-24184: Add AsyncIterator and AsyncIterable ABCs to collections.abc. Contributed by Yury Selivanov. -- Issue #24190: Implement inspect.BoundArgument.apply_defaults() method. +- bpo-22547: Implement informative __repr__ for inspect.BoundArguments. Contributed by Yury Selivanov. -- Issue #20691: Add 'follow_wrapped' argument to - inspect.Signature.from_callable() and inspect.signature(). +- bpo-24190: Implement inspect.BoundArgument.apply_defaults() method. Contributed by Yury Selivanov. -- Issue #24248: Deprecate inspect.Signature.from_function() and +- bpo-20691: Add 'follow_wrapped' argument to + inspect.Signature.from_callable() and inspect.signature(). Contributed by + Yury Selivanov. + +- bpo-24248: Deprecate inspect.Signature.from_function() and inspect.Signature.from_builtin(). -- Issue #23898: Fix inspect.classify_class_attrs() to support attributes - with overloaded __eq__ and __bool__. Patch by Mike Bayer. +- bpo-23898: Fix inspect.classify_class_attrs() to support attributes with + overloaded __eq__ and __bool__. Patch by Mike Bayer. -- Issue #24298: Fix inspect.signature() to correctly unwrap wrappers - around bound methods. +- bpo-24298: Fix inspect.signature() to correctly unwrap wrappers around + bound methods. IDLE ---- -- Issue #23184: remove unused names and imports in idlelib. - Initial patch by Al Sweigart. +- bpo-23184: remove unused names and imports in idlelib. Initial patch by Al + Sweigart. Tests ----- -- Issue #21520: test_zipfile no longer fails if the word 'bad' appears - anywhere in the name of the current directory. +- bpo-21520: test_zipfile no longer fails if the word 'bad' appears anywhere + in the name of the current directory. -- Issue #9517: Move script_helper into the support package. - Patch by Christie Wilson. +- bpo-9517: Move script_helper into the support package. Patch by Christie + Wilson. Documentation ------------- -- Issue #22155: Add File Handlers subsection with createfilehandler to tkinter +- bpo-22155: Add File Handlers subsection with createfilehandler to tkinter doc. Remove obsolete example from FAQ. Patch by Martin Panter. -- Issue #24029: Document the name binding behavior for submodule imports. +- bpo-24029: Document the name binding behavior for submodule imports. -- Issue #24077: Fix typo in man page for -I command option: -s, not -S +- bpo-24077: Fix typo in man page for -I command option: -s, not -S Tools/Demos ----------- -- Issue #24000: Improved Argument Clinic's mapping of converters to legacy - "format units". Updated the documentation to match. +- bpo-24000: Improved Argument Clinic's mapping of converters to legacy + "format units". Updated the documentation to match. -- Issue #24001: Argument Clinic converters now use accept={type} - instead of types={'type'} to specify the types the converter accepts. +- bpo-24001: Argument Clinic converters now use accept={type} instead of + types={'type'} to specify the types the converter accepts. -- Issue #23330: h2py now supports arbitrary filenames in #include. +- bpo-23330: h2py now supports arbitrary filenames in #include. -- Issue #24031: make patchcheck now supports git checkouts, too. +- bpo-24031: make patchcheck now supports git checkouts, too. What's New in Python 3.5.0 alpha 4? =================================== -Release date: 2015-04-19 +*Release date: 2015-04-19* Core and Builtins ----------------- -- Issue #22980: Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include - the architecture triplet in the extension name, to make it easy to test builds - for different ABIs in the same working tree. Under OS X, the extension name - now includes PEP 3149-style information. +- bpo-22980: Under Linux, GNU/KFreeBSD and the Hurd, C extensions now + include the architecture triplet in the extension name, to make it easy to + test builds for different ABIs in the same working tree. Under OS X, the + extension name now includes PEP 3149-style information. -- Issue #22631: Added Linux-specific socket constant CAN_RAW_FD_FRAMES. - Patch courtesy of Joe Jevnik. +- bpo-22631: Added Linux-specific socket constant CAN_RAW_FD_FRAMES. Patch + courtesy of Joe Jevnik. -- Issue #23731: Implement PEP 488: removal of .pyo files. +- bpo-23731: Implement PEP 488: removal of .pyo files. -- Issue #23726: Don't enable GC for user subclasses of non-GC types that - don't add any new fields. Patch by Eugene Toder. +- bpo-23726: Don't enable GC for user subclasses of non-GC types that don't + add any new fields. Patch by Eugene Toder. -- Issue #23309: Avoid a deadlock at shutdown if a daemon thread is aborted +- bpo-23309: Avoid a deadlock at shutdown if a daemon thread is aborted while it is holding a lock to a buffered I/O object, and the main thread tries to use the same I/O object (typically stdout or stderr). A fatal error is emitted instead. -- Issue #22977: Fixed formatting Windows error messages on Wine. - Patch by Martin Panter. +- bpo-22977: Fixed formatting Windows error messages on Wine. Patch by + Martin Panter. -- Issue #23466: %c, %o, %x, and %X in bytes formatting now raise TypeError on +- bpo-23466: %c, %o, %x, and %X in bytes formatting now raise TypeError on non-integer input. -- Issue #24044: Fix possible null pointer dereference in list.sort in out of +- bpo-24044: Fix possible null pointer dereference in list.sort in out of memory conditions. -- Issue #21354: PyCFunction_New function is exposed by python DLL again. +- bpo-21354: PyCFunction_New function is exposed by python DLL again. Library ------- -- Issue #23840: tokenize.open() now closes the temporary binary file on error +- bpo-23840: tokenize.open() now closes the temporary binary file on error to fix a resource warning. -- Issue #16914: new debuglevel 2 in smtplib adds timestamps to debug output. +- bpo-16914: new debuglevel 2 in smtplib adds timestamps to debug output. -- Issue #7159: urllib.request now supports sending auth credentials +- bpo-7159: urllib.request now supports sending auth credentials automatically after the first 401. This enhancement is a superset of the enhancement from issue #19494 and supersedes that change. -- Issue #23703: Fix a regression in urljoin() introduced in 901e4e52b20a. - Patch by Demian Brecht. +- bpo-23703: Fix a regression in urljoin() introduced in 901e4e52b20a. Patch + by Demian Brecht. -- Issue #4254: Adds _curses.update_lines_cols(). Patch by Arnon Yaari +- bpo-4254: Adds _curses.update_lines_cols(). Patch by Arnon Yaari -- Issue #19933: Provide default argument for ndigits in round. Patch by +- bpo-19933: Provide default argument for ndigits in round. Patch by Vajrasky Kok. -- Issue #23193: Add a numeric_owner parameter to - tarfile.TarFile.extract and tarfile.TarFile.extractall. Patch by - Michael Vogt and Eric Smith. +- bpo-23193: Add a numeric_owner parameter to tarfile.TarFile.extract and + tarfile.TarFile.extractall. Patch by Michael Vogt and Eric Smith. -- Issue #23342: Add a subprocess.run() function than returns a CalledProcess +- bpo-23342: Add a subprocess.run() function than returns a CalledProcess instance for a more consistent API than the existing call* functions. -- Issue #21217: inspect.getsourcelines() now tries to compute the start and end - lines from the code object, fixing an issue when a lambda function is used as - decorator argument. Patch by Thomas Ballinger and Allison Kaptur. +- bpo-21217: inspect.getsourcelines() now tries to compute the start and end + lines from the code object, fixing an issue when a lambda function is used + as decorator argument. Patch by Thomas Ballinger and Allison Kaptur. -- Issue #24521: Fix possible integer overflows in the pickle module. +- bpo-24521: Fix possible integer overflows in the pickle module. -- Issue #22931: Allow '[' and ']' in cookie values. +- bpo-22931: Allow '[' and ']' in cookie values. - The keywords attribute of functools.partial is now always a dictionary. -- Issue #23811: Add missing newline to the PyCompileError error message. - Patch by Alex Shkop. +- bpo-23811: Add missing newline to the PyCompileError error message. Patch + by Alex Shkop. -- Issue #21116: Avoid blowing memory when allocating a multiprocessing shared - array that's larger than 50% of the available RAM. Patch by Médéric Boquien. +- bpo-21116: Avoid blowing memory when allocating a multiprocessing shared + array that's larger than 50% of the available RAM. Patch by Médéric + Boquien. -- Issue #22982: Improve BOM handling when seeking to multiple positions of - a writable text file. +- bpo-22982: Improve BOM handling when seeking to multiple positions of a + writable text file. -- Issue #23464: Removed deprecated asyncio JoinableQueue. +- bpo-23464: Removed deprecated asyncio JoinableQueue. -- Issue #23529: Limit the size of decompressed data when reading from - GzipFile, BZ2File or LZMAFile. This defeats denial of service attacks - using compressed bombs (i.e. compressed payloads which decompress to a huge +- bpo-23529: Limit the size of decompressed data when reading from GzipFile, + BZ2File or LZMAFile. This defeats denial of service attacks using + compressed bombs (i.e. compressed payloads which decompress to a huge size). Patch by Martin Panter and Nikolaus Rath. -- Issue #21859: Added Python implementation of io.FileIO. +- bpo-21859: Added Python implementation of io.FileIO. -- Issue #23865: close() methods in multiple modules now are idempotent and more +- bpo-23865: close() methods in multiple modules now are idempotent and more robust at shutdown. If they need to release multiple resources, all are released even if errors occur. -- Issue #23400: Raise same exception on both Python 2 and 3 if sem_open is not - available. Patch by Davin Potts. +- bpo-23400: Raise same exception on both Python 2 and 3 if sem_open is not + available. Patch by Davin Potts. -- Issue #10838: The subprocess now module includes SubprocessError and - TimeoutError in its list of exported names for the users wild enough - to use ``from subprocess import *``. +- bpo-10838: The subprocess now module includes SubprocessError and + TimeoutError in its list of exported names for the users wild enough to + use ``from subprocess import *``. -- Issue #23411: Added DefragResult, ParseResult, SplitResult, DefragResultBytes, - ParseResultBytes, and SplitResultBytes to urllib.parse.__all__. - Patch by Martin Panter. +- bpo-23411: Added DefragResult, ParseResult, SplitResult, + DefragResultBytes, ParseResultBytes, and SplitResultBytes to + urllib.parse.__all__. Patch by Martin Panter. -- Issue #23881: urllib.request.ftpwrapper constructor now closes the socket if +- bpo-23881: urllib.request.ftpwrapper constructor now closes the socket if the FTP connection failed to fix a ResourceWarning. -- Issue #23853: :meth:`socket.socket.sendall` does no more reset the socket +- bpo-23853: :meth:`socket.socket.sendall` does no more reset the socket timeout each time data is sent successfully. The socket timeout is now the maximum total duration to send all data. -- Issue #22721: An order of multiline pprint output of set or dict containing - orderable and non-orderable elements no longer depends on iteration order of - set or dict. +- bpo-22721: An order of multiline pprint output of set or dict containing + orderable and non-orderable elements no longer depends on iteration order + of set or dict. -- Issue #15133: _tkinter.tkapp.getboolean() now supports Tcl_Obj and always - returns bool. tkinter.BooleanVar now validates input values (accepted bool, - int, str, and Tcl_Obj). tkinter.BooleanVar.get() now always returns bool. +- bpo-15133: _tkinter.tkapp.getboolean() now supports Tcl_Obj and always + returns bool. tkinter.BooleanVar now validates input values (accepted + bool, int, str, and Tcl_Obj). tkinter.BooleanVar.get() now always returns + bool. -- Issue #10590: xml.sax.parseString() now supports string argument. +- bpo-10590: xml.sax.parseString() now supports string argument. -- Issue #23338: Fixed formatting ctypes error messages on Cygwin. - Patch by Makoto Kato. +- bpo-23338: Fixed formatting ctypes error messages on Cygwin. Patch by + Makoto Kato. -- Issue #15582: inspect.getdoc() now follows inheritance chains. +- bpo-15582: inspect.getdoc() now follows inheritance chains. -- Issue #2175: SAX parsers now support a character stream of InputSource object. +- bpo-2175: SAX parsers now support a character stream of InputSource + object. -- Issue #16840: Tkinter now supports 64-bit integers added in Tcl 8.4 and +- bpo-16840: Tkinter now supports 64-bit integers added in Tcl 8.4 and arbitrary precision integers added in Tcl 8.5. -- Issue #23834: Fix socket.sendto(), use the C Py_ssize_t type to store the +- bpo-23834: Fix socket.sendto(), use the C Py_ssize_t type to store the result of sendto() instead of the C int type. -- Issue #23618: :meth:`socket.socket.connect` now waits until the connection +- bpo-23618: :meth:`socket.socket.connect` now waits until the connection completes instead of raising :exc:`InterruptedError` if the connection is interrupted by signals, signal handlers don't raise an exception and the socket is blocking or has a timeout. :meth:`socket.socket.connect` still raise :exc:`InterruptedError` for non-blocking sockets. -- Issue #21526: Tkinter now supports new boolean type in Tcl 8.5. +- bpo-21526: Tkinter now supports new boolean type in Tcl 8.5. -- Issue #23836: Fix the faulthandler module to handle reentrant calls to - its signal handlers. +- bpo-23836: Fix the faulthandler module to handle reentrant calls to its + signal handlers. -- Issue #23838: linecache now clears the cache and returns an empty result on +- bpo-23838: linecache now clears the cache and returns an empty result on MemoryError. -- Issue #10395: Added os.path.commonpath(). Implemented in posixpath and ntpath. - Based on patch by Rafik Draoui. +- bpo-10395: Added os.path.commonpath(). Implemented in posixpath and + ntpath. Based on patch by Rafik Draoui. -- Issue #23611: Serializing more "lookupable" objects (such as unbound methods +- bpo-23611: Serializing more "lookupable" objects (such as unbound methods or nested classes) now are supported with pickle protocols < 4. -- Issue #13583: sqlite3.Row now supports slice indexing. +- bpo-13583: sqlite3.Row now supports slice indexing. -- Issue #18473: Fixed 2to3 and 3to2 compatible pickle mappings. Fixed - ambigious reverse mappings. Added many new mappings. Import mapping is no - longer applied to modules already mapped with full name mapping. +- bpo-18473: Fixed 2to3 and 3to2 compatible pickle mappings. Fixed + ambigious reverse mappings. Added many new mappings. Import mapping is + no longer applied to modules already mapped with full name mapping. -- Issue #23485: select.select() is now retried automatically with the - recomputed timeout when interrupted by a signal, except if the signal handler - raises an exception. This change is part of the PEP 475. +- bpo-23485: select.select() is now retried automatically with the + recomputed timeout when interrupted by a signal, except if the signal + handler raises an exception. This change is part of the PEP 475. -- Issue #23752: When built from an existing file descriptor, io.FileIO() now +- bpo-23752: When built from an existing file descriptor, io.FileIO() now only calls fstat() once. Before fstat() was called twice, which was not necessary. -- Issue #23704: collections.deque() objects now support __add__, __mul__, and +- bpo-23704: collections.deque() objects now support __add__, __mul__, and __imul__(). -- Issue #23171: csv.Writer.writerow() now supports arbitrary iterables. +- bpo-23171: csv.Writer.writerow() now supports arbitrary iterables. -- Issue #23745: The new email header parser now handles duplicate MIME +- bpo-23745: The new email header parser now handles duplicate MIME parameter names without error, similar to how get_param behaves. -- Issue #22117: Fix os.utime(), it now rounds the timestamp towards minus +- bpo-22117: Fix os.utime(), it now rounds the timestamp towards minus infinity (-inf) instead of rounding towards zero. -- Issue #23310: Fix MagicMock's initializer to work with __methods__, just - like configure_mock(). Patch by Kasia Jachim. +- bpo-23310: Fix MagicMock's initializer to work with __methods__, just like + configure_mock(). Patch by Kasia Jachim. Build ----- -- Issue #23817: FreeBSD now uses "1.0" in the SOVERSION as other operating +- bpo-23817: FreeBSD now uses "1.0" in the SOVERSION as other operating systems, instead of just "1". -- Issue #23501: Argument Clinic now generates code into separate files by default. +- bpo-23501: Argument Clinic now generates code into separate files by + default. Tests ----- -- Issue #23799: Added test.support.start_threads() for running and - cleaning up multiple threads. +- bpo-23799: Added test.support.start_threads() for running and cleaning up + multiple threads. -- Issue #22390: test.regrtest now emits a warning if temporary files or +- bpo-22390: test.regrtest now emits a warning if temporary files or directories are left after running a test. Tools/Demos ----------- -- Issue #18128: pygettext now uses standard +NNNN format in the - POT-Creation-Date header. +- bpo-18128: pygettext now uses standard +NNNN format in the POT-Creation- + Date header. -- Issue #23935: Argument Clinic's understanding of format units - accepting bytes, bytearrays, and buffers is now consistent with - both the documentation and the implementation. +- bpo-23935: Argument Clinic's understanding of format units accepting + bytes, bytearrays, and buffers is now consistent with both the + documentation and the implementation. -- Issue #23944: Argument Clinic now wraps long impl prototypes at column 78. +- bpo-23944: Argument Clinic now wraps long impl prototypes at column 78. -- Issue #20586: Argument Clinic now ensures that functions without docstrings +- bpo-20586: Argument Clinic now ensures that functions without docstrings have signatures. -- Issue #23492: Argument Clinic now generates argument parsing code with +- bpo-23492: Argument Clinic now generates argument parsing code with PyArg_Parse instead of PyArg_ParseTuple if possible. -- Issue #23500: Argument Clinic is now smarter about generating the "#ifndef" +- bpo-23500: Argument Clinic is now smarter about generating the "#ifndef" (empty) definition of the methoddef macro: it's only generated once, even - if Argument Clinic processes the same symbol multiple times, and it's emitted - at the end of all processing rather than immediately after the first use. + if Argument Clinic processes the same symbol multiple times, and it's + emitted at the end of all processing rather than immediately after the + first use. C API ----- -- Issue #23998: PyImport_ReInitLock() now checks for lock allocation error +- bpo-23998: PyImport_ReInitLock() now checks for lock allocation error What's New in Python 3.5.0 alpha 3? =================================== -Release date: 2015-03-28 +*Release date: 2015-03-28* Core and Builtins ----------------- -- Issue #23573: Increased performance of string search operations (str.find, +- bpo-23573: Increased performance of string search operations (str.find, str.index, str.count, the in operator, str.split, str.partition) with arguments of different kinds (UCS1, UCS2, UCS4). -- Issue #23753: Python doesn't support anymore platforms without stat() or +- bpo-23753: Python doesn't support anymore platforms without stat() or fstat(), these functions are always required. -- Issue #23681: The -b option now affects comparisons of bytes with int. +- bpo-23681: The -b option now affects comparisons of bytes with int. -- Issue #23632: Memoryviews now allow tuple indexing (including for - multi-dimensional memoryviews). +- bpo-23632: Memoryviews now allow tuple indexing (including for multi- + dimensional memoryviews). -- Issue #23192: Fixed generator lambdas. Patch by Bruno Cauet. +- bpo-23192: Fixed generator lambdas. Patch by Bruno Cauet. -- Issue #23629: Fix the default __sizeof__ implementation for variable-sized +- bpo-23629: Fix the default __sizeof__ implementation for variable-sized objects. Library ------- -- Issue #14260: The groupindex attribute of regular expression pattern object - now is non-modifiable mapping. +- bpo-14260: The groupindex attribute of regular expression pattern object + now is non- modifiable mapping. -- Issue #23792: Ignore KeyboardInterrupt when the pydoc pager is active. - This mimics the behavior of the standard unix pagers, and prevents - pipepager from shutting down while the pager itself is still running. +- bpo-23792: Ignore KeyboardInterrupt when the pydoc pager is active. This + mimics the behavior of the standard unix pagers, and prevents pipepager + from shutting down while the pager itself is still running. -- Issue #23775: pprint() of OrderedDict now outputs the same representation - as repr(). +- bpo-23775: pprint() of OrderedDict now outputs the same representation as + repr(). -- Issue #23765: Removed IsBadStringPtr calls in ctypes +- bpo-23765: Removed IsBadStringPtr calls in ctypes -- Issue #22364: Improved some re error messages using regex for hints. +- bpo-22364: Improved some re error messages using regex for hints. -- Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes. +- bpo-23742: ntpath.expandvars() no longer loses unbalanced single quotes. -- Issue #21717: The zipfile.ZipFile.open function now supports 'x' (exclusive +- bpo-21717: The zipfile.ZipFile.open function now supports 'x' (exclusive creation) mode. -- Issue #21802: The reader in BufferedRWPair now is closed even when closing +- bpo-21802: The reader in BufferedRWPair now is closed even when closing writer failed in BufferedRWPair.close(). -- Issue #23622: Unknown escapes in regular expressions that consist of ``'\'`` +- bpo-23622: Unknown escapes in regular expressions that consist of ``'\'`` and ASCII letter now raise a deprecation warning and will be forbidden in Python 3.6. -- Issue #23671: string.Template now allows specifying the "self" parameter as - a keyword argument. string.Formatter now allows specifying the "self" and +- bpo-23671: string.Template now allows specifying the "self" parameter as a + keyword argument. string.Formatter now allows specifying the "self" and the "format_string" parameters as keyword arguments. -- Issue #23502: The pprint module now supports mapping proxies. +- bpo-23502: The pprint module now supports mapping proxies. -- Issue #17530: pprint now wraps long bytes objects and bytearrays. +- bpo-17530: pprint now wraps long bytes objects and bytearrays. -- Issue #22687: Fixed some corner cases in breaking words in tetxtwrap. - Got rid of quadratic complexity in breaking long words. +- bpo-22687: Fixed some corner cases in breaking words in tetxtwrap. Got rid + of quadratic complexity in breaking long words. -- Issue #4727: The copy module now uses pickle protocol 4 (PEP 3154) and +- bpo-4727: The copy module now uses pickle protocol 4 (PEP 3154) and supports copying of instances of classes whose __new__ method takes keyword-only arguments. -- Issue #23491: Added a zipapp module to support creating executable zip - file archives of Python code. Registered ".pyz" and ".pyzw" extensions - on Windows for these archives (PEP 441). +- bpo-23491: Added a zipapp module to support creating executable zip file + archives of Python code. Registered ".pyz" and ".pyzw" extensions on + Windows for these archives (PEP 441). -- Issue #23657: Avoid explicit checks for str in zipapp, adding support - for pathlib.Path objects as arguments. +- bpo-23657: Avoid explicit checks for str in zipapp, adding support for + pathlib.Path objects as arguments. -- Issue #23688: Added support of arbitrary bytes-like objects and avoided - unnecessary copying of memoryview in gzip.GzipFile.write(). - Original patch by Wolfgang Maier. +- bpo-23688: Added support of arbitrary bytes-like objects and avoided + unnecessary copying of memoryview in gzip.GzipFile.write(). Original patch + by Wolfgang Maier. -- Issue #23252: Added support for writing ZIP files to unseekable streams. +- bpo-23252: Added support for writing ZIP files to unseekable streams. -- Issue #23647: Increase impalib's MAXLINE to accommodate modern mailbox sizes. +- bpo-23647: Increase impalib's MAXLINE to accommodate modern mailbox sizes. -- Issue #23539: If body is None, http.client.HTTPConnection.request now sets - Content-Length to 0 for PUT, POST, and PATCH headers to avoid 411 errors from - some web servers. +- bpo-23539: If body is None, http.client.HTTPConnection.request now sets + Content-Length to 0 for PUT, POST, and PATCH headers to avoid 411 errors + from some web servers. -- Issue #22351: The nntplib.NNTP constructor no longer leaves the connection +- bpo-22351: The nntplib.NNTP constructor no longer leaves the connection and socket open until the garbage collector cleans them up. Patch by Martin Panter. -- Issue #23704: collections.deque() objects now support methods for index(), +- bpo-23704: collections.deque() objects now support methods for index(), insert(), and copy(). This allows deques to be registered as a MutableSequence and it improves their substitutability for lists. -- Issue #23715: :func:`signal.sigwaitinfo` and :func:`signal.sigtimedwait` are +- bpo-23715: :func:`signal.sigwaitinfo` and :func:`signal.sigtimedwait` are now retried when interrupted by a signal not in the *sigset* parameter, if the signal handler does not raise an exception. signal.sigtimedwait() recomputes the timeout with a monotonic clock when it is retried. -- Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and +- bpo-23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and codecs, that accepted only read-only bytes-like object now accept writable bytes-like object too. -- Issue #23646: If time.sleep() is interrupted by a signal, the sleep is now +- bpo-23646: If time.sleep() is interrupted by a signal, the sleep is now retried with the recomputed delay, except if the signal handler raises an exception (PEP 475). -- Issue #23136: _strptime now uniformly handles all days in week 0, including +- bpo-23136: _strptime now uniformly handles all days in week 0, including Dec 30 of previous year. Based on patch by Jim Carroll. -- Issue #23700: Iterator of NamedTemporaryFile now keeps a reference to +- bpo-23700: Iterator of NamedTemporaryFile now keeps a reference to NamedTemporaryFile instance. Patch by Bohuslav Kabrda. -- Issue #22903: The fake test case created by unittest.loader when it fails +- bpo-22903: The fake test case created by unittest.loader when it fails importing a test module is now picklable. -- Issue #22181: On Linux, os.urandom() now uses the new getrandom() syscall if - available, syscall introduced in the Linux kernel 3.17. It is more reliable - and more secure, because it avoids the need of a file descriptor and waits - until the kernel has enough entropy. +- bpo-22181: On Linux, os.urandom() now uses the new getrandom() syscall if + available, syscall introduced in the Linux kernel 3.17. It is more + reliable and more secure, because it avoids the need of a file descriptor + and waits until the kernel has enough entropy. -- Issue #2211: Updated the implementation of the http.cookies.Morsel class. +- bpo-2211: Updated the implementation of the http.cookies.Morsel class. Setting attributes key, value and coded_value directly now is deprecated. update() and setdefault() now transform and check keys. Comparing for equality now takes into account attributes key, value and coded_value. - copy() now returns a Morsel, not a dict. repr() now contains all attributes. - Optimized checking keys and quoting values. Added new tests. + copy() now returns a Morsel, not a dict. repr() now contains all + attributes. Optimized checking keys and quoting values. Added new tests. Original patch by Demian Brecht. -- Issue #18983: Allow selection of output units in timeit. - Patch by Julian Gindi. +- bpo-18983: Allow selection of output units in timeit. Patch by Julian + Gindi. -- Issue #23631: Fix traceback.format_list when a traceback has been mutated. +- bpo-23631: Fix traceback.format_list when a traceback has been mutated. -- Issue #23568: Add rdivmod support to MagicMock() objects. - Patch by Håkan Lövdahl. +- bpo-23568: Add rdivmod support to MagicMock() objects. Patch by Håkan + Lövdahl. -- Issue #2052: Add charset parameter to HtmlDiff.make_file(). +- bpo-2052: Add charset parameter to HtmlDiff.make_file(). -- Issue #23668: Support os.truncate and os.ftruncate on Windows. +- bpo-23668: Support os.truncate and os.ftruncate on Windows. -- Issue #23138: Fixed parsing cookies with absent keys or values in cookiejar. +- bpo-23138: Fixed parsing cookies with absent keys or values in cookiejar. Patch by Demian Brecht. -- Issue #23051: multiprocessing.Pool methods imap() and imap_unordered() now +- bpo-23051: multiprocessing.Pool methods imap() and imap_unordered() now handle exceptions raised by an iterator. Patch by Alon Diamant and Davin Potts. -- Issue #23581: Add matmul support to MagicMock. Patch by Håkan Lövdahl. +- bpo-23581: Add matmul support to MagicMock. Patch by Håkan Lövdahl. -- Issue #23566: enable(), register(), dump_traceback() and +- bpo-23566: enable(), register(), dump_traceback() and dump_traceback_later() functions of faulthandler now accept file descriptors. Patch by Wei Wu. -- Issue #22928: Disabled HTTP header injections in http.client. - Original patch by Demian Brecht. +- bpo-22928: Disabled HTTP header injections in http.client. Original patch + by Demian Brecht. -- Issue #23615: Modules bz2, tarfile and tokenize now can be reloaded with - imp.reload(). Patch by Thomas Kluyver. +- bpo-23615: Modules bz2, tarfile and tokenize now can be reloaded with + imp.reload(). Patch by Thomas Kluyver. -- Issue #23605: os.walk() now calls os.scandir() instead of os.listdir(). - The usage of os.scandir() reduces the number of calls to os.stat(). - Initial patch written by Ben Hoyt. +- bpo-23605: os.walk() now calls os.scandir() instead of os.listdir(). The + usage of os.scandir() reduces the number of calls to os.stat(). Initial + patch written by Ben Hoyt. Build ----- -- Issue #23585: make patchcheck will ensure the interpreter is built. +- bpo-23585: make patchcheck will ensure the interpreter is built. Tests ----- -- Issue #23583: Added tests for standard IO streams in IDLE. +- bpo-23583: Added tests for standard IO streams in IDLE. -- Issue #22289: Prevent test_urllib2net failures due to ftp connection timeout. +- bpo-22289: Prevent test_urllib2net failures due to ftp connection timeout. Tools/Demos ----------- -- Issue #22826: The result of open() in Tools/freeze/bkfile.py is now better +- bpo-22826: The result of open() in Tools/freeze/bkfile.py is now better compatible with regular files (in particular it now supports the context management protocol). -What's New in Python 3.5 alpha 2? -================================= +What's New in Python 3.5.0 alpha 2? +=================================== -Release date: 2015-03-09 +*Release date: 2015-03-09* Core and Builtins ----------------- -- Issue #23571: PyObject_Call() and PyCFunction_Call() now raise a SystemError +- bpo-23571: PyObject_Call() and PyCFunction_Call() now raise a SystemError if a function returns a result and raises an exception. The SystemError is chained to the previous exception. Library ------- -- Issue #22524: New os.scandir() function, part of the PEP 471: "os.scandir() +- bpo-22524: New os.scandir() function, part of the PEP 471: "os.scandir() function -- a better and faster directory iterator". Patch written by Ben Hoyt. -- Issue #23103: Reduced the memory consumption of IPv4Address and IPv6Address. +- bpo-23103: Reduced the memory consumption of IPv4Address and IPv6Address. -- Issue #21793: BaseHTTPRequestHandler again logs response code as numeric, - not as stringified enum. Patch by Demian Brecht. +- bpo-21793: BaseHTTPRequestHandler again logs response code as numeric, not + as stringified enum. Patch by Demian Brecht. -- Issue #23476: In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST +- bpo-23476: In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST flag on certificate stores when it is available. -- Issue #23576: Avoid stalling in SSL reads when EOF has been reached in the +- bpo-23576: Avoid stalling in SSL reads when EOF has been reached in the SSL layer but the underlying connection hasn't been closed. -- Issue #23504: Added an __all__ to the types module. +- bpo-23504: Added an __all__ to the types module. -- Issue #23563: Optimized utility functions in urllib.parse. +- bpo-23563: Optimized utility functions in urllib.parse. -- Issue #7830: Flatten nested functools.partial. +- bpo-7830: Flatten nested functools.partial. -- Issue #20204: Added the __module__ attribute to _tkinter classes. +- bpo-20204: Added the __module__ attribute to _tkinter classes. -- Issue #19980: Improved help() for non-recognized strings. help('') now - shows the help on str. help('help') now shows the help on help(). - Original patch by Mark Lawrence. +- bpo-19980: Improved help() for non-recognized strings. help('') now shows + the help on str. help('help') now shows the help on help(). Original + patch by Mark Lawrence. -- Issue #23521: Corrected pure python implementation of timedelta division. +- bpo-23521: Corrected pure python implementation of timedelta division. - * Eliminated OverflowError from timedelta * float for some floats; - * Corrected rounding in timedlta true division. + Eliminated OverflowError from ``timedelta * float`` for some floats; + Corrected rounding in timedlta true division. -- Issue #21619: Popen objects no longer leave a zombie after exit in the with +- bpo-21619: Popen objects no longer leave a zombie after exit in the with statement if the pipe was broken. Patch by Martin Panter. -- Issue #22936: Make it possible to show local variables in tracebacks for - both the traceback module and unittest. +- bpo-22936: Make it possible to show local variables in tracebacks for both + the traceback module and unittest. -- Issue #15955: Add an option to limit the output size in bz2.decompress(). +- bpo-15955: Add an option to limit the output size in bz2.decompress(). Patch by Nikolaus Rath. -- Issue #6639: Module-level turtle functions no longer raise TclError after +- bpo-6639: Module-level turtle functions no longer raise TclError after closing the window. -- Issues #814253, #9179: Group references and conditional group references now - work in lookbehind assertions in regular expressions. +- bpo-814253: Group references and conditional group references now work in + lookbehind assertions in regular expressions. (See also: bpo-9179) -- Issue #23215: Multibyte codecs with custom error handlers that ignores errors - consumed too much memory and raised SystemError or MemoryError. - Original patch by Aleksi Torhamo. +- bpo-23215: Multibyte codecs with custom error handlers that ignores errors + consumed too much memory and raised SystemError or MemoryError. Original + patch by Aleksi Torhamo. -- Issue #5700: io.FileIO() called flush() after closing the file. - flush() was not called in close() if closefd=False. +- bpo-5700: io.FileIO() called flush() after closing the file. flush() was + not called in close() if closefd=False. -- Issue #23374: Fixed pydoc failure with non-ASCII files when stdout encoding +- bpo-23374: Fixed pydoc failure with non-ASCII files when stdout encoding differs from file system encoding (e.g. on Mac OS). -- Issue #23481: Remove RC4 from the SSL module's default cipher list. +- bpo-23481: Remove RC4 from the SSL module's default cipher list. -- Issue #21548: Fix pydoc.synopsis() and pydoc.apropos() on modules with empty +- bpo-21548: Fix pydoc.synopsis() and pydoc.apropos() on modules with empty docstrings. -- Issue #22885: Fixed arbitrary code execution vulnerability in the dbm.dumb - module. Original patch by Claudiu Popa. +- bpo-22885: Fixed arbitrary code execution vulnerability in the dbm.dumb + module. Original patch by Claudiu Popa. -- Issue #23239: ssl.match_hostname() now supports matching of IP addresses. +- bpo-23239: ssl.match_hostname() now supports matching of IP addresses. -- Issue #23146: Fix mishandling of absolute Windows paths with forward - slashes in pathlib. +- bpo-23146: Fix mishandling of absolute Windows paths with forward slashes + in pathlib. -- Issue #23096: Pickle representation of floats with protocol 0 now is the same +- bpo-23096: Pickle representation of floats with protocol 0 now is the same for both Python and C implementations. -- Issue #19105: pprint now more efficiently uses free space at the right. +- bpo-19105: pprint now more efficiently uses free space at the right. -- Issue #14910: Add allow_abbrev parameter to argparse.ArgumentParser. Patch by +- bpo-14910: Add allow_abbrev parameter to argparse.ArgumentParser. Patch by Jonathan Paugh, Steven Bethard, paul j3 and Daniel Eriksson. -- Issue #21717: tarfile.open() now supports 'x' (exclusive creation) mode. +- bpo-21717: tarfile.open() now supports 'x' (exclusive creation) mode. -- Issue #23344: marshal.dumps() is now 20-25% faster on average. +- bpo-23344: marshal.dumps() is now 20-25% faster on average. -- Issue #20416: marshal.dumps() with protocols 3 and 4 is now 40-50% faster on +- bpo-20416: marshal.dumps() with protocols 3 and 4 is now 40-50% faster on average. -- Issue #23421: Fixed compression in tarfile CLI. Patch by wdv4758h. +- bpo-23421: Fixed compression in tarfile CLI. Patch by wdv4758h. -- Issue #23367: Fix possible overflows in the unicodedata module. +- bpo-23367: Fix possible overflows in the unicodedata module. -- Issue #23361: Fix possible overflow in Windows subprocess creation code. +- bpo-23361: Fix possible overflow in Windows subprocess creation code. - logging.handlers.QueueListener now takes a respect_handler_level keyword - argument which, if set to True, will pass messages to handlers taking handler - levels into account. + argument which, if set to True, will pass messages to handlers taking + handler levels into account. -- Issue #19705: turtledemo now has a visual sorting algorithm demo. Original +- bpo-19705: turtledemo now has a visual sorting algorithm demo. Original patch from Jason Yeo. -- Issue #23801: Fix issue where cgi.FieldStorage did not always ignore the +- bpo-23801: Fix issue where cgi.FieldStorage did not always ignore the entire preamble to a multipart body. Build ----- -- Issue #23445: pydebug builds now use "gcc -Og" where possible, to make - the resulting executable faster. +- bpo-23445: pydebug builds now use "gcc -Og" where possible, to make the + resulting executable faster. -- Issue #23686: Update OS X 10.5 installer build to use OpenSSL 1.0.2a. +- bpo-23686: Update OS X 10.5 installer build to use OpenSSL 1.0.2a. C API ----- -- Issue #20204: Deprecation warning is now raised for builtin types without the +- bpo-20204: Deprecation warning is now raised for builtin types without the __module__ attribute. Windows ------- -- Issue #23465: Implement PEP 486 - Make the Python Launcher aware of virtual +- bpo-23465: Implement PEP 486 - Make the Python Launcher aware of virtual environments. Patch by Paul Moore. -- Issue #23437: Make user scripts directory versioned on Windows. Patch by Paul +- bpo-23437: Make user scripts directory versioned on Windows. Patch by Paul Moore. -What's New in Python 3.5 alpha 1? -================================= +What's New in Python 3.5.0 alpha 1? +=================================== -Release date: 2015-02-08 +*Release date: 2015-02-08* Core and Builtins ----------------- -- Issue #23285: PEP 475 - EINTR handling. +- bpo-23285: PEP 475 - EINTR handling. -- Issue #22735: Fix many edge cases (including crashes) involving custom mro() +- bpo-22735: Fix many edge cases (including crashes) involving custom mro() implementations. -- Issue #22896: Avoid using PyObject_AsCharBuffer(), PyObject_AsReadBuffer() +- bpo-22896: Avoid using PyObject_AsCharBuffer(), PyObject_AsReadBuffer() and PyObject_AsWriteBuffer(). -- Issue #21295: Revert some changes (issue #16795) to AST line numbers and +- bpo-21295: Revert some changes (issue #16795) to AST line numbers and column offsets that constituted a regression. -- Issue #22986: Allow changing an object's __class__ between a dynamic type and +- bpo-22986: Allow changing an object's __class__ between a dynamic type and static type in some cases. -- Issue #15859: PyUnicode_EncodeFSDefault(), PyUnicode_EncodeMBCS() and +- bpo-15859: PyUnicode_EncodeFSDefault(), PyUnicode_EncodeMBCS() and PyUnicode_EncodeCodePage() now raise an exception if the object is not a - Unicode object. For PyUnicode_EncodeFSDefault(), it was already the case on - platforms other than Windows. Patch written by Campbell Barton. + Unicode object. For PyUnicode_EncodeFSDefault(), it was already the case + on platforms other than Windows. Patch written by Campbell Barton. -- Issue #21408: The default __ne__() now returns NotImplemented if __eq__() +- bpo-21408: The default __ne__() now returns NotImplemented if __eq__() returned NotImplemented. Original patch by Martin Panter. -- Issue #23321: Fixed a crash in str.decode() when error handler returned +- bpo-23321: Fixed a crash in str.decode() when error handler returned replacment string longer than mailformed input data. -- Issue #22286: The "backslashreplace" error handlers now works with - decoding and translating. +- bpo-22286: The "backslashreplace" error handlers now works with decoding + and translating. -- Issue #23253: Delay-load ShellExecute[AW] in os.startfile for reduced - startup overhead on Windows. +- bpo-23253: Delay-load ShellExecute[AW] in os.startfile for reduced startup + overhead on Windows. -- Issue #22038: pyatomic.h now uses stdatomic.h or GCC built-in functions for - atomic memory access if available. Patch written by Vitor de Lima and Gustavo - Temple. +- bpo-22038: pyatomic.h now uses stdatomic.h or GCC built-in functions for + atomic memory access if available. Patch written by Vitor de Lima and + Gustavo Temple. -- Issue #20284: %-interpolation (aka printf) formatting added for bytes and +- bpo-20284: %-interpolation (aka printf) formatting added for bytes and bytearray. -- Issue #23048: Fix jumping out of an infinite while loop in the pdb. +- bpo-23048: Fix jumping out of an infinite while loop in the pdb. -- Issue #20335: bytes constructor now raises TypeError when encoding or errors +- bpo-20335: bytes constructor now raises TypeError when encoding or errors is specified with non-string argument. Based on patch by Renaud Blanch. -- Issue #22834: If the current working directory ends up being set to a - non-existent directory then import will no longer raise FileNotFoundError. +- bpo-22834: If the current working directory ends up being set to a non- + existent directory then import will no longer raise FileNotFoundError. -- Issue #22869: Move the interpreter startup & shutdown code to a new - dedicated pylifecycle.c module +- bpo-22869: Move the interpreter startup & shutdown code to a new dedicated + pylifecycle.c module -- Issue #22847: Improve method cache efficiency. +- bpo-22847: Improve method cache efficiency. -- Issue #22335: Fix crash when trying to enlarge a bytearray to 0x7fffffff +- bpo-22335: Fix crash when trying to enlarge a bytearray to 0x7fffffff bytes on a 32-bit platform. -- Issue #22653: Fix an assertion failure in debug mode when doing a reentrant +- bpo-22653: Fix an assertion failure in debug mode when doing a reentrant dict insertion in debug mode. -- Issue #22643: Fix integer overflow in Unicode case operations (upper, lower, +- bpo-22643: Fix integer overflow in Unicode case operations (upper, lower, title, swapcase, casefold). -- Issue #17636: Circular imports involving relative imports are now - supported. +- bpo-17636: Circular imports involving relative imports are now supported. -- Issue #22604: Fix assertion error in debug mode when dividing a complex +- bpo-22604: Fix assertion error in debug mode when dividing a complex number by (nan+0j). -- Issue #21052: Do not raise ImportWarning when sys.path_hooks or sys.meta_path +- bpo-21052: Do not raise ImportWarning when sys.path_hooks or sys.meta_path are set to None. -- Issue #16518: Use 'bytes-like object required' in error messages that +- bpo-16518: Use 'bytes-like object required' in error messages that previously used the far more cryptic "'x' does not support the buffer protocol. -- Issue #22470: Fixed integer overflow issues in "backslashreplace", +- bpo-22470: Fixed integer overflow issues in "backslashreplace", "xmlcharrefreplace", and "surrogatepass" error handlers. -- Issue #22540: speed up `PyObject_IsInstance` and `PyObject_IsSubclass` in the +- bpo-22540: speed up `PyObject_IsInstance` and `PyObject_IsSubclass` in the common case that the second argument has metaclass `type`. -- Issue #18711: Add a new `PyErr_FormatV` function, similar to `PyErr_Format` +- bpo-18711: Add a new `PyErr_FormatV` function, similar to `PyErr_Format` but accepting a `va_list` argument. -- Issue #22520: Fix overflow checking when generating the repr of a unicode +- bpo-22520: Fix overflow checking when generating the repr of a unicode object. -- Issue #22519: Fix overflow checking in PyBytes_Repr. +- bpo-22519: Fix overflow checking in PyBytes_Repr. -- Issue #22518: Fix integer overflow issues in latin-1 encoding. +- bpo-22518: Fix integer overflow issues in latin-1 encoding. -- Issue #16324: _charset parameter of MIMEText now also accepts +- bpo-16324: _charset parameter of MIMEText now also accepts email.charset.Charset instances. Initial patch by Claude Paroz. -- Issue #1764286: Fix inspect.getsource() to support decorated functions. - Patch by Claudiu Popa. +- bpo-1764286: Fix inspect.getsource() to support decorated functions. Patch + by Claudiu Popa. -- Issue #18554: os.__all__ includes posix functions. +- bpo-18554: os.__all__ includes posix functions. -- Issue #21391: Use os.path.abspath in the shutil module. +- bpo-21391: Use os.path.abspath in the shutil module. -- Issue #11471: avoid generating a JUMP_FORWARD instruction at the end of - an if-block if there is no else-clause. Original patch by Eugene Toder. +- bpo-11471: avoid generating a JUMP_FORWARD instruction at the end of an + if-block if there is no else-clause. Original patch by Eugene Toder. -- Issue #22215: Now ValueError is raised instead of TypeError when str or bytes +- bpo-22215: Now ValueError is raised instead of TypeError when str or bytes argument contains not permitted null character or byte. -- Issue #22258: Fix the internal function set_inheritable() on Illumos. - This platform exposes the function ``ioctl(FIOCLEX)``, but calling it fails +- bpo-22258: Fix the internal function set_inheritable() on Illumos. This + platform exposes the function ``ioctl(FIOCLEX)``, but calling it fails with errno is ENOTTY: "Inappropriate ioctl for device". set_inheritable() - now falls back to the slower ``fcntl()`` (``F_GETFD`` and then ``F_SETFD``). + now falls back to the slower ``fcntl()`` (``F_GETFD`` and then + ``F_SETFD``). -- Issue #21389: Displaying the __qualname__ of the underlying function in the +- bpo-21389: Displaying the __qualname__ of the underlying function in the repr of a bound method. -- Issue #22206: Using pthread, PyThread_create_key() now sets errno to ENOMEM +- bpo-22206: Using pthread, PyThread_create_key() now sets errno to ENOMEM and returns -1 (error) on integer overflow. -- Issue #20184: Argument Clinic based signature introspection added for - 30 of the builtin functions. +- bpo-20184: Argument Clinic based signature introspection added for 30 of + the builtin functions. -- Issue #22116: C functions and methods (of the 'builtin_function_or_method' +- bpo-22116: C functions and methods (of the 'builtin_function_or_method' type) can now be weakref'ed. Patch by Wei Wu. -- Issue #22077: Improve index error messages for bytearrays, bytes, lists, - and tuples by adding 'or slices'. Added ', not ' for bytearrays. +- bpo-22077: Improve index error messages for bytearrays, bytes, lists, and + tuples by adding 'or slices'. Added ', not ' for bytearrays. Original patch by Claudiu Popa. -- Issue #20179: Apply Argument Clinic to bytes and bytearray. - Patch by Tal Einat. +- bpo-20179: Apply Argument Clinic to bytes and bytearray. Patch by Tal + Einat. -- Issue #22082: Clear interned strings in slotdefs. +- bpo-22082: Clear interned strings in slotdefs. - Upgrade Unicode database to Unicode 7.0.0. -- Issue #21897: Fix a crash with the f_locals attribute with closure - variables when frame.clear() has been called. +- bpo-21897: Fix a crash with the f_locals attribute with closure variables + when frame.clear() has been called. -- Issue #21205: Add a new ``__qualname__`` attribute to generator, the +- bpo-21205: Add a new ``__qualname__`` attribute to generator, the qualified name, and use it in the representation of a generator - (``repr(gen)``). The default name of the generator (``__name__`` attribute) - is now get from the function instead of the code. Use ``gen.gi_code.co_name`` - to get the name of the code. + (``repr(gen)``). The default name of the generator (``__name__`` + attribute) is now get from the function instead of the code. Use + ``gen.gi_code.co_name`` to get the name of the code. -- Issue #21669: With the aid of heuristics in SyntaxError.__init__, the - parser now attempts to generate more meaningful (or at least more search - engine friendly) error messages when "exec" and "print" are used as - statements. +- bpo-21669: With the aid of heuristics in SyntaxError.__init__, the parser + now attempts to generate more meaningful (or at least more search engine + friendly) error messages when "exec" and "print" are used as statements. -- Issue #21642: In the conditional if-else expression, allow an integer written - with no space between itself and the ``else`` keyword (e.g. ``True if 42else - False``) to be valid syntax. +- bpo-21642: In the conditional if-else expression, allow an integer written + with no space between itself and the ``else`` keyword (e.g. ``True if + 42else False``) to be valid syntax. -- Issue #21523: Fix over-pessimistic computation of the stack effect of - some opcodes in the compiler. This also fixes a quadratic compilation - time issue noticeable when compiling code with a large number of "and" - and "or" operators. +- bpo-21523: Fix over-pessimistic computation of the stack effect of some + opcodes in the compiler. This also fixes a quadratic compilation time + issue noticeable when compiling code with a large number of "and" and "or" + operators. -- Issue #21418: Fix a crash in the builtin function super() when called without +- bpo-21418: Fix a crash in the builtin function super() when called without argument and without current frame (ex: embedded Python). -- Issue #21425: Fix flushing of standard streams in the interactive +- bpo-21425: Fix flushing of standard streams in the interactive interpreter. -- Issue #21435: In rare cases, when running finalizers on objects in cyclic +- bpo-21435: In rare cases, when running finalizers on objects in cyclic trash a bad pointer dereference could occur due to a subtle flaw in internal iteration logic. -- Issue #21377: PyBytes_Concat() now tries to concatenate in-place when the +- bpo-21377: PyBytes_Concat() now tries to concatenate in-place when the first argument has a reference count of 1. Patch by Nikolaus Rath. -- Issue #20355: -W command line options now have higher priority than the +- bpo-20355: -W command line options now have higher priority than the PYTHONWARNINGS environment variable. Patch by Arfrever. -- Issue #21274: Define PATH_MAX for GNU/Hurd in Python/pythonrun.c. +- bpo-21274: Define PATH_MAX for GNU/Hurd in Python/pythonrun.c. -- Issue #20904: Support setting FPU precision on m68k. +- bpo-20904: Support setting FPU precision on m68k. -- Issue #21209: Fix sending tuples to custom generator objects with the yield +- bpo-21209: Fix sending tuples to custom generator objects with the yield from syntax. -- Issue #21193: pow(a, b, c) now raises ValueError rather than TypeError when b - is negative. Patch by Josh Rosenberg. +- bpo-21193: pow(a, b, c) now raises ValueError rather than TypeError when b + is negative. Patch by Josh Rosenberg. -- PEP 465 and Issue #21176: Add the '@' operator for matrix multiplication. +- bpo-21176: PEP 465: Add the '@' operator for matrix multiplication. -- Issue #21134: Fix segfault when str is called on an uninitialized +- bpo-21134: Fix segfault when str is called on an uninitialized UnicodeEncodeError, UnicodeDecodeError, or UnicodeTranslateError object. -- Issue #19537: Fix PyUnicode_DATA() alignment under m68k. Patch by - Andreas Schwab. +- bpo-19537: Fix PyUnicode_DATA() alignment under m68k. Patch by Andreas + Schwab. -- Issue #20929: Add a type cast to avoid shifting a negative number. +- bpo-20929: Add a type cast to avoid shifting a negative number. -- Issue #20731: Properly position in source code files even if they - are opened in text mode. Patch by Serhiy Storchaka. +- bpo-20731: Properly position in source code files even if they are opened + in text mode. Patch by Serhiy Storchaka. -- Issue #20637: Key-sharing now also works for instance dictionaries of +- bpo-20637: Key-sharing now also works for instance dictionaries of subclasses. Patch by Peter Ingebretson. -- Issue #8297: Attributes missing from modules now include the module name - in the error text. Original patch by ysj.ray. +- bpo-8297: Attributes missing from modules now include the module name in + the error text. Original patch by ysj.ray. -- Issue #19995: %c, %o, %x, and %X now raise TypeError on non-integer input. +- bpo-19995: %c, %o, %x, and %X now raise TypeError on non-integer input. -- Issue #19655: The ASDL parser - used by the build process to generate code for - managing the Python AST in C - was rewritten. The new parser is self contained - and does not require to carry long the spark.py parser-generator library; - spark.py was removed from the source base. +- bpo-19655: The ASDL parser - used by the build process to generate code + for managing the Python AST in C - was rewritten. The new parser is self + contained and does not require to carry long the spark.py parser-generator + library; spark.py was removed from the source base. -- Issue #12546: Allow ``\x00`` to be used as a fill character when using str, int, - float, and complex __format__ methods. +- bpo-12546: Allow ``\x00`` to be used as a fill character when using str, + int, float, and complex __format__ methods. -- Issue #20480: Add ipaddress.reverse_pointer. Patch by Leon Weber. +- bpo-20480: Add ipaddress.reverse_pointer. Patch by Leon Weber. -- Issue #13598: Modify string.Formatter to support auto-numbering of - replacement fields. It now matches the behavior of str.format() in - this regard. Patches by Phil Elson and Ramchandra Apte. +- bpo-13598: Modify string.Formatter to support auto-numbering of + replacement fields. It now matches the behavior of str.format() in this + regard. Patches by Phil Elson and Ramchandra Apte. -- Issue #8931: Make alternate formatting ('#') for type 'c' raise an - exception. In versions prior to 3.5, '#' with 'c' had no effect. Now - specifying it is an error. Patch by Torsten Landschoff. +- bpo-8931: Make alternate formatting ('#') for type 'c' raise an exception. + In versions prior to 3.5, '#' with 'c' had no effect. Now specifying it is + an error. Patch by Torsten Landschoff. -- Issue #23165: Perform overflow checks before allocating memory in the +- bpo-23165: Perform overflow checks before allocating memory in the _Py_char2wchar function. Library ------- -- Issue #23399: pyvenv creates relative symlinks where possible. +- bpo-23399: pyvenv creates relative symlinks where possible. -- Issue #20289: cgi.FieldStorage() now supports the context management +- bpo-20289: cgi.FieldStorage() now supports the context management protocol. -- Issue #13128: Print response headers for CONNECT requests when debuglevel - > 0. Patch by Demian Brecht. +- bpo-13128: Print response headers for CONNECT requests when debuglevel > + 0. Patch by Demian Brecht. -- Issue #15381: Optimized io.BytesIO to make less allocations and copyings. +- bpo-15381: Optimized io.BytesIO to make less allocations and copyings. -- Issue #22818: Splitting on a pattern that could match an empty string now +- bpo-22818: Splitting on a pattern that could match an empty string now raises a warning. Patterns that can only match empty strings are now rejected. -- Issue #23099: Closing io.BytesIO with exported buffer is rejected now to +- bpo-23099: Closing io.BytesIO with exported buffer is rejected now to prevent corrupting exported buffer. -- Issue #23326: Removed __ne__ implementations. Since fixing default __ne__ +- bpo-23326: Removed __ne__ implementations. Since fixing default __ne__ implementation in issue #21408 they are redundant. -- Issue #23363: Fix possible overflow in itertools.permutations. +- bpo-23363: Fix possible overflow in itertools.permutations. -- Issue #23364: Fix possible overflow in itertools.product. +- bpo-23364: Fix possible overflow in itertools.product. -- Issue #23366: Fixed possible integer overflow in itertools.combinations. +- bpo-23366: Fixed possible integer overflow in itertools.combinations. -- Issue #23369: Fixed possible integer overflow in +- bpo-23369: Fixed possible integer overflow in _json.encode_basestring_ascii. -- Issue #23353: Fix the exception handling of generators in +- bpo-23353: Fix the exception handling of generators in PyEval_EvalFrameEx(). At entry, save or swap the exception state even if - PyEval_EvalFrameEx() is called with throwflag=0. At exit, the exception state - is now always restored or swapped, not only if why is WHY_YIELD or + PyEval_EvalFrameEx() is called with throwflag=0. At exit, the exception + state is now always restored or swapped, not only if why is WHY_YIELD or WHY_RETURN. Patch co-written with Antoine Pitrou. -- Issue #14099: Restored support of writing ZIP files to tellable but - non-seekable streams. +- bpo-14099: Restored support of writing ZIP files to tellable but non- + seekable streams. -- Issue #14099: Writing to ZipFile and reading multiple ZipExtFiles is +- bpo-14099: Writing to ZipFile and reading multiple ZipExtFiles is threadsafe now. -- Issue #19361: JSON decoder now raises JSONDecodeError instead of ValueError. +- bpo-19361: JSON decoder now raises JSONDecodeError instead of ValueError. -- Issue #18518: timeit now rejects statements which can't be compiled outside - a function or a loop (e.g. "return" or "break"). +- bpo-18518: timeit now rejects statements which can't be compiled outside a + function or a loop (e.g. "return" or "break"). -- Issue #23094: Fixed readline with frames in Python implementation of pickle. +- bpo-23094: Fixed readline with frames in Python implementation of pickle. -- Issue #23268: Fixed bugs in the comparison of ipaddress classes. +- bpo-23268: Fixed bugs in the comparison of ipaddress classes. -- Issue #21408: Removed incorrect implementations of __ne__() which didn't +- bpo-21408: Removed incorrect implementations of __ne__() which didn't returned NotImplemented if __eq__() returned NotImplemented. The default __ne__() now works correctly. -- Issue #19996: :class:`email.feedparser.FeedParser` now handles (malformed) +- bpo-19996: :class:`email.feedparser.FeedParser` now handles (malformed) headers with no key rather than assuming the body has started. -- Issue #20188: Support Application-Layer Protocol Negotiation (ALPN) in the ssl - module. +- bpo-20188: Support Application-Layer Protocol Negotiation (ALPN) in the + ssl module. -- Issue #23133: Pickling of ipaddress objects now produces more compact and +- bpo-23133: Pickling of ipaddress objects now produces more compact and portable representation. -- Issue #23248: Update ssl error codes from latest OpenSSL git master. +- bpo-23248: Update ssl error codes from latest OpenSSL git master. -- Issue #23266: Much faster implementation of ipaddress.collapse_addresses() +- bpo-23266: Much faster implementation of ipaddress.collapse_addresses() when there are many non-consecutive addresses. -- Issue #23098: 64-bit dev_t is now supported in the os module. +- bpo-23098: 64-bit dev_t is now supported in the os module. -- Issue #21817: When an exception is raised in a task submitted to a - ProcessPoolExecutor, the remote traceback is now displayed in the - parent process. Patch by Claudiu Popa. +- bpo-21817: When an exception is raised in a task submitted to a + ProcessPoolExecutor, the remote traceback is now displayed in the parent + process. Patch by Claudiu Popa. -- Issue #15955: Add an option to limit output size when decompressing LZMA +- bpo-15955: Add an option to limit output size when decompressing LZMA data. Patch by Nikolaus Rath and Martin Panter. -- Issue #23250: In the http.cookies module, capitalize "HttpOnly" and "Secure" +- bpo-23250: In the http.cookies module, capitalize "HttpOnly" and "Secure" as they are written in the standard. -- Issue #23063: In the disutils' check command, fix parsing of reST with code or - code-block directives. +- bpo-23063: In the disutils' check command, fix parsing of reST with code + or code-block directives. -- Issue #23209, #23225: selectors.BaseSelector.get_key() now raises a - RuntimeError if the selector is closed. And selectors.BaseSelector.close() - now clears its internal reference to the selector mapping to break a - reference cycle. Initial patch written by Martin Richard. +- bpo-23209: selectors.BaseSelector.get_key() now raises a RuntimeError if + the selector is closed. And selectors.BaseSelector.close() now clears its + internal reference to the selector mapping to break a reference cycle. + Initial patch written by Martin Richard. (See also: bpo-23225) -- Issue #17911: Provide a way to seed the linecache for a PEP-302 module +- bpo-17911: Provide a way to seed the linecache for a PEP-302 module without actually loading the code. -- Issue #17911: Provide a new object API for traceback, including the ability - to not lookup lines at all until the traceback is actually rendered, without - any trace of the original objects being kept alive. +- bpo-17911: Provide a new object API for traceback, including the ability + to not lookup lines at all until the traceback is actually rendered, + without any trace of the original objects being kept alive. -- Issue #19777: Provide a home() classmethod on Path objects. Contributed - by Victor Salgado and Mayank Tripathi. +- bpo-19777: Provide a home() classmethod on Path objects. Contributed by + Victor Salgado and Mayank Tripathi. -- Issue #23206: Make ``json.dumps(..., ensure_ascii=False)`` as fast as the +- bpo-23206: Make ``json.dumps(..., ensure_ascii=False)`` as fast as the default case of ``ensure_ascii=True``. Patch by Naoki Inada. -- Issue #23185: Add math.inf and math.nan constants. +- bpo-23185: Add math.inf and math.nan constants. -- Issue #23186: Add ssl.SSLObject.shared_ciphers() and +- bpo-23186: Add ssl.SSLObject.shared_ciphers() and ssl.SSLSocket.shared_ciphers() to fetch the client's list ciphers sent at handshake. -- Issue #23143: Remove compatibility with OpenSSLs older than 0.9.8. +- bpo-23143: Remove compatibility with OpenSSLs older than 0.9.8. -- Issue #23132: Improve performance and introspection support of comparison +- bpo-23132: Improve performance and introspection support of comparison methods created by functool.total_ordering. -- Issue #19776: Add an expanduser() method on Path objects. +- bpo-19776: Add an expanduser() method on Path objects. -- Issue #23112: Fix SimpleHTTPServer to correctly carry the query string and +- bpo-23112: Fix SimpleHTTPServer to correctly carry the query string and fragment when it redirects to add a trailing slash. -- Issue #21793: Added http.HTTPStatus enums (i.e. HTTPStatus.OK, - HTTPStatus.NOT_FOUND). Patch by Demian Brecht. +- bpo-21793: Added http.HTTPStatus enums (i.e. HTTPStatus.OK, + HTTPStatus.NOT_FOUND). Patch by Demian Brecht. -- Issue #23093: In the io, module allow more operations to work on detached +- bpo-23093: In the io, module allow more operations to work on detached streams. -- Issue #23111: In the ftplib, make ssl.PROTOCOL_SSLv23 the default protocol +- bpo-23111: In the ftplib, make ssl.PROTOCOL_SSLv23 the default protocol version. -- Issue #22585: On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(), +- bpo-22585: On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(), instead of reading /dev/urandom, to get pseudo-random bytes. -- Issue #19104: pprint now produces evaluable output for wrapped strings. +- bpo-19104: pprint now produces evaluable output for wrapped strings. -- Issue #23071: Added missing names to codecs.__all__. Patch by Martin Panter. +- bpo-23071: Added missing names to codecs.__all__. Patch by Martin Panter. -- Issue #22783: Pickling now uses the NEWOBJ opcode instead of the NEWOBJ_EX +- bpo-22783: Pickling now uses the NEWOBJ opcode instead of the NEWOBJ_EX opcode if possible. -- Issue #15513: Added a __sizeof__ implementation for pickle classes. +- bpo-15513: Added a __sizeof__ implementation for pickle classes. -- Issue #19858: pickletools.optimize() now aware of the MEMOIZE opcode, can +- bpo-19858: pickletools.optimize() now aware of the MEMOIZE opcode, can produce more compact result and no longer produces invalid output if input data contains MEMOIZE opcodes together with PUT or BINPUT opcodes. -- Issue #22095: Fixed HTTPConnection.set_tunnel with default port. The port +- bpo-22095: Fixed HTTPConnection.set_tunnel with default port. The port value in the host header was set to "None". Patch by Demian Brecht. -- Issue #23016: A warning no longer produces an AttributeError when the program +- bpo-23016: A warning no longer produces an AttributeError when the program is run with pythonw.exe. -- Issue #21775: shutil.copytree(): fix crash when copying to VFAT. An exception +- bpo-21775: shutil.copytree(): fix crash when copying to VFAT. An exception handler assumed that OSError objects always have a 'winerror' attribute. - That is not the case, so the exception handler itself raised AttributeError - when run on Linux (and, presumably, any other non-Windows OS). - Patch by Greg Ward. + That is not the case, so the exception handler itself raised + AttributeError when run on Linux (and, presumably, any other non-Windows + OS). Patch by Greg Ward. -- Issue #1218234: Fix inspect.getsource() to load updated source of - reloaded module. Initial patch by Berker Peksag. +- bpo-1218234: Fix inspect.getsource() to load updated source of reloaded + module. Initial patch by Berker Peksag. -- Issue #21740: Support wrapped callables in doctest. Patch by Claudiu Popa. +- bpo-21740: Support wrapped callables in doctest. Patch by Claudiu Popa. -- Issue #23009: Make sure selectors.EpollSelecrtor.select() works when no - FD is registered. +- bpo-23009: Make sure selectors.EpollSelecrtor.select() works when no FD is + registered. -- Issue #22959: In the constructor of http.client.HTTPSConnection, prefer the +- bpo-22959: In the constructor of http.client.HTTPSConnection, prefer the context's check_hostname attribute over the *check_hostname* parameter. -- Issue #22696: Add function :func:`sys.is_finalizing` to know about +- bpo-22696: Add function :func:`sys.is_finalizing` to know about interpreter shutdown. -- Issue #16043: Add a default limit for the amount of data xmlrpclib.gzip_decode - will return. This resolves CVE-2013-1753. +- bpo-16043: Add a default limit for the amount of data + xmlrpclib.gzip_decode will return. This resolves CVE-2013-1753. -- Issue #14099: ZipFile.open() no longer reopen the underlying file. Objects - returned by ZipFile.open() can now operate independently of the ZipFile even - if the ZipFile was created by passing in a file-like object as the first - argument to the constructor. +- bpo-14099: ZipFile.open() no longer reopen the underlying file. Objects + returned by ZipFile.open() can now operate independently of the ZipFile + even if the ZipFile was created by passing in a file-like object as the + first argument to the constructor. -- Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile is - asked to compile a source file containing multiple dots in the source file - name. +- bpo-22966: Fix __pycache__ pyc file name clobber when pyc_compile is asked + to compile a source file containing multiple dots in the source file name. -- Issue #21971: Update turtledemo doc and add module to the index. +- bpo-21971: Update turtledemo doc and add module to the index. -- Issue #21032: Fixed socket leak if HTTPConnection.getresponse() fails. +- bpo-21032: Fixed socket leak if HTTPConnection.getresponse() fails. Original patch by Martin Panter. -- Issue #22407: Deprecated the use of re.LOCALE flag with str patterns or +- bpo-22407: Deprecated the use of re.LOCALE flag with str patterns or re.ASCII. It was newer worked. -- Issue #22902: The "ip" command is now used on Linux to determine MAC address +- bpo-22902: The "ip" command is now used on Linux to determine MAC address in uuid.getnode(). Pach by Bruno Cauet. -- Issue #22960: Add a context argument to xmlrpclib.ServerProxy constructor. +- bpo-22960: Add a context argument to xmlrpclib.ServerProxy constructor. -- Issue #22389: Add contextlib.redirect_stderr(). +- bpo-22389: Add contextlib.redirect_stderr(). -- Issue #21356: Make ssl.RAND_egd() optional to support LibreSSL. The - availability of the function is checked during the compilation. Patch written - by Bernard Spil. +- bpo-21356: Make ssl.RAND_egd() optional to support LibreSSL. The + availability of the function is checked during the compilation. Patch + written by Bernard Spil. -- Issue #22915: SAX parser now supports files opened with file descriptor or +- bpo-22915: SAX parser now supports files opened with file descriptor or bytes path. -- Issue #22609: Constructors and update methods of mapping classes in the +- bpo-22609: Constructors and update methods of mapping classes in the collections module now accept the self keyword argument. -- Issue #22940: Add readline.append_history_file. +- bpo-22940: Add readline.append_history_file. -- Issue #19676: Added the "namereplace" error handler. +- bpo-19676: Added the "namereplace" error handler. -- Issue #22788: Add *context* parameter to logging.handlers.HTTPHandler. +- bpo-22788: Add *context* parameter to logging.handlers.HTTPHandler. -- Issue #22921: Allow SSLContext to take the *hostname* parameter even if +- bpo-22921: Allow SSLContext to take the *hostname* parameter even if OpenSSL doesn't support SNI. -- Issue #22894: TestCase.subTest() would cause the test suite to be stopped +- bpo-22894: TestCase.subTest() would cause the test suite to be stopped when in failfast mode, even in the absence of failures. -- Issue #22796: HTTP cookie parsing is now stricter, in order to protect +- bpo-22796: HTTP cookie parsing is now stricter, in order to protect against potential injection attacks. -- Issue #22370: Windows detection in pathlib is now more robust. +- bpo-22370: Windows detection in pathlib is now more robust. -- Issue #22841: Reject coroutines in asyncio add_signal_handler(). - Patch by Ludovic.Gasc. +- bpo-22841: Reject coroutines in asyncio add_signal_handler(). Patch by + Ludovic.Gasc. -- Issue #19494: Added urllib.request.HTTPBasicPriorAuthHandler. Patch by - Matej Cepl. +- bpo-19494: Added urllib.request.HTTPBasicPriorAuthHandler. Patch by Matej + Cepl. -- Issue #22578: Added attributes to the re.error class. +- bpo-22578: Added attributes to the re.error class. -- Issue #22849: Fix possible double free in the io.TextIOWrapper constructor. +- bpo-22849: Fix possible double free in the io.TextIOWrapper constructor. -- Issue #12728: Different Unicode characters having the same uppercase but - different lowercase are now matched in case-insensitive regular expressions. +- bpo-12728: Different Unicode characters having the same uppercase but + different lowercase are now matched in case-insensitive regular + expressions. -- Issue #22821: Fixed fcntl() with integer argument on 64-bit big-endian +- bpo-22821: Fixed fcntl() with integer argument on 64-bit big-endian platforms. -- Issue #21650: Add an `--sort-keys` option to json.tool CLI. +- bpo-21650: Add an `--sort-keys` option to json.tool CLI. -- Issue #22824: Updated reprlib output format for sets to use set literals. +- bpo-22824: Updated reprlib output format for sets to use set literals. Patch contributed by Berker Peksag. -- Issue #22824: Updated reprlib output format for arrays to display empty +- bpo-22824: Updated reprlib output format for arrays to display empty arrays without an unnecessary empty list. Suggested by Serhiy Storchaka. -- Issue #22406: Fixed the uu_codec codec incorrectly ported to 3.x. - Based on patch by Martin Panter. +- bpo-22406: Fixed the uu_codec codec incorrectly ported to 3.x. Based on + patch by Martin Panter. -- Issue #17293: uuid.getnode() now determines MAC address on AIX using netstat. +- bpo-17293: uuid.getnode() now determines MAC address on AIX using netstat. Based on patch by Aivars Kalvāns. -- Issue #22769: Fixed ttk.Treeview.tag_has() when called without arguments. +- bpo-22769: Fixed ttk.Treeview.tag_has() when called without arguments. -- Issue #22417: Verify certificates by default in httplib (PEP 476). +- bpo-22417: Verify certificates by default in httplib (PEP 476). -- Issue #22775: Fixed unpickling of http.cookies.SimpleCookie with protocol 2 - and above. Patch by Tim Graham. +- bpo-22775: Fixed unpickling of http.cookies.SimpleCookie with protocol 2 + and above. Patch by Tim Graham. -- Issue #22776: Brought excluded code into the scope of a try block in +- bpo-22776: Brought excluded code into the scope of a try block in SysLogHandler.emit(). -- Issue #22665: Add missing get_terminal_size and SameFileError to +- bpo-22665: Add missing get_terminal_size and SameFileError to shutil.__all__. -- Issue #6623: Remove deprecated Netrc class in the ftplib module. Patch by +- bpo-6623: Remove deprecated Netrc class in the ftplib module. Patch by Matt Chaput. -- Issue #17381: Fixed handling of case-insensitive ranges in regular +- bpo-17381: Fixed handling of case-insensitive ranges in regular expressions. -- Issue #22410: Module level functions in the re module now cache compiled +- bpo-22410: Module level functions in the re module now cache compiled locale-dependent regular expressions taking into account the locale. -- Issue #22759: Query methods on pathlib.Path() (exists(), is_dir(), etc.) - now return False when the underlying stat call raises NotADirectoryError. +- bpo-22759: Query methods on pathlib.Path() (exists(), is_dir(), etc.) now + return False when the underlying stat call raises NotADirectoryError. -- Issue #8876: distutils now falls back to copying files when hard linking - doesn't work. This allows use with special filesystems such as VirtualBox +- bpo-8876: distutils now falls back to copying files when hard linking + doesn't work. This allows use with special filesystems such as VirtualBox shared folders. -- Issue #22217: Implemented reprs of classes in the zipfile module. +- bpo-22217: Implemented reprs of classes in the zipfile module. -- Issue #22457: Honour load_tests in the start_dir of discovery. +- bpo-22457: Honour load_tests in the start_dir of discovery. -- Issue #18216: gettext now raises an error when a .mo file has an - unsupported major version number. Patch by Aaron Hill. +- bpo-18216: gettext now raises an error when a .mo file has an unsupported + major version number. Patch by Aaron Hill. -- Issue #13918: Provide a locale.delocalize() function which can remove - locale-specific number formatting from a string representing a number, - without then converting it to a specific type. Patch by Cédric Krier. +- bpo-13918: Provide a locale.delocalize() function which can remove locale- + specific number formatting from a string representing a number, without + then converting it to a specific type. Patch by Cédric Krier. -- Issue #22676: Make the pickling of global objects which don't have a +- bpo-22676: Make the pickling of global objects which don't have a __module__ attribute less slow. -- Issue #18853: Fixed ResourceWarning in shlex.__nain__. +- bpo-18853: Fixed ResourceWarning in shlex.__nain__. -- Issue #9351: Defaults set with set_defaults on an argparse subparser - are no longer ignored when also set on the parent parser. +- bpo-9351: Defaults set with set_defaults on an argparse subparser are no + longer ignored when also set on the parent parser. -- Issue #7559: unittest test loading ImportErrors are reported as import errors - with their import exception rather than as attribute errors after the import - has already failed. +- bpo-7559: unittest test loading ImportErrors are reported as import errors + with their import exception rather than as attribute errors after the + import has already failed. -- Issue #19746: Make it possible to examine the errors from unittest - discovery without executing the test suite. The new `errors` attribute - on TestLoader exposes these non-fatal errors encountered during discovery. +- bpo-19746: Make it possible to examine the errors from unittest discovery + without executing the test suite. The new `errors` attribute on TestLoader + exposes these non-fatal errors encountered during discovery. -- Issue #21991: Make email.headerregistry's header 'params' attributes - be read-only (MappingProxyType). Previously the dictionary was modifiable - but a new one was created on each access of the attribute. +- bpo-21991: Make email.headerregistry's header 'params' attributes be read- + only (MappingProxyType). Previously the dictionary was modifiable but a + new one was created on each access of the attribute. -- Issue #22638: SSLv3 is now disabled throughout the standard library. - It can still be enabled by instantiating a SSLContext manually. +- bpo-22638: SSLv3 is now disabled throughout the standard library. It can + still be enabled by instantiating a SSLContext manually. -- Issue #22641: In asyncio, the default SSL context for client connections - is now created using ssl.create_default_context(), for stronger security. +- bpo-22641: In asyncio, the default SSL context for client connections is + now created using ssl.create_default_context(), for stronger security. -- Issue #17401: Include closefd in io.FileIO repr. +- bpo-17401: Include closefd in io.FileIO repr. -- Issue #21338: Add silent mode for compileall. quiet parameters of - compile_{dir, file, path} functions now have a multilevel value. Also, - -q option of the CLI now have a multilevel value. Patch by Thomas Kluyver. +- bpo-21338: Add silent mode for compileall. quiet parameters of + compile_{dir, file, path} functions now have a multilevel value. Also, -q + option of the CLI now have a multilevel value. Patch by Thomas Kluyver. -- Issue #20152: Convert the array and cmath modules to Argument Clinic. +- bpo-20152: Convert the array and cmath modules to Argument Clinic. -- Issue #18643: Add socket.socketpair() on Windows. +- bpo-18643: Add socket.socketpair() on Windows. -- Issue #22435: Fix a file descriptor leak when socketserver bind fails. +- bpo-22435: Fix a file descriptor leak when socketserver bind fails. -- Issue #13096: Fixed segfault in CTypes POINTER handling of large - values. +- bpo-13096: Fixed segfault in CTypes POINTER handling of large values. -- Issue #11694: Raise ConversionError in xdrlib as documented. Patch - by Filip Gruszczyński and Claudiu Popa. +- bpo-11694: Raise ConversionError in xdrlib as documented. Patch by Filip + Gruszczyński and Claudiu Popa. -- Issue #19380: Optimized parsing of regular expressions. +- bpo-19380: Optimized parsing of regular expressions. -- Issue #1519638: Now unmatched groups are replaced with empty strings in re.sub() - and re.subn(). +- bpo-1519638: Now unmatched groups are replaced with empty strings in + re.sub() and re.subn(). -- Issue #18615: sndhdr.what/whathdr now return a namedtuple. +- bpo-18615: sndhdr.what/whathdr now return a namedtuple. -- Issue #22462: Fix pyexpat's creation of a dummy frame to make it - appear in exception tracebacks. +- bpo-22462: Fix pyexpat's creation of a dummy frame to make it appear in + exception tracebacks. -- Issue #21965: Add support for in-memory SSL to the ssl module. Patch - by Geert Jansen. +- bpo-21965: Add support for in-memory SSL to the ssl module. Patch by + Geert Jansen. -- Issue #21173: Fix len() on a WeakKeyDictionary when .clear() was called - with an iterator alive. +- bpo-21173: Fix len() on a WeakKeyDictionary when .clear() was called with + an iterator alive. -- Issue #11866: Eliminated race condition in the computation of names - for new threads. +- bpo-11866: Eliminated race condition in the computation of names for new + threads. -- Issue #21905: Avoid RuntimeError in pickle.whichmodule() when sys.modules - is mutated while iterating. Patch by Olivier Grisel. +- bpo-21905: Avoid RuntimeError in pickle.whichmodule() when sys.modules is + mutated while iterating. Patch by Olivier Grisel. -- Issue #11271: concurrent.futures.Executor.map() now takes a *chunksize* +- bpo-11271: concurrent.futures.Executor.map() now takes a *chunksize* argument to allow batching of tasks in child processes and improve performance of ProcessPoolExecutor. Patch by Dan O'Reilly. -- Issue #21883: os.path.join() and os.path.relpath() now raise a TypeError with - more helpful error message for unsupported or mismatched types of arguments. +- bpo-21883: os.path.join() and os.path.relpath() now raise a TypeError with + more helpful error message for unsupported or mismatched types of + arguments. -- Issue #22219: The zipfile module CLI now adds entries for directories +- bpo-22219: The zipfile module CLI now adds entries for directories (including empty directories) in ZIP file. -- Issue #22449: In the ssl.SSLContext.load_default_certs, consult the +- bpo-22449: In the ssl.SSLContext.load_default_certs, consult the environmental variables SSL_CERT_DIR and SSL_CERT_FILE on Windows. -- Issue #22508: The email.__version__ variable has been removed; the email - code is no longer shipped separately from the stdlib, and __version__ - hasn't been updated in several releases. +- bpo-22508: The email.__version__ variable has been removed; the email code + is no longer shipped separately from the stdlib, and __version__ hasn't + been updated in several releases. -- Issue #20076: Added non derived UTF-8 aliases to locale aliases table. +- bpo-20076: Added non derived UTF-8 aliases to locale aliases table. -- Issue #20079: Added locales supported in glibc 2.18 to locale alias table. +- bpo-20079: Added locales supported in glibc 2.18 to locale alias table. -- Issue #20218: Added convenience methods read_text/write_text and read_bytes/ +- bpo-20218: Added convenience methods read_text/write_text and read_bytes/ write_bytes to pathlib.Path objects. -- Issue #22396: On 32-bit AIX platform, don't expose os.posix_fadvise() nor +- bpo-22396: On 32-bit AIX platform, don't expose os.posix_fadvise() nor os.posix_fallocate() because their prototypes in system headers are wrong. -- Issue #22517: When an io.BufferedRWPair object is deallocated, clear its +- bpo-22517: When an io.BufferedRWPair object is deallocated, clear its weakrefs. -- Issue #22437: Number of capturing groups in regular expression is no longer +- bpo-22437: Number of capturing groups in regular expression is no longer limited by 100. -- Issue #17442: InteractiveInterpreter now displays the full chained traceback - in its showtraceback method, to match the built in interactive interpreter. - -- Issue #23392: Added tests for marshal C API that works with FILE*. +- bpo-17442: InteractiveInterpreter now displays the full chained traceback + in its showtraceback method, to match the built in interactive + interpreter. +- bpo-23392: Added tests for marshal C API that works with FILE*. -- Issue #10510: distutils register and upload methods now use HTML standards +- bpo-10510: distutils register and upload methods now use HTML standards compliant CRLF line endings. -- Issue #9850: Fixed macpath.join() for empty first component. Patch by - Oleg Oshmyan. +- bpo-9850: Fixed macpath.join() for empty first component. Patch by Oleg + Oshmyan. -- Issue #5309: distutils' build and build_ext commands now accept a ``-j`` +- bpo-5309: distutils' build and build_ext commands now accept a ``-j`` option to enable parallel building of extension modules. -- Issue #22448: Improve canceled timer handles cleanup to prevent - unbound memory usage. Patch by Joshua Moore-Oliva. +- bpo-22448: Improve canceled timer handles cleanup to prevent unbound + memory usage. Patch by Joshua Moore-Oliva. -- Issue #22427: TemporaryDirectory no longer attempts to clean up twice when +- bpo-22427: TemporaryDirectory no longer attempts to clean up twice when used in the with statement in generator. -- Issue #22362: Forbidden ambiguous octal escapes out of range 0-0o377 in +- bpo-22362: Forbidden ambiguous octal escapes out of range 0-0o377 in regular expressions. -- Issue #20912: Now directories added to ZIP file have correct Unix and MS-DOS +- bpo-20912: Now directories added to ZIP file have correct Unix and MS-DOS directory attributes. -- Issue #21866: ZipFile.close() no longer writes ZIP64 central directory +- bpo-21866: ZipFile.close() no longer writes ZIP64 central directory records if allowZip64 is false. -- Issue #22278: Fix urljoin problem with relative urls, a regression observed +- bpo-22278: Fix urljoin problem with relative urls, a regression observed after changes to issue22118 were submitted. -- Issue #22415: Fixed debugging output of the GROUPREF_EXISTS opcode in the re - module. Removed trailing spaces in debugging output. +- bpo-22415: Fixed debugging output of the GROUPREF_EXISTS opcode in the re + module. Removed trailing spaces in debugging output. -- Issue #22423: Unhandled exception in thread no longer causes unhandled +- bpo-22423: Unhandled exception in thread no longer causes unhandled AttributeError when sys.stderr is None. -- Issue #21332: Ensure that ``bufsize=1`` in subprocess.Popen() selects - line buffering, rather than block buffering. Patch by Akira Li. +- bpo-21332: Ensure that ``bufsize=1`` in subprocess.Popen() selects line + buffering, rather than block buffering. Patch by Akira Li. -- Issue #21091: Fix API bug: email.message.EmailMessage.is_attachment is now - a method. +- bpo-21091: Fix API bug: email.message.EmailMessage.is_attachment is now a + method. -- Issue #21079: Fix email.message.EmailMessage.is_attachment to return the +- bpo-21079: Fix email.message.EmailMessage.is_attachment to return the correct result when the header has parameters as well as a value. -- Issue #22247: Add NNTPError to nntplib.__all__. +- bpo-22247: Add NNTPError to nntplib.__all__. -- Issue #22366: urllib.request.urlopen will accept a context object +- bpo-22366: urllib.request.urlopen will accept a context object (SSLContext) as an argument which will then be used for HTTPS connection. Patch by Alex Gaynor. -- Issue #4180: The warnings registries are now reset when the filters - are modified. +- bpo-4180: The warnings registries are now reset when the filters are + modified. -- Issue #22419: Limit the length of incoming HTTP request in wsgiref server to - 65536 bytes and send a 414 error code for higher lengths. Patch contributed - by Devin Cook. +- bpo-22419: Limit the length of incoming HTTP request in wsgiref server to + 65536 bytes and send a 414 error code for higher lengths. Patch + contributed by Devin Cook. - Lax cookie parsing in http.cookies could be a security issue when combined with non-standard cookie handling in some Web browsers. Reported by Sergey Bobrov. -- Issue #20537: logging methods now accept an exception instance as well as a +- bpo-20537: logging methods now accept an exception instance as well as a Boolean value or exception tuple. Thanks to Yury Selivanov for the patch. -- Issue #22384: An exception in Tkinter callback no longer crashes the program +- bpo-22384: An exception in Tkinter callback no longer crashes the program when it is run with pythonw.exe. -- Issue #22168: Prevent turtle AttributeError with non-default Canvas on OS X. +- bpo-22168: Prevent turtle AttributeError with non-default Canvas on OS X. -- Issue #21147: sqlite3 now raises an exception if the request contains a null +- bpo-21147: sqlite3 now raises an exception if the request contains a null character instead of truncating it. Based on patch by Victor Stinner. -- Issue #13968: The glob module now supports recursive search in - subdirectories using the "**" pattern. +- bpo-13968: The glob module now supports recursive search in subdirectories + using the ``**`` pattern. -- Issue #21951: Fixed a crash in Tkinter on AIX when called Tcl command with +- bpo-21951: Fixed a crash in Tkinter on AIX when called Tcl command with empty string or tuple argument. -- Issue #21951: Tkinter now most likely raises MemoryError instead of crash - if the memory allocation fails. +- bpo-21951: Tkinter now most likely raises MemoryError instead of crash if + the memory allocation fails. -- Issue #22338: Fix a crash in the json module on memory allocation failure. +- bpo-22338: Fix a crash in the json module on memory allocation failure. -- Issue #12410: imaplib.IMAP4 now supports the context management protocol. +- bpo-12410: imaplib.IMAP4 now supports the context management protocol. Original patch by Tarek Ziadé. -- Issue #21270: We now override tuple methods in mock.call objects so that - they can be used as normal call attributes. +- bpo-21270: We now override tuple methods in mock.call objects so that they + can be used as normal call attributes. -- Issue #16662: load_tests() is now unconditionally run when it is present in - a package's __init__.py. TestLoader.loadTestsFromModule() still accepts +- bpo-16662: load_tests() is now unconditionally run when it is present in a + package's __init__.py. TestLoader.loadTestsFromModule() still accepts use_load_tests, but it is deprecated and ignored. A new keyword-only - attribute `pattern` is added and documented. Patch given by Robert Collins, - tweaked by Barry Warsaw. + attribute `pattern` is added and documented. Patch given by Robert + Collins, tweaked by Barry Warsaw. -- Issue #22226: First letter no longer is stripped from the "status" key in - the result of Treeview.heading(). +- bpo-22226: First letter no longer is stripped from the "status" key in the + result of Treeview.heading(). -- Issue #19524: Fixed resource leak in the HTTP connection when an invalid +- bpo-19524: Fixed resource leak in the HTTP connection when an invalid response is received. Patch by Martin Panter. -- Issue #20421: Add a .version() method to SSL sockets exposing the actual +- bpo-20421: Add a .version() method to SSL sockets exposing the actual protocol version in use. -- Issue #19546: configparser exceptions no longer expose implementation details. - Chained KeyErrors are removed, which leads to cleaner tracebacks. Patch by - Claudiu Popa. +- bpo-19546: configparser exceptions no longer expose implementation + details. Chained KeyErrors are removed, which leads to cleaner tracebacks. + Patch by Claudiu Popa. -- Issue #22051: turtledemo no longer reloads examples to re-run them. - Initialization of variables and gui setup should be done in main(), - which is called each time a demo is run, but not on import. +- bpo-22051: turtledemo no longer reloads examples to re-run them. + Initialization of variables and gui setup should be done in main(), which + is called each time a demo is run, but not on import. -- Issue #21933: Turtledemo users can change the code font size with a menu - selection or control(command) '-' or '+' or control-mousewheel. - Original patch by Lita Cho. +- bpo-21933: Turtledemo users can change the code font size with a menu + selection or control(command) '-' or '+' or control-mousewheel. Original + patch by Lita Cho. -- Issue #21597: The separator between the turtledemo text pane and the drawing - canvas can now be grabbed and dragged with a mouse. The code text pane can - be widened to easily view or copy the full width of the text. The canvas - can be widened on small screens. Original patches by Jan Kanis and Lita Cho. +- bpo-21597: The separator between the turtledemo text pane and the drawing + canvas can now be grabbed and dragged with a mouse. The code text pane + can be widened to easily view or copy the full width of the text. The + canvas can be widened on small screens. Original patches by Jan Kanis and + Lita Cho. -- Issue #18132: Turtledemo buttons no longer disappear when the window is +- bpo-18132: Turtledemo buttons no longer disappear when the window is shrunk. Original patches by Jan Kanis and Lita Cho. -- Issue #22043: time.monotonic() is now always available. +- bpo-22043: time.monotonic() is now always available. ``threading.Lock.acquire()``, ``threading.RLock.acquire()`` and socket operations now use a monotonic clock, instead of the system clock, when a timeout is used. -- Issue #21527: Add a default number of workers to ThreadPoolExecutor equal - to 5 times the number of CPUs. Patch by Claudiu Popa. +- bpo-21527: Add a default number of workers to ThreadPoolExecutor equal to + 5 times the number of CPUs. Patch by Claudiu Popa. -- Issue #22216: smtplib now resets its state more completely after a quit. The +- bpo-22216: smtplib now resets its state more completely after a quit. The most obvious consequence of the previous behavior was a STARTTLS failure during a connect/starttls/quit/connect/starttls sequence. -- Issue #22098: ctypes' BigEndianStructure and LittleEndianStructure now - define an empty __slots__ so that subclasses don't always get an instance - dict. Patch by Claudiu Popa. +- bpo-22098: ctypes' BigEndianStructure and LittleEndianStructure now define + an empty __slots__ so that subclasses don't always get an instance dict. + Patch by Claudiu Popa. -- Issue #22185: Fix an occasional RuntimeError in threading.Condition.wait() +- bpo-22185: Fix an occasional RuntimeError in threading.Condition.wait() caused by mutation of the waiters queue without holding the lock. Patch by Doug Zongker. -- Issue #22287: On UNIX, _PyTime_gettimeofday() now uses +- bpo-22287: On UNIX, _PyTime_gettimeofday() now uses clock_gettime(CLOCK_REALTIME) if available. As a side effect, Python now - depends on the librt library on Solaris and on Linux (only with glibc older - than 2.17). + depends on the librt library on Solaris and on Linux (only with glibc + older than 2.17). -- Issue #22182: Use e.args to unpack exceptions correctly in +- bpo-22182: Use e.args to unpack exceptions correctly in distutils.file_util.move_file. Patch by Claudiu Popa. - The webbrowser module now uses subprocess's start_new_session=True rather than a potentially risky preexec_fn=os.setsid call. -- Issue #22042: signal.set_wakeup_fd(fd) now raises an exception if the file +- bpo-22042: signal.set_wakeup_fd(fd) now raises an exception if the file descriptor is in blocking mode. -- Issue #16808: inspect.stack() now returns a named tuple instead of a tuple. +- bpo-16808: inspect.stack() now returns a named tuple instead of a tuple. Patch by Daniel Shahaf. -- Issue #22236: Fixed Tkinter images copying operations in NoDefaultRoot mode. +- bpo-22236: Fixed Tkinter images copying operations in NoDefaultRoot mode. -- Issue #2527: Add a *globals* argument to timeit functions, in order to - override the globals namespace in which the timed code is executed. - Patch by Ben Roberts. +- bpo-2527: Add a *globals* argument to timeit functions, in order to + override the globals namespace in which the timed code is executed. Patch + by Ben Roberts. -- Issue #22118: Switch urllib.parse to use RFC 3986 semantics for the - resolution of relative URLs, rather than RFCs 1808 and 2396. - Patch by Demian Brecht. +- bpo-22118: Switch urllib.parse to use RFC 3986 semantics for the + resolution of relative URLs, rather than RFCs 1808 and 2396. Patch by + Demian Brecht. -- Issue #21549: Added the "members" parameter to TarFile.list(). +- bpo-21549: Added the "members" parameter to TarFile.list(). -- Issue #19628: Allow compileall recursion depth to be specified with a -r +- bpo-19628: Allow compileall recursion depth to be specified with a -r option. -- Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows. +- bpo-15696: Add a __sizeof__ implementation for mmap objects on Windows. -- Issue #22068: Avoided reference loops with Variables and Fonts in Tkinter. +- bpo-22068: Avoided reference loops with Variables and Fonts in Tkinter. -- Issue #22165: SimpleHTTPRequestHandler now supports undecodable file names. +- bpo-22165: SimpleHTTPRequestHandler now supports undecodable file names. -- Issue #15381: Optimized line reading in io.BytesIO. +- bpo-15381: Optimized line reading in io.BytesIO. -- Issue #8797: Raise HTTPError on failed Basic Authentication immediately. +- bpo-8797: Raise HTTPError on failed Basic Authentication immediately. Initial patch by Sam Bull. -- Issue #20729: Restored the use of lazy iterkeys()/itervalues()/iteritems() - in the mailbox module. +- bpo-20729: Restored the use of lazy iterkeys()/itervalues()/iteritems() in + the mailbox module. -- Issue #21448: Changed FeedParser feed() to avoid O(N**2) behavior when - parsing long line. Original patch by Raymond Hettinger. +- bpo-21448: Changed FeedParser feed() to avoid O(N**2) behavior when + parsing long line. Original patch by Raymond Hettinger. -- Issue #22184: The functools LRU Cache decorator factory now gives an earlier +- bpo-22184: The functools LRU Cache decorator factory now gives an earlier and clearer error message when the user forgets the required parameters. -- Issue #17923: glob() patterns ending with a slash no longer match non-dirs on +- bpo-17923: glob() patterns ending with a slash no longer match non-dirs on AIX. Based on patch by Delhallt. -- Issue #21725: Added support for RFC 6531 (SMTPUTF8) in smtpd. +- bpo-21725: Added support for RFC 6531 (SMTPUTF8) in smtpd. -- Issue #22176: Update the ctypes module's libffi to v3.1. This release - adds support for the Linux AArch64 and POWERPC ELF ABIv2 little endian +- bpo-22176: Update the ctypes module's libffi to v3.1. This release adds + support for the Linux AArch64 and POWERPC ELF ABIv2 little endian architectures. -- Issue #5411: Added support for the "xztar" format in the shutil module. +- bpo-5411: Added support for the "xztar" format in the shutil module. -- Issue #21121: Don't force 3rd party C extensions to be built with - -Werror=declaration-after-statement. +- bpo-21121: Don't force 3rd party C extensions to be built with + -Werror=declaration- after-statement. -- Issue #21975: Fixed crash when using uninitialized sqlite3.Row (in particular - when unpickling pickled sqlite3.Row). sqlite3.Row is now initialized in the - __new__() method. +- bpo-21975: Fixed crash when using uninitialized sqlite3.Row (in particular + when unpickling pickled sqlite3.Row). sqlite3.Row is now initialized in + the __new__() method. -- Issue #20170: Convert posixmodule to use Argument Clinic. +- bpo-20170: Convert posixmodule to use Argument Clinic. -- Issue #21539: Add an *exists_ok* argument to `Pathlib.mkdir()` to mimic +- bpo-21539: Add an *exists_ok* argument to `Pathlib.mkdir()` to mimic `mkdir -p` and `os.makedirs()` functionality. When true, ignore FileExistsErrors. Patch by Berker Peksag. -- Issue #22127: Bypass IDNA for pure-ASCII host names in the socket module - (in particular for numeric IPs). +- bpo-22127: Bypass IDNA for pure-ASCII host names in the socket module (in + particular for numeric IPs). -- Issue #21047: set the default value for the *convert_charrefs* argument - of HTMLParser to True. Patch by Berker Peksag. +- bpo-21047: set the default value for the *convert_charrefs* argument of + HTMLParser to True. Patch by Berker Peksag. - Add an __all__ to html.entities. -- Issue #15114: the strict mode and argument of HTMLParser, HTMLParser.error, +- bpo-15114: the strict mode and argument of HTMLParser, HTMLParser.error, and the HTMLParserError exception have been removed. -- Issue #22085: Dropped support of Tk 8.3 in Tkinter. +- bpo-22085: Dropped support of Tk 8.3 in Tkinter. -- Issue #21580: Now Tkinter correctly handles bytes arguments passed to Tk. - In particular this allows initializing images from binary data. +- bpo-21580: Now Tkinter correctly handles bytes arguments passed to Tk. In + particular this allows initializing images from binary data. -- Issue #22003: When initialized from a bytes object, io.BytesIO() now - defers making a copy until it is mutated, improving performance and - memory use on some use cases. Patch by David Wilson. +- bpo-22003: When initialized from a bytes object, io.BytesIO() now defers + making a copy until it is mutated, improving performance and memory use on + some use cases. Patch by David Wilson. -- Issue #22018: On Windows, signal.set_wakeup_fd() now also supports sockets. - A side effect is that Python depends to the WinSock library. +- bpo-22018: On Windows, signal.set_wakeup_fd() now also supports sockets. A + side effect is that Python depends to the WinSock library. -- Issue #22054: Add os.get_blocking() and os.set_blocking() functions to get - and set the blocking mode of a file descriptor (False if the O_NONBLOCK flag - is set, True otherwise). These functions are not available on Windows. +- bpo-22054: Add os.get_blocking() and os.set_blocking() functions to get + and set the blocking mode of a file descriptor (False if the O_NONBLOCK + flag is set, True otherwise). These functions are not available on + Windows. -- Issue #17172: Make turtledemo start as active on OS X even when run with - subprocess. Patch by Lita Cho. +- bpo-17172: Make turtledemo start as active on OS X even when run with + subprocess. Patch by Lita Cho. -- Issue #21704: Fix build error for _multiprocessing when semaphores - are not available. Patch by Arfrever Frehtes Taifersar Arahesis. +- bpo-21704: Fix build error for _multiprocessing when semaphores are not + available. Patch by Arfrever Frehtes Taifersar Arahesis. -- Issue #20173: Convert sha1, sha256, sha512 and md5 to ArgumentClinic. - Patch by Vajrasky Kok. +- bpo-20173: Convert sha1, sha256, sha512 and md5 to ArgumentClinic. Patch + by Vajrasky Kok. - Fix repr(_socket.socket) on Windows 64-bit: don't fail with OverflowError on closed socket. repr(socket.socket) already works fine. -- Issue #22033: Reprs of most Python implemened classes now contain actual +- bpo-22033: Reprs of most Python implemened classes now contain actual class name instead of hardcoded one. -- Issue #21947: The dis module can now disassemble generator-iterator - objects based on their gi_code attribute. Patch by Clement Rouault. +- bpo-21947: The dis module can now disassemble generator-iterator objects + based on their gi_code attribute. Patch by Clement Rouault. -- Issue #16133: The asynchat.async_chat.handle_read() method now ignores +- bpo-16133: The asynchat.async_chat.handle_read() method now ignores BlockingIOError exceptions. -- Issue #22044: Fixed premature DECREF in call_tzinfo_method. - Patch by Tom Flanagan. +- bpo-22044: Fixed premature DECREF in call_tzinfo_method. Patch by Tom + Flanagan. -- Issue #19884: readline: Disable the meta modifier key if stdout is not - a terminal to not write the ANSI sequence ``"\033[1034h"`` into stdout. This +- bpo-19884: readline: Disable the meta modifier key if stdout is not a + terminal to not write the ANSI sequence ``"\033[1034h"`` into stdout. This sequence is used on some terminal (ex: TERM=xterm-256color") to enable support of 8 bit characters. -- Issue #4350: Removed a number of out-of-dated and non-working for a long time +- bpo-4350: Removed a number of out-of-dated and non-working for a long time Tkinter methods. -- Issue #6167: Scrollbar.activate() now returns the name of active element if +- bpo-6167: Scrollbar.activate() now returns the name of active element if the argument is not specified. Scrollbar.set() now always accepts only 2 arguments. -- Issue #15275: Clean up and speed up the ntpath module. +- bpo-15275: Clean up and speed up the ntpath module. -- Issue #21888: plistlib's load() and loads() now work if the fmt parameter is +- bpo-21888: plistlib's load() and loads() now work if the fmt parameter is specified. -- Issue #22032: __qualname__ instead of __name__ is now always used to format +- bpo-22032: __qualname__ instead of __name__ is now always used to format fully qualified class names of Python implemented classes. -- Issue #22031: Reprs now always use hexadecimal format with the "0x" prefix +- bpo-22031: Reprs now always use hexadecimal format with the "0x" prefix when contain an id in form " at 0x...". -- Issue #22018: signal.set_wakeup_fd() now raises an OSError instead of a +- bpo-22018: signal.set_wakeup_fd() now raises an OSError instead of a ValueError on ``fstat()`` failure. -- Issue #21044: tarfile.open() now handles fileobj with an integer 'name' +- bpo-21044: tarfile.open() now handles fileobj with an integer 'name' attribute. Based on patch by Antoine Pietri. -- Issue #21966: Respect -q command-line option when code module is ran. +- bpo-21966: Respect -q command-line option when code module is ran. -- Issue #19076: Don't pass the redundant 'file' argument to self.error(). +- bpo-19076: Don't pass the redundant 'file' argument to self.error(). -- Issue #16382: Improve exception message of warnings.warn() for bad - category. Initial patch by Phil Elson. +- bpo-16382: Improve exception message of warnings.warn() for bad category. + Initial patch by Phil Elson. -- Issue #21932: os.read() now uses a :c:func:`Py_ssize_t` type instead of +- bpo-21932: os.read() now uses a :c:func:`Py_ssize_t` type instead of :c:type:`int` for the size to support reading more than 2 GB at once. On Windows, the size is truncted to INT_MAX. As any call to os.read(), the OS may read less bytes than the number of requested bytes. -- Issue #21942: Fixed source file viewing in pydoc's server mode on Windows. +- bpo-21942: Fixed source file viewing in pydoc's server mode on Windows. -- Issue #11259: asynchat.async_chat().set_terminator() now raises a ValueError +- bpo-11259: asynchat.async_chat().set_terminator() now raises a ValueError if the number of received bytes is negative. -- Issue #12523: asynchat.async_chat.push() now raises a TypeError if it doesn't +- bpo-12523: asynchat.async_chat.push() now raises a TypeError if it doesn't get a bytes string -- Issue #21707: Add missing kwonlyargcount argument to +- bpo-21707: Add missing kwonlyargcount argument to ModuleFinder.replace_paths_in_code(). -- Issue #20639: calling Path.with_suffix('') allows removing the suffix - again. Patch by July Tikhonov. +- bpo-20639: calling Path.with_suffix('') allows removing the suffix again. + Patch by July Tikhonov. -- Issue #21714: Disallow the construction of invalid paths using +- bpo-21714: Disallow the construction of invalid paths using Path.with_name(). Original patch by Antony Lee. -- Issue #15014: Added 'auth' method to smtplib to make implementing auth +- bpo-15014: Added 'auth' method to smtplib to make implementing auth mechanisms simpler, and used it internally in the login method. -- Issue #21151: Fixed a segfault in the winreg module when ``None`` is passed +- bpo-21151: Fixed a segfault in the winreg module when ``None`` is passed as a ``REG_BINARY`` value to SetValueEx. Patch by John Ehresman. -- Issue #21090: io.FileIO.readall() does not ignore I/O errors anymore. Before, +- bpo-21090: io.FileIO.readall() does not ignore I/O errors anymore. Before, it ignored I/O errors if at least the first C call read() succeed. -- Issue #5800: headers parameter of wsgiref.headers.Headers is now optional. +- bpo-5800: headers parameter of wsgiref.headers.Headers is now optional. Initial patch by Pablo Torres Navarrete and SilentGhost. -- Issue #21781: ssl.RAND_add() now supports strings longer than 2 GB. +- bpo-21781: ssl.RAND_add() now supports strings longer than 2 GB. -- Issue #21679: Prevent extraneous fstat() calls during open(). Patch by +- bpo-21679: Prevent extraneous fstat() calls during open(). Patch by Bohuslav Kabrda. -- Issue #21863: cProfile now displays the module name of C extension functions, +- bpo-21863: cProfile now displays the module name of C extension functions, in addition to their own name. -- Issue #11453: asyncore: emit a ResourceWarning when an unclosed file_wrapper +- bpo-11453: asyncore: emit a ResourceWarning when an unclosed file_wrapper object is destroyed. The destructor now closes the file if needed. The close() method can now be called twice: the second call does nothing. -- Issue #21858: Better handling of Python exceptions in the sqlite3 module. +- bpo-21858: Better handling of Python exceptions in the sqlite3 module. -- Issue #21476: Make sure the email.parser.BytesParser TextIOWrapper is +- bpo-21476: Make sure the email.parser.BytesParser TextIOWrapper is discarded after parsing, so the input file isn't unexpectedly closed. -- Issue #20295: imghdr now recognizes OpenEXR format images. +- bpo-20295: imghdr now recognizes OpenEXR format images. -- Issue #21729: Used the "with" statement in the dbm.dumb module to ensure - files closing. Patch by Claudiu Popa. +- bpo-21729: Used the "with" statement in the dbm.dumb module to ensure + files closing. Patch by Claudiu Popa. -- Issue #21491: socketserver: Fix a race condition in child processes reaping. +- bpo-21491: socketserver: Fix a race condition in child processes reaping. -- Issue #21719: Added the ``st_file_attributes`` field to os.stat_result on +- bpo-21719: Added the ``st_file_attributes`` field to os.stat_result on Windows. -- Issue #21832: Require named tuple inputs to be exact strings. +- bpo-21832: Require named tuple inputs to be exact strings. -- Issue #21722: The distutils "upload" command now exits with a non-zero - return code when uploading fails. Patch by Martin Dengler. +- bpo-21722: The distutils "upload" command now exits with a non-zero return + code when uploading fails. Patch by Martin Dengler. -- Issue #21723: asyncio.Queue: support any type of number (ex: float) for the +- bpo-21723: asyncio.Queue: support any type of number (ex: float) for the maximum size. Patch written by Vajrasky Kok. -- Issue #21711: support for "site-python" directories has now been removed - from the site module (it was deprecated in 3.4). +- bpo-21711: support for "site-python" directories has now been removed from + the site module (it was deprecated in 3.4). -- Issue #17552: new socket.sendfile() method allowing a file to be sent over a - socket by using high-performance os.sendfile() on UNIX. - Patch by Giampaolo Rodola'. +- bpo-17552: new socket.sendfile() method allowing a file to be sent over a + socket by using high-performance os.sendfile() on UNIX. Patch by Giampaolo + Rodola'. -- Issue #18039: dbm.dump.open() now always creates a new database when the - flag has the value 'n'. Patch by Claudiu Popa. +- bpo-18039: dbm.dump.open() now always creates a new database when the flag + has the value 'n'. Patch by Claudiu Popa. -- Issue #21326: Add a new is_closed() method to asyncio.BaseEventLoop. - run_forever() and run_until_complete() methods of asyncio.BaseEventLoop now - raise an exception if the event loop was closed. +- bpo-21326: Add a new is_closed() method to asyncio.BaseEventLoop. + run_forever() and run_until_complete() methods of asyncio.BaseEventLoop + now raise an exception if the event loop was closed. -- Issue #21766: Prevent a security hole in CGIHTTPServer by URL unquoting paths +- bpo-21766: Prevent a security hole in CGIHTTPServer by URL unquoting paths before checking for a CGI script at that path. -- Issue #21310: Fixed possible resource leak in failed open(). +- bpo-21310: Fixed possible resource leak in failed open(). -- Issue #21256: Printout of keyword args should be in deterministic order in - a mock function call. This will help to write better doctests. +- bpo-21256: Printout of keyword args should be in deterministic order in a + mock function call. This will help to write better doctests. -- Issue #21677: Fixed chaining nonnormalized exceptions in io close() methods. +- bpo-21677: Fixed chaining nonnormalized exceptions in io close() methods. -- Issue #11709: Fix the pydoc.help function to not fail when sys.stdin is not a +- bpo-11709: Fix the pydoc.help function to not fail when sys.stdin is not a valid file. -- Issue #21515: tempfile.TemporaryFile now uses os.O_TMPFILE flag is available. +- bpo-21515: tempfile.TemporaryFile now uses os.O_TMPFILE flag is available. -- Issue #13223: Fix pydoc.writedoc so that the HTML documentation for methods +- bpo-13223: Fix pydoc.writedoc so that the HTML documentation for methods that use 'self' in the example code is generated correctly. -- Issue #21463: In urllib.request, fix pruning of the FTP cache. +- bpo-21463: In urllib.request, fix pruning of the FTP cache. -- Issue #21618: The subprocess module could fail to close open fds that were +- bpo-21618: The subprocess module could fail to close open fds that were inherited by the calling process and already higher than POSIX resource limits would otherwise allow. On systems with a functioning /proc/self/fd or /dev/fd interface the max is now ignored and all fds are closed. -- Issue #20383: Introduce importlib.util.module_from_spec() as the preferred way - to create a new module. +- bpo-20383: Introduce importlib.util.module_from_spec() as the preferred + way to create a new module. -- Issue #21552: Fixed possible integer overflow of too long string lengths in +- bpo-21552: Fixed possible integer overflow of too long string lengths in the tkinter module on 64-bit platforms. -- Issue #14315: The zipfile module now ignores extra fields in the central - directory that are too short to be parsed instead of letting a struct.unpack - error bubble up as this "bad data" appears in many real world zip files in - the wild and is ignored by other zip tools. +- bpo-14315: The zipfile module now ignores extra fields in the central + directory that are too short to be parsed instead of letting a + struct.unpack error bubble up as this "bad data" appears in many real + world zip files in the wild and is ignored by other zip tools. -- Issue #13742: Added "key" and "reverse" parameters to heapq.merge(). - (First draft of patch contributed by Simon Sapin.) +- bpo-13742: Added "key" and "reverse" parameters to heapq.merge(). (First + draft of patch contributed by Simon Sapin.) -- Issue #21402: tkinter.ttk now works when default root window is not set. +- bpo-21402: tkinter.ttk now works when default root window is not set. -- Issue #3015: _tkinter.create() now creates tkapp object with wantobject=1 by +- bpo-3015: _tkinter.create() now creates tkapp object with wantobject=1 by default. -- Issue #10203: sqlite3.Row now truly supports sequence protocol. In particular - it supports reverse() and negative indices. Original patch by Claudiu Popa. +- bpo-10203: sqlite3.Row now truly supports sequence protocol. In + particular it supports reverse() and negative indices. Original patch by + Claudiu Popa. -- Issue #18807: If copying (no symlinks) specified for a venv, then the python - interpreter aliases (python, python3) are now created by copying rather than - symlinking. +- bpo-18807: If copying (no symlinks) specified for a venv, then the python + interpreter aliases (python, python3) are now created by copying rather + than symlinking. -- Issue #20197: Added support for the WebP image type in the imghdr module. +- bpo-20197: Added support for the WebP image type in the imghdr module. Patch by Fabrice Aneche and Claudiu Popa. -- Issue #21513: Speedup some properties of IP addresses (IPv4Address, +- bpo-21513: Speedup some properties of IP addresses (IPv4Address, IPv6Address) such as .is_private or .is_multicast. -- Issue #21137: Improve the repr for threading.Lock() and its variants - by showing the "locked" or "unlocked" status. Patch by Berker Peksag. +- bpo-21137: Improve the repr for threading.Lock() and its variants by + showing the "locked" or "unlocked" status. Patch by Berker Peksag. -- Issue #21538: The plistlib module now supports loading of binary plist files +- bpo-21538: The plistlib module now supports loading of binary plist files when reference or offset size is not a power of two. -- Issue #21455: Add a default backlog to socket.listen(). +- bpo-21455: Add a default backlog to socket.listen(). -- Issue #21525: Most Tkinter methods which accepted tuples now accept lists too. +- bpo-21525: Most Tkinter methods which accepted tuples now accept lists + too. -- Issue #22166: With the assistance of a new internal _codecs._forget_codec +- bpo-22166: With the assistance of a new internal _codecs._forget_codec helping function, test_codecs now clears the encoding caches to avoid the appearance of a reference leak -- Issue #22236: Tkinter tests now don't reuse default root window. New root +- bpo-22236: Tkinter tests now don't reuse default root window. New root window is created for every test class. -- Issue #10744: Fix PEP 3118 format strings on ctypes objects with a nontrivial +- bpo-10744: Fix PEP 3118 format strings on ctypes objects with a nontrivial shape. -- Issue #20826: Optimize ipaddress.collapse_addresses(). +- bpo-20826: Optimize ipaddress.collapse_addresses(). -- Issue #21487: Optimize ipaddress.summarize_address_range() and +- bpo-21487: Optimize ipaddress.summarize_address_range() and ipaddress.{IPv4Network,IPv6Network}.subnets(). -- Issue #21486: Optimize parsing of netmasks in ipaddress.IPv4Network and +- bpo-21486: Optimize parsing of netmasks in ipaddress.IPv4Network and ipaddress.IPv6Network. -- Issue #13916: Disallowed the surrogatepass error handler for non UTF-\* +- bpo-13916: Disallowed the surrogatepass error handler for non UTF-\* encodings. -- Issue #20998: Fixed re.fullmatch() of repeated single character pattern - with ignore case. Original patch by Matthew Barnett. +- bpo-20998: Fixed re.fullmatch() of repeated single character pattern with + ignore case. Original patch by Matthew Barnett. -- Issue #21075: fileinput.FileInput now reads bytes from standard stream if +- bpo-21075: fileinput.FileInput now reads bytes from standard stream if binary mode is specified. Patch by Sam Kimbrel. -- Issue #19775: Add a samefile() method to pathlib Path objects. Initial - patch by Vajrasky Kok. +- bpo-19775: Add a samefile() method to pathlib Path objects. Initial patch + by Vajrasky Kok. -- Issue #21226: Set up modules properly in PyImport_ExecCodeModuleObject - (and friends). +- bpo-21226: Set up modules properly in PyImport_ExecCodeModuleObject (and + friends). -- Issue #21398: Fix a unicode error in the pydoc pager when the documentation +- bpo-21398: Fix a unicode error in the pydoc pager when the documentation contains characters not encodable to the stdout encoding. -- Issue #16531: ipaddress.IPv4Network and ipaddress.IPv6Network now accept - an (address, netmask) tuple argument, so as to easily construct network +- bpo-16531: ipaddress.IPv4Network and ipaddress.IPv6Network now accept an + (address, netmask) tuple argument, so as to easily construct network objects from existing addresses. -- Issue #21156: importlib.abc.InspectLoader.source_to_code() is now a +- bpo-21156: importlib.abc.InspectLoader.source_to_code() is now a staticmethod. -- Issue #21424: Simplified and optimized heaqp.nlargest() and nmsmallest() - to make fewer tuple comparisons. +- bpo-21424: Simplified and optimized heaqp.nlargest() and nmsmallest() to + make fewer tuple comparisons. -- Issue #21396: Fix TextIOWrapper(..., write_through=True) to not force a +- bpo-21396: Fix TextIOWrapper(..., write_through=True) to not force a flush() on the underlying binary stream. Patch by akira. -- Issue #18314: Unlink now removes junctions on Windows. Patch by Kim Gräsman +- bpo-18314: Unlink now removes junctions on Windows. Patch by Kim Gräsman -- Issue #21088: Bugfix for curses.window.addch() regression in 3.4.0. - In porting to Argument Clinic, the first two arguments were reversed. +- bpo-21088: Bugfix for curses.window.addch() regression in 3.4.0. In + porting to Argument Clinic, the first two arguments were reversed. -- Issue #21407: _decimal: The module now supports function signatures. +- bpo-21407: _decimal: The module now supports function signatures. -- Issue #10650: Remove the non-standard 'watchexp' parameter from the +- bpo-10650: Remove the non-standard 'watchexp' parameter from the Decimal.quantize() method in the Python version. It had never been present in the C version. -- Issue #21469: Reduced the risk of false positives in robotparser by - checking to make sure that robots.txt has been read or does not exist - prior to returning True in can_fetch(). +- bpo-21469: Reduced the risk of false positives in robotparser by checking + to make sure that robots.txt has been read or does not exist prior to + returning True in can_fetch(). -- Issue #19414: Have the OrderedDict mark deleted links as unusable. - This gives an early failure if the link is deleted during iteration. +- bpo-19414: Have the OrderedDict mark deleted links as unusable. This gives + an early failure if the link is deleted during iteration. -- Issue #21421: Add __slots__ to the MappingViews ABC. - Patch by Josh Rosenberg. +- bpo-21421: Add __slots__ to the MappingViews ABC. Patch by Josh Rosenberg. -- Issue #21101: Eliminate double hashing in the C speed-up code for +- bpo-21101: Eliminate double hashing in the C speed-up code for collections.Counter(). -- Issue #21321: itertools.islice() now releases the reference to the source +- bpo-21321: itertools.islice() now releases the reference to the source iterator when the slice is exhausted. Patch by Anton Afanasyev. -- Issue #21057: TextIOWrapper now allows the underlying binary stream's - read() or read1() method to return an arbitrary bytes-like object - (such as a memoryview). Patch by Nikolaus Rath. +- bpo-21057: TextIOWrapper now allows the underlying binary stream's read() + or read1() method to return an arbitrary bytes-like object (such as a + memoryview). Patch by Nikolaus Rath. -- Issue #20951: SSLSocket.send() now raises either SSLWantReadError or +- bpo-20951: SSLSocket.send() now raises either SSLWantReadError or SSLWantWriteError on a non-blocking socket if the operation would block. Previously, it would return 0. Patch by Nikolaus Rath. -- Issue #13248: removed previously deprecated asyncore.dispatcher __getattr__ +- bpo-13248: removed previously deprecated asyncore.dispatcher __getattr__ cheap inheritance hack. -- Issue #9815: assertRaises now tries to clear references to local variables - in the exception's traceback. +- bpo-9815: assertRaises now tries to clear references to local variables in + the exception's traceback. -- Issue #19940: ssl.cert_time_to_seconds() now interprets the given time - string in the UTC timezone (as specified in RFC 5280), not the local - timezone. +- bpo-19940: ssl.cert_time_to_seconds() now interprets the given time string + in the UTC timezone (as specified in RFC 5280), not the local timezone. -- Issue #13204: Calling sys.flags.__new__ would crash the interpreter, - now it raises a TypeError. +- bpo-13204: Calling sys.flags.__new__ would crash the interpreter, now it + raises a TypeError. -- Issue #19385: Make operations on a closed dbm.dumb database always raise the +- bpo-19385: Make operations on a closed dbm.dumb database always raise the same exception. -- Issue #21207: Detect when the os.urandom cached fd has been closed or +- bpo-21207: Detect when the os.urandom cached fd has been closed or replaced, and open it anew. -- Issue #21291: subprocess's Popen.wait() is now thread safe so that - multiple threads may be calling wait() or poll() on a Popen instance - at the same time without losing the Popen.returncode value. +- bpo-21291: subprocess's Popen.wait() is now thread safe so that multiple + threads may be calling wait() or poll() on a Popen instance at the same + time without losing the Popen.returncode value. -- Issue #21127: Path objects can now be instantiated from str subclass +- bpo-21127: Path objects can now be instantiated from str subclass instances (such as ``numpy.str_``). -- Issue #15002: urllib.response object to use _TemporaryFileWrapper (and +- bpo-15002: urllib.response object to use _TemporaryFileWrapper (and _TemporaryFileCloser) facility. Provides a better way to handle file descriptor close. Patch contributed by Christian Theune. -- Issue #12220: mindom now raises a custom ValueError indicating it doesn't +- bpo-12220: mindom now raises a custom ValueError indicating it doesn't support spaces in URIs instead of letting a 'split' ValueError bubble up. -- Issue #21068: The ssl.PROTOCOL* constants are now enum members. +- bpo-21068: The ssl.PROTOCOL* constants are now enum members. -- Issue #21276: posixmodule: Don't define USE_XATTRS on KFreeBSD and the Hurd. +- bpo-21276: posixmodule: Don't define USE_XATTRS on KFreeBSD and the Hurd. -- Issue #21262: New method assert_not_called for Mock. - It raises AssertionError if the mock has been called. +- bpo-21262: New method assert_not_called for Mock. It raises AssertionError + if the mock has been called. -- Issue #21238: New keyword argument `unsafe` to Mock. It raises +- bpo-21238: New keyword argument `unsafe` to Mock. It raises `AttributeError` incase of an attribute startswith assert or assret. -- Issue #20896: ssl.get_server_certificate() now uses PROTOCOL_SSLv23, not +- bpo-20896: ssl.get_server_certificate() now uses PROTOCOL_SSLv23, not PROTOCOL_SSLv3, for maximum compatibility. -- Issue #21239: patch.stopall() didn't work deterministically when the same +- bpo-21239: patch.stopall() didn't work deterministically when the same name was patched more than once. -- Issue #21203: Updated fileConfig and dictConfig to remove inconsistencies. +- bpo-21203: Updated fileConfig and dictConfig to remove inconsistencies. Thanks to Jure Koren for the patch. -- Issue #21222: Passing name keyword argument to mock.create_autospec now +- bpo-21222: Passing name keyword argument to mock.create_autospec now works. -- Issue #21197: Add lib64 -> lib symlink in venvs on 64-bit non-OS X POSIX. +- bpo-21197: Add lib64 -> lib symlink in venvs on 64-bit non-OS X POSIX. -- Issue #17498: Some SMTP servers disconnect after certain errors, violating - strict RFC conformance. Instead of losing the error code when we issue the - subsequent RSET, smtplib now returns the error code and defers raising the - SMTPServerDisconnected error until the next command is issued. +- bpo-17498: Some SMTP servers disconnect after certain errors, violating + strict RFC conformance. Instead of losing the error code when we issue + the subsequent RSET, smtplib now returns the error code and defers raising + the SMTPServerDisconnected error until the next command is issued. -- Issue #17826: setting an iterable side_effect on a mock function created by +- bpo-17826: setting an iterable side_effect on a mock function created by create_autospec now works. Patch by Kushal Das. -- Issue #7776: Fix ``Host:`` header and reconnection when using +- bpo-7776: Fix ``Host:`` header and reconnection when using http.client.HTTPConnection.set_tunnel(). Patch by Nikolaus Rath. -- Issue #20968: unittest.mock.MagicMock now supports division. - Patch by Johannes Baiter. +- bpo-20968: unittest.mock.MagicMock now supports division. Patch by + Johannes Baiter. -- Issue #21529 (CVE-2014-4616): Fix arbitrary memory access in - JSONDecoder.raw_decode with a negative second parameter. Bug reported by Guido - Vranken. +- bpo-21529: Fix arbitrary memory access in JSONDecoder.raw_decode with a + negative second parameter. Bug reported by Guido Vranken. (See also: + CVE-2014-4616) -- Issue #21169: getpass now handles non-ascii characters that the - input stream encoding cannot encode by re-encoding using the - replace error handler. +- bpo-21169: getpass now handles non-ascii characters that the input stream + encoding cannot encode by re-encoding using the replace error handler. -- Issue #21171: Fixed undocumented filter API of the rot13 codec. - Patch by Berker Peksag. +- bpo-21171: Fixed undocumented filter API of the rot13 codec. Patch by + Berker Peksag. -- Issue #20539: Improved math.factorial error message for large positive inputs - and changed exception type (OverflowError -> ValueError) for large negative - inputs. +- bpo-20539: Improved math.factorial error message for large positive inputs + and changed exception type (OverflowError -> ValueError) for large + negative inputs. -- Issue #21172: isinstance check relaxed from dict to collections.Mapping. +- bpo-21172: isinstance check relaxed from dict to collections.Mapping. -- Issue #21155: asyncio.EventLoop.create_unix_server() now raises a ValueError +- bpo-21155: asyncio.EventLoop.create_unix_server() now raises a ValueError if path and sock are specified at the same time. -- Issue #21136: Avoid unnecessary normalization of Fractions resulting from +- bpo-21136: Avoid unnecessary normalization of Fractions resulting from power and other operations. Patch by Raymond Hettinger. -- Issue #17621: Introduce importlib.util.LazyLoader. +- bpo-17621: Introduce importlib.util.LazyLoader. -- Issue #21076: signal module constants were turned into enums. - Patch by Giampaolo Rodola'. +- bpo-21076: signal module constants were turned into enums. Patch by + Giampaolo Rodola'. -- Issue #20636: Improved the repr of Tkinter widgets. +- bpo-20636: Improved the repr of Tkinter widgets. -- Issue #19505: The items, keys, and values views of OrderedDict now support +- bpo-19505: The items, keys, and values views of OrderedDict now support reverse iteration using reversed(). -- Issue #21149: Improved thread-safety in logging cleanup during interpreter +- bpo-21149: Improved thread-safety in logging cleanup during interpreter shutdown. Thanks to Devin Jeanpierre for the patch. -- Issue #21058: Fix a leak of file descriptor in +- bpo-21058: Fix a leak of file descriptor in :func:`tempfile.NamedTemporaryFile`, close the file descriptor if :func:`io.open` fails -- Issue #21200: Return None from pkgutil.get_loader() when __spec__ is missing. +- bpo-21200: Return None from pkgutil.get_loader() when __spec__ is missing. -- Issue #21013: Enhance ssl.create_default_context() when used for server side +- bpo-21013: Enhance ssl.create_default_context() when used for server side sockets to provide better security by default. -- Issue #20145: `assertRaisesRegex` and `assertWarnsRegex` now raise a +- bpo-20145: `assertRaisesRegex` and `assertWarnsRegex` now raise a TypeError if the second argument is not a string or compiled regex. -- Issue #20633: Replace relative import by absolute import. +- bpo-20633: Replace relative import by absolute import. -- Issue #20980: Stop wrapping exception when using ThreadPool. +- bpo-20980: Stop wrapping exception when using ThreadPool. -- Issue #21082: In os.makedirs, do not set the process-wide umask. Note this +- bpo-21082: In os.makedirs, do not set the process-wide umask. Note this changes behavior of makedirs when exist_ok=True. -- Issue #20990: Fix issues found by pyflakes for multiprocessing. +- bpo-20990: Fix issues found by pyflakes for multiprocessing. -- Issue #21015: SSL contexts will now automatically select an elliptic - curve for ECDH key exchange on OpenSSL 1.0.2 and later, and otherwise - default to "prime256v1". +- bpo-21015: SSL contexts will now automatically select an elliptic curve + for ECDH key exchange on OpenSSL 1.0.2 and later, and otherwise default to + "prime256v1". -- Issue #21000: Improve the command-line interface of json.tool. +- bpo-21000: Improve the command-line interface of json.tool. -- Issue #20995: Enhance default ciphers used by the ssl module to enable - better security and prioritize perfect forward secrecy. +- bpo-20995: Enhance default ciphers used by the ssl module to enable better + security and prioritize perfect forward secrecy. -- Issue #20884: Don't assume that __file__ is defined on importlib.__init__. +- bpo-20884: Don't assume that __file__ is defined on importlib.__init__. -- Issue #21499: Ignore __builtins__ in several test_importlib.test_api tests. +- bpo-21499: Ignore __builtins__ in several test_importlib.test_api tests. -- Issue #20627: xmlrpc.client.ServerProxy is now a context manager. +- bpo-20627: xmlrpc.client.ServerProxy is now a context manager. -- Issue #19165: The formatter module now raises DeprecationWarning instead of +- bpo-19165: The formatter module now raises DeprecationWarning instead of PendingDeprecationWarning. -- Issue #13936: Remove the ability of datetime.time instances to be considered +- bpo-13936: Remove the ability of datetime.time instances to be considered false in boolean contexts. -- Issue #18931: selectors module now supports /dev/poll on Solaris. - Patch by Giampaolo Rodola'. +- bpo-18931: selectors module now supports /dev/poll on Solaris. Patch by + Giampaolo Rodola'. -- Issue #19977: When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), +- bpo-19977: When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), :py:data:`sys.stdin` and :py:data:`sys.stdout` are now using the - ``surrogateescape`` error handler, instead of the ``strict`` error handler. + ``surrogateescape`` error handler, instead of the ``strict`` error + handler. -- Issue #20574: Implement incremental decoder for cp65001 code (Windows code +- bpo-20574: Implement incremental decoder for cp65001 code (Windows code page 65001, Microsoft UTF-8). -- Issue #20879: Delay the initialization of encoding and decoding tables for +- bpo-20879: Delay the initialization of encoding and decoding tables for base32, ascii85 and base85 codecs in the base64 module, and delay the - initialization of the unquote_to_bytes() table of the urllib.parse module, to - not waste memory if these modules are not used. + initialization of the unquote_to_bytes() table of the urllib.parse module, + to not waste memory if these modules are not used. -- Issue #19157: Include the broadcast address in the usuable hosts for IPv6 - in ipaddress. +- bpo-19157: Include the broadcast address in the usuable hosts for IPv6 in + ipaddress. -- Issue #11599: When an external command (e.g. compiler) fails, distutils now - prints out the whole command line (instead of just the command name) if the - environment variable DISTUTILS_DEBUG is set. +- bpo-11599: When an external command (e.g. compiler) fails, distutils now + prints out the whole command line (instead of just the command name) if + the environment variable DISTUTILS_DEBUG is set. -- Issue #4931: distutils should not produce unhelpful "error: None" messages - anymore. distutils.util.grok_environment_error is kept but doc-deprecated. +- bpo-4931: distutils should not produce unhelpful "error: None" messages + anymore. distutils.util.grok_environment_error is kept but doc-deprecated. -- Issue #20875: Prevent possible gzip "'read' is not defined" NameError. - Patch by Claudiu Popa. +- bpo-20875: Prevent possible gzip "'read' is not defined" NameError. Patch + by Claudiu Popa. -- Issue #11558: ``email.message.Message.attach`` now returns a more - useful error message if ``attach`` is called on a message for which +- bpo-11558: ``email.message.Message.attach`` now returns a more useful + error message if ``attach`` is called on a message for which ``is_multipart`` is False. -- Issue #20283: RE pattern methods now accept the string keyword parameters - as documented. The pattern and source keyword parameters are left as +- bpo-20283: RE pattern methods now accept the string keyword parameters as + documented. The pattern and source keyword parameters are left as deprecated aliases. -- Issue #20778: Fix modulefinder to work with bytecode-only modules. +- bpo-20778: Fix modulefinder to work with bytecode-only modules. -- Issue #20791: copy.copy() now doesn't make a copy when the input is - a bytes object. Initial patch by Peter Otten. +- bpo-20791: copy.copy() now doesn't make a copy when the input is a bytes + object. Initial patch by Peter Otten. -- Issue #19748: On AIX, time.mktime() now raises an OverflowError for year +- bpo-19748: On AIX, time.mktime() now raises an OverflowError for year outsize range [1902; 2037]. -- Issue #19573: inspect.signature: Use enum for parameter kind constants. +- bpo-19573: inspect.signature: Use enum for parameter kind constants. -- Issue #20726: inspect.signature: Make Signature and Parameter picklable. +- bpo-20726: inspect.signature: Make Signature and Parameter picklable. -- Issue #17373: Add inspect.Signature.from_callable method. +- bpo-17373: Add inspect.Signature.from_callable method. -- Issue #20378: Improve repr of inspect.Signature and inspect.Parameter. +- bpo-20378: Improve repr of inspect.Signature and inspect.Parameter. -- Issue #20816: Fix inspect.getcallargs() to raise correct TypeError for - missing keyword-only arguments. Patch by Jeremiah Lowin. +- bpo-20816: Fix inspect.getcallargs() to raise correct TypeError for + missing keyword- only arguments. Patch by Jeremiah Lowin. -- Issue #20817: Fix inspect.getcallargs() to fail correctly if more - than 3 arguments are missing. Patch by Jeremiah Lowin. +- bpo-20817: Fix inspect.getcallargs() to fail correctly if more than 3 + arguments are missing. Patch by Jeremiah Lowin. -- Issue #6676: Ensure a meaningful exception is raised when attempting - to parse more than one XML document per pyexpat xmlparser instance. - (Original patches by Hirokazu Yamamoto and Amaury Forgeot d'Arc, with - suggested wording by David Gutteridge) +- bpo-6676: Ensure a meaningful exception is raised when attempting to parse + more than one XML document per pyexpat xmlparser instance. (Original + patches by Hirokazu Yamamoto and Amaury Forgeot d'Arc, with suggested + wording by David Gutteridge) -- Issue #21117: Fix inspect.signature to better support functools.partial. - Due to the specifics of functools.partial implementation, - positional-or-keyword arguments passed as keyword arguments become - keyword-only. +- bpo-21117: Fix inspect.signature to better support functools.partial. Due + to the specifics of functools.partial implementation, positional-or- + keyword arguments passed as keyword arguments become keyword-only. -- Issue #20334: inspect.Signature and inspect.Parameter are now hashable. +- bpo-20334: inspect.Signature and inspect.Parameter are now hashable. Thanks to Antony Lee for bug reports and suggestions. -- Issue #15916: doctest.DocTestSuite returns an empty unittest.TestSuite instead - of raising ValueError if it finds no tests +- bpo-15916: doctest.DocTestSuite returns an empty unittest.TestSuite + instead of raising ValueError if it finds no tests -- Issue #21209: Fix asyncio.tasks.CoroWrapper to workaround a bug - in yield-from implementation in CPythons prior to 3.4.1. +- bpo-21209: Fix asyncio.tasks.CoroWrapper to workaround a bug in yield-from + implementation in CPythons prior to 3.4.1. -- asyncio: Add gi_{frame,running,code} properties to CoroWrapper - (upstream issue #163). +- asyncio: Add gi_{frame,running,code} properties to CoroWrapper (upstream + issue #163). -- Issue #21311: Avoid exception in _osx_support with non-standard compiler - configurations. Patch by John Szakmeister. +- bpo-21311: Avoid exception in _osx_support with non-standard compiler + configurations. Patch by John Szakmeister. -- Issue #11571: Ensure that the turtle window becomes the topmost window - when launched on OS X. +- bpo-11571: Ensure that the turtle window becomes the topmost window when + launched on OS X. -- Issue #21801: Validate that __signature__ is None or an instance of Signature. +- bpo-21801: Validate that __signature__ is None or an instance of + Signature. -- Issue #21923: Prevent AttributeError in distutils.sysconfig.customize_compiler - due to possible uninitialized _config_vars. +- bpo-21923: Prevent AttributeError in + distutils.sysconfig.customize_compiler due to possible uninitialized + _config_vars. -- Issue #21323: Fix http.server to again handle scripts in CGI subdirectories, +- bpo-21323: Fix http.server to again handle scripts in CGI subdirectories, broken by the fix for security issue #19435. Patch by Zach Byrne. -- Issue #22733: Fix ffi_prep_args not zero-extending argument values correctly +- bpo-22733: Fix ffi_prep_args not zero-extending argument values correctly on 64-bit Windows. -- Issue #23302: Default to TCP_NODELAY=1 upon establishing an HTTPConnection. - Removed use of hard-coded MSS as it's an optimization that's no longer needed - with Nagle disabled. +- bpo-23302: Default to TCP_NODELAY=1 upon establishing an HTTPConnection. + Removed use of hard-coded MSS as it's an optimization that's no longer + needed with Nagle disabled. IDLE ---- -- Issue #20577: Configuration of the max line length for the FormatParagraph - extension has been moved from the General tab of the Idle preferences dialog - to the FormatParagraph tab of the Config Extensions dialog. - Patch by Tal Einat. +- bpo-20577: Configuration of the max line length for the FormatParagraph + extension has been moved from the General tab of the Idle preferences + dialog to the FormatParagraph tab of the Config Extensions dialog. Patch + by Tal Einat. -- Issue #16893: Update Idle doc chapter to match current Idle and add new +- bpo-16893: Update Idle doc chapter to match current Idle and add new information. -- Issue #3068: Add Idle extension configuration dialog to Options menu. - Changes are written to HOME/.idlerc/config-extensions.cfg. - Original patch by Tal Einat. +- bpo-3068: Add Idle extension configuration dialog to Options menu. Changes + are written to HOME/.idlerc/config-extensions.cfg. Original patch by Tal + Einat. -- Issue #16233: A module browser (File : Class Browser, Alt+C) requires an +- bpo-16233: A module browser (File : Class Browser, Alt+C) requires an editor window with a filename. When Class Browser is requested otherwise, from a shell, output window, or 'Untitled' editor, Idle no longer displays - an error box. It now pops up an Open Module box (Alt+M). If a valid name + an error box. It now pops up an Open Module box (Alt+M). If a valid name is entered and a module is opened, a corresponding browser is also opened. -- Issue #4832: Save As to type Python files automatically adds .py to the - name you enter (even if your system does not display it). Some systems +- bpo-4832: Save As to type Python files automatically adds .py to the name + you enter (even if your system does not display it). Some systems automatically add .txt when type is Text files. -- Issue #21986: Code objects are not normally pickled by the pickle module. - To match this, they are no longer pickled when running under Idle. +- bpo-21986: Code objects are not normally pickled by the pickle module. To + match this, they are no longer pickled when running under Idle. -- Issue #17390: Adjust Editor window title; remove 'Python', - move version to end. +- bpo-17390: Adjust Editor window title; remove 'Python', move version to + end. -- Issue #14105: Idle debugger breakpoints no longer disappear - when inserting or deleting lines. +- bpo-14105: Idle debugger breakpoints no longer disappear when inserting or + deleting lines. -- Issue #17172: Turtledemo can now be run from Idle. - Currently, the entry is on the Help menu, but it may move to Run. - Patch by Ramchandra Apt and Lita Cho. +- bpo-17172: Turtledemo can now be run from Idle. Currently, the entry is on + the Help menu, but it may move to Run. Patch by Ramchandra Apt and Lita + Cho. -- Issue #21765: Add support for non-ascii identifiers to HyperParser. +- bpo-21765: Add support for non-ascii identifiers to HyperParser. -- Issue #21940: Add unittest for WidgetRedirector. Initial patch by Saimadhav +- bpo-21940: Add unittest for WidgetRedirector. Initial patch by Saimadhav Heblikar. -- Issue #18592: Add unittest for SearchDialogBase. Patch by Phil Webster. +- bpo-18592: Add unittest for SearchDialogBase. Patch by Phil Webster. -- Issue #21694: Add unittest for ParenMatch. Patch by Saimadhav Heblikar. +- bpo-21694: Add unittest for ParenMatch. Patch by Saimadhav Heblikar. -- Issue #21686: add unittest for HyperParser. Original patch by Saimadhav +- bpo-21686: add unittest for HyperParser. Original patch by Saimadhav Heblikar. -- Issue #12387: Add missing upper(lower)case versions of default Windows key - bindings for Idle so Caps Lock does not disable them. Patch by Roger Serwy. +- bpo-12387: Add missing upper(lower)case versions of default Windows key + bindings for Idle so Caps Lock does not disable them. Patch by Roger + Serwy. -- Issue #21695: Closing a Find-in-files output window while the search is - still in progress no longer closes Idle. +- bpo-21695: Closing a Find-in-files output window while the search is still + in progress no longer closes Idle. -- Issue #18910: Add unittest for textView. Patch by Phil Webster. +- bpo-18910: Add unittest for textView. Patch by Phil Webster. -- Issue #18292: Add unittest for AutoExpand. Patch by Saihadhav Heblikar. +- bpo-18292: Add unittest for AutoExpand. Patch by Saihadhav Heblikar. -- Issue #18409: Add unittest for AutoComplete. Patch by Phil Webster. +- bpo-18409: Add unittest for AutoComplete. Patch by Phil Webster. -- Issue #21477: htest.py - Improve framework, complete set of tests. - Patches by Saimadhav Heblikar +- bpo-21477: htest.py - Improve framework, complete set of tests. Patches by + Saimadhav Heblikar -- Issue #18104: Add idlelib/idle_test/htest.py with a few sample tests to begin - consolidating and improving human-validated tests of Idle. Change other files - as needed to work with htest. Running the module as __main__ runs all tests. +- bpo-18104: Add idlelib/idle_test/htest.py with a few sample tests to begin + consolidating and improving human-validated tests of Idle. Change other + files as needed to work with htest. Running the module as __main__ runs + all tests. -- Issue #21139: Change default paragraph width to 72, the PEP 8 recommendation. +- bpo-21139: Change default paragraph width to 72, the PEP 8 recommendation. -- Issue #21284: Paragraph reformat test passes after user changes reformat width. +- bpo-21284: Paragraph reformat test passes after user changes reformat + width. -- Issue #17654: Ensure IDLE menus are customized properly on OS X for - non-framework builds and for all variants of Tk. +- bpo-17654: Ensure IDLE menus are customized properly on OS X for non- + framework builds and for all variants of Tk. -- Issue #23180: Rename IDLE "Windows" menu item to "Window". - Patch by Al Sweigart. +- bpo-23180: Rename IDLE "Windows" menu item to "Window". Patch by Al + Sweigart. Build ----- -- Issue #15506: Use standard PKG_PROG_PKG_CONFIG autoconf macro in the configure - script. +- bpo-15506: Use standard PKG_PROG_PKG_CONFIG autoconf macro in the + configure script. -- Issue #22935: Allow the ssl module to be compiled if openssl doesn't support +- bpo-22935: Allow the ssl module to be compiled if openssl doesn't support SSL 3. -- Issue #22592: Drop support of the Borland C compiler to build Python. The +- bpo-22592: Drop support of the Borland C compiler to build Python. The distutils module still supports it to build extensions. -- Issue #22591: Drop support of MS-DOS, especially of the DJGPP compiler - (MS-DOS port of GCC). +- bpo-22591: Drop support of MS-DOS, especially of the DJGPP compiler (MS- + DOS port of GCC). -- Issue #16537: Check whether self.extensions is empty in setup.py. Patch by +- bpo-16537: Check whether self.extensions is empty in setup.py. Patch by Jonathan Hosmer. -- Issue #22359: Remove incorrect uses of recursive make. Patch by Jonas +- bpo-22359: Remove incorrect uses of recursive make. Patch by Jonas Wagner. -- Issue #21958: Define HAVE_ROUND when building with Visual Studio 2013 and +- bpo-21958: Define HAVE_ROUND when building with Visual Studio 2013 and above. Patch by Zachary Turner. -- Issue #18093: the programs that embed the CPython runtime are now in a +- bpo-18093: the programs that embed the CPython runtime are now in a separate "Programs" directory, rather than being kept in the Modules directory. -- Issue #15759: "make suspicious", "make linkcheck" and "make doctest" in Doc/ +- bpo-15759: "make suspicious", "make linkcheck" and "make doctest" in Doc/ now display special message when and only when there are failures. -- Issue #21141: The Windows build process no longer attempts to find Perl, - instead relying on OpenSSL source being configured and ready to build. The - ``PCbuild\build_ssl.py`` script has been re-written and re-named to +- bpo-21141: The Windows build process no longer attempts to find Perl, + instead relying on OpenSSL source being configured and ready to build. + The ``PCbuild\build_ssl.py`` script has been re-written and re-named to ``PCbuild\prepare_ssl.py``, and takes care of configuring OpenSSL source for both 32 and 64 bit platforms. OpenSSL sources obtained from svn.python.org will always be pre-configured and ready to build. -- Issue #21037: Add a build option to enable AddressSanitizer support. +- bpo-21037: Add a build option to enable AddressSanitizer support. -- Issue #19962: The Windows build process now creates "python.bat" in the - root of the source tree, which passes all arguments through to the most +- bpo-19962: The Windows build process now creates "python.bat" in the root + of the source tree, which passes all arguments through to the most recently built interpreter. -- Issue #21285: Refactor and fix curses configure check to always search - in a ncursesw directory. +- bpo-21285: Refactor and fix curses configure check to always search in a + ncursesw directory. -- Issue #15234: For BerkelyDB and Sqlite, only add the found library and - include directories if they aren't already being searched. This avoids - an explicit runtime library dependency. +- bpo-15234: For BerkelyDB and Sqlite, only add the found library and + include directories if they aren't already being searched. This avoids an + explicit runtime library dependency. -- Issue #17861: Tools/scripts/generate_opcode_h.py automatically regenerates +- bpo-17861: Tools/scripts/generate_opcode_h.py automatically regenerates Include/opcode.h from Lib/opcode.py if the latter gets any change. -- Issue #20644: OS X installer build support for documentation build changes - in 3.4.1: assume externally supplied sphinx-build is available in /usr/bin. +- bpo-20644: OS X installer build support for documentation build changes in + 3.4.1: assume externally supplied sphinx-build is available in /usr/bin. -- Issue #20022: Eliminate use of deprecated bundlebuilder in OS X builds. +- bpo-20022: Eliminate use of deprecated bundlebuilder in OS X builds. -- Issue #15968: Incorporated Tcl, Tk, and Tix builds into the Windows build +- bpo-15968: Incorporated Tcl, Tk, and Tix builds into the Windows build solution. -- Issue #17095: Fix Modules/Setup *shared* support. +- bpo-17095: Fix Modules/Setup *shared* support. -- Issue #21811: Anticipated fixes to support OS X versions > 10.9. +- bpo-21811: Anticipated fixes to support OS X versions > 10.9. -- Issue #21166: Prevent possible segfaults and other random failures of - python --generate-posix-vars in pybuilddir.txt build target. +- bpo-21166: Prevent possible segfaults and other random failures of python + --generate- posix-vars in pybuilddir.txt build target. -- Issue #18096: Fix library order returned by python-config. +- bpo-18096: Fix library order returned by python-config. -- Issue #17219: Add library build dir for Python extension cross-builds. +- bpo-17219: Add library build dir for Python extension cross-builds. -- Issue #22919: Windows build updated to support VC 14.0 (Visual Studio 2015), +- bpo-22919: Windows build updated to support VC 14.0 (Visual Studio 2015), which will be used for the official release. -- Issue #21236: Build _msi.pyd with cabinet.lib instead of fci.lib +- bpo-21236: Build _msi.pyd with cabinet.lib instead of fci.lib -- Issue #17128: Use private version of OpenSSL for OS X 10.5+ installer. +- bpo-17128: Use private version of OpenSSL for OS X 10.5+ installer. C API ----- -- Issue #14203: Remove obsolete support for view==NULL in PyBuffer_FillInfo(), +- bpo-14203: Remove obsolete support for view==NULL in PyBuffer_FillInfo(), bytearray_getbuffer(), bytesiobuf_getbuffer() and array_buffer_getbuf(). All functions now raise BufferError in that case. -- Issue #22445: PyBuffer_IsContiguous() now implements precise contiguity +- bpo-22445: PyBuffer_IsContiguous() now implements precise contiguity tests, compatible with NumPy's NPY_RELAXED_STRIDES_CHECKING compilation flag. Previously the function reported false negatives for corner cases. -- Issue #22079: PyType_Ready() now checks that statically allocated type has - no dynamically allocated bases. +- bpo-22079: PyType_Ready() now checks that statically allocated type has no + dynamically allocated bases. -- Issue #22453: Removed non-documented macro PyObject_REPR(). +- bpo-22453: Removed non-documented macro PyObject_REPR(). -- Issue #18395: Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, +- bpo-18395: Rename ``_Py_char2wchar()`` to :c:func:`Py_DecodeLocale`, rename ``_Py_wchar2char()`` to :c:func:`Py_EncodeLocale`, and document these functions. -- Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(), +- bpo-21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(), PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) is now using ``calloc()`` instead of ``malloc()`` for large objects which is faster and use less memory. -- Issue #20942: PyImport_ImportFrozenModuleObject() no longer sets __file__ to +- bpo-20942: PyImport_ImportFrozenModuleObject() no longer sets __file__ to match what importlib does; this affects _frozen_importlib as well as any module loaded using imp.init_frozen(). Documentation ------------- -- Issue #19548: Update the codecs module documentation to better cover the +- bpo-19548: Update the codecs module documentation to better cover the distinction between text encodings and other codecs, together with other clarifications. Patch by Martin Panter. -- Issue #22394: Doc/Makefile now supports ``make venv PYTHON=../python`` to - create a venv for generating the documentation, e.g., - ``make html PYTHON=venv/bin/python3``. +- bpo-22394: Doc/Makefile now supports ``make venv PYTHON=../python`` to + create a venv for generating the documentation, e.g., ``make html + PYTHON=venv/bin/python3``. -- Issue #21514: The documentation of the json module now refers to new JSON RFC +- bpo-21514: The documentation of the json module now refers to new JSON RFC 7159 instead of obsoleted RFC 4627. -- Issue #21777: The binary sequence methods on bytes and bytearray are now +- bpo-21777: The binary sequence methods on bytes and bytearray are now documented explicitly, rather than assuming users will be able to derive - the expected behaviour from the behaviour of the corresponding str methods. + the expected behaviour from the behaviour of the corresponding str + methods. -- Issue #6916: undocument deprecated asynchat.fifo class. +- bpo-6916: undocument deprecated asynchat.fifo class. -- Issue #17386: Expanded functionality of the ``Doc/make.bat`` script to make +- bpo-17386: Expanded functionality of the ``Doc/make.bat`` script to make it much more comparable to ``Doc/Makefile``. -- Issue #21312: Update the thread_foobar.h template file to include newer - threading APIs. Patch by Jack McCracken. +- bpo-21312: Update the thread_foobar.h template file to include newer + threading APIs. Patch by Jack McCracken. -- Issue #21043: Remove the recommendation for specific CA organizations and to +- bpo-21043: Remove the recommendation for specific CA organizations and to mention the ability to load the OS certificates. -- Issue #20765: Add missing documentation for PurePath.with_name() and +- bpo-20765: Add missing documentation for PurePath.with_name() and PurePath.with_suffix(). -- Issue #19407: New package installation and distribution guides based on - the Python Packaging Authority tools. Existing guides have been retained - as legacy links from the distutils docs, as they still contain some - required reference material for tool developers that isn't recorded - anywhere else. +- bpo-19407: New package installation and distribution guides based on the + Python Packaging Authority tools. Existing guides have been retained as + legacy links from the distutils docs, as they still contain some required + reference material for tool developers that isn't recorded anywhere else. -- Issue #19697: Document cases where __main__.__spec__ is None. +- bpo-19697: Document cases where __main__.__spec__ is None. Tests ----- -- Issue #18982: Add tests for CLI of the calendar module. +- bpo-18982: Add tests for CLI of the calendar module. -- Issue #19548: Added some additional checks to test_codecs to ensure that +- bpo-19548: Added some additional checks to test_codecs to ensure that statements in the updated documentation remain accurate. Patch by Martin Panter. -- Issue #22838: All test_re tests now work with unittest test discovery. +- bpo-22838: All test_re tests now work with unittest test discovery. -- Issue #22173: Update lib2to3 tests to use unittest test discovery. +- bpo-22173: Update lib2to3 tests to use unittest test discovery. -- Issue #16000: Convert test_curses to use unittest. +- bpo-16000: Convert test_curses to use unittest. -- Issue #21456: Skip two tests in test_urllib2net.py if _ssl module not +- bpo-21456: Skip two tests in test_urllib2net.py if _ssl module not present. Patch by Remi Pointel. -- Issue #20746: Fix test_pdb to run in refleak mode (-R). Patch by Xavier - de Gaye. +- bpo-20746: Fix test_pdb to run in refleak mode (-R). Patch by Xavier de + Gaye. -- Issue #22060: test_ctypes has been somewhat cleaned up and simplified; it - now uses unittest test discovery to find its tests. +- bpo-22060: test_ctypes has been somewhat cleaned up and simplified; it now + uses unittest test discovery to find its tests. -- Issue #22104: regrtest.py no longer holds a reference to the suite of tests +- bpo-22104: regrtest.py no longer holds a reference to the suite of tests loaded from test modules that don't define test_main(). -- Issue #22111: Assorted cleanups in test_imaplib. Patch by Milan Oberkirch. +- bpo-22111: Assorted cleanups in test_imaplib. Patch by Milan Oberkirch. -- Issue #22002: Added ``load_package_tests`` function to test.support and used +- bpo-22002: Added ``load_package_tests`` function to test.support and used it to implement/augment test discovery in test_asyncio, test_email, test_importlib, test_json, and test_tools. -- Issue #21976: Fix test_ssl to accept LibreSSL version strings. Thanks - to William Orr. +- bpo-21976: Fix test_ssl to accept LibreSSL version strings. Thanks to + William Orr. -- Issue #21918: Converted test_tools from a module to a package containing +- bpo-21918: Converted test_tools from a module to a package containing separate test files for each tested script. -- Issue #9554: Use modern unittest features in test_argparse. Initial patch by +- bpo-9554: Use modern unittest features in test_argparse. Initial patch by Denver Coneybeare and Radu Voicilas. -- Issue #20155: Changed HTTP method names in failing tests in test_httpservers - so that packet filtering software (specifically Windows Base Filtering Engine) - does not interfere with the transaction semantics expected by the tests. +- bpo-20155: Changed HTTP method names in failing tests in test_httpservers + so that packet filtering software (specifically Windows Base Filtering + Engine) does not interfere with the transaction semantics expected by the + tests. -- Issue #19493: Refactored the ctypes test package to skip tests explicitly +- bpo-19493: Refactored the ctypes test package to skip tests explicitly rather than silently. -- Issue #18492: All resources are now allowed when tests are not run by +- bpo-18492: All resources are now allowed when tests are not run by regrtest.py. -- Issue #21634: Fix pystone micro-benchmark: use floor division instead of true - division to benchmark integers instead of floating point numbers. Set pystone - version to 1.2. Patch written by Lennart Regebro. +- bpo-21634: Fix pystone micro-benchmark: use floor division instead of true + division to benchmark integers instead of floating point numbers. Set + pystone version to 1.2. Patch written by Lennart Regebro. -- Issue #21605: Added tests for Tkinter images. +- bpo-21605: Added tests for Tkinter images. -- Issue #21493: Added test for ntpath.expanduser(). Original patch by - Claudiu Popa. +- bpo-21493: Added test for ntpath.expanduser(). Original patch by Claudiu + Popa. -- Issue #19925: Added tests for the spwd module. Original patch by Vajrasky Kok. +- bpo-19925: Added tests for the spwd module. Original patch by Vajrasky + Kok. -- Issue #21522: Added Tkinter tests for Listbox.itemconfigure(), +- bpo-21522: Added Tkinter tests for Listbox.itemconfigure(), PanedWindow.paneconfigure(), and Menu.entryconfigure(). -- Issue #17756: Fix test_code test when run from the installed location. +- bpo-17756: Fix test_code test when run from the installed location. -- Issue #17752: Fix distutils tests when run from the installed location. +- bpo-17752: Fix distutils tests when run from the installed location. -- Issue #18604: Consolidated checks for GUI availability. All platforms now - at least check whether Tk can be instantiated when the GUI resource is +- bpo-18604: Consolidated checks for GUI availability. All platforms now at + least check whether Tk can be instantiated when the GUI resource is requested. -- Issue #21275: Fix a socket test on KFreeBSD. +- bpo-21275: Fix a socket test on KFreeBSD. -- Issue #21223: Pass test_site/test_startup_imports when some of the extensions +- bpo-21223: Pass test_site/test_startup_imports when some of the extensions are built as builtins. -- Issue #20635: Added tests for Tk geometry managers. +- bpo-20635: Added tests for Tk geometry managers. - Add test case for freeze. -- Issue #20743: Fix a reference leak in test_tcl. +- bpo-20743: Fix a reference leak in test_tcl. -- Issue #21097: Move test_namespace_pkgs into test_importlib. +- bpo-21097: Move test_namespace_pkgs into test_importlib. -- Issue #21503: Use test_both() consistently in test_importlib. +- bpo-21503: Use test_both() consistently in test_importlib. -- Issue #20939: Avoid various network test failures due to new - redirect of http://www.python.org/ to https://www.python.org: - use http://www.example.com instead. +- bpo-20939: Avoid various network test failures due to new redirect of + http://www.python.org/ to https://www.python.org: use + http://www.example.com instead. -- Issue #20668: asyncio tests no longer rely on tests.txt file. - (Patch by Vajrasky Kok) +- bpo-20668: asyncio tests no longer rely on tests.txt file. (Patch by + Vajrasky Kok) -- Issue #21093: Prevent failures of ctypes test_macholib on OS X if a - copy of libz exists in $HOME/lib or /usr/local/lib. +- bpo-21093: Prevent failures of ctypes test_macholib on OS X if a copy of + libz exists in $HOME/lib or /usr/local/lib. -- Issue #22770: Prevent some Tk segfaults on OS X when running gui tests. +- bpo-22770: Prevent some Tk segfaults on OS X when running gui tests. -- Issue #23211: Workaround test_logging failure on some OS X 10.6 systems. +- bpo-23211: Workaround test_logging failure on some OS X 10.6 systems. -- Issue #23345: Prevent test_ssl failures with large OpenSSL patch level - values (like 0.9.8zc). +- bpo-23345: Prevent test_ssl failures with large OpenSSL patch level values + (like 0.9.8zc). Tools/Demos ----------- -- Issue #22314: pydoc now works when the LINES environment variable is set. +- bpo-22314: pydoc now works when the LINES environment variable is set. -- Issue #22615: Argument Clinic now supports the "type" argument for the - int converter. This permits using the int converter with enums and - typedefs. +- bpo-22615: Argument Clinic now supports the "type" argument for the int + converter. This permits using the int converter with enums and typedefs. -- Issue #20076: The makelocalealias.py script no longer ignores UTF-8 mapping. +- bpo-20076: The makelocalealias.py script no longer ignores UTF-8 mapping. -- Issue #20079: The makelocalealias.py script now can parse the SUPPORTED file +- bpo-20079: The makelocalealias.py script now can parse the SUPPORTED file from glibc sources and supports command line options for source paths. -- Issue #22201: Command-line interface of the zipfile module now correctly +- bpo-22201: Command-line interface of the zipfile module now correctly extracts ZIP files with directory entries. Patch by Ryan Wilson. -- Issue #22120: For functions using an unsigned integer return converter, - Argument Clinic now generates a cast to that type for the comparison - to -1 in the generated code. (This suppresses a compilation warning.) +- bpo-22120: For functions using an unsigned integer return converter, + Argument Clinic now generates a cast to that type for the comparison to -1 + in the generated code. (This suppresses a compilation warning.) -- Issue #18974: Tools/scripts/diff.py now uses argparse instead of optparse. +- bpo-18974: Tools/scripts/diff.py now uses argparse instead of optparse. -- Issue #21906: Make Tools/scripts/md5sum.py work in Python 3. - Patch by Zachary Ware. +- bpo-21906: Make Tools/scripts/md5sum.py work in Python 3. Patch by Zachary + Ware. -- Issue #21629: Fix Argument Clinic's "--converters" feature. +- bpo-21629: Fix Argument Clinic's "--converters" feature. - Add support for ``yield from`` to 2to3. - Add support for the PEP 465 matrix multiplication operator to 2to3. -- Issue #16047: Fix module exception list and __file__ handling in freeze. +- bpo-16047: Fix module exception list and __file__ handling in freeze. Patch by Meador Inge. -- Issue #11824: Consider ABI tags in freeze. Patch by Meador Inge. +- bpo-11824: Consider ABI tags in freeze. Patch by Meador Inge. -- Issue #20535: PYTHONWARNING no longer affects the run_tests.py script. - Patch by Arfrever Frehtes Taifersar Arahesis. +- bpo-20535: PYTHONWARNING no longer affects the run_tests.py script. Patch + by Arfrever Frehtes Taifersar Arahesis. Windows ------- -- Issue #23260: Update Windows installer +- bpo-23260: Update Windows installer - The bundled version of Tcl/Tk has been updated to 8.6.3. The most visible result of this change is the addition of new native file dialogs when running on Windows Vista or newer. See Tcl/Tk's TIP 432 for more - information. Also, this version of Tcl/Tk includes support for Windows 10. + information. Also, this version of Tcl/Tk includes support for Windows + 10. -- Issue #17896: The Windows build scripts now expect external library sources +- bpo-17896: The Windows build scripts now expect external library sources to be in ``PCbuild\..\externals`` rather than ``PCbuild\..\..``. -- Issue #17717: The Windows build scripts now use a copy of NASM pulled from +- bpo-17717: The Windows build scripts now use a copy of NASM pulled from svn.python.org to build OpenSSL. -- Issue #21907: Improved the batch scripts provided for building Python. +- bpo-21907: Improved the batch scripts provided for building Python. -- Issue #22644: The bundled version of OpenSSL has been updated to 1.0.1j. +- bpo-22644: The bundled version of OpenSSL has been updated to 1.0.1j. -- Issue #10747: Use versioned labels in the Windows start menu. - Patch by Olive Kilburn. +- bpo-10747: Use versioned labels in the Windows start menu. Patch by Olive + Kilburn. -- Issue #22980: .pyd files with a version and platform tag (for example, +- bpo-22980: .pyd files with a version and platform tag (for example, ".cp35-win32.pyd") will now be loaded in preference to those without tags. -What's New in Python 3.4.0? -=========================== +What's New in Python 3.4.0 final? +================================= -Release date: 2014-03-16 +*Release date: 2014-03-16* Library ------- -- Issue #20939: Fix test_geturl failure in test_urllibnet due to - new redirect of http://www.python.org/ to https://www.python.org. +- bpo-20939: Fix test_geturl failure in test_urllibnet due to new redirect + of http://www.python.org/ to https://www.python.org. Documentation ------------- @@ -5050,1002 +5524,1005 @@ Documentation What's New in Python 3.4.0 release candidate 3? =============================================== -Release date: 2014-03-09 +*Release date: 2014-03-09* Core and Builtins ----------------- -- Issue #20786: Fix signatures for dict.__delitem__ and - property.__delete__ builtins. +- bpo-20786: Fix signatures for dict.__delitem__ and property.__delete__ + builtins. Library ------- -- Issue #20839: Don't trigger a DeprecationWarning in the still supported - pkgutil.get_loader() API when __loader__ isn't set on a module (nor - when pkgutil.find_loader() is called directly). +- bpo-20839: Don't trigger a DeprecationWarning in the still supported + pkgutil.get_loader() API when __loader__ isn't set on a module (nor when + pkgutil.find_loader() is called directly). Build ----- -- Issue #14512: Launch pydoc -b instead of pydocgui.pyw on Windows. +- bpo-14512: Launch pydoc -b instead of pydocgui.pyw on Windows. -- Issue #20748: Uninstalling pip does not leave behind the pyc of - the uninstaller anymore. +- bpo-20748: Uninstalling pip does not leave behind the pyc of the + uninstaller anymore. -- Issue #20568: The Windows installer now installs the unversioned ``pip`` +- bpo-20568: The Windows installer now installs the unversioned ``pip`` command in addition to the versioned ``pip3`` and ``pip3.4`` commands. -- Issue #20757: The ensurepip helper for the Windows uninstaller now skips +- bpo-20757: The ensurepip helper for the Windows uninstaller now skips uninstalling pip (rather than failing) if the user has updated pip to a different version from the one bundled with ensurepip. -- Issue #20465: Update OS X and Windows installer builds to use - SQLite 3.8.3.1. +- bpo-20465: Update OS X and Windows installer builds to use SQLite 3.8.3.1. What's New in Python 3.4.0 release candidate 2? =============================================== -Release date: 2014-02-23 +*Release date: 2014-02-23* Core and Builtins ----------------- -- Issue #20625: Parameter names in __annotations__ were not mangled properly. +- bpo-20625: Parameter names in __annotations__ were not mangled properly. Discovered by Jonas Wielicki, patch by Yury Selivanov. -- Issue #20261: In pickle, lookup __getnewargs__ and __getnewargs_ex__ on the +- bpo-20261: In pickle, lookup __getnewargs__ and __getnewargs_ex__ on the type of the object. -- Issue #20619: Give the AST nodes of keyword-only arguments a column and line +- bpo-20619: Give the AST nodes of keyword-only arguments a column and line number. -- Issue #20526: Revert changes of issue #19466 which introduces a regression: +- bpo-20526: Revert changes of issue #19466 which introduces a regression: don't clear anymore the state of Python threads early during the Python shutdown. Library ------- -- Issue #20710: The pydoc summary line no longer displays the "self" parameter +- bpo-20710: The pydoc summary line no longer displays the "self" parameter for bound methods. -- Issue #20566: Change asyncio.as_completed() to use a Queue, to - avoid O(N**2) behavior. +- bpo-20566: Change asyncio.as_completed() to use a Queue, to avoid O(N**2) + behavior. -- Issue #20704: Implement new debug API in asyncio. Add new methods - BaseEventLoop.set_debug() and BaseEventLoop.get_debug(). - Add support for setting 'asyncio.tasks._DEBUG' variable with - 'PYTHONASYNCIODEBUG' environment variable. +- bpo-20704: Implement new debug API in asyncio. Add new methods + BaseEventLoop.set_debug() and BaseEventLoop.get_debug(). Add support for + setting 'asyncio.tasks._DEBUG' variable with 'PYTHONASYNCIODEBUG' + environment variable. - asyncio: Refactoring and fixes: BaseEventLoop.sock_connect() raises an error if the address is not resolved; use __slots__ in Handle and - TimerHandle; as_completed() and wait() raise TypeError if the passed - list of Futures is a single Future; call_soon() and other 'call_*()' - functions raise TypeError if the passed callback is a coroutine - function; _ProactorBasePipeTransport uses _FlowControlMixin; - WriteTransport.set_write_buffer_size() calls _maybe_pause_protocol() - to consider pausing receiving if the watermark limits have changed; - fix _check_resolved_address() for IPv6 address; and other minor - improvements, along with multiple documentation updates. - -- Issue #20684: Fix inspect.getfullargspec() to not to follow __wrapped__ + TimerHandle; as_completed() and wait() raise TypeError if the passed list + of Futures is a single Future; call_soon() and other 'call_*()' functions + raise TypeError if the passed callback is a coroutine function; + _ProactorBasePipeTransport uses _FlowControlMixin; + WriteTransport.set_write_buffer_size() calls _maybe_pause_protocol() to + consider pausing receiving if the watermark limits have changed; fix + _check_resolved_address() for IPv6 address; and other minor improvements, + along with multiple documentation updates. + +- bpo-20684: Fix inspect.getfullargspec() to not to follow __wrapped__ chains. Make its behaviour consistent with bound methods first argument. Patch by Nick Coghlan and Yury Selivanov. -- Issue #20681: Add new error handling API in asyncio. New APIs: +- bpo-20681: Add new error handling API in asyncio. New APIs: loop.set_exception_handler(), loop.default_exception_handler(), and loop.call_exception_handler(). -- Issue #20673: Implement support for UNIX Domain Sockets in asyncio. - New APIs: loop.create_unix_connection(), loop.create_unix_server(), +- bpo-20673: Implement support for UNIX Domain Sockets in asyncio. New APIs: + loop.create_unix_connection(), loop.create_unix_server(), streams.open_unix_connection(), and streams.start_unix_server(). -- Issue #20616: Add a format() method to tracemalloc.Traceback. +- bpo-20616: Add a format() method to tracemalloc.Traceback. -- Issue #19744: the ensurepip installation step now just prints a warning to +- bpo-19744: the ensurepip installation step now just prints a warning to stderr rather than failing outright if SSL/TLS is unavailable. This allows local installation of POSIX builds without SSL/TLS support. -- Issue #20594: Avoid name clash with the libc function posix_close. +- bpo-20594: Avoid name clash with the libc function posix_close. Build ----- -- Issue #20641: Run MSI custom actions (pip installation, pyc compilation) - with the NoImpersonate flag, to support elevated execution (UAC). +- bpo-20641: Run MSI custom actions (pip installation, pyc compilation) with + the NoImpersonate flag, to support elevated execution (UAC). -- Issue #20221: Removed conflicting (or circular) hypot definition when +- bpo-20221: Removed conflicting (or circular) hypot definition when compiled with VS 2010 or above. Initial patch by Tabrez Mohammed. -- Issue #20609: Restored the ability to build 64-bit Windows binaries on - 32-bit Windows, which was broken by the change in issue #19788. +- bpo-20609: Restored the ability to build 64-bit Windows binaries on 32-bit + Windows, which was broken by the change in issue #19788. What's New in Python 3.4.0 release candidate 1? =============================================== -Release date: 2014-02-10 +*Release date: 2014-02-10* Core and Builtins ----------------- -- Issue #19255: The builtins module is restored to initial value before +- bpo-19255: The builtins module is restored to initial value before cleaning other modules. The sys and builtins modules are cleaned last. -- Issue #20588: Make Python-ast.c C89 compliant. +- bpo-20588: Make Python-ast.c C89 compliant. -- Issue #20437: Fixed 22 potential bugs when deleting object references. +- bpo-20437: Fixed 22 potential bugs when deleting object references. -- Issue #20500: Displaying an exception at interpreter shutdown no longer - risks triggering an assertion failure in PyObject_Str. +- bpo-20500: Displaying an exception at interpreter shutdown no longer risks + triggering an assertion failure in PyObject_Str. -- Issue #20538: UTF-7 incremental decoder produced inconsistent string when +- bpo-20538: UTF-7 incremental decoder produced inconsistent string when input was truncated in BASE64 section. -- Issue #20404: io.TextIOWrapper (and hence the open() builtin) now uses the +- bpo-20404: io.TextIOWrapper (and hence the open() builtin) now uses the internal codec marking system added for issue #19619 to throw LookupError - for known non-text encodings at stream construction time. The existing + for known non- text encodings at stream construction time. The existing output type checks remain in place to deal with unmarked third party codecs. -- Issue #17162: Add PyType_GetSlot. +- bpo-17162: Add PyType_GetSlot. -- Issue #20162: Fix an alignment issue in the siphash24() hash function which +- bpo-20162: Fix an alignment issue in the siphash24() hash function which caused a crash on PowerPC 64-bit (ppc64). Library ------- -- Issue #20530: The signatures for slot builtins have been updated - to reflect the fact that they only accept positional-only arguments. +- bpo-20530: The signatures for slot builtins have been updated to reflect + the fact that they only accept positional-only arguments. -- Issue #20517: Functions in the os module that accept two filenames - now register both filenames in the exception on failure. +- bpo-20517: Functions in the os module that accept two filenames now + register both filenames in the exception on failure. -- Issue #20563: The ipaddress module API is now considered stable. +- bpo-20563: The ipaddress module API is now considered stable. -- Issue #14983: email.generator now always adds a line end after each MIME +- bpo-14983: email.generator now always adds a line end after each MIME boundary marker, instead of doing so only when there is an epilogue. This fixes an RFC compliance bug and solves an issue with signed MIME parts. -- Issue #20540: Fix a performance regression (vs. Python 3.2) when layering - a multiprocessing Connection over a TCP socket. For small payloads, Nagle's +- bpo-20540: Fix a performance regression (vs. Python 3.2) when layering a + multiprocessing Connection over a TCP socket. For small payloads, Nagle's algorithm would introduce idle delays before the entire transmission of a message. -- Issue #16983: the new email header parsing code will now decode encoded words +- bpo-16983: the new email header parsing code will now decode encoded words that are (incorrectly) surrounded by quotes, and register a defect. -- Issue #19772: email.generator no longer mutates the message object when - doing a down-transform from 8bit to 7bit CTEs. +- bpo-19772: email.generator no longer mutates the message object when doing + a down- transform from 8bit to 7bit CTEs. -- Issue #20536: the statistics module now correctly handle Decimal instances +- bpo-20536: the statistics module now correctly handle Decimal instances with positive exponents -- Issue #18805: the netmask/hostmask parsing in ipaddress now more reliably +- bpo-18805: the netmask/hostmask parsing in ipaddress now more reliably filters out illegal values and correctly allows any valid prefix length. -- Issue #20481: For at least Python 3.4, the statistics module will require +- bpo-20481: For at least Python 3.4, the statistics module will require that all inputs for a single operation be of a single consistent type, or - else a mixed of ints and a single other consistent type. This avoids - some interoperability issues that arose with the previous approach of - coercing to a suitable common type. + else a mixed of ints and a single other consistent type. This avoids some + interoperability issues that arose with the previous approach of coercing + to a suitable common type. -- Issue #20478: the statistics module now treats collections.Counter inputs +- bpo-20478: the statistics module now treats collections.Counter inputs like any other iterable. -- Issue #17369: get_filename was raising an exception if the filename - parameter's RFC2231 encoding was broken in certain ways. This was - a regression relative to python2. +- bpo-17369: get_filename was raising an exception if the filename + parameter's RFC2231 encoding was broken in certain ways. This was a + regression relative to python2. -- Issue #20013: Some imap servers disconnect if the current mailbox is - deleted, and imaplib did not handle that case gracefully. Now it - handles the 'bye' correctly. +- bpo-20013: Some imap servers disconnect if the current mailbox is deleted, + and imaplib did not handle that case gracefully. Now it handles the 'bye' + correctly. -- Issue #20531: Revert 3.4 version of fix for #19063, and apply the 3.3 +- bpo-20531: Revert 3.4 version of fix for #19063, and apply the 3.3 version. That is, do *not* raise an error if unicode is passed to email.message.Message.set_payload. -- Issue #20476: If a non-compat32 policy is used with any of the email parsers, +- bpo-20476: If a non-compat32 policy is used with any of the email parsers, EmailMessage is now used as the factory class. The factory class should really come from the policy; that will get fixed in 3.5. -- Issue #19920: TarFile.list() no longer fails when outputs a listing - containing non-encodable characters. Based on patch by Vajrasky Kok. +- bpo-19920: TarFile.list() no longer fails when outputs a listing + containing non- encodable characters. Based on patch by Vajrasky Kok. -- Issue #20515: Fix NULL pointer dereference introduced by issue #20368. +- bpo-20515: Fix NULL pointer dereference introduced by issue #20368. -- Issue #19186: Restore namespacing of expat symbols inside the pyexpat module. +- bpo-19186: Restore namespacing of expat symbols inside the pyexpat module. -- Issue #20053: ensurepip (and hence venv) are no longer affected by the +- bpo-20053: ensurepip (and hence venv) are no longer affected by the settings in the default pip configuration file. -- Issue #20426: When passing the re.DEBUG flag, re.compile() displays the - debug output every time it is called, regardless of the compilation cache. +- bpo-20426: When passing the re.DEBUG flag, re.compile() displays the debug + output every time it is called, regardless of the compilation cache. -- Issue #20368: The null character now correctly passed from Tcl to Python. +- bpo-20368: The null character now correctly passed from Tcl to Python. Improved error handling in variables-related commands. -- Issue #20435: Fix _pyio.StringIO.getvalue() to take into account newline +- bpo-20435: Fix _pyio.StringIO.getvalue() to take into account newline translation settings. - tracemalloc: Fix slicing traces and fix slicing a traceback. -- Issue #20354: Fix an alignment issue in the tracemalloc module on 64-bit +- bpo-20354: Fix an alignment issue in the tracemalloc module on 64-bit platforms. Bug seen on 64-bit Linux when using "make profile-opt". -- Issue #17159: inspect.signature now accepts duck types of functions, - which adds support for Cython functions. Initial patch by Stefan Behnel. +- bpo-17159: inspect.signature now accepts duck types of functions, which + adds support for Cython functions. Initial patch by Stefan Behnel. -- Issue #18801: Fix inspect.classify_class_attrs to correctly classify +- bpo-18801: Fix inspect.classify_class_attrs to correctly classify object.__new__ and object.__init__. - Fixed cmath.isinf's name in its argument parsing code. -- Issue #20311, #20452: poll and epoll now round the timeout away from zero, - instead of rounding towards zero, in select and selectors modules: +- bpo-20311: poll and epoll now round the timeout away from zero, instead of + rounding towards zero, in select and selectors modules: select.epoll.poll(), selectors.PollSelector.poll() and selectors.EpollSelector.poll(). For example, a timeout of one microsecond - (1e-6) is now rounded to one millisecondi (1e-3), instead of being rounded to - zero. However, the granularity property and asyncio's resolution feature - were removed again. + (1e-6) is now rounded to one millisecondi (1e-3), instead of being rounded + to zero. However, the granularity property and asyncio's resolution + feature were removed again. (See also: bpo-20452) -- asyncio: Some refactoring; various fixes; add write flow control to - unix pipes; Future.set_exception() instantiates the exception - argument if it is a class; improved proactor pipe transport; support - wait_for(f, None); don't log broken/disconnected pipes; use - ValueError instead of assert for forbidden subprocess_{shell,exec} - arguments; added a convenience API for subprocess management; added - StreamReader.at_eof(); properly handle duplicate coroutines/futures - in gather(), wait(), as_completed(); use a bytearray for buffering - in StreamReader; and more. +- asyncio: Some refactoring; various fixes; add write flow control to unix + pipes; Future.set_exception() instantiates the exception argument if it is + a class; improved proactor pipe transport; support wait_for(f, None); + don't log broken/disconnected pipes; use ValueError instead of assert for + forbidden subprocess_{shell,exec} arguments; added a convenience API for + subprocess management; added StreamReader.at_eof(); properly handle + duplicate coroutines/futures in gather(), wait(), as_completed(); use a + bytearray for buffering in StreamReader; and more. -- Issue #20288: fix handling of invalid numeric charrefs in HTMLParser. +- bpo-20288: fix handling of invalid numeric charrefs in HTMLParser. -- Issue #20424: Python implementation of io.StringIO now supports lone surrogates. +- bpo-20424: Python implementation of io.StringIO now supports lone + surrogates. -- Issue #20308: inspect.signature now works on classes without user-defined +- bpo-20308: inspect.signature now works on classes without user-defined __init__ or __new__ methods. -- Issue #20372: inspect.getfile (and a bunch of other inspect functions that - use it) doesn't crash with unexpected AttributeError on classes defined in C - without __module__. +- bpo-20372: inspect.getfile (and a bunch of other inspect functions that + use it) doesn't crash with unexpected AttributeError on classes defined in + C without __module__. -- Issue #20356: inspect.signature formatting uses '/' to separate - positional-only parameters from others. +- bpo-20356: inspect.signature formatting uses '/' to separate positional- + only parameters from others. -- Issue #20223: inspect.signature now supports methods defined with +- bpo-20223: inspect.signature now supports methods defined with functools.partialmethods. -- Issue #19456: ntpath.join() now joins relative paths correctly when a drive +- bpo-19456: ntpath.join() now joins relative paths correctly when a drive is present. -- Issue #19077: tempfile.TemporaryDirectory cleanup no longer fails when - called during shutdown. Emitting resource warning in __del__ no longer fails. +- bpo-19077: tempfile.TemporaryDirectory cleanup no longer fails when called + during shutdown. Emitting resource warning in __del__ no longer fails. Original patch by Antoine Pitrou. -- Issue #20394: Silence Coverity warning in audioop module. +- bpo-20394: Silence Coverity warning in audioop module. -- Issue #20367: Fix behavior of concurrent.futures.as_completed() for - duplicate arguments. Patch by Glenn Langford. +- bpo-20367: Fix behavior of concurrent.futures.as_completed() for duplicate + arguments. Patch by Glenn Langford. -- Issue #8260: The read(), readline() and readlines() methods of +- bpo-8260: The read(), readline() and readlines() methods of codecs.StreamReader returned incomplete data when were called after - readline() or read(size). Based on patch by Amaury Forgeot d'Arc. + readline() or read(size). Based on patch by Amaury Forgeot d'Arc. -- Issue #20105: the codec exception chaining now correctly sets the - traceback of the original exception as its __traceback__ attribute. +- bpo-20105: the codec exception chaining now correctly sets the traceback + of the original exception as its __traceback__ attribute. -- Issue #17481: inspect.getfullargspec() now uses inspect.signature() API. +- bpo-17481: inspect.getfullargspec() now uses inspect.signature() API. -- Issue #15304: concurrent.futures.wait() can block forever even if - Futures have completed. Patch by Glenn Langford. +- bpo-15304: concurrent.futures.wait() can block forever even if Futures + have completed. Patch by Glenn Langford. -- Issue #14455: plistlib: fix serializing integers in the range - of an unsigned long long but outside of the range of signed long long for - binary plist files. +- bpo-14455: plistlib: fix serializing integers in the range of an unsigned + long long but outside of the range of signed long long for binary plist + files. IDLE ---- -- Issue #20406: Use Python application icons for Idle window title bars. - Patch mostly by Serhiy Storchaka. +- bpo-20406: Use Python application icons for Idle window title bars. Patch + mostly by Serhiy Storchaka. -- Update the python.gif icon for the Idle classbrowser and pathbowser - from the old green snake to the new blue and yellow snakes. +- Update the python.gif icon for the Idle classbrowser and pathbowser from + the old green snake to the new blue and yellow snakes. -- Issue #17721: Remove non-functional configuration dialog help button until we +- bpo-17721: Remove non-functional configuration dialog help button until we make it actually gives some help when clicked. Patch by Guilherme Simões. Tests ----- -- Issue #20532: Tests which use _testcapi now are marked as CPython only. +- bpo-20532: Tests which use _testcapi now are marked as CPython only. -- Issue #19920: Added tests for TarFile.list(). Based on patch by Vajrasky Kok. +- bpo-19920: Added tests for TarFile.list(). Based on patch by Vajrasky + Kok. -- Issue #19990: Added tests for the imghdr module. Based on patch by - Claudiu Popa. +- bpo-19990: Added tests for the imghdr module. Based on patch by Claudiu + Popa. -- Issue #20474: Fix test_socket "unexpected success" failures on OS X 10.7+. +- bpo-20474: Fix test_socket "unexpected success" failures on OS X 10.7+. Tools/Demos ----------- -- Issue #20530: Argument Clinic's signature format has been revised again. - The new syntax is highly human readable while still preventing false +- bpo-20530: Argument Clinic's signature format has been revised again. The + new syntax is highly human readable while still preventing false positives. The syntax also extends Python syntax to denote "self" and positional-only parameters, allowing inspect.Signature objects to be totally accurate for all supported builtins in Python 3.4. -- Issue #20456: Argument Clinic now observes the C preprocessor conditional +- bpo-20456: Argument Clinic now observes the C preprocessor conditional compilation statements of the C files it parses. When a Clinic block is inside a conditional code, it adjusts its output to match, including automatically generating an empty methoddef macro. -- Issue #20456: Cloned functions in Argument Clinic now use the correct - name, not the name of the function they were cloned from, for text - strings inside generated code. +- bpo-20456: Cloned functions in Argument Clinic now use the correct name, + not the name of the function they were cloned from, for text strings + inside generated code. -- Issue #20456: Fixed Argument Clinic's test suite and "--converters" feature. +- bpo-20456: Fixed Argument Clinic's test suite and "--converters" feature. -- Issue #20456: Argument Clinic now allows specifying different names - for a parameter in Python and C, using "as" on the parameter line. +- bpo-20456: Argument Clinic now allows specifying different names for a + parameter in Python and C, using "as" on the parameter line. -- Issue #20326: Argument Clinic now uses a simple, unique signature to - annotate text signatures in docstrings, resulting in fewer false - positives. "self" parameters are also explicitly marked, allowing - inspect.Signature() to authoritatively detect (and skip) said parameters. +- bpo-20326: Argument Clinic now uses a simple, unique signature to annotate + text signatures in docstrings, resulting in fewer false positives. "self" + parameters are also explicitly marked, allowing inspect.Signature() to + authoritatively detect (and skip) said parameters. -- Issue #20326: Argument Clinic now generates separate checksums for the - input and output sections of the block, allowing external tools to verify - that the input has not changed (and thus the output is not out-of-date). +- bpo-20326: Argument Clinic now generates separate checksums for the input + and output sections of the block, allowing external tools to verify that + the input has not changed (and thus the output is not out-of-date). Build ----- -- Issue #20465: Update SQLite shipped with OS X installer to 3.8.3. +- bpo-20465: Update SQLite shipped with OS X installer to 3.8.3. -C-API +C API ----- -- Issue #20517: Added new functions allowing OSError exceptions to reference +- bpo-20517: Added new functions allowing OSError exceptions to reference two filenames instead of one: PyErr_SetFromErrnoWithFilenameObjects() and PyErr_SetExcFromWindowsErrWithFilenameObjects(). Documentation ------------- -- Issue #20488: Change wording to say importlib is *the* implementation of +- bpo-20488: Change wording to say importlib is *the* implementation of import instead of just *an* implementation. -- Issue #6386: Clarify in the tutorial that specifying a symlink to execute +- bpo-6386: Clarify in the tutorial that specifying a symlink to execute means the directory containing the executed script and not the symlink is added to sys.path. -What's New in Python 3.4.0 Beta 3? +What's New in Python 3.4.0 beta 3? ================================== -Release date: 2014-01-26 +*Release date: 2014-01-26* Core and Builtins ----------------- -- Issue #20189: Four additional builtin types (PyTypeObject, - PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type) - have been modified to provide introspection information for builtins. +- bpo-20189: Four additional builtin types (PyTypeObject, + PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type) have + been modified to provide introspection information for builtins. -- Issue #17825: Cursor "^" is correctly positioned for SyntaxError and +- bpo-17825: Cursor "^" is correctly positioned for SyntaxError and IndentationError. -- Issue #2382: SyntaxError cursor "^" is now written at correct position in most - cases when multibyte characters are in line (before "^"). This still not - works correctly with wide East Asian characters. +- bpo-2382: SyntaxError cursor "^" is now written at correct position in + most cases when multibyte characters are in line (before "^"). This still + not works correctly with wide East Asian characters. -- Issue #18960: The first line of Python script could be executed twice when - the source encoding was specified on the second line. Now the source encoding - declaration on the second line isn't effective if the first line contains - anything except a comment. 'python -x' works now again with files with the - source encoding declarations, and can be used to make Python batch files - on Windows. +- bpo-18960: The first line of Python script could be executed twice when + the source encoding was specified on the second line. Now the source + encoding declaration on the second line isn't effective if the first line + contains anything except a comment. 'python -x' works now again with + files with the source encoding declarations, and can be used to make + Python batch files on Windows. Library ------- -- asyncio: Various improvements and small changes not all covered by - issues listed below. E.g. wait_for() now cancels the inner task if - the timeout occcurs; tweaked the set of exported symbols; renamed - Empty/Full to QueueEmpty/QueueFull; "with (yield from lock)" now - uses a separate context manager; readexactly() raises if not enough - data was read; PTY support tweaks. +- asyncio: Various improvements and small changes not all covered by issues + listed below. E.g. wait_for() now cancels the inner task if the timeout + occcurs; tweaked the set of exported symbols; renamed Empty/Full to + QueueEmpty/QueueFull; "with (yield from lock)" now uses a separate context + manager; readexactly() raises if not enough data was read; PTY support + tweaks. -- Issue #20311: asyncio: Add a granularity attribute to BaseEventLoop: maximum - between the resolution of the BaseEventLoop.time() method and the resolution - of the selector. The granuarility is used in the scheduler to round time and - deadline. +- bpo-20311: asyncio: Add a granularity attribute to BaseEventLoop: maximum + between the resolution of the BaseEventLoop.time() method and the + resolution of the selector. The granuarility is used in the scheduler to + round time and deadline. -- Issue #20311: selectors: Add a resolution attribute to BaseSelector. +- bpo-20311: selectors: Add a resolution attribute to BaseSelector. -- Issue #20189: unittest.mock now no longer assumes that any object for - which it could get an inspect.Signature is a callable written in Python. - Fix courtesy of Michael Foord. +- bpo-20189: unittest.mock now no longer assumes that any object for which + it could get an inspect.Signature is a callable written in Python. Fix + courtesy of Michael Foord. -- Issue #20317: ExitStack.__exit__ could create a self-referential loop if an +- bpo-20317: ExitStack.__exit__ could create a self-referential loop if an exception raised by a cleanup operation already had its context set correctly (for example, by the @contextmanager decorator). The infinite loop this caused is now avoided by checking if the expected context is already set before trying to fix it. -- Issue #20374: Fix build with GNU readline >= 6.3. +- bpo-20374: Fix build with GNU readline >= 6.3. -- Issue #20262: Warnings are raised now when duplicate names are added in the +- bpo-20262: Warnings are raised now when duplicate names are added in the ZIP file or too long ZIP file comment is truncated. -- Issue #20165: The unittest module no longer considers tests marked with +- bpo-20165: The unittest module no longer considers tests marked with @expectedFailure successful if they pass. -- Issue #18574: Added missing newline in 100-Continue reply from +- bpo-18574: Added missing newline in 100-Continue reply from http.server.BaseHTTPRequestHandler. Patch by Nikolaus Rath. -- Issue #20270: urllib.urlparse now supports empty ports. +- bpo-20270: urllib.urlparse now supports empty ports. -- Issue #20243: TarFile no longer raise ReadError when opened in write mode. +- bpo-20243: TarFile no longer raise ReadError when opened in write mode. -- Issue #20238: TarFile opened with external fileobj and "w:gz" mode didn't +- bpo-20238: TarFile opened with external fileobj and "w:gz" mode didn't write complete output on close. -- Issue #20245: The open functions in the tarfile module now correctly handle +- bpo-20245: The open functions in the tarfile module now correctly handle empty mode. -- Issue #20242: Fixed basicConfig() format strings for the alternative +- bpo-20242: Fixed basicConfig() format strings for the alternative formatting styles. Thanks to kespindler for the bug report and patch. -- Issue #20246: Fix buffer overflow in socket.recvfrom_into. +- bpo-20246: Fix buffer overflow in socket.recvfrom_into. -- Issues #20206 and #5803: Fix edge case in email.quoprimime.encode where it - truncated lines ending in a character needing encoding but no newline by - using a more efficient algorithm that doesn't have the bug. +- bpo-20206: Fix edge case in email.quoprimime.encode where it truncated + lines ending in a character needing encoding but no newline by using a + more efficient algorithm that doesn't have the bug. (See also: bpo-5803) -- Issue #19082: Working xmlrpc.server and xmlrpc.client examples. Both in +- bpo-19082: Working xmlrpc.server and xmlrpc.client examples. Both in modules and in documentation. Initial patch contributed by Vajrasky Kok. -- Issue #20138: The wsgiref.application_uri() and wsgiref.request_uri() +- bpo-20138: The wsgiref.application_uri() and wsgiref.request_uri() functions now conform to PEP 3333 when handle non-ASCII URLs. -- Issue #19097: Raise the correct Exception when cgi.FieldStorage is given an +- bpo-19097: Raise the correct Exception when cgi.FieldStorage is given an invalid fileobj. -- Issue #20152: Ported Python/import.c over to Argument Clinic. +- bpo-20152: Ported Python/import.c over to Argument Clinic. -- Issue #13107: argparse and optparse no longer raises an exception when output - a help on environment with too small COLUMNS. Based on patch by - Elazar Gershuni. +- bpo-13107: argparse and optparse no longer raises an exception when output + a help on environment with too small COLUMNS. Based on patch by Elazar + Gershuni. -- Issue #20207: Always disable SSLv2 except when PROTOCOL_SSLv2 is explicitly +- bpo-20207: Always disable SSLv2 except when PROTOCOL_SSLv2 is explicitly asked for. -- Issue #18960: The tokenize module now ignore the source encoding declaration +- bpo-18960: The tokenize module now ignore the source encoding declaration on the second line if the first line contains anything except a comment. -- Issue #20078: Reading malformed zipfiles no longer hangs with 100% CPU +- bpo-20078: Reading malformed zipfiles no longer hangs with 100% CPU consumption. -- Issue #20113: os.readv() and os.writev() now raise an OSError exception on +- bpo-20113: os.readv() and os.writev() now raise an OSError exception on error instead of returning -1. -- Issue #19719: Make importlib.abc.MetaPathFinder.find_module(), - PathEntryFinder.find_loader(), and Loader.load_module() use PEP 451 APIs to - help with backwards-compatibility. +- bpo-19719: Make importlib.abc.MetaPathFinder.find_module(), + PathEntryFinder.find_loader(), and Loader.load_module() use PEP 451 APIs + to help with backwards-compatibility. -- Issue #20144: inspect.Signature now supports parsing simple symbolic +- bpo-20144: inspect.Signature now supports parsing simple symbolic constants as parameter default values in __text_signature__. -- Issue #20072: Fixed multiple errors in tkinter with wantobjects is False. +- bpo-20072: Fixed multiple errors in tkinter with wantobjects is False. -- Issue #20229: Avoid plistlib deprecation warning in platform.mac_ver(). +- bpo-20229: Avoid plistlib deprecation warning in platform.mac_ver(). -- Issue #14455: Fix some problems with the new binary plist support in plistlib. +- bpo-14455: Fix some problems with the new binary plist support in + plistlib. IDLE ---- -- Issue #17390: Add Python version to Idle editor window title bar. - Original patches by Edmond Burnett and Kent Johnson. +- bpo-17390: Add Python version to Idle editor window title bar. Original + patches by Edmond Burnett and Kent Johnson. -- Issue #18960: IDLE now ignores the source encoding declaration on the second +- bpo-18960: IDLE now ignores the source encoding declaration on the second line if the first line contains anything except a comment. Tests ----- -- Issue #20358: Tests for curses.window.overlay and curses.window.overwrite - no longer specify min{row,col} > max{row,col}. +- bpo-20358: Tests for curses.window.overlay and curses.window.overwrite no + longer specify min{row,col} > max{row,col}. -- Issue #19804: The test_find_mac test in test_uuid is now skipped if the +- bpo-19804: The test_find_mac test in test_uuid is now skipped if the ifconfig executable is not available. -- Issue #19886: Use better estimated memory requirements for bigmem tests. +- bpo-19886: Use better estimated memory requirements for bigmem tests. Tools/Demos ----------- -- Issue #20390: Argument Clinic's "file" output preset now defaults to +- bpo-20390: Argument Clinic's "file" output preset now defaults to "{dirname}/clinic/{basename}.h". -- Issue #20390: Argument Clinic's "class" directive syntax has been extended +- bpo-20390: Argument Clinic's "class" directive syntax has been extended with two new required arguments: "typedef" and "type_object". -- Issue #20390: Argument Clinic: If __new__ or __init__ functions didn't use +- bpo-20390: Argument Clinic: If __new__ or __init__ functions didn't use kwargs (or args), the PyArg_NoKeywords (or PyArg_NoPositional) calls generated are only run when the type object is an exact match. -- Issue #20390: Argument Clinic now fails if you have required parameters after +- bpo-20390: Argument Clinic now fails if you have required parameters after optional parameters. -- Issue #20390: Argument Clinic converters now have a new template they can +- bpo-20390: Argument Clinic converters now have a new template they can inject code into: "modifiers". Code put there is run in the parsing function after argument parsing but before the call to the impl. -- Issue #20376: Argument Clinic now escapes backslashes in docstrings. +- bpo-20376: Argument Clinic now escapes backslashes in docstrings. -- Issue #20381: Argument Clinic now sanity checks the default argument when +- bpo-20381: Argument Clinic now sanity checks the default argument when c_default is also specified, providing a nice failure message for disallowed values. -- Issue #20189: Argument Clinic now ensures that parser functions for - __new__ are always of type newfunc, the type of the tp_new slot. - Similarly, parser functions for __init__ are now always of type initproc, - the type of tp_init. +- bpo-20189: Argument Clinic now ensures that parser functions for __new__ + are always of type newfunc, the type of the tp_new slot. Similarly, parser + functions for __init__ are now always of type initproc, the type of + tp_init. -- Issue #20189: Argument Clinic now suppresses the docstring for __new__ - and __init__ functions if no docstring is provided in the input. +- bpo-20189: Argument Clinic now suppresses the docstring for __new__ and + __init__ functions if no docstring is provided in the input. -- Issue #20189: Argument Clinic now suppresses the "self" parameter in the - impl for @staticmethod functions. +- bpo-20189: Argument Clinic now suppresses the "self" parameter in the impl + for @staticmethod functions. -- Issue #20294: Argument Clinic now supports argument parsing for __new__ and +- bpo-20294: Argument Clinic now supports argument parsing for __new__ and __init__ functions. -- Issue #20299: Argument Clinic custom converters may now change the default +- bpo-20299: Argument Clinic custom converters may now change the default value of c_default and py_default with a class member. -- Issue #20287: Argument Clinic's output is now configurable, allowing - delaying its output or even redirecting it to a separate file. +- bpo-20287: Argument Clinic's output is now configurable, allowing delaying + its output or even redirecting it to a separate file. -- Issue #20226: Argument Clinic now permits simple expressions - (e.g. "sys.maxsize - 1") as default values for parameters. +- bpo-20226: Argument Clinic now permits simple expressions (e.g. + "sys.maxsize - 1") as default values for parameters. -- Issue #19936: Added executable bits or shebang lines to Python scripts which +- bpo-19936: Added executable bits or shebang lines to Python scripts which requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang lines in the unittestgui and checkpip scripts. -- Issue #20268: Argument Clinic now supports cloning the parameters and - return converter of existing functions. +- bpo-20268: Argument Clinic now supports cloning the parameters and return + converter of existing functions. -- Issue #20228: Argument Clinic now has special support for class special +- bpo-20228: Argument Clinic now has special support for class special methods. -- Issue #20214: Fixed a number of small issues and documentation errors in +- bpo-20214: Fixed a number of small issues and documentation errors in Argument Clinic (see issue for details). -- Issue #20196: Fixed a bug where Argument Clinic did not generate correct - parsing code for functions with positional-only parameters where all arguments - are optional. +- bpo-20196: Fixed a bug where Argument Clinic did not generate correct + parsing code for functions with positional-only parameters where all + arguments are optional. -- Issue #18960: 2to3 and the findnocoding.py script now ignore the source - encoding declaration on the second line if the first line contains anything - except a comment. +- bpo-18960: 2to3 and the findnocoding.py script now ignore the source + encoding declaration on the second line if the first line contains + anything except a comment. -- Issue #19723: The marker comments Argument Clinic uses have been changed - to improve readability. +- bpo-19723: The marker comments Argument Clinic uses have been changed to + improve readability. -- Issue #20157: When Argument Clinic renames a parameter because its name - collides with a C keyword, it no longer exposes that rename to PyArg_Parse. +- bpo-20157: When Argument Clinic renames a parameter because its name + collides with a C keyword, it no longer exposes that rename to + PyArg_Parse. -- Issue #20141: Improved Argument Clinic's support for the PyArg_Parse "O!" +- bpo-20141: Improved Argument Clinic's support for the PyArg_Parse "O!" format unit. -- Issue #20144: Argument Clinic now supports simple symbolic constants - as parameter default values. +- bpo-20144: Argument Clinic now supports simple symbolic constants as + parameter default values. -- Issue #20143: The line numbers reported in Argument Clinic errors are - now more accurate. +- bpo-20143: The line numbers reported in Argument Clinic errors are now + more accurate. -- Issue #20142: Py_buffer variables generated by Argument Clinic are now +- bpo-20142: Py_buffer variables generated by Argument Clinic are now initialized with a default value. Build ----- -- Issue #12837: Silence a tautological comparison warning on OS X under Clang in - socketmodule.c. +- bpo-12837: Silence a tautological comparison warning on OS X under Clang + in socketmodule.c. -What's New in Python 3.4.0 Beta 2? +What's New in Python 3.4.0 beta 2? ================================== -Release date: 2014-01-05 +*Release date: 2014-01-05* Core and Builtins ----------------- -- Issue #17432: Drop UCS2 from names of Unicode functions in python3.def. +- bpo-17432: Drop UCS2 from names of Unicode functions in python3.def. -- Issue #19526: Exclude all new API from the stable ABI. Exceptions can be - made if a need is demonstrated. +- bpo-19526: Exclude all new API from the stable ABI. Exceptions can be made + if a need is demonstrated. -- Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c" +- bpo-19969: PyBytes_FromFormatV() now raises an OverflowError if "%c" argument is not in range [0; 255]. -- Issue #19995: %c, %o, %x, and %X now issue a DeprecationWarning on non-integer - input; reworded docs to clarify that an integer type should define both __int__ - and __index__. +- bpo-19995: %c, %o, %x, and %X now issue a DeprecationWarning on non- + integer input; reworded docs to clarify that an integer type should define + both __int__ and __index__. -- Issue #19787: PyThread_set_key_value() now always set the value. In Python - 3.3, the function did nothing if the key already exists (if the current value - is a non-NULL pointer). +- bpo-19787: PyThread_set_key_value() now always set the value. In Python + 3.3, the function did nothing if the key already exists (if the current + value is a non-NULL pointer). -- Issue #14432: Remove the thread state field from the frame structure. Fix a - crash when a generator is created in a C thread that is destroyed while the - generator is still used. The issue was that a generator contains a frame, and - the frame kept a reference to the Python state of the destroyed C thread. The - crash occurs when a trace function is setup. +- bpo-14432: Remove the thread state field from the frame structure. Fix a + crash when a generator is created in a C thread that is destroyed while + the generator is still used. The issue was that a generator contains a + frame, and the frame kept a reference to the Python state of the destroyed + C thread. The crash occurs when a trace function is setup. -- Issue #19576: PyGILState_Ensure() now initializes threads. At startup, Python - has no concrete GIL. If PyGILState_Ensure() is called from a new thread for - the first time and PyEval_InitThreads() was not called yet, a GIL needs to be - created. +- bpo-19576: PyGILState_Ensure() now initializes threads. At startup, Python + has no concrete GIL. If PyGILState_Ensure() is called from a new thread + for the first time and PyEval_InitThreads() was not called yet, a GIL + needs to be created. -- Issue #17576: Deprecation warning emitted now when __int__() or __index__() +- bpo-17576: Deprecation warning emitted now when __int__() or __index__() return not int instance. -- Issue #19932: Fix typo in import.h, missing whitespaces in function prototypes. +- bpo-19932: Fix typo in import.h, missing whitespaces in function + prototypes. -- Issue #19736: Add module-level statvfs constants defined for GNU/glibc - based systems. +- bpo-19736: Add module-level statvfs constants defined for GNU/glibc based + systems. -- Issue #20097: Fix bad use of "self" in importlib's WindowsRegistryFinder. +- bpo-20097: Fix bad use of "self" in importlib's WindowsRegistryFinder. -- Issue #19729: In str.format(), fix recursive expansion in format spec. +- bpo-19729: In str.format(), fix recursive expansion in format spec. -- Issue #19638: Fix possible crash / undefined behaviour from huge (more than 2 +- bpo-19638: Fix possible crash / undefined behaviour from huge (more than 2 billion characters) input strings in _Py_dg_strtod. Library ------- -- Issue #20154: Deadlock in asyncio.StreamReader.readexactly(). +- bpo-20154: Deadlock in asyncio.StreamReader.readexactly(). -- Issue #16113: Remove sha3 module again. +- bpo-16113: Remove sha3 module again. -- Issue #20111: pathlib.Path.with_suffix() now sanity checks the given suffix. +- bpo-20111: pathlib.Path.with_suffix() now sanity checks the given suffix. - Fix breakage in TestSuite.countTestCases() introduced by issue #11798. -- Issue #20108: Avoid parameter name clash in inspect.getcallargs(). +- bpo-20108: Avoid parameter name clash in inspect.getcallargs(). -- Issue #19918: Fix PurePath.relative_to() under Windows. +- bpo-19918: Fix PurePath.relative_to() under Windows. -- Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl - module, rather than silently let them emit clear text data. +- bpo-19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl module, + rather than silently let them emit clear text data. -- Issue #20046: Locale alias table no longer contains entities which can be - calculated. Generalized support of the euro modifier. +- bpo-20046: Locale alias table no longer contains entities which can be + calculated. Generalized support of the euro modifier. -- Issue #20027: Fixed locale aliases for devanagari locales. +- bpo-20027: Fixed locale aliases for devanagari locales. -- Issue #20067: Tkinter variables now work when wantobjects is false. +- bpo-20067: Tkinter variables now work when wantobjects is false. -- Issue #19020: Tkinter now uses splitlist() instead of split() in configure +- bpo-19020: Tkinter now uses splitlist() instead of split() in configure methods. -- Issue #19744: ensurepip now provides a better error message when Python is +- bpo-19744: ensurepip now provides a better error message when Python is built without SSL/TLS support (pip currently requires that support to run, even if only operating with local wheel files) -- Issue #19734: ensurepip now ignores all pip environment variables to avoid +- bpo-19734: ensurepip now ignores all pip environment variables to avoid odd behaviour based on user configuration settings - Fix TypeError on "setup.py upload --show-response". -- Issue #20045: Fix "setup.py register --list-classifiers". +- bpo-20045: Fix "setup.py register --list-classifiers". -- Issue #18879: When a method is looked up on a temporary file, avoid closing +- bpo-18879: When a method is looked up on a temporary file, avoid closing the file before the method is possibly called. -- Issue #20037: Avoid crashes when opening a text file late at interpreter +- bpo-20037: Avoid crashes when opening a text file late at interpreter shutdown. -- Issue #19967: Thanks to the PEP 442, asyncio.Future now uses a - destructor to log uncaught exceptions, instead of the dedicated - _TracebackLogger class. +- bpo-19967: Thanks to the PEP 442, asyncio.Future now uses a destructor to + log uncaught exceptions, instead of the dedicated _TracebackLogger class. - Added a Task.current_task() class method to asyncio. -- Issue #19850: Set SA_RESTART in asyncio when registering a signal - handler to limit EINTR occurrences. +- bpo-19850: Set SA_RESTART in asyncio when registering a signal handler to + limit EINTR occurrences. -- Implemented write flow control in asyncio for proactor event loop (Windows). +- Implemented write flow control in asyncio for proactor event loop + (Windows). - Change write buffer in asyncio use to avoid O(N**2) behavior. Make write()/sendto() accept bytearray/memoryview. -- Issue #20034: Updated alias mapping to most recent locale.alias file - from X.org distribution using makelocalealias.py. +- bpo-20034: Updated alias mapping to most recent locale.alias file from + X.org distribution using makelocalealias.py. -- Issue #5815: Fixed support for locales with modifiers. Fixed support for +- bpo-5815: Fixed support for locales with modifiers. Fixed support for locale encodings with hyphens. -- Issue #20026: Fix the sqlite module to handle correctly invalid isolation +- bpo-20026: Fix the sqlite module to handle correctly invalid isolation level (wrong type). -- Issue #18829: csv.Dialect() now checks type for delimiter, escapechar and +- bpo-18829: csv.Dialect() now checks type for delimiter, escapechar and quotechar fields. Original patch by Vajrasky Kok. -- Issue #19855: uuid.getnode() on Unix now looks on the PATH for the +- bpo-19855: uuid.getnode() on Unix now looks on the PATH for the executables used to find the mac address, with /sbin and /usr/sbin as fallbacks. -- Issue #20007: HTTPResponse.read(0) no more prematurely closes connection. +- bpo-20007: HTTPResponse.read(0) no more prematurely closes connection. Original patch by Simon Sapin. -- Issue #19946: multiprocessing now uses runpy to initialize __main__ in - child processes when necessary, allowing it to correctly handle scripts - without suffixes and submodules that use explicit relative imports or - otherwise rely on parent modules being correctly imported prior to - execution. +- bpo-19946: multiprocessing now uses runpy to initialize __main__ in child + processes when necessary, allowing it to correctly handle scripts without + suffixes and submodules that use explicit relative imports or otherwise + rely on parent modules being correctly imported prior to execution. -- Issue #19921: When Path.mkdir() is called with parents=True, any missing +- bpo-19921: When Path.mkdir() is called with parents=True, any missing parent is created with the default permissions, ignoring the mode argument (mimicking the POSIX "mkdir -p" command). -- Issue #19887: Improve the Path.resolve() algorithm to support certain - symlink chains. +- bpo-19887: Improve the Path.resolve() algorithm to support certain symlink + chains. -- Issue #19912: Fixed numerous bugs in ntpath.splitunc(). +- bpo-19912: Fixed numerous bugs in ntpath.splitunc(). -- Issue #19911: ntpath.splitdrive() now correctly processes the 'İ' character +- bpo-19911: ntpath.splitdrive() now correctly processes the 'İ' character (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE). -- Issue #19532: python -m compileall with no filename/directory arguments now +- bpo-19532: python -m compileall with no filename/directory arguments now respects the -f and -q flags instead of ignoring them. -- Issue #19623: Fixed writing to unseekable files in the aifc module. +- bpo-19623: Fixed writing to unseekable files in the aifc module. -- Issue #19946: multiprocessing.spawn now raises ImportError when the module to +- bpo-19946: multiprocessing.spawn now raises ImportError when the module to be used as the main module cannot be imported. -- Issue #17919: select.poll.register() again works with poll.POLLNVAL on AIX. +- bpo-17919: select.poll.register() again works with poll.POLLNVAL on AIX. Fixed integer overflow in the eventmask parameter. -- Issue #19063: if a Charset's body_encoding was set to None, the email - package would generate a message claiming the Content-Transfer-Encoding - was 7bit, and produce garbage output for the content. This now works. - A couple of other set_payload mishandlings of non-ASCII are also fixed. - In addition, calling set_payload with a string argument without - specifying a charset now raises an error (this is a new error in 3.4). +- bpo-19063: if a Charset's body_encoding was set to None, the email package + would generate a message claiming the Content-Transfer-Encoding was 7bit, + and produce garbage output for the content. This now works. A couple of + other set_payload mishandlings of non-ASCII are also fixed. In addition, + calling set_payload with a string argument without specifying a charset + now raises an error (this is a new error in 3.4). -- Issue #15475: Add __sizeof__ implementations for itertools objects. +- bpo-15475: Add __sizeof__ implementations for itertools objects. -- Issue #19944: Fix importlib.find_spec() so it imports parents as needed - and move the function to importlib.util. +- bpo-19944: Fix importlib.find_spec() so it imports parents as needed and + move the function to importlib.util. -- Issue #19880: Fix a reference leak in unittest.TestCase. Explicitly break +- bpo-19880: Fix a reference leak in unittest.TestCase. Explicitly break reference cycles between frames and the _Outcome instance. -- Issue #17429: platform.linux_distribution() now decodes files from the UTF-8 - encoding with the surrogateescape error handler, instead of decoding from the - locale encoding in strict mode. It fixes the function on Fedora 19 which is - probably the first major distribution release with a non-ASCII name. Patch - written by Toshio Kuratomi. +- bpo-17429: platform.linux_distribution() now decodes files from the UTF-8 + encoding with the surrogateescape error handler, instead of decoding from + the locale encoding in strict mode. It fixes the function on Fedora 19 + which is probably the first major distribution release with a non-ASCII + name. Patch written by Toshio Kuratomi. -- Issue #19343: Expose FreeBSD-specific APIs in resource module. Original +- bpo-19343: Expose FreeBSD-specific APIs in resource module. Original patch by Koobs. -- Issue #19929: Call os.read with 32768 within subprocess.Popen.communicate +- bpo-19929: Call os.read with 32768 within subprocess.Popen.communicate rather than 4096 for efficiency. A microbenchmark shows Linux and OS X both using ~50% less cpu time this way. -- Issue #19506: Use a memoryview to avoid a data copy when piping data - to stdin within subprocess.Popen.communicate. 5-10% less cpu usage. +- bpo-19506: Use a memoryview to avoid a data copy when piping data to stdin + within subprocess.Popen.communicate. 5-10% less cpu usage. -- Issue #19876: selectors unregister() no longer raises ValueError or OSError +- bpo-19876: selectors unregister() no longer raises ValueError or OSError if the FD is closed (as long as it was registered). -- Issue #19908: pathlib now joins relative Windows paths correctly when a drive - is present. Original patch by Antoine Pitrou. +- bpo-19908: pathlib now joins relative Windows paths correctly when a drive + is present. Original patch by Antoine Pitrou. -- Issue #19296: Silence compiler warning in dbm_open +- bpo-19296: Silence compiler warning in dbm_open -- Issue #6784: Strings from Python 2 can now be unpickled as bytes - objects by setting the encoding argument of Unpickler to be 'bytes'. - Initial patch by Merlijn van Deen. +- bpo-6784: Strings from Python 2 can now be unpickled as bytes objects by + setting the encoding argument of Unpickler to be 'bytes'. Initial patch by + Merlijn van Deen. -- Issue #19839: Fix regression in bz2 module's handling of non-bzip2 data at +- bpo-19839: Fix regression in bz2 module's handling of non-bzip2 data at EOF, and analogous bug in lzma module. -- Issue #19881: Fix pickling bug where cpickle would emit bad pickle data for +- bpo-19881: Fix pickling bug where cpickle would emit bad pickle data for large bytes string (i.e., with size greater than 2**32-1). -- Issue #19138: doctest's IGNORE_EXCEPTION_DETAIL now allows a match when - no exception detail exists (no colon following the exception's name, or - a colon does follow but no text follows the colon). +- bpo-19138: doctest's IGNORE_EXCEPTION_DETAIL now allows a match when no + exception detail exists (no colon following the exception's name, or a + colon does follow but no text follows the colon). -- Issue #19927: Add __eq__ to path-based loaders in importlib. +- bpo-19927: Add __eq__ to path-based loaders in importlib. -- Issue #19827: On UNIX, setblocking() and settimeout() methods of - socket.socket can now avoid a second syscall if the ioctl() function can be - used, or if the non-blocking flag of the socket is unchanged. +- bpo-19827: On UNIX, setblocking() and settimeout() methods of + socket.socket can now avoid a second syscall if the ioctl() function can + be used, or if the non- blocking flag of the socket is unchanged. -- Issue #19785: smtplib now supports SSLContext.check_hostname and server name +- bpo-19785: smtplib now supports SSLContext.check_hostname and server name indication for TLS/SSL connections. -- Issue #19784: poplib now supports SSLContext.check_hostname and server name +- bpo-19784: poplib now supports SSLContext.check_hostname and server name indication for TLS/SSL connections. -- Issue #19783: nntplib now supports SSLContext.check_hostname and server name +- bpo-19783: nntplib now supports SSLContext.check_hostname and server name indication for TLS/SSL connections. -- Issue #19782: imaplib now supports SSLContext.check_hostname and server name +- bpo-19782: imaplib now supports SSLContext.check_hostname and server name indication for TLS/SSL connections. -- Issue #20123: Fix pydoc.synopsis() for "binary" modules. +- bpo-20123: Fix pydoc.synopsis() for "binary" modules. -- Issue #19834: Support unpickling of exceptions pickled by Python 2. +- bpo-19834: Support unpickling of exceptions pickled by Python 2. -- Issue #19781: ftplib now supports SSLContext.check_hostname and server name +- bpo-19781: ftplib now supports SSLContext.check_hostname and server name indication for TLS/SSL connections. -- Issue #19509: Add SSLContext.check_hostname to match the peer's certificate +- bpo-19509: Add SSLContext.check_hostname to match the peer's certificate with server_hostname on handshake. -- Issue #15798: Fixed subprocess.Popen() to no longer fail if file - descriptor 0, 1 or 2 is closed. +- bpo-15798: Fixed subprocess.Popen() to no longer fail if file descriptor + 0, 1 or 2 is closed. -- Issue #17897: Optimized unpickle prefetching. +- bpo-17897: Optimized unpickle prefetching. -- Issue #3693: Make the error message more helpful when the array.array() - constructor is given a str. Move the array module typecode documentation to - the docstring of the constructor. +- bpo-3693: Make the error message more helpful when the array.array() + constructor is given a str. Move the array module typecode documentation + to the docstring of the constructor. -- Issue #19088: Fixed incorrect caching of the copyreg module in +- bpo-19088: Fixed incorrect caching of the copyreg module in object.__reduce__() and object.__reduce_ex__(). -- Issue #19698: Removed exec_module() methods from +- bpo-19698: Removed exec_module() methods from importlib.machinery.BuiltinImporter and ExtensionFileLoader. -- Issue #18864: Added a setter for ModuleSpec.has_location. +- bpo-18864: Added a setter for ModuleSpec.has_location. - Fixed _pickle.Unpickler to not fail when loading empty strings as persistent IDs. -- Issue #11480: Fixed copy.copy to work with classes with custom metaclasses. +- bpo-11480: Fixed copy.copy to work with classes with custom metaclasses. Patch by Daniel Urban. -- Issue #6477: Added support for pickling the types of built-in singletons +- bpo-6477: Added support for pickling the types of built-in singletons (i.e., Ellipsis, NotImplemented, None). -- Issue #19713: Add remaining PEP 451-related deprecations and move away - from using find_module/find_loaer/load_module. +- bpo-19713: Add remaining PEP 451-related deprecations and move away from + using find_module/find_loaer/load_module. -- Issue #19708: Update pkgutil to use the new importer APIs. +- bpo-19708: Update pkgutil to use the new importer APIs. -- Issue #19703: Update pydoc to use the new importer APIs. +- bpo-19703: Update pydoc to use the new importer APIs. -- Issue #19851: Fixed a regression in reloading sub-modules. +- bpo-19851: Fixed a regression in reloading sub-modules. - ssl.create_default_context() sets OP_NO_COMPRESSION to prevent CRIME. -- Issue #19802: Add socket.SO_PRIORITY. +- bpo-19802: Add socket.SO_PRIORITY. -- Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with - virtual interface. Original patch by Kent Frazier. +- bpo-11508: Fixed uuid.getnode() and uuid.uuid1() on environment with + virtual interface. Original patch by Kent Frazier. -- Issue #11489: JSON decoder now accepts lone surrogates. +- bpo-11489: JSON decoder now accepts lone surrogates. -- Issue #19545: Avoid chained exceptions while passing stray % to +- bpo-19545: Avoid chained exceptions while passing stray % to time.strptime(). Initial patch by Claudiu Popa. IDLE ---- -- Issue #20058: sys.stdin.readline() in IDLE now always returns only one line. +- bpo-20058: sys.stdin.readline() in IDLE now always returns only one line. -- Issue #19481: print() of string subclass instance in IDLE no longer hangs. +- bpo-19481: print() of string subclass instance in IDLE no longer hangs. -- Issue #18270: Prevent possible IDLE AttributeError on OS X when no initial +- bpo-18270: Prevent possible IDLE AttributeError on OS X when no initial shell window is present. Tests ----- -- Issue #20055: Fix test_shutil under Windows with symlink privileges held. +- bpo-20055: Fix test_shutil under Windows with symlink privileges held. Patch by Vajrasky Kok. -- Issue #20070: Don't run test_urllib2net when network resources are not +- bpo-20070: Don't run test_urllib2net when network resources are not enabled. -- Issue #19938: Re-enabled test_bug_1333982 in test_dis, which had been +- bpo-19938: Re-enabled test_bug_1333982 in test_dis, which had been disabled since 3.0 due to the changes in listcomp handling. -- Issue #19320: test_tcl no longer fails when wantobjects is false. +- bpo-19320: test_tcl no longer fails when wantobjects is false. -- Issue #19919: Fix flaky SSL test. connect_ex() sometimes returns - EWOULDBLOCK on Windows or VMs hosted on Windows. +- bpo-19919: Fix flaky SSL test. connect_ex() sometimes returns EWOULDBLOCK + on Windows or VMs hosted on Windows. -- Issue #19912: Added tests for ntpath.splitunc(). +- bpo-19912: Added tests for ntpath.splitunc(). -- Issue #19828: Fixed test_site when the whole suite is run with -S. +- bpo-19828: Fixed test_site when the whole suite is run with -S. -- Issue #19928: Implemented a test for repr() of cell objects. +- bpo-19928: Implemented a test for repr() of cell objects. -- Issue #19535: Fixed test_docxmlrpc, test_functools, test_inspect, and +- bpo-19535: Fixed test_docxmlrpc, test_functools, test_inspect, and test_statistics when python is run with -OO. -- Issue #19926: Removed unneeded test_main from test_abstract_numbers. - Patch by Vajrasky Kok. +- bpo-19926: Removed unneeded test_main from test_abstract_numbers. Patch by + Vajrasky Kok. -- Issue #19572: More skipped tests explicitly marked as skipped. +- bpo-19572: More skipped tests explicitly marked as skipped. -- Issue #19595, #19987: Re-enabled a long-disabled test in test_winsound. +- bpo-19595: Re-enabled a long-disabled test in test_winsound. (See also: + bpo-19987) -- Issue #19588: Fixed tests in test_random that were silently skipped most - of the time. Patch by Julian Gindi. +- bpo-19588: Fixed tests in test_random that were silently skipped most of + the time. Patch by Julian Gindi. Build ----- -- Issue #19728: Enable pip installation by default on Windows. +- bpo-19728: Enable pip installation by default on Windows. -- Issue #16136: Remove VMS support +- bpo-16136: Remove VMS support -- Issue #18215: Add script Tools/ssl/test_multiple_versions.py to compile and +- bpo-18215: Add script Tools/ssl/test_multiple_versions.py to compile and run Python's unit tests with multiple versions of OpenSSL. -- Issue #19922: define _INCLUDE__STDC_A1_SOURCE in HP-UX to include mbstate_t +- bpo-19922: define _INCLUDE__STDC_A1_SOURCE in HP-UX to include mbstate_t for mbrtowc(). -- Issue #19788: kill_python(_d).exe is now run as a PreBuildEvent on the - pythoncore sub-project. This should prevent build errors due a previous +- bpo-19788: kill_python(_d).exe is now run as a PreBuildEvent on the + pythoncore sub- project. This should prevent build errors due a previous build's python(_d).exe still running. Documentation ------------- -- Issue #20265: Updated some parts of the Using Windows document. +- bpo-20265: Updated some parts of the Using Windows document. -- Issue #20266: Updated some parts of the Windows FAQ. +- bpo-20266: Updated some parts of the Windows FAQ. -- Issue #20255: Updated the about and bugs pages. +- bpo-20255: Updated the about and bugs pages. -- Issue #20253: Fixed a typo in the ipaddress docs that advertised an - illegal attribute name. Found by INADA Naoki. +- bpo-20253: Fixed a typo in the ipaddress docs that advertised an illegal + attribute name. Found by INADA Naoki. -- Issue #18840: Introduce the json module in the tutorial, and de-emphasize - the pickle module. +- bpo-18840: Introduce the json module in the tutorial, and de-emphasize the + pickle module. -- Issue #19845: Updated the Compiling Python on Windows section. +- bpo-19845: Updated the Compiling Python on Windows section. -- Issue #19795: Improved markup of True/False constants. +- bpo-19795: Improved markup of True/False constants. Tools/Demos ----------- -- Issue #19659: Added documentation for Argument Clinic. +- bpo-19659: Added documentation for Argument Clinic. -- Issue #19976: Argument Clinic METH_NOARGS functions now always - take two parameters. +- bpo-19976: Argument Clinic METH_NOARGS functions now always take two + parameters. -What's New in Python 3.4.0 Beta 1? +What's New in Python 3.4.0 beta 1? ================================== -Release date: 2013-11-24 +*Release date: 2013-11-24* Core and Builtins ----------------- @@ -6053,644 +6530,644 @@ Core and Builtins - Use the repr of a module name in more places in import, especially exceptions. -- Issue #19619: str.encode, bytes.decode and bytearray.decode now use an +- bpo-19619: str.encode, bytes.decode and bytearray.decode now use an internal API to throw LookupError for known non-text encodings, rather than attempting the encoding or decoding operation and then throwing a - TypeError for an unexpected output type. (The latter mechanism remains - in place for third party non-text encodings) + TypeError for an unexpected output type. (The latter mechanism remains in + place for third party non-text encodings) -- Issue #19183: Implement PEP 456 'secure and interchangeable hash algorithm'. +- bpo-19183: Implement PEP 456 'secure and interchangeable hash algorithm'. Python now uses SipHash24 on all major platforms. -- Issue #12892: The utf-16* and utf-32* encoders no longer allow surrogate code - points (U+D800-U+DFFF) to be encoded. The utf-32* decoders no longer decode - byte sequences that correspond to surrogate code points. The surrogatepass - error handler now works with the utf-16* and utf-32* codecs. Based on - patches by Victor Stinner and Kang-Hao (Kenny) Lu. +- bpo-12892: The utf-16* and utf-32* encoders no longer allow surrogate code + points (U+D800-U+DFFF) to be encoded. The utf-32* decoders no longer + decode byte sequences that correspond to surrogate code points. The + surrogatepass error handler now works with the utf-16* and utf-32* codecs. + Based on patches by Victor Stinner and Kang-Hao (Kenny) Lu. -- Issue #17806: Added keyword-argument support for "tabsize" to +- bpo-17806: Added keyword-argument support for "tabsize" to str/bytes.expandtabs(). -- Issue #17828: Output type errors in str.encode(), bytes.decode() and +- bpo-17828: Output type errors in str.encode(), bytes.decode() and bytearray.decode() now direct users to codecs.encode() or codecs.decode() as appropriate. -- Issue #17828: The interpreter now attempts to chain errors that occur in +- bpo-17828: The interpreter now attempts to chain errors that occur in codec processing with a replacement exception of the same type that includes the codec name in the error message. It ensures it only does this when the creation of the replacement exception won't lose any information. -- Issue #19466: Clear the frames of daemon threads earlier during the - Python shutdown to call object destructors. So "unclosed file" resource - warnings are now correctly emitted for daemon threads. +- bpo-19466: Clear the frames of daemon threads earlier during the Python + shutdown to call object destructors. So "unclosed file" resource warnings + are now correctly emitted for daemon threads. -- Issue #19514: Deduplicate some _Py_IDENTIFIER declarations. - Patch by Andrei Dorian Duma. +- bpo-19514: Deduplicate some _Py_IDENTIFIER declarations. Patch by Andrei + Dorian Duma. -- Issue #17936: Fix O(n**2) behaviour when adding or removing many subclasses +- bpo-17936: Fix O(n**2) behaviour when adding or removing many subclasses of a given type. -- Issue #19428: zipimport now handles errors when reading truncated or invalid +- bpo-19428: zipimport now handles errors when reading truncated or invalid ZIP archive. -- Issue #18408: Add a new PyFrame_FastToLocalsWithError() function to handle +- bpo-18408: Add a new PyFrame_FastToLocalsWithError() function to handle exceptions when merging fast locals into f_locals of a frame. PyEval_GetLocals() now raises an exception and return NULL on failure. -- Issue #19369: Optimized the usage of __length_hint__(). +- bpo-19369: Optimized the usage of __length_hint__(). -- Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the +- bpo-18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the Python executable and not removed by the linker's optimizer. -- Issue #19306: Add extra hints to the faulthandler module's stack - dumps that these are "upside down". +- bpo-19306: Add extra hints to the faulthandler module's stack dumps that + these are "upside down". Library ------- -- Issue #3158: doctest can now find doctests in functions and methods - written in C. +- bpo-3158: doctest can now find doctests in functions and methods written + in C. -- Issue #13477: Added command line interface to the tarfile module. - Original patch by Berker Peksag. +- bpo-13477: Added command line interface to the tarfile module. Original + patch by Berker Peksag. -- Issue #19674: inspect.signature() now produces a correct signature - for some builtins. +- bpo-19674: inspect.signature() now produces a correct signature for some + builtins. -- Issue #19722: Added opcode.stack_effect(), which - computes the stack effect of bytecode instructions. +- bpo-19722: Added opcode.stack_effect(), which computes the stack effect of + bytecode instructions. -- Issue #19735: Implement private function ssl._create_stdlib_context() to +- bpo-19735: Implement private function ssl._create_stdlib_context() to create SSLContext objects in Python's stdlib module. It provides a single configuration point and makes use of SSLContext.load_default_certs(). -- Issue #16203: Add re.fullmatch() function and regex.fullmatch() method, - which anchor the pattern at both ends of the string to match. - Original patch by Matthew Barnett. +- bpo-16203: Add re.fullmatch() function and regex.fullmatch() method, which + anchor the pattern at both ends of the string to match. Original patch by + Matthew Barnett. -- Issue #13592: Improved the repr for regular expression pattern objects. - Based on patch by Hugo Lopes Tavares. +- bpo-13592: Improved the repr for regular expression pattern objects. Based + on patch by Hugo Lopes Tavares. -- Issue #19641: Added the audioop.byteswap() function to convert big-endian +- bpo-19641: Added the audioop.byteswap() function to convert big-endian samples to little-endian and vice versa. -- Issue #15204: Deprecated the 'U' mode in file-like objects. +- bpo-15204: Deprecated the 'U' mode in file-like objects. -- Issue #17810: Implement PEP 3154, pickle protocol 4. +- bpo-17810: Implement PEP 3154, pickle protocol 4. -- Issue #19668: Added support for the cp1125 encoding. +- bpo-19668: Added support for the cp1125 encoding. -- Issue #19689: Add ssl.create_default_context() factory function. It creates - a new SSLContext object with secure default settings. +- bpo-19689: Add ssl.create_default_context() factory function. It creates a + new SSLContext object with secure default settings. -- Issue #19727: os.utime(..., None) is now potentially more precise - under Windows. +- bpo-19727: os.utime(..., None) is now potentially more precise under + Windows. -- Issue #17201: ZIP64 extensions now are enabled by default. Patch by - William Mallard. +- bpo-17201: ZIP64 extensions now are enabled by default. Patch by William + Mallard. -- Issue #19292: Add SSLContext.load_default_certs() to load default root CA +- bpo-19292: Add SSLContext.load_default_certs() to load default root CA certificates from default stores or system stores. By default the method loads CA certs for authentication of server certs. -- Issue #19673: Add pathlib to the stdlib as a provisional module (PEP 428). +- bpo-19673: Add pathlib to the stdlib as a provisional module (PEP 428). -- Issue #16596: pdb in a generator now properly skips over yield and - yield from rather than stepping out of the generator into its - caller. (This is essential for stepping through asyncio coroutines.) +- bpo-16596: pdb in a generator now properly skips over yield and yield from + rather than stepping out of the generator into its caller. (This is + essential for stepping through asyncio coroutines.) -- Issue #17916: Added dis.Bytecode.from_traceback() and +- bpo-17916: Added dis.Bytecode.from_traceback() and dis.Bytecode.current_offset to easily display "current instruction" markers in the new disassembly API (Patch by Claudiu Popa). -- Issue #19552: venv now supports bootstrapping pip into virtual environments +- bpo-19552: venv now supports bootstrapping pip into virtual environments -- Issue #17134: Finalize interface to Windows' certificate store. Cert and - CRL enumeration are now two functions. enum_certificates() also returns +- bpo-17134: Finalize interface to Windows' certificate store. Cert and CRL + enumeration are now two functions. enum_certificates() also returns purpose flags as set of OIDs. -- Issue #19555: Restore sysconfig.get_config_var('SO'), (and the distutils +- bpo-19555: Restore sysconfig.get_config_var('SO'), (and the distutils equivalent) with a DeprecationWarning pointing people at $EXT_SUFFIX. -- Issue #8813: Add SSLContext.verify_flags to change the verification flags - of the context in order to enable certification revocation list (CRL) - checks or strict X509 rules. +- bpo-8813: Add SSLContext.verify_flags to change the verification flags of + the context in order to enable certification revocation list (CRL) checks + or strict X509 rules. -- Issue #18294: Fix the zlib module to make it 64-bit safe. +- bpo-18294: Fix the zlib module to make it 64-bit safe. -- Issue #19682: Fix compatibility issue with old version of OpenSSL that - was introduced by Issue #18379. +- bpo-19682: Fix compatibility issue with old version of OpenSSL that was + introduced by Issue #18379. -- Issue #14455: plistlib now supports binary plists and has an updated API. +- bpo-14455: plistlib now supports binary plists and has an updated API. -- Issue #19633: Fixed writing not compressed 16- and 32-bit wave files on - big-endian platforms. +- bpo-19633: Fixed writing not compressed 16- and 32-bit wave files on big- + endian platforms. -- Issue #18379: SSLSocket.getpeercert() returns CA issuer AIA fields, OCSP - and CRL distribution points. +- bpo-18379: SSLSocket.getpeercert() returns CA issuer AIA fields, OCSP and + CRL distribution points. -- Issue #18138: Implement cadata argument of SSLContext.load_verify_location() +- bpo-18138: Implement cadata argument of SSLContext.load_verify_location() to load CA certificates and CRL from memory. It supports PEM and DER encoded strings. -- Issue #18775: Add name and block_size attribute to HMAC object. They now +- bpo-18775: Add name and block_size attribute to HMAC object. They now provide the same API elements as non-keyed cryptographic hash functions. -- Issue #17276: MD5 as default digestmod for HMAC is deprecated. The HMAC +- bpo-17276: MD5 as default digestmod for HMAC is deprecated. The HMAC module supports digestmod names, e.g. hmac.HMAC('sha1'). -- Issue #19449: in csv's writerow, handle non-string keys when generating the +- bpo-19449: in csv's writerow, handle non-string keys when generating the error message that certain keys are not in the 'fieldnames' list. -- Issue #13633: Added a new convert_charrefs keyword arg to HTMLParser that, +- bpo-13633: Added a new convert_charrefs keyword arg to HTMLParser that, when True, automatically converts all character references. -- Issue #2927: Added the unescape() function to the html module. +- bpo-2927: Added the unescape() function to the html module. -- Issue #8402: Added the escape() function to the glob module. +- bpo-8402: Added the escape() function to the glob module. -- Issue #17618: Add Base85 and Ascii85 encoding/decoding to the base64 module. +- bpo-17618: Add Base85 and Ascii85 encoding/decoding to the base64 module. -- Issue #19634: time.strftime("%y") now raises a ValueError on AIX when given a +- bpo-19634: time.strftime("%y") now raises a ValueError on AIX when given a year before 1900. -- Fix test.support.bind_port() to not cause an error when Python was compiled - on a system with SO_REUSEPORT defined in the headers but run on a system - with an OS kernel that does not support that reasonably new socket option. +- Fix test.support.bind_port() to not cause an error when Python was + compiled on a system with SO_REUSEPORT defined in the headers but run on a + system with an OS kernel that does not support that reasonably new socket + option. -- Fix compilation error under gcc of the ctypes module bundled libffi for arm. +- Fix compilation error under gcc of the ctypes module bundled libffi for + arm. -- Issue #19448: Add private API to SSL module to lookup ASN.1 objects by OID, +- bpo-19448: Add private API to SSL module to lookup ASN.1 objects by OID, NID, short name and long name. -- Issue #19282: dbm.open now supports the context management protocol. - (Initial patch by Claudiu Popa) +- bpo-19282: dbm.open now supports the context management protocol. (Initial + patch by Claudiu Popa) -- Issue #8311: Added support for writing any bytes-like objects in the aifc, +- bpo-8311: Added support for writing any bytes-like objects in the aifc, sunau, and wave modules. -- Issue #5202: Added support for unseekable files in the wave module. +- bpo-5202: Added support for unseekable files in the wave module. -- Issue #19544 and Issue #1180: Restore global option to ignore - ~/.pydistutils.cfg in Distutils, accidentally removed in backout of - distutils2 changes. +- bpo-19544: Restore global option to ignore ~/.pydistutils.cfg in + Distutils, accidentally removed in backout of distutils2 changes. (See + also: bpo-1180) -- Issue #19523: Closed FileHandler leak which occurred when delay was set. +- bpo-19523: Closed FileHandler leak which occurred when delay was set. -- Issue #19544 and Issue #6516: Restore support for --user and --group - parameters to sdist command accidentally rolled back as part of the - distutils2 rollback. +- bpo-19544: Restore support for --user and --group parameters to sdist + command accidentally rolled back as part of the distutils2 rollback. (See + also: bpo-6516) -- Issue #13674: Prevented time.strftime from crashing on Windows when given - a year before 1900 and a format of %y. +- bpo-13674: Prevented time.strftime from crashing on Windows when given a + year before 1900 and a format of %y. -- Issue #19406: implementation of the ensurepip module (part of PEP 453). - Patch by Donald Stufft and Nick Coghlan. +- bpo-19406: implementation of the ensurepip module (part of PEP 453). Patch + by Donald Stufft and Nick Coghlan. -- Issue #19544 and Issue #6286: Restore use of urllib over http allowing use - of http_proxy for Distutils upload command, a feature accidentally lost - in the rollback of distutils2. +- bpo-19544: Restore use of urllib over http allowing use of http_proxy for + Distutils upload command, a feature accidentally lost in the rollback of + distutils2. (See also: bpo-6286) -- Issue #19544 and Issue #7457: Restore the read_pkg_file method to +- bpo-19544: Restore the read_pkg_file method to distutils.dist.DistributionMetadata accidentally removed in the undo of - distutils2. + distutils2. (See also: bpo-7457) -- Issue #16685: Added support for any bytes-like objects in the audioop module. +- bpo-16685: Added support for any bytes-like objects in the audioop module. Removed support for strings. -- Issue #7171: Add Windows implementation of ``inet_ntop`` and ``inet_pton`` - to socket module. Patch by Atsuo Ishimoto. +- bpo-7171: Add Windows implementation of ``inet_ntop`` and ``inet_pton`` to + socket module. Patch by Atsuo Ishimoto. -- Issue #19261: Added support for writing 24-bit samples in the sunau module. +- bpo-19261: Added support for writing 24-bit samples in the sunau module. -- Issue #1097797: Added CP273 encoding, used on IBM mainframes in - Germany and Austria. Mapping provided by Michael Bierenfeld. +- bpo-1097797: Added CP273 encoding, used on IBM mainframes in Germany and + Austria. Mapping provided by Michael Bierenfeld. -- Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms. +- bpo-1575020: Fixed support of 24-bit wave files on big-endian platforms. -- Issue #19378: Fixed a number of cases in the dis module where the new - "file" parameter was not being honoured correctly +- bpo-19378: Fixed a number of cases in the dis module where the new "file" + parameter was not being honoured correctly -- Issue #19378: Removed the "dis.Bytecode.show_info" method +- bpo-19378: Removed the "dis.Bytecode.show_info" method -- Issue #19378: Renamed the "dis.Bytecode.display_code" method to +- bpo-19378: Renamed the "dis.Bytecode.display_code" method to "dis.Bytecode.dis" and converted it to returning a string rather than printing output. -- Issue #19378: the "line_offset" parameter in the new "dis.get_instructions" +- bpo-19378: the "line_offset" parameter in the new "dis.get_instructions" API has been renamed to "first_line" (and the default value and usage - changed accordingly). This should reduce confusion with the more common use - of "offset" in the dis docs to refer to bytecode offsets. + changed accordingly). This should reduce confusion with the more common + use of "offset" in the dis docs to refer to bytecode offsets. -- Issue #18678: Corrected spwd struct member names in spwd module: +- bpo-18678: Corrected spwd struct member names in spwd module: sp_nam->sp_namp, and sp_pwd->sp_pwdp. The old names are kept as extra structseq members, for backward compatibility. -- Issue #6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises - TypeError instead of TclError on wrong number of arguments. Original patch - by Guilherme Polo. +- bpo-6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises + TypeError instead of TclError on wrong number of arguments. Original + patch by Guilherme Polo. -- Issue #10197: Rework subprocess.get[status]output to use subprocess +- bpo-10197: Rework subprocess.get[status]output to use subprocess functionality and thus to work on Windows. Patch by Nick Coghlan -- Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of +- bpo-6160: The bbox() method of tkinter.Spinbox now returns a tuple of integers instead of a string. Based on patch by Guilherme Polo. -- Issue #19403: contextlib.redirect_stdout is now reentrant +- bpo-19403: contextlib.redirect_stdout is now reentrant -- Issue #19286: Directories in ``package_data`` are no longer added to - the filelist, preventing failure outlined in the ticket. +- bpo-19286: Directories in ``package_data`` are no longer added to the + filelist, preventing failure outlined in the ticket. -- Issue #19480: HTMLParser now accepts all valid start-tag names as defined - by the HTML5 standard. +- bpo-19480: HTMLParser now accepts all valid start-tag names as defined by + the HTML5 standard. -- Issue #15114: The html.parser module now raises a DeprecationWarning when the +- bpo-15114: The html.parser module now raises a DeprecationWarning when the strict argument of HTMLParser or the HTMLParser.error method are used. -- Issue #19410: Undo the special-casing removal of '' for +- bpo-19410: Undo the special-casing removal of '' for importlib.machinery.FileFinder. -- Issue #19424: Fix the warnings module to accept filename containing surrogate +- bpo-19424: Fix the warnings module to accept filename containing surrogate characters. -- Issue #19435: Fix directory traversal attack on CGIHttpRequestHandler. +- bpo-19435: Fix directory traversal attack on CGIHttpRequestHandler. -- Issue #19227: Remove pthread_atfork() handler. The handler was added to - solve #18747 but has caused issues. +- bpo-19227: Remove pthread_atfork() handler. The handler was added to solve + #18747 but has caused issues. -- Issue #19420: Fix reference leak in module initialization code of +- bpo-19420: Fix reference leak in module initialization code of _hashopenssl.c -- Issue #19329: Optimized compiling charsets in regular expressions. +- bpo-19329: Optimized compiling charsets in regular expressions. -- Issue #19227: Try to fix deadlocks caused by re-seeding then OpenSSL - pseudo-random number generator on fork(). +- bpo-19227: Try to fix deadlocks caused by re-seeding then OpenSSL pseudo- + random number generator on fork(). -- Issue #16037: HTTPMessage.readheaders() raises an HTTPException when more than - 100 headers are read. Adapted from patch by Jyrki Pulliainen. +- bpo-16037: HTTPMessage.readheaders() raises an HTTPException when more + than 100 headers are read. Adapted from patch by Jyrki Pulliainen. -- Issue #16040: CVE-2013-1752: nntplib: Limit maximum line lengths to 2048 to +- bpo-16040: CVE-2013-1752: nntplib: Limit maximum line lengths to 2048 to prevent readline() calls from consuming too much memory. Patch by Jyrki Pulliainen. -- Issue #16041: CVE-2013-1752: poplib: Limit maximum line lengths to 2048 to +- bpo-16041: CVE-2013-1752: poplib: Limit maximum line lengths to 2048 to prevent readline() calls from consuming too much memory. Patch by Jyrki Pulliainen. -- Issue #17997: Change behavior of ``ssl.match_hostname()`` to follow RFC 6125, - for security reasons. It now doesn't match multiple wildcards nor wildcards - inside IDN fragments. +- bpo-17997: Change behavior of ``ssl.match_hostname()`` to follow RFC 6125, + for security reasons. It now doesn't match multiple wildcards nor + wildcards inside IDN fragments. -- Issue #16039: CVE-2013-1752: Change use of readline in imaplib module to limit - line length. Patch by Emil Lind. +- bpo-16039: CVE-2013-1752: Change use of readline in imaplib module to + limit line length. Patch by Emil Lind. -- Issue #19330: the unnecessary wrapper functions have been removed from the +- bpo-19330: the unnecessary wrapper functions have been removed from the implementations of the new contextlib.redirect_stdout and contextlib.suppress context managers, which also ensures they provide reasonable help() output on instances -- Issue #19393: Fix symtable.symtable function to not be confused when there are - functions or classes named "top". +- bpo-19393: Fix symtable.symtable function to not be confused when there + are functions or classes named "top". -- Issue #18685: Restore re performance to pre-PEP 393 levels. +- bpo-18685: Restore re performance to pre-PEP 393 levels. -- Issue #19339: telnetlib module is now using time.monotonic() when available +- bpo-19339: telnetlib module is now using time.monotonic() when available to compute timeout. -- Issue #19399: fix sporadic test_subprocess failure. +- bpo-19399: fix sporadic test_subprocess failure. -- Issue #13234: Fix os.listdir to work with extended paths on Windows. - Patch by Santoso Wijaya. +- bpo-13234: Fix os.listdir to work with extended paths on Windows. Patch by + Santoso Wijaya. -- Issue #19375: The site module adding a "site-python" directory to sys.path, +- bpo-19375: The site module adding a "site-python" directory to sys.path, if it exists, is now deprecated. -- Issue #19379: Lazily import linecache in the warnings module, to make - startup with warnings faster until a warning gets printed. +- bpo-19379: Lazily import linecache in the warnings module, to make startup + with warnings faster until a warning gets printed. -- Issue #19288: Fixed the "in" operator of dbm.gnu databases for string +- bpo-19288: Fixed the "in" operator of dbm.gnu databases for string argument. Original patch by Arfrever Frehtes Taifersar Arahesis. -- Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string +- bpo-19287: Fixed the "in" operator of dbm.ndbm databases for string argument. Original patch by Arfrever Frehtes Taifersar Arahesis. -- Issue #19327: Fixed the working of regular expressions with too big charset. +- bpo-19327: Fixed the working of regular expressions with too big charset. -- Issue #17400: New 'is_global' attribute for ipaddress to tell if an address +- bpo-17400: New 'is_global' attribute for ipaddress to tell if an address is allocated by IANA for global or private networks. -- Issue #19350: Increasing the test coverage of macurl2path. Patch by Colin +- bpo-19350: Increasing the test coverage of macurl2path. Patch by Colin Williams. -- Issue #19365: Optimized the parsing of long replacement string in re.sub*() +- bpo-19365: Optimized the parsing of long replacement string in re.sub*() functions. -- Issue #19352: Fix unittest discovery when a module can be reached - through several paths (e.g. under Debian/Ubuntu with virtualenv). +- bpo-19352: Fix unittest discovery when a module can be reached through + several paths (e.g. under Debian/Ubuntu with virtualenv). -- Issue #15207: Fix mimetypes to read from correct part of Windows registry +- bpo-15207: Fix mimetypes to read from correct part of Windows registry Original patch by Dave Chambers -- Issue #16595: Add prlimit() to resource module. +- bpo-16595: Add prlimit() to resource module. -- Issue #19324: Expose Linux-specific constants in resource module. +- bpo-19324: Expose Linux-specific constants in resource module. - Load SSL's error strings in hashlib. -- Issue #18527: Upgrade internal copy of zlib to 1.2.8. +- bpo-18527: Upgrade internal copy of zlib to 1.2.8. -- Issue #19274: Add a filterfunc parameter to PyZipFile.writepy. +- bpo-19274: Add a filterfunc parameter to PyZipFile.writepy. -- Issue #8964: fix platform._sys_version to handle IronPython 2.6+. - Patch by Martin Matusiak. +- bpo-8964: fix platform._sys_version to handle IronPython 2.6+. Patch by + Martin Matusiak. -- Issue #19413: Restore pre-3.3 reload() semantics of re-finding modules. +- bpo-19413: Restore pre-3.3 reload() semantics of re-finding modules. -- Issue #18958: Improve error message for json.load(s) while passing a string +- bpo-18958: Improve error message for json.load(s) while passing a string that starts with a UTF-8 BOM. -- Issue #19307: Improve error message for json.load(s) while passing objects - of the wrong type. +- bpo-19307: Improve error message for json.load(s) while passing objects of + the wrong type. -- Issue #16038: CVE-2013-1752: ftplib: Limit amount of data read by - limiting the call to readline(). Original patch by Michał - Jastrzębski and Giampaolo Rodola. +- bpo-16038: CVE-2013-1752: ftplib: Limit amount of data read by limiting + the call to readline(). Original patch by Michał Jastrzębski and + Giampaolo Rodola. -- Issue #17087: Improved the repr for regular expression match objects. +- bpo-17087: Improved the repr for regular expression match objects. Tests ----- -- Issue #19664: test_userdict's repr test no longer depends on the order - of dict elements. +- bpo-19664: test_userdict's repr test no longer depends on the order of + dict elements. -- Issue #19440: Clean up test_capi by removing an unnecessary __future__ +- bpo-19440: Clean up test_capi by removing an unnecessary __future__ import, converting from test_main to unittest.main, and running the _testcapi module tests as subTests of a unittest TestCase method. -- Issue #19378: the main dis module tests are now run with both stdout +- bpo-19378: the main dis module tests are now run with both stdout redirection *and* passing an explicit file parameter -- Issue #19378: removed the not-actually-helpful assertInstructionMatches - and assertBytecodeExactlyMatches helpers from bytecode_helper +- bpo-19378: removed the not-actually-helpful assertInstructionMatches and + assertBytecodeExactlyMatches helpers from bytecode_helper -- Issue #18702: All skipped tests now reported as skipped. +- bpo-18702: All skipped tests now reported as skipped. -- Issue #19439: interpreter embedding tests are now executed on Windows - (Patch by Zachary Ware) +- bpo-19439: interpreter embedding tests are now executed on Windows (Patch + by Zachary Ware) -- Issue #19085: Added basic tests for all tkinter widget options. +- bpo-19085: Added basic tests for all tkinter widget options. -- Issue #19384: Fix test_py_compile for root user, patch by Claudiu Popa. +- bpo-19384: Fix test_py_compile for root user, patch by Claudiu Popa. Documentation ------------- -- Issue #18326: Clarify that list.sort's arguments are keyword-only. Also, +- bpo-18326: Clarify that list.sort's arguments are keyword-only. Also, attempt to reduce confusion in the glossary by not saying there are different "types" of arguments and parameters. Build ----- -- Issue #19358: "make clinic" now runs the Argument Clinic preprocessor - over all CPython source files. +- bpo-19358: "make clinic" now runs the Argument Clinic preprocessor over + all CPython source files. - Update SQLite to 3.8.1, xz to 5.0.5, and Tcl/Tk to 8.6.1 on Windows. -- Issue #16632: Enable DEP and ASLR on Windows. +- bpo-16632: Enable DEP and ASLR on Windows. -- Issue #17791: Drop PREFIX and EXEC_PREFIX definitions from PC/pyconfig.h +- bpo-17791: Drop PREFIX and EXEC_PREFIX definitions from PC/pyconfig.h - Add workaround for VS 2010 nmake clean issue. VS 2010 doesn't set up PATH for nmake.exe correctly. -- Issue #19550: Implement Windows installer changes of PEP 453 (ensurepip). +- bpo-19550: Implement Windows installer changes of PEP 453 (ensurepip). -- Issue #19520: Fix compiler warning in the _sha3 module on 32bit Windows. +- bpo-19520: Fix compiler warning in the _sha3 module on 32bit Windows. -- Issue #19356: Avoid using a C variabled named "_self", it's a reserved - word in some C compilers. +- bpo-19356: Avoid using a C variabled named "_self", it's a reserved word + in some C compilers. -- Issue #15792: Correct build options on Win64. Patch by Jeremy Kloth. +- bpo-15792: Correct build options on Win64. Patch by Jeremy Kloth. -- Issue #19373: Apply upstream change to Tk 8.5.15 fixing OS X 10.9 - screen refresh problem for OS X installer build. +- bpo-19373: Apply upstream change to Tk 8.5.15 fixing OS X 10.9 screen + refresh problem for OS X installer build. -- Issue #19649: On OS X, the same set of file names are now installed - in bin directories for all configurations: non-framework vs framework, - and single arch vs universal builds. pythonx.y-32 is now always - installed for 64-bit/32-bit universal builds. The obsolete and - undocumented pythonw* symlinks are no longer installed anywhere. +- bpo-19649: On OS X, the same set of file names are now installed in bin + directories for all configurations: non-framework vs framework, and single + arch vs universal builds. pythonx.y-32 is now always installed for + 64-bit/32-bit universal builds. The obsolete and undocumented pythonw* + symlinks are no longer installed anywhere. -- Issue #19553: PEP 453 - "make install" and "make altinstall" now install or - upgrade pip by default, using the bundled pip provided by the new ensurepip - module. A new configure option, --with-ensurepip[=upgrade|install|no], is - available to override the default ensurepip "--upgrade" option. The option - can also be set with "make [alt]install ENSUREPIP=[upgrade|install|no]". +- bpo-19553: PEP 453 - "make install" and "make altinstall" now install or + upgrade pip by default, using the bundled pip provided by the new + ensurepip module. A new configure option, --with- + ensurepip[=upgrade|install|no], is available to override the default + ensurepip "--upgrade" option. The option can also be set with "make + [alt]install ENSUREPIP=[upgrade|install|no]". -- Issue #19551: PEP 453 - the OS X installer now installs pip by default. +- bpo-19551: PEP 453 - the OS X installer now installs pip by default. - Update third-party libraries for OS X installers: xz 5.0.3 -> 5.0.5, SQLite 3.7.13 -> 3.8.1 -- Issue #15663: Revert OS X installer built-in Tcl/Tk support for 3.4.0b1. - Some third-party projects, such as Matplotlib and PIL/Pillow, - depended on being able to build with Tcl and Tk frameworks in - /Library/Frameworks. +- bpo-15663: Revert OS X installer built-in Tcl/Tk support for 3.4.0b1. Some + third-party projects, such as Matplotlib and PIL/Pillow, depended on being + able to build with Tcl and Tk frameworks in /Library/Frameworks. Tools/Demos ----------- -- Issue #19730: Argument Clinic now supports all the existing PyArg - "format units" as legacy converters, as well as two new features: - "self converters" and the "version" directive. +- bpo-19730: Argument Clinic now supports all the existing PyArg "format + units" as legacy converters, as well as two new features: "self + converters" and the "version" directive. -- Issue #19552: pyvenv now bootstraps pip into virtual environments by - default (pass --without-pip to request the old behaviour) +- bpo-19552: pyvenv now bootstraps pip into virtual environments by default + (pass --without-pip to request the old behaviour) -- Issue #19390: Argument Clinic no longer accepts malformed Python - and C ids. +- bpo-19390: Argument Clinic no longer accepts malformed Python and C ids. -What's New in Python 3.4.0 Alpha 4? +What's New in Python 3.4.0 alpha 4? =================================== -Release date: 2013-10-20 +*Release date: 2013-10-20* Core and Builtins ----------------- -- Issue #19301: Give classes and functions that are explicitly marked global a +- bpo-19301: Give classes and functions that are explicitly marked global a global qualname. -- Issue #19279: UTF-7 decoder no longer produces illegal strings. +- bpo-19279: UTF-7 decoder no longer produces illegal strings. -- Issue #16612: Add "Argument Clinic", a compile-time preprocessor for - C files to generate argument parsing code. (See PEP 436.) +- bpo-16612: Add "Argument Clinic", a compile-time preprocessor for C files + to generate argument parsing code. (See PEP 436.) -- Issue #18810: Shift stat calls in importlib.machinery.FileFinder such that - the code is optimistic that if something exists in a directory named exactly - like the possible package being searched for that it's in actuality a - directory. +- bpo-18810: Shift stat calls in importlib.machinery.FileFinder such that + the code is optimistic that if something exists in a directory named + exactly like the possible package being searched for that it's in + actuality a directory. -- Issue #18416: importlib.machinery.PathFinder now treats '' as the cwd and - importlib.machinery.FileFinder no longer special-cases '' to '.'. This leads - to modules imported from cwd to now possess an absolute file path for - __file__ (this does not affect modules specified by path on the CLI but it - does affect -m/runpy). It also allows FileFinder to be more consistent by not - having an edge case. +- bpo-18416: importlib.machinery.PathFinder now treats '' as the cwd and + importlib.machinery.FileFinder no longer special-cases '' to '.'. This + leads to modules imported from cwd to now possess an absolute file path + for __file__ (this does not affect modules specified by path on the CLI + but it does affect -m/runpy). It also allows FileFinder to be more + consistent by not having an edge case. -- Issue #4555: All exported C symbols are now prefixed with either - "Py" or "_Py". +- bpo-4555: All exported C symbols are now prefixed with either "Py" or + "_Py". -- Issue #19219: Speed up marshal.loads(), and make pyc files slightly - (5% to 10%) smaller. +- bpo-19219: Speed up marshal.loads(), and make pyc files slightly (5% to + 10%) smaller. -- Issue #19221: Upgrade Unicode database to version 6.3.0. +- bpo-19221: Upgrade Unicode database to version 6.3.0. -- Issue #16742: The result of the C callback PyOS_ReadlineFunctionPointer must - now be a string allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL - if an error occurred), instead of a string allocated by PyMem_Malloc() or - PyMem_Realloc(). +- bpo-16742: The result of the C callback PyOS_ReadlineFunctionPointer must + now be a string allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or + NULL if an error occurred), instead of a string allocated by + PyMem_Malloc() or PyMem_Realloc(). -- Issue #19199: Remove ``PyThreadState.tick_counter`` field +- bpo-19199: Remove ``PyThreadState.tick_counter`` field - Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions. -- Issue #19087: Improve bytearray allocation in order to allow cheap popping - of data at the front (slice deletion). +- bpo-19087: Improve bytearray allocation in order to allow cheap popping of + data at the front (slice deletion). -- Issue #19014: memoryview.cast() is now allowed on zero-length views. +- bpo-19014: memoryview.cast() is now allowed on zero-length views. -- Issue #18690: memoryview is now automatically registered with +- bpo-18690: memoryview is now automatically registered with collections.abc.Sequence -- Issue #19078: memoryview now correctly supports the reversed builtin - (Patch by Claudiu Popa) +- bpo-19078: memoryview now correctly supports the reversed builtin (Patch + by Claudiu Popa) Library ------- -- Issue #17457: unittest test discovery now works with namespace packages. +- bpo-17457: unittest test discovery now works with namespace packages. Patch by Claudiu Popa. -- Issue #18235: Fix the sysconfig variables LDSHARED and BLDSHARED under AIX. +- bpo-18235: Fix the sysconfig variables LDSHARED and BLDSHARED under AIX. Patch by David Edelsohn. -- Issue #18606: Add the new "statistics" module (PEP 450). Contributed - by Steven D'Aprano. +- bpo-18606: Add the new "statistics" module (PEP 450). Contributed by + Steven D'Aprano. -- Issue #12866: The audioop module now supports 24-bit samples. +- bpo-12866: The audioop module now supports 24-bit samples. -- Issue #19254: Provide an optimized Python implementation of pbkdf2_hmac. +- bpo-19254: Provide an optimized Python implementation of pbkdf2_hmac. -- Issues #19201, Issue #19222, Issue #19223: Add "x" mode (exclusive creation) - in opening file to bz2, gzip and lzma modules. Patches by Tim Heaney and - Vajrasky Kok. +- bpo-19201: Add "x" mode (exclusive creation) in opening file to bz2, gzip + and lzma modules. Patches by Tim Heaney and Vajrasky Kok. (See also: + bpo-19222, bpo-19223) - Fix a reference count leak in _sre. -- Issue #19262: Initial check in of the 'asyncio' package (a.k.a. Tulip, - a.k.a. PEP 3156). There are no docs yet, and the PEP is slightly - out of date with the code. This module will have *provisional* status - in Python 3.4. +- bpo-19262: Initial check in of the 'asyncio' package (a.k.a. Tulip, a.k.a. + PEP 3156). There are no docs yet, and the PEP is slightly out of date with + the code. This module will have *provisional* status in Python 3.4. -- Issue #19276: Fixed the wave module on 64-bit big-endian platforms. +- bpo-19276: Fixed the wave module on 64-bit big-endian platforms. -- Issue #19266: Rename the new-in-3.4 ``contextlib.ignore`` context manager - to ``contextlib.suppress`` in order to be more consistent with existing +- bpo-19266: Rename the new-in-3.4 ``contextlib.ignore`` context manager to + ``contextlib.suppress`` in order to be more consistent with existing descriptions of that operation elsewhere in the language and standard library documentation (Patch by Zero Piraeus). -- Issue #18891: Completed the new email package (provisional) API additions - by adding new classes EmailMessage, MIMEPart, and ContentManager. +- bpo-18891: Completed the new email package (provisional) API additions by + adding new classes EmailMessage, MIMEPart, and ContentManager. -- Issue #18281: Unused stat constants removed from `tarfile`. +- bpo-18281: Unused stat constants removed from `tarfile`. -- Issue #18999: Multiprocessing now supports 'contexts' with the same API - as the module, but bound to specified start methods. +- bpo-18999: Multiprocessing now supports 'contexts' with the same API as + the module, but bound to specified start methods. -- Issue #18468: The re.split, re.findall, and re.sub functions and the group() +- bpo-18468: The re.split, re.findall, and re.sub functions and the group() and groups() methods of match object now always return a string or a bytes object. -- Issue #18725: The textwrap module now supports truncating multiline text. +- bpo-18725: The textwrap module now supports truncating multiline text. -- Issue #18776: atexit callbacks now display their full traceback when they +- bpo-18776: atexit callbacks now display their full traceback when they raise an exception. -- Issue #17827: Add the missing documentation for ``codecs.encode`` and +- bpo-17827: Add the missing documentation for ``codecs.encode`` and ``codecs.decode``. -- Issue #19218: Rename collections.abc to _collections_abc in order to - speed up interpreter start. +- bpo-19218: Rename collections.abc to _collections_abc in order to speed up + interpreter start. -- Issue #18582: Add 'pbkdf2_hmac' to the hashlib module. It implements PKCS#5 - password-based key derivation functions with HMAC as pseudorandom function. +- bpo-18582: Add 'pbkdf2_hmac' to the hashlib module. It implements PKCS#5 + password-based key derivation functions with HMAC as pseudorandom + function. -- Issue #19131: The aifc module now correctly reads and writes sampwidth of +- bpo-19131: The aifc module now correctly reads and writes sampwidth of compressed streams. -- Issue #19209: Remove import of copyreg from the os module to speed up +- bpo-19209: Remove import of copyreg from the os module to speed up interpreter startup. stat_result and statvfs_result are now hard-coded to reside in the os module. -- Issue #19205: Don't import the 're' module in site and sysconfig module to +- bpo-19205: Don't import the 're' module in site and sysconfig module to speed up interpreter start. -- Issue #9548: Add a minimal "_bootlocale" module that is imported by the - _io module instead of the full locale module. +- bpo-9548: Add a minimal "_bootlocale" module that is imported by the _io + module instead of the full locale module. -- Issue #18764: Remove the 'print' alias for the PDB 'p' command so that it no +- bpo-18764: Remove the 'print' alias for the PDB 'p' command so that it no longer shadows the print function. -- Issue #19158: A rare race in BoundedSemaphore could allow .release() too +- bpo-19158: A rare race in BoundedSemaphore could allow .release() too often. -- Issue #15805: Add contextlib.redirect_stdout(). +- bpo-15805: Add contextlib.redirect_stdout(). -- Issue #18716: Deprecate the formatter module. +- bpo-18716: Deprecate the formatter module. -- Issue #10712: 2to3 has a new "asserts" fixer that replaces deprecated names +- bpo-10712: 2to3 has a new "asserts" fixer that replaces deprecated names of unittest methods (e.g. failUnlessEqual -> assertEqual). -- Issue #18037: 2to3 now escapes ``'\u'`` and ``'\U'`` in native strings. +- bpo-18037: 2to3 now escapes ``'\u'`` and ``'\U'`` in native strings. -- Issue #17839: base64.decodebytes and base64.encodebytes now accept any - object that exports a 1 dimensional array of bytes (this means the same - is now also true for base64_codec) +- bpo-17839: base64.decodebytes and base64.encodebytes now accept any object + that exports a 1 dimensional array of bytes (this means the same is now + also true for base64_codec) -- Issue #19132: The pprint module now supports compact mode. +- bpo-19132: The pprint module now supports compact mode. -- Issue #19137: The pprint module now correctly formats instances of set and +- bpo-19137: The pprint module now correctly formats instances of set and frozenset subclasses. -- Issue #10042: functools.total_ordering now correctly handles - NotImplemented being returned by the underlying comparison function (Patch - by Katie Miller) +- bpo-10042: functools.total_ordering now correctly handles NotImplemented + being returned by the underlying comparison function (Patch by Katie + Miller) -- Issue #19092: contextlib.ExitStack now correctly reraises exceptions - from the __exit__ callbacks of inner context managers (Patch by Hrvoje - Nikšić) +- bpo-19092: contextlib.ExitStack now correctly reraises exceptions from the + __exit__ callbacks of inner context managers (Patch by Hrvoje Nikšić) -- Issue #12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except - when necessary. Patch by Oscar Benjamin. +- bpo-12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except + when necessary. Patch by Oscar Benjamin. -- Issue #5845: In site.py, only load readline history from ~/.python_history - if no history has been read already. This avoids double writes to the +- bpo-5845: In site.py, only load readline history from ~/.python_history if + no history has been read already. This avoids double writes to the history file at shutdown. - Properly initialize all fields of a SSL object after allocation. -- Issue #19095: SSLSocket.getpeercert() now raises ValueError when the - SSL handshake hasn't been done. +- bpo-19095: SSLSocket.getpeercert() now raises ValueError when the SSL + handshake hasn't been done. -- Issue #4366: Fix building extensions on all platforms when --enable-shared - is used. +- bpo-4366: Fix building extensions on all platforms when --enable-shared is + used. -- Issue #19030: Fixed `inspect.getmembers` and `inspect.classify_class_attrs` +- bpo-19030: Fixed `inspect.getmembers` and `inspect.classify_class_attrs` to attempt activating descriptors before falling back to a __dict__ search for faulty descriptors. `inspect.classify_class_attrs` no longer returns Attributes whose home class is None. @@ -6698,9 +7175,9 @@ Library C API ----- -- Issue #1772673: The type of `char*` arguments now changed to `const char*`. +- bpo-1772673: The type of `char*` arguments now changed to `const char*`. -- Issue #16129: Added a `Py_SetStandardStreamEncoding` pre-initialization API +- bpo-16129: Added a `Py_SetStandardStreamEncoding` pre-initialization API to allow embedding applications like Blender to force a particular encoding and error handler for the standard IO streams (initial patch by Bastien Montagne) @@ -6708,415 +7185,415 @@ C API Tests ----- -- Issue #19275: Fix test_site on AMD64 Snow Leopard +- bpo-19275: Fix test_site on AMD64 Snow Leopard -- Issue #14407: Fix unittest test discovery in test_concurrent_futures. +- bpo-14407: Fix unittest test discovery in test_concurrent_futures. -- Issue #18919: Unified and extended tests for audio modules: aifc, sunau and +- bpo-18919: Unified and extended tests for audio modules: aifc, sunau and wave. -- Issue #18714: Added tests for ``pdb.find_function()``. +- bpo-18714: Added tests for ``pdb.find_function()``. Documentation ------------- -- Issue #18758: Fixed and improved cross-references. +- bpo-18758: Fixed and improved cross-references. -- Issue #18972: Modernize email examples and use the argparse module in them. +- bpo-18972: Modernize email examples and use the argparse module in them. Build ----- -- Issue #19130: Correct PCbuild/readme.txt, Python 3.3 and 3.4 require VS 2010. +- bpo-19130: Correct PCbuild/readme.txt, Python 3.3 and 3.4 require VS 2010. -- Issue #15663: Update OS X 10.6+ installer to use Tcl/Tk 8.5.15. +- bpo-15663: Update OS X 10.6+ installer to use Tcl/Tk 8.5.15. -- Issue #14499: Fix several problems with OS X universal build support: - 1. ppc arch detection for extension module builds broke with Xcode 5 - 2. ppc arch detection in configure did not work on OS X 10.4 - 3. -sysroot and -arch flags were unnecessarily duplicated - 4. there was no obvious way to configure an intel-32 only build. +- bpo-14499: Fix several problems with OS X universal build support: 1. + ppc arch detection for extension module builds broke with Xcode 5 2. ppc + arch detection in configure did not work on OS X 10.4 3. -sysroot and + -arch flags were unnecessarily duplicated 4. there was no obvious way to + configure an intel-32 only build. -- Issue #19019: Change the OS X installer build script to use CFLAGS instead - of OPT for special build options. By setting OPT, some compiler-specific +- bpo-19019: Change the OS X installer build script to use CFLAGS instead of + OPT for special build options. By setting OPT, some compiler-specific options like -fwrapv were overridden and thus not used, which could result in broken interpreters when building with clang. -What's New in Python 3.4.0 Alpha 3? +What's New in Python 3.4.0 alpha 3? =================================== -Release date: 2013-09-29 +*Release date: 2013-09-29* Core and Builtins ----------------- -- Issue #18818: The "encodingname" part of PYTHONIOENCODING is now optional. +- bpo-18818: The "encodingname" part of PYTHONIOENCODING is now optional. -- Issue #19098: Prevent overflow in the compiler when the recursion limit is set - absurdly high. +- bpo-19098: Prevent overflow in the compiler when the recursion limit is + set absurdly high. Library ------- -- Issue #18929: `inspect.classify_class_attrs()` now correctly finds class +- bpo-18929: `inspect.classify_class_attrs()` now correctly finds class attributes returned by `dir()` that are located in the metaclass. -- Issue #18950: Fix miscellaneous bugs in the sunau module. +- bpo-18950: Fix miscellaneous bugs in the sunau module. Au_read.readframes() now updates current file position and reads correct number of frames from multichannel stream. Au_write.writeframesraw() now - correctly updates current file position. Au_read.getnframes() now returns an - integer (as in Python 2). Au_read and Au_write now correctly works with file - object if start file position is not a zero. + correctly updates current file position. Au_read.getnframes() now returns + an integer (as in Python 2). Au_read and Au_write now correctly works with + file object if start file position is not a zero. -- Issue #18594: The fast path for collections.Counter() was never taken - due to an over-restrictive type check. +- bpo-18594: The fast path for collections.Counter() was never taken due to + an over- restrictive type check. -- Issue #19053: ZipExtFile.read1() with non-zero argument no more returns empty +- bpo-19053: ZipExtFile.read1() with non-zero argument no more returns empty bytes until end of data. - logging: added support for Unix domain sockets to SocketHandler and DatagramHandler. -- Issue #18996: TestCase.assertEqual() now more cleverly shorten differing +- bpo-18996: TestCase.assertEqual() now more cleverly shorten differing strings in error report. -- Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation. +- bpo-19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation. -- Issue #18978: ``urllib.request.Request`` now allows the method to be +- bpo-18978: ``urllib.request.Request`` now allows the method to be indicated on the class and no longer sets it to None in ``__init__``. -- Issue #18626: the inspect module now offers a basic command line +- bpo-18626: the inspect module now offers a basic command line introspection interface (Initial patch by Claudiu Popa) -- Issue #3015: Fixed tkinter with wantobject=False. Any Tcl command call +- bpo-3015: Fixed tkinter with wantobject=False. Any Tcl command call returned empty string. -- Issue #19037: The mailbox module now makes all changes to maildir files - before moving them into place, to avoid race conditions with other programs - that may be accessing the maildir directory. +- bpo-19037: The mailbox module now makes all changes to maildir files + before moving them into place, to avoid race conditions with other + programs that may be accessing the maildir directory. -- Issue #14984: On POSIX systems, when netrc is called without a filename +- bpo-14984: On POSIX systems, when netrc is called without a filename argument (and therefore is reading the user's $HOME/.netrc file), it now - enforces the same security rules as typical ftp clients: the .netrc file must - be owned by the user that owns the process and must not be readable by any - other user. + enforces the same security rules as typical ftp clients: the .netrc file + must be owned by the user that owns the process and must not be readable + by any other user. -- Issue #18873: The tokenize module now detects Python source code encoding +- bpo-18873: The tokenize module now detects Python source code encoding only in comment lines. -- Issue #17764: Enable http.server to bind to a user specified network +- bpo-17764: Enable http.server to bind to a user specified network interface. Patch contributed by Malte Swart. -- Issue #18937: Add an assertLogs() context manager to unittest.TestCase - to ensure that a block of code emits a message using the logging module. +- bpo-18937: Add an assertLogs() context manager to unittest.TestCase to + ensure that a block of code emits a message using the logging module. -- Issue #17324: Fix http.server's request handling case on trailing '/'. Patch +- bpo-17324: Fix http.server's request handling case on trailing '/'. Patch contributed by Vajrasky Kok. -- Issue #19018: The heapq.merge() function no longer suppresses IndexError - in the underlying iterables. +- bpo-19018: The heapq.merge() function no longer suppresses IndexError in + the underlying iterables. -- Issue #18784: The uuid module no longer attempts to load libc via ctypes.CDLL - if all the necessary functions have already been found in libuuid. Patch by - Evgeny Sologubov. +- bpo-18784: The uuid module no longer attempts to load libc via ctypes.CDLL + if all the necessary functions have already been found in libuuid. Patch + by Evgeny Sologubov. - The :envvar:`PYTHONFAULTHANDLER` environment variable now only enables the - faulthandler module if the variable is non-empty. Same behaviour than other - variables like :envvar:`PYTHONDONTWRITEBYTECODE`. + faulthandler module if the variable is non-empty. Same behaviour than + other variables like :envvar:`PYTHONDONTWRITEBYTECODE`. -- Issue #1565525: New function ``traceback.clear_frames`` will clear - the local variables of all the stack frames referenced by a traceback - object. +- bpo-1565525: New function ``traceback.clear_frames`` will clear the local + variables of all the stack frames referenced by a traceback object. Tests ----- -- Issue #18952: Fix regression in support data downloads introduced when +- bpo-18952: Fix regression in support data downloads introduced when test.support was converted to a package. Regression noticed by Zachary Ware. IDLE ---- -- Issue #18873: IDLE now detects Python source code encoding only in comment +- bpo-18873: IDLE now detects Python source code encoding only in comment lines. -- Issue #18988: The "Tab" key now works when a word is already autocompleted. +- bpo-18988: The "Tab" key now works when a word is already autocompleted. Documentation ------------- -- Issue #17003: Unified the size argument names in the io module with common +- bpo-17003: Unified the size argument names in the io module with common practice. Build ----- -- Issue #18596: Support the use of address sanity checking in recent versions +- bpo-18596: Support the use of address sanity checking in recent versions of clang and GCC by appropriately marking known false alarms in the small object allocator. Patch contributed by Dhiru Kholia. Tools/Demos ----------- -- Issue #18873: 2to3 and the findnocoding.py script now detect Python source +- bpo-18873: 2to3 and the findnocoding.py script now detect Python source code encoding only in comment lines. -What's New in Python 3.4.0 Alpha 2? +What's New in Python 3.4.0 alpha 2? =================================== -Release date: 2013-09-09 +*Release date: 2013-09-09* Core and Builtins ----------------- -- Issue #18942: sys._debugmallocstats() output was damaged on Windows. +- bpo-18942: sys._debugmallocstats() output was damaged on Windows. -- Issue #18571: Implementation of the PEP 446: file descriptors and file +- bpo-18571: Implementation of the PEP 446: file descriptors and file handles are now created non-inheritable; add functions os.get/set_inheritable(), os.get/set_handle_inheritable() and socket.socket.get/set_inheritable(). -- Issue #11619: The parser and the import machinery do not encode Unicode +- bpo-11619: The parser and the import machinery do not encode Unicode filenames anymore on Windows. -- Issue #18808: Non-daemon threads are now automatically joined when - a sub-interpreter is shutdown (it would previously dump a fatal error). +- bpo-18808: Non-daemon threads are now automatically joined when a sub- + interpreter is shutdown (it would previously dump a fatal error). - Remove support for compiling on systems without getcwd(). -- Issue #18774: Remove last bits of GNU PTH thread code and thread_pth.h. +- bpo-18774: Remove last bits of GNU PTH thread code and thread_pth.h. -- Issue #18771: Add optimization to set object lookups to reduce the cost - of hash collisions. The core idea is to inspect a second key/hash pair - for each cache line retrieved. +- bpo-18771: Add optimization to set object lookups to reduce the cost of + hash collisions. The core idea is to inspect a second key/hash pair for + each cache line retrieved. -- Issue #16105: When a signal handler fails to write to the file descriptor - registered with ``signal.set_wakeup_fd()``, report an exception instead - of ignoring the error. +- bpo-16105: When a signal handler fails to write to the file descriptor + registered with ``signal.set_wakeup_fd()``, report an exception instead of + ignoring the error. -- Issue #18722: Remove uses of the "register" keyword in C code. +- bpo-18722: Remove uses of the "register" keyword in C code. -- Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions. +- bpo-18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions. -- Issue #16499: Add command line option for isolated mode. +- bpo-16499: Add command line option for isolated mode. -- Issue #15301: Parsing fd, uid, and gid parameters for builtins - in Modules/posixmodule.c is now far more robust. +- bpo-15301: Parsing fd, uid, and gid parameters for builtins in + Modules/posixmodule.c is now far more robust. -- Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc() +- bpo-18368: PyOS_StdioReadline() no longer leaks memory when realloc() fail. -- Issue #17934: Add a clear() method to frame objects, to help clean up +- bpo-17934: Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles. -- Issue #18780: %-formatting codes %d, %i, and %u now treat int-subclasses - as int (displays value of int-subclass instead of str(int-subclass) ). +- bpo-18780: %-formatting codes %d, %i, and %u now treat int-subclasses as + int (displays value of int-subclass instead of str(int-subclass) ). Library ------- -- Issue #18808: Thread.join() now waits for the underlying thread state to - be destroyed before returning. This prevents unpredictable aborts in +- bpo-18808: Thread.join() now waits for the underlying thread state to be + destroyed before returning. This prevents unpredictable aborts in Py_EndInterpreter() when some non-daemon threads are still running. -- Issue #18458: Prevent crashes with newer versions of libedit. Its readline +- bpo-18458: Prevent crashes with newer versions of libedit. Its readline emulation has changed from 0-based indexing to 1-based like gnu readline. -- Issue #18852: Handle case of ``readline.__doc__`` being ``None`` in the new +- bpo-18852: Handle case of ``readline.__doc__`` being ``None`` in the new readline activation code in ``site.py``. -- Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in +- bpo-18672: Fixed format specifiers for Py_ssize_t in debugging output in the _sre module. -- Issue #18830: inspect.getclasstree() no longer produces duplicate entries even - when input list contains duplicates. +- bpo-18830: inspect.getclasstree() no longer produces duplicate entries + even when input list contains duplicates. -- Issue #18878: sunau.open now supports the context management protocol. Based on - patches by Claudiu Popa and R. David Murray. +- bpo-18878: sunau.open now supports the context management protocol. Based + on patches by Claudiu Popa and R. David Murray. -- Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast +- bpo-18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast 64-bit pointer to long (32 bits). -- Issue #18876: The FileIO.mode attribute now better reflects the actual mode +- bpo-18876: The FileIO.mode attribute now better reflects the actual mode under which the file was opened. Patch by Erik Bray. -- Issue #16853: Add new selectors module. +- bpo-16853: Add new selectors module. -- Issue #18882: Add threading.main_thread() function. +- bpo-18882: Add threading.main_thread() function. -- Issue #18901: The sunau getparams method now returns a namedtuple rather than +- bpo-18901: The sunau getparams method now returns a namedtuple rather than a plain tuple. Patch by Claudiu Popa. -- Issue #17487: The result of the wave getparams method now is pickleable again. - Patch by Claudiu Popa. +- bpo-17487: The result of the wave getparams method now is pickleable + again. Patch by Claudiu Popa. -- Issue #18756: os.urandom() now uses a lazily-opened persistent file +- bpo-18756: os.urandom() now uses a lazily-opened persistent file descriptor, so as to avoid using many file descriptors when run in parallel from multiple threads. -- Issue #18418: After fork(), reinit all threads states, not only active ones. +- bpo-18418: After fork(), reinit all threads states, not only active ones. Patch by A. Jesse Jiryu Davis. -- Issue #17974: Switch unittest from using getopt to using argparse. +- bpo-17974: Switch unittest from using getopt to using argparse. -- Issue #11798: TestSuite now drops references to own tests after execution. +- bpo-11798: TestSuite now drops references to own tests after execution. -- Issue #16611: http.cookie now correctly parses the 'secure' and 'httponly' +- bpo-16611: http.cookie now correctly parses the 'secure' and 'httponly' cookie flags. -- Issue #11973: Fix a problem in kevent. The flags and fflags fields are now +- bpo-11973: Fix a problem in kevent. The flags and fflags fields are now properly handled as unsigned. -- Issue #18807: ``pyvenv`` now takes a --copies argument allowing copies +- bpo-18807: ``pyvenv`` now takes a --copies argument allowing copies instead of symlinks even where symlinks are available and the default. -- Issue #18538: ``python -m dis`` now uses argparse for argument processing. +- bpo-18538: ``python -m dis`` now uses argparse for argument processing. Patch by Michele Orrù. -- Issue #18394: Close cgi.FieldStorage's optional file. +- bpo-18394: Close cgi.FieldStorage's optional file. -- Issue #17702: On error, os.environb now suppresses the exception context - when raising a new KeyError with the original key. +- bpo-17702: On error, os.environb now suppresses the exception context when + raising a new KeyError with the original key. -- Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6. +- bpo-16809: Fixed some tkinter incompatibilities with Tcl/Tk 8.6. -- Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj +- bpo-16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj argument. -- Issue #18324: set_payload now correctly handles binary input. This also +- bpo-18324: set_payload now correctly handles binary input. This also supersedes the previous fixes for #14360, #1717, and #16564. -- Issue #18794: Add a fileno() method and a closed attribute to select.devpoll +- bpo-18794: Add a fileno() method and a closed attribute to select.devpoll objects. -- Issue #17119: Fixed integer overflows when processing large strings and tuples - in the tkinter module. +- bpo-17119: Fixed integer overflows when processing large strings and + tuples in the tkinter module. -- Issue #18747: Re-seed OpenSSL's pseudo-random number generator after fork. - A pthread_atfork() parent handler is used to seed the PRNG with pid, time +- bpo-18747: Re-seed OpenSSL's pseudo-random number generator after fork. A + pthread_atfork() parent handler is used to seed the PRNG with pid, time and some stack data. -- Issue #8865: Concurrent invocation of select.poll.poll() now raises a +- bpo-8865: Concurrent invocation of select.poll.poll() now raises a RuntimeError exception. Patch by Christian Schubert. -- Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of - OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function. +- bpo-18777: The ssl module now uses the new CRYPTO_THREADID API of OpenSSL + 1.0.0+ instead of the deprecated CRYPTO id callback function. -- Issue #18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok. +- bpo-18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok. -- Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke +- bpo-18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke malloc weak symbols. -- Issue #18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes - inside subjectAltName correctly. Formerly the module has used OpenSSL's +- bpo-18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes inside + subjectAltName correctly. Formerly the module has used OpenSSL's GENERAL_NAME_print() function to get the string representation of ASN.1 strings for ``rfc822Name`` (email), ``dNSName`` (DNS) and ``uniformResourceIdentifier`` (URI). -- Issue #18701: Remove support of old CPython versions (<3.0) from C code. +- bpo-18701: Remove support of old CPython versions (<3.0) from C code. -- Issue #18756: Improve error reporting in os.urandom() when the failure - is due to something else than /dev/urandom not existing (for example, - exhausting the file descriptor limit). +- bpo-18756: Improve error reporting in os.urandom() when the failure is due + to something else than /dev/urandom not existing (for example, exhausting + the file descriptor limit). -- Issue #18673: Add O_TMPFILE to os module. O_TMPFILE requires Linux kernel +- bpo-18673: Add O_TMPFILE to os module. O_TMPFILE requires Linux kernel 3.11 or newer. It's only defined on system with 3.11 uapi headers, too. -- Issue #18532: Change the builtin hash algorithms' names to lower case names +- bpo-18532: Change the builtin hash algorithms' names to lower case names as promised by hashlib's documentation. -- Issue #8713: add new spwan and forkserver start methods, and new functions +- bpo-8713: add new spwan and forkserver start methods, and new functions get_all_start_methods, get_start_method, and set_start_method, to multiprocessing. -- Issue #18405: Improve the entropy of crypt.mksalt(). +- bpo-18405: Improve the entropy of crypt.mksalt(). -- Issue #12015: The tempfile module now uses a suffix of 8 random characters +- bpo-12015: The tempfile module now uses a suffix of 8 random characters instead of 6, to reduce the risk of filename collision. The entropy was - reduced when uppercase letters were removed from the charset used to generate - random characters. + reduced when uppercase letters were removed from the charset used to + generate random characters. -- Issue #18585: Add :func:`textwrap.shorten` to collapse and truncate a - piece of text to a given length. +- bpo-18585: Add :func:`textwrap.shorten` to collapse and truncate a piece + of text to a given length. -- Issue #18598: Tweak exception message for importlib.import_module() to +- bpo-18598: Tweak exception message for importlib.import_module() to include the module name when a key argument is missing. -- Issue #19151: Fix docstring and use of _get_supported_file_loaders() to +- bpo-19151: Fix docstring and use of _get_supported_file_loaders() to reflect 2-tuples. -- Issue #19152: Add ExtensionFileLoader.get_filename(). +- bpo-19152: Add ExtensionFileLoader.get_filename(). -- Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get +- bpo-18676: Change 'positive' to 'non-negative' in queue.py put and get docstrings and ValueError messages. Patch by Zhongyue Luo - Fix refcounting issue with extension types in tkinter. -- Issue #8112: xlmrpc.server's DocXMLRPCServer server no longer raises an error +- bpo-8112: xlmrpc.server's DocXMLRPCServer server no longer raises an error if methods have annotations; it now correctly displays the annotations. -- Issue #18600: Added policy argument to email.message.Message.as_string, - and as_bytes and __bytes__ methods to Message. +- bpo-18600: Added policy argument to email.message.Message.as_string, and + as_bytes and __bytes__ methods to Message. -- Issue #18671: Output more information when logging exceptions occur. +- bpo-18671: Output more information when logging exceptions occur. -- Issue #18621: Prevent the site module's patched builtins from keeping - too many references alive for too long. +- bpo-18621: Prevent the site module's patched builtins from keeping too + many references alive for too long. -- Issue #4885: Add weakref support to mmap objects. Patch by Valerie Lambert. +- bpo-4885: Add weakref support to mmap objects. Patch by Valerie Lambert. -- Issue #8860: Fixed rounding in timedelta constructor. +- bpo-8860: Fixed rounding in timedelta constructor. -- Issue #18849: Fixed a Windows-specific tempfile bug where collision with an +- bpo-18849: Fixed a Windows-specific tempfile bug where collision with an existing directory caused mkstemp and related APIs to fail instead of retrying. Report and fix by Vlad Shcherbina. -- Issue #18920: argparse's default destination for the version action (-v, - --version) has also been changed to stdout, to match the Python executable. +- bpo-18920: argparse's default destination for the version action (-v, + --version) has also been changed to stdout, to match the Python + executable. Tests ----- -- Issue #18623: Factor out the _SuppressCoreFiles context manager into +- bpo-18623: Factor out the _SuppressCoreFiles context manager into test.support. Patch by Valerie Lambert. -- Issue #12037: Fix test_email for desktop Windows. +- bpo-12037: Fix test_email for desktop Windows. -- Issue #15507: test_subprocess's test_send_signal could fail if the test +- bpo-15507: test_subprocess's test_send_signal could fail if the test runner were run in an environment where the process inherited an ignore - setting for SIGINT. Restore the SIGINT handler to the desired + setting for SIGINT. Restore the SIGINT handler to the desired KeyboardInterrupt raising one during that test. -- Issue #16799: Switched from getopt to argparse style in regrtest's argument - parsing. Added more tests for regrtest's argument parsing. +- bpo-16799: Switched from getopt to argparse style in regrtest's argument + parsing. Added more tests for regrtest's argument parsing. -- Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as +- bpo-18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as possible, since "localhost" goes through a DNS lookup under recent Windows versions. IDLE ---- -- Issue #18489: Add tests for SearchEngine. Original patch by Phil Webster. +- bpo-18489: Add tests for SearchEngine. Original patch by Phil Webster. Documentation ------------- -- Issue #18743: Fix references to non-existent "StringIO" module. +- bpo-18743: Fix references to non-existent "StringIO" module. -- Issue #18783: Removed existing mentions of Python long type in docstrings, +- bpo-18783: Removed existing mentions of Python long type in docstrings, error messages and comments. Build ----- -- Issue #1584: Provide configure options to override default search paths for +- bpo-1584: Provide configure options to override default search paths for Tcl and Tk when building _tkinter. -- Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+ 64-/32-bit +- bpo-15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+ 64-/32-bit installer. It is no longer necessary to install a third-party version of Tcl/Tk 8.5 to work around the problems in the Apple-supplied Tcl/Tk 8.5 shipped in OS X 10.6 and later releases. @@ -7124,1378 +7601,1397 @@ Build Tools/Demos ----------- -- Issue #18922: Now The Lib/smtpd.py and Tools/i18n/msgfmt.py scripts write +- bpo-18922: Now The Lib/smtpd.py and Tools/i18n/msgfmt.py scripts write their version strings to stdout, and not to sderr. -What's New in Python 3.4.0 Alpha 1? +What's New in Python 3.4.0 alpha 1? =================================== -Release date: 2013-08-03 +*Release date: 2013-08-03* Core and Builtins ----------------- -- Issue #16741: Fix an error reporting in int(). +- bpo-16741: Fix an error reporting in int(). -- Issue #17899: Fix rare file descriptor leak in os.listdir(). +- bpo-17899: Fix rare file descriptor leak in os.listdir(). -- Issue #10241: Clear extension module dict copies at interpreter shutdown. +- bpo-10241: Clear extension module dict copies at interpreter shutdown. Patch by Neil Schemenauer, minimally modified. -- Issue #9035: ismount now recognises volumes mounted below a drive root - on Windows. Original patch by Atsuo Ishimoto. +- bpo-9035: ismount now recognises volumes mounted below a drive root on + Windows. Original patch by Atsuo Ishimoto. -- Issue #18214: Improve finalization of Python modules to avoid setting - their globals to None, in most cases. +- bpo-18214: Improve finalization of Python modules to avoid setting their + globals to None, in most cases. -- Issue #18112: PEP 442 implementation (safe object finalization). +- bpo-18112: PEP 442 implementation (safe object finalization). -- Issue #18552: Check return value of PyArena_AddPyObject() in +- bpo-18552: Check return value of PyArena_AddPyObject() in obj2ast_object(). -- Issue #18560: Fix potential NULL pointer dereference in sum(). +- bpo-18560: Fix potential NULL pointer dereference in sum(). -- Issue #18520: Add a new PyStructSequence_InitType2() function, same than - PyStructSequence_InitType() except that it has a return value (0 on success, - -1 on error). +- bpo-18520: Add a new PyStructSequence_InitType2() function, same than + PyStructSequence_InitType() except that it has a return value (0 on + success, -1 on error). -- Issue #15905: Fix theoretical buffer overflow in handling of sys.argv[0], +- bpo-15905: Fix theoretical buffer overflow in handling of sys.argv[0], prefix and exec_prefix if the operation system does not obey MAXPATHLEN. -- Issue #18408: Fix many various bugs in code handling errors, especially - on memory allocation failure (MemoryError). +- bpo-18408: Fix many various bugs in code handling errors, especially on + memory allocation failure (MemoryError). -- Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all(). +- bpo-18344: Fix potential ref-leaks in _bufferedreader_read_all(). -- Issue #18342: Use the repr of a module name when an import fails when using +- bpo-18342: Use the repr of a module name when an import fails when using ``from ... import ...``. -- Issue #17872: Fix a segfault in marshal.load() when input stream returns - more bytes than requested. +- bpo-17872: Fix a segfault in marshal.load() when input stream returns more + bytes than requested. -- Issue #18338: `python --version` now prints version string to stdout, and - not to stderr. Patch by Berker Peksag and Michael Dickens. +- bpo-18338: `python --version` now prints version string to stdout, and not + to stderr. Patch by Berker Peksag and Michael Dickens. -- Issue #18426: Fix NULL pointer dereference in C extension import when +- bpo-18426: Fix NULL pointer dereference in C extension import when PyModule_GetDef() returns an error. -- Issue #17206: On Windows, increase the stack size from 2 MB to 4.2 MB to fix +- bpo-17206: On Windows, increase the stack size from 2 MB to 4.2 MB to fix a stack overflow in the marshal module (fix a crash in test_marshal). Patch written by Jeremy Kloth. -- Issue #3329: Implement the PEP 445: Add new APIs to customize Python memory +- bpo-3329: Implement the PEP 445: Add new APIs to customize Python memory allocators. -- Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the +- bpo-18328: Reorder ops in PyThreadState_Delete*() functions. Now the tstate is first removed from TLS and then deallocated. -- Issue #13483: Use VirtualAlloc in obmalloc on Windows. +- bpo-13483: Use VirtualAlloc in obmalloc on Windows. -- Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise +- bpo-18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise OverflowError when an argument of %c format is out of range. -- Issue #18111: The min() and max() functions now support a default argument - to be returned instead of raising a ValueError on an empty sequence. +- bpo-18111: The min() and max() functions now support a default argument to + be returned instead of raising a ValueError on an empty sequence. (Contributed by Julian Berman.) -- Issue #18137: Detect integer overflow on precision in float.__format__() - and complex.__format__(). +- bpo-18137: Detect integer overflow on precision in float.__format__() and + complex.__format__(). -- Issue #18183: Fix various unicode operations on strings with large unicode +- bpo-18183: Fix various unicode operations on strings with large unicode codepoints. -- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows(). +- bpo-18180: Fix ref leak in _PyImport_GetDynLoadWindows(). -- Issue #18038: SyntaxError raised during compilation sources with illegal +- bpo-18038: SyntaxError raised during compilation sources with illegal encoding now always contains an encoding name. -- Issue #17931: Resolve confusion on Windows between pids and process - handles. +- bpo-17931: Resolve confusion on Windows between pids and process handles. -- Tweak the exception message when the magic number or size value in a bytecode - file is truncated. +- Tweak the exception message when the magic number or size value in a + bytecode file is truncated. -- Issue #17932: Fix an integer overflow issue on Windows 64-bit in iterators: +- bpo-17932: Fix an integer overflow issue on Windows 64-bit in iterators: change the C type of seqiterobject.it_index from long to Py_ssize_t. -- Issue #18065: Don't set __path__ to the package name for frozen packages. +- bpo-18065: Don't set __path__ to the package name for frozen packages. -- Issue #18088: When reloading a module, unconditionally reset all relevant - attributes on the module (e.g. __name__, __loader__, __package__, __file__, - __cached__). +- bpo-18088: When reloading a module, unconditionally reset all relevant + attributes on the module (e.g. __name__, __loader__, __package__, + __file__, __cached__). -- Issue #17937: Try harder to collect cyclic garbage at shutdown. +- bpo-17937: Try harder to collect cyclic garbage at shutdown. -- Issue #12370: Prevent class bodies from interfering with the __class__ +- bpo-12370: Prevent class bodies from interfering with the __class__ closure. -- Issue #17644: Fix a crash in str.format when curly braces are used in square +- bpo-17644: Fix a crash in str.format when curly braces are used in square brackets. -- Issue #17237: Fix crash in the ASCII decoder on m68k. +- bpo-17237: Fix crash in the ASCII decoder on m68k. -- Issue #17927: Frame objects kept arguments alive if they had been - copied into a cell, even if the cell was cleared. +- bpo-17927: Frame objects kept arguments alive if they had been copied into + a cell, even if the cell was cleared. -- Issue #1545463: At shutdown, defer finalization of codec modules so - that stderr remains usable. +- bpo-1545463: At shutdown, defer finalization of codec modules so that + stderr remains usable. -- Issue #7330: Implement width and precision (ex: "%5.3s") for the format - string of PyUnicode_FromFormat() function, original patch written by Ysj Ray. +- bpo-7330: Implement width and precision (ex: "%5.3s") for the format + string of PyUnicode_FromFormat() function, original patch written by Ysj + Ray. -- Issue #1545463: Global variables caught in reference cycles are now - garbage-collected at shutdown. +- bpo-1545463: Global variables caught in reference cycles are now garbage- + collected at shutdown. -- Issue #17094: Clear stale thread states after fork(). Note that this - is a potentially disruptive change since it may release some system - resources which would otherwise remain perpetually alive (e.g. database - connections kept in thread-local storage). +- bpo-17094: Clear stale thread states after fork(). Note that this is a + potentially disruptive change since it may release some system resources + which would otherwise remain perpetually alive (e.g. database connections + kept in thread-local storage). -- Issue #17408: Avoid using an obsolete instance of the copyreg module when - the interpreter is shutdown and then started again. +- bpo-17408: Avoid using an obsolete instance of the copyreg module when the + interpreter is shutdown and then started again. -- Issue #5845: Enable tab-completion in the interactive interpreter by - default, thanks to a new sys.__interactivehook__. +- bpo-5845: Enable tab-completion in the interactive interpreter by default, + thanks to a new sys.__interactivehook__. -- Issue #17115,17116: Module initialization now includes setting __package__ and - __loader__ attributes to None. +- bpo-17115: Module initialization now includes setting __package__ and + __loader__ attributes to None. (See also: bpo-17116) -- Issue #17853: Ensure locals of a class that shadow free variables always win +- bpo-17853: Ensure locals of a class that shadow free variables always win over the closures. -- Issue #17863: In the interactive console, don't loop forever if the encoding +- bpo-17863: In the interactive console, don't loop forever if the encoding can't be fetched from stdin. -- Issue #17867: Raise an ImportError if __import__ is not found in __builtins__. +- bpo-17867: Raise an ImportError if __import__ is not found in + __builtins__. -- Issue #18698: Ensure importlib.reload() returns the module out of sys.modules. +- bpo-18698: Ensure importlib.reload() returns the module out of + sys.modules. -- Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3, - such as was shipped with Centos 5 and Mac OS X 10.4. +- bpo-17857: Prevent build failures with pre-3.5.0 versions of sqlite3, such + as was shipped with Centos 5 and Mac OS X 10.4. -- Issue #17413: sys.settrace callbacks were being passed a string instead of an - exception instance for the 'value' element of the arg tuple if the exception - originated from C code; now an exception instance is always provided. +- bpo-17413: sys.settrace callbacks were being passed a string instead of an + exception instance for the 'value' element of the arg tuple if the + exception originated from C code; now an exception instance is always + provided. -- Issue #17782: Fix undefined behaviour on platforms where - ``struct timespec``'s "tv_nsec" member is not a C long. +- bpo-17782: Fix undefined behaviour on platforms where ``struct + timespec``'s "tv_nsec" member is not a C long. -- Issue #17722: When looking up __round__, resolve descriptors. +- bpo-17722: When looking up __round__, resolve descriptors. -- Issue #16061: Speed up str.replace() for replacing 1-character strings. +- bpo-16061: Speed up str.replace() for replacing 1-character strings. -- Issue #17715: Fix segmentation fault from raising an exception in a __trunc__ +- bpo-17715: Fix segmentation fault from raising an exception in a __trunc__ method. -- Issue #17643: Add __callback__ attribute to weakref.ref. +- bpo-17643: Add __callback__ attribute to weakref.ref. -- Issue #16447: Fixed potential segmentation fault when setting __name__ on a +- bpo-16447: Fixed potential segmentation fault when setting __name__ on a class. -- Issue #17669: Fix crash involving finalization of generators using yield from. +- bpo-17669: Fix crash involving finalization of generators using yield + from. -- Issue #14439: Python now prints the traceback on runpy failure at startup. +- bpo-14439: Python now prints the traceback on runpy failure at startup. -- Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks() - when running on valgrind. +- bpo-17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks() when + running on valgrind. -- Issue #17619: Make input() check for Ctrl-C correctly on Windows. +- bpo-17619: Make input() check for Ctrl-C correctly on Windows. -- Issue #17357: Add missing verbosity messages for -v/-vv that were lost during +- bpo-17357: Add missing verbosity messages for -v/-vv that were lost during the importlib transition. -- Issue #17610: Don't rely on non-standard behavior of the C qsort() function. +- bpo-17610: Don't rely on non-standard behavior of the C qsort() function. -- Issue #17323: The "[X refs, Y blocks]" printed by debug builds has been - disabled by default. It can be re-enabled with the `-X showrefcount` option. +- bpo-17323: The "[X refs, Y blocks]" printed by debug builds has been + disabled by default. It can be re-enabled with the `-X showrefcount` + option. -- Issue #17328: Fix possible refleak in dict.setdefault. +- bpo-17328: Fix possible refleak in dict.setdefault. -- Issue #17275: Corrected class name in init error messages of the C version of +- bpo-17275: Corrected class name in init error messages of the C version of BufferedWriter and BufferedRandom. -- Issue #7963: Fixed misleading error message that issued when object is - called without arguments. +- bpo-7963: Fixed misleading error message that issued when object is called + without arguments. -- Issue #8745: Small speed up zipimport on Windows. Patch by Catalin Iacob. +- bpo-8745: Small speed up zipimport on Windows. Patch by Catalin Iacob. -- Issue #5308: Raise ValueError when marshalling too large object (a sequence +- bpo-5308: Raise ValueError when marshalling too large object (a sequence with size >= 2**31), instead of producing illegal marshal data. -- Issue #12983: Bytes literals with invalid ``\x`` escape now raise a SyntaxError - and a full traceback including line number. +- bpo-12983: Bytes literals with invalid ``\x`` escape now raise a + SyntaxError and a full traceback including line number. -- Issue #16967: In function definition, evaluate positional defaults before +- bpo-16967: In function definition, evaluate positional defaults before keyword-only defaults. -- Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) - in the interpreter. +- bpo-17173: Remove uses of locale-dependent C functions (isalpha() etc.) in + the interpreter. -- Issue #17137: When a Unicode string is resized, the internal wide character +- bpo-17137: When a Unicode string is resized, the internal wide character string (wstr) format is now cleared. -- Issue #17043: The unicode-internal decoder no longer read past the end of +- bpo-17043: The unicode-internal decoder no longer read past the end of input buffer. -- Issue #17098: All modules now have __loader__ set even if they pre-exist the +- bpo-17098: All modules now have __loader__ set even if they pre-exist the bootstrapping of importlib. -- Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. +- bpo-16979: Fix error handling bugs in the unicode-escape-decode decoder. -- Issue #16772: The base argument to the int constructor no longer accepts - floats, or other non-integer objects with an __int__ method. Objects - with an __index__ method are now accepted. +- bpo-16772: The base argument to the int constructor no longer accepts + floats, or other non-integer objects with an __int__ method. Objects with + an __index__ method are now accepted. -- Issue #10156: In the interpreter's initialization phase, unicode globals - are now initialized dynamically as needed. +- bpo-10156: In the interpreter's initialization phase, unicode globals are + now initialized dynamically as needed. -- Issue #16980: Fix processing of escaped non-ascii bytes in the - unicode-escape-decode decoder. +- bpo-16980: Fix processing of escaped non-ascii bytes in the unicode- + escape-decode decoder. -- Issue #16975: Fix error handling bug in the escape-decode bytes decoder. +- bpo-16975: Fix error handling bug in the escape-decode bytes decoder. -- Issue #14850: Now a charmap decoder treats U+FFFE as "undefined mapping" - in any mapping, not only in a string. +- bpo-14850: Now a charmap decoder treats U+FFFE as "undefined mapping" in + any mapping, not only in a string. -- Issue #16613: Add *m* argument to ``collections.Chainmap.new_child`` to - allow the new child map to be specified explicitly. +- bpo-16613: Add *m* argument to ``collections.Chainmap.new_child`` to allow + the new child map to be specified explicitly. -- Issue #16730: importlib.machinery.FileFinder now no longers raises an - exception when trying to populate its cache and it finds out the directory is - unreadable or has turned into a file. Reported and diagnosed by - David Pritchard. +- bpo-16730: importlib.machinery.FileFinder now no longers raises an + exception when trying to populate its cache and it finds out the directory + is unreadable or has turned into a file. Reported and diagnosed by David + Pritchard. -- Issue #16906: Fix a logic error that prevented most static strings from being +- bpo-16906: Fix a logic error that prevented most static strings from being cleared. -- Issue #11461: Fix the incremental UTF-16 decoder. Original patch by - Amaury Forgeot d'Arc. +- bpo-11461: Fix the incremental UTF-16 decoder. Original patch by Amaury + Forgeot d'Arc. -- Issue #16856: Fix a segmentation fault from calling repr() on a dict with - a key whose repr raise an exception. +- bpo-16856: Fix a segmentation fault from calling repr() on a dict with a + key whose repr raise an exception. -- Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB. +- bpo-16367: Fix FileIO.readall() on Windows for files larger than 2 GB. -- Issue #16761: Calling int() with base argument only now raises TypeError. +- bpo-16761: Calling int() with base argument only now raises TypeError. -- Issue #16759: Support the full DWORD (unsigned long) range in Reg2Py - when retrieving a REG_DWORD value. This corrects functions like +- bpo-16759: Support the full DWORD (unsigned long) range in Reg2Py when + retrieving a REG_DWORD value. This corrects functions like winreg.QueryValueEx that may have been returning truncated values. -- Issue #14420: Support the full DWORD (unsigned long) range in Py2Reg - when passed a REG_DWORD value. Fixes OverflowError in winreg.SetValueEx. +- bpo-14420: Support the full DWORD (unsigned long) range in Py2Reg when + passed a REG_DWORD value. Fixes OverflowError in winreg.SetValueEx. -- Issue #11939: Set the st_dev attribute of stat_result to allow Windows to - take advantage of the os.path.samefile/sameopenfile/samestat implementations - used by other platforms. +- bpo-11939: Set the st_dev attribute of stat_result to allow Windows to + take advantage of the os.path.samefile/sameopenfile/samestat + implementations used by other platforms. -- Issue #16772: The int() constructor's second argument (base) no longer +- bpo-16772: The int() constructor's second argument (base) no longer accepts non integer values. Consistent with the behavior in Python 2. -- Issue #14470: Remove w9xpopen support per PEP 11. +- bpo-14470: Remove w9xpopen support per PEP 11. -- Issue #9856: Replace deprecation warning with raising TypeError - in object.__format__. Patch by Florent Xicluna. +- bpo-9856: Replace deprecation warning with raising TypeError in + object.__format__. Patch by Florent Xicluna. -- Issue #16597: In buffered and text IO, call close() on the underlying stream +- bpo-16597: In buffered and text IO, call close() on the underlying stream if invoking flush() fails. -- Issue #16722: In the bytes() constructor, try to call __bytes__ on the +- bpo-16722: In the bytes() constructor, try to call __bytes__ on the argument before __index__. -- Issue #16421: loading multiple modules from one shared object is now - handled correctly (previously, the first module loaded from that file - was silently returned). Patch by Václav Šmilauer. +- bpo-16421: loading multiple modules from one shared object is now handled + correctly (previously, the first module loaded from that file was silently + returned). Patch by Václav Šmilauer. -- Issue #16602: When a weakref's target was part of a long deallocation - chain, the object could remain reachable through its weakref even though - its refcount had dropped to zero. +- bpo-16602: When a weakref's target was part of a long deallocation chain, + the object could remain reachable through its weakref even though its + refcount had dropped to zero. -- Issue #16495: Remove extraneous NULL encoding check from bytes_decode(). +- bpo-16495: Remove extraneous NULL encoding check from bytes_decode(). -- Issue #16619: Create NameConstant AST class to represent None, True, and False - literals. As a result, these constants are never loaded at runtime from - builtins. +- bpo-16619: Create NameConstant AST class to represent None, True, and + False literals. As a result, these constants are never loaded at runtime + from builtins. -- Issue #16455: On FreeBSD and Solaris, if the locale is C, the - ASCII/surrogateescape codec is now used (instead of the locale encoding) to - decode the command line arguments. This change fixes inconsistencies with - os.fsencode() and os.fsdecode(), because these operating systems announce an - ASCII locale encoding, but actually use the ISO-8859-1 encoding in practice. +- bpo-16455: On FreeBSD and Solaris, if the locale is C, the + ASCII/surrogateescape codec is now used (instead of the locale encoding) + to decode the command line arguments. This change fixes inconsistencies + with os.fsencode() and os.fsdecode(), because these operating systems + announce an ASCII locale encoding, but actually use the ISO-8859-1 + encoding in practice. -- Issue #16562: Optimize dict equality testing. Patch by Serhiy Storchaka. +- bpo-16562: Optimize dict equality testing. Patch by Serhiy Storchaka. -- Issue #16588: Silence unused-but-set warnings in Python/thread_pthread +- bpo-16588: Silence unused-but-set warnings in Python/thread_pthread -- Issue #16592: stringlib_bytes_join doesn't raise MemoryError on allocation +- bpo-16592: stringlib_bytes_join doesn't raise MemoryError on allocation failure. -- Issue #16546: Fix: ast.YieldFrom argument is now mandatory. +- bpo-16546: Fix: ast.YieldFrom argument is now mandatory. -- Issue #16514: Fix regression causing a traceback when sys.path[0] is None +- bpo-16514: Fix regression causing a traceback when sys.path[0] is None (actually, any non-string or non-bytes type). -- Issue #16306: Fix multiple error messages when unknown command line +- bpo-16306: Fix multiple error messages when unknown command line parameters where passed to the interpreter. Patch by Hieu Nguyen. -- Issue #16215: Fix potential double memory free in str.replace(). Patch - by Serhiy Storchaka. +- bpo-16215: Fix potential double memory free in str.replace(). Patch by + Serhiy Storchaka. -- Issue #16290: A float return value from the __complex__ special method is no +- bpo-16290: A float return value from the __complex__ special method is no longer accepted in the complex() constructor. -- Issue #16416: On Mac OS X, operating system data are now always - encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding - (which may be ASCII if no locale environment variable is set), to avoid - inconsistencies with os.fsencode() and os.fsdecode() functions which are - already using UTF-8/surrogateescape. +- bpo-16416: On Mac OS X, operating system data are now always + encoded/decoded to/from UTF-8/surrogateescape, instead of the locale + encoding (which may be ASCII if no locale environment variable is set), to + avoid inconsistencies with os.fsencode() and os.fsdecode() functions which + are already using UTF-8/surrogateescape. -- Issue #16453: Fix equality testing of dead weakref objects. +- bpo-16453: Fix equality testing of dead weakref objects. -- Issue #9535: Fix pending signals that have been received but not yet - handled by Python to not persist after os.fork() in the child process. +- bpo-9535: Fix pending signals that have been received but not yet handled + by Python to not persist after os.fork() in the child process. -- Issue #14794: Fix slice.indices to return correct results for huge values, +- bpo-14794: Fix slice.indices to return correct results for huge values, rather than raising OverflowError. -- Issue #15001: fix segfault on "del sys.modules['__main__']". Patch by Victor +- bpo-15001: fix segfault on "del sys.modules['__main__']". Patch by Victor Stinner. -- Issue #8271: the utf-8 decoder now outputs the correct number of U+FFFD +- bpo-8271: the utf-8 decoder now outputs the correct number of U+FFFD characters when used with the 'replace' error handler on invalid utf-8 sequences. Patch by Serhiy Storchaka, tests by Ezio Melotti. -- Issue #5765: Apply a hard recursion limit in the compiler instead of - blowing the stack and segfaulting. Initial patch by Andrea Griffini. +- bpo-5765: Apply a hard recursion limit in the compiler instead of blowing + the stack and segfaulting. Initial patch by Andrea Griffini. -- Issue #16402: When slicing a range, fix shadowing of exceptions from +- bpo-16402: When slicing a range, fix shadowing of exceptions from __index__. -- Issue #16336: fix input checking in the surrogatepass error handler. - Patch by Serhiy Storchaka. +- bpo-16336: fix input checking in the surrogatepass error handler. Patch by + Serhiy Storchaka. -- Issue #8401: assigning an int to a bytearray slice (e.g. b[3:4] = 5) now +- bpo-8401: assigning an int to a bytearray slice (e.g. b[3:4] = 5) now raises an error. -- Issue #7317: Display full tracebacks when an error occurs asynchronously. +- bpo-7317: Display full tracebacks when an error occurs asynchronously. Patch by Alon Horev with update by Alexey Kachayev. -- Issue #16309: Make PYTHONPATH="" behavior the same as if PYTHONPATH - not set at all. +- bpo-16309: Make PYTHONPATH="" behavior the same as if PYTHONPATH not set + at all. -- Issue #10189: Improve the error reporting of SyntaxErrors related to global +- bpo-10189: Improve the error reporting of SyntaxErrors related to global and nonlocal statements. - Fix segfaults on setting __qualname__ on builtin types and attempting to delete it on any type. -- Issue #14625: Rewrite the UTF-32 decoder. It is now 3x to 4x faster. Patch +- bpo-14625: Rewrite the UTF-32 decoder. It is now 3x to 4x faster. Patch written by Serhiy Storchaka. -- Issue #16345: Fix an infinite loop when ``fromkeys`` on a dict subclass +- bpo-16345: Fix an infinite loop when ``fromkeys`` on a dict subclass received a nonempty dict from the constructor. -- Issue #16271: Fix strange bugs that resulted from __qualname__ appearing in a +- bpo-16271: Fix strange bugs that resulted from __qualname__ appearing in a class's __dict__ and on type. -- Issue #12805: Make bytes.join and bytearray.join faster when the separator - is empty. Patch by Serhiy Storchaka. +- bpo-12805: Make bytes.join and bytearray.join faster when the separator is + empty. Patch by Serhiy Storchaka. -- Issue #6074: Ensure cached bytecode files can always be updated by the - user that created them, even when the source file is read-only. +- bpo-6074: Ensure cached bytecode files can always be updated by the user + that created them, even when the source file is read-only. -- Issue #15958: bytes.join and bytearray.join now accept arbitrary buffer +- bpo-15958: bytes.join and bytearray.join now accept arbitrary buffer objects. -- Issue #14783: Improve int() docstring and switch docstrings for str(), +- bpo-14783: Improve int() docstring and switch docstrings for str(), range(), and slice() to use multi-line signatures. -- Issue #16160: Subclass support now works for types.SimpleNamespace. +- bpo-16160: Subclass support now works for types.SimpleNamespace. -- Issue #16148: Implement PEP 424, adding operator.length_hint and +- bpo-16148: Implement PEP 424, adding operator.length_hint and PyObject_LengthHint. - Upgrade Unicode data (UCD) to version 6.2. -- Issue #15379: Fix passing of non-BMP characters as integers for the charmap +- bpo-15379: Fix passing of non-BMP characters as integers for the charmap decoder (already working as unicode strings). Patch by Serhiy Storchaka. -- Issue #15144: Fix possible integer overflow when handling pointers as integer +- bpo-15144: Fix possible integer overflow when handling pointers as integer values, by using `Py_uintptr_t` instead of `size_t`. Patch by Serhiy Storchaka. -- Issue #15965: Explicitly cast `AT_FDCWD` as (int). Required on Solaris 10 +- bpo-15965: Explicitly cast `AT_FDCWD` as (int). Required on Solaris 10 (which defines `AT_FDCWD` as ``0xffd19553``), harmless on other platforms. -- Issue #15839: Convert SystemErrors in `super()` to RuntimeErrors. +- bpo-15839: Convert SystemErrors in `super()` to RuntimeErrors. -- Issue #15448: Buffered IO now frees the buffer when closed, instead - of when deallocating. +- bpo-15448: Buffered IO now frees the buffer when closed, instead of when + deallocating. -- Issue #15846: Fix SystemError which happened when using `ast.parse()` in an +- bpo-15846: Fix SystemError which happened when using `ast.parse()` in an exception handler on code with syntax errors. -- Issue #15897: zipimport.c doesn't check return value of fseek(). - Patch by Felipe Cruz. +- bpo-15897: zipimport.c doesn't check return value of fseek(). Patch by + Felipe Cruz. -- Issue #15801: Make sure mappings passed to '%' formatting are actually +- bpo-15801: Make sure mappings passed to '%' formatting are actually subscriptable. -- Issue #15111: __import__ should propagate ImportError when raised as a - side-effect of a module triggered from using fromlist. +- bpo-15111: __import__ should propagate ImportError when raised as a side- + effect of a module triggered from using fromlist. -- Issue #15022: Add pickle and comparison support to types.SimpleNamespace. +- bpo-15022: Add pickle and comparison support to types.SimpleNamespace. Library ------- -- Issue #4331: Added functools.partialmethod (Initial patch by Alon Horev) +- bpo-4331: Added functools.partialmethod (Initial patch by Alon Horev) -- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit +- bpo-13461: Fix a crash in the TextIOWrapper.tell method on 64-bit platforms. Patch by Yogesh Chaudhari. -- Issue #18681: Fix a NameError in importlib.reload() (noticed by Weizhao Li). +- bpo-18681: Fix a NameError in importlib.reload() (noticed by Weizhao Li). -- Issue #14323: Expanded the number of digits in the coefficients for the - RGB -- YIQ conversions so that they match the FCC NTSC versions. +- bpo-14323: Expanded the number of digits in the coefficients for the RGB + -- YIQ conversions so that they match the FCC NTSC versions. -- Issue #17998: Fix an internal error in regular expression engine. +- bpo-17998: Fix an internal error in regular expression engine. -- Issue #17557: Fix os.getgroups() to work with the modified behavior of +- bpo-17557: Fix os.getgroups() to work with the modified behavior of getgroups(2) on OS X 10.8. Original patch by Mateusz Lenik. -- Issue #18608: Avoid keeping a strong reference to the locale module - inside the _io module. +- bpo-18608: Avoid keeping a strong reference to the locale module inside + the _io module. -- Issue #18619: Fix atexit leaking callbacks registered from sub-interpreters, +- bpo-18619: Fix atexit leaking callbacks registered from sub-interpreters, and make it GC-aware. -- Issue #15699: The readline module now uses PEP 3121-style module - initialization, so as to reclaim allocated resources (Python callbacks) - at shutdown. Original patch by Robin Schreiber. +- bpo-15699: The readline module now uses PEP 3121-style module + initialization, so as to reclaim allocated resources (Python callbacks) at + shutdown. Original patch by Robin Schreiber. -- Issue #17616: wave.open now supports the context management protocol. +- bpo-17616: wave.open now supports the context management protocol. -- Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns +- bpo-18599: Fix name attribute of _sha1.sha1() object. It now returns 'SHA1' instead of 'SHA'. -- Issue #13266: Added inspect.unwrap to easily unravel __wrapped__ chains +- bpo-13266: Added inspect.unwrap to easily unravel __wrapped__ chains (initial patch by Daniel Urban and Aaron Iles) -- Issue #18561: Skip name in ctypes' _build_callargs() if name is NULL. +- bpo-18561: Skip name in ctypes' _build_callargs() if name is NULL. -- Issue #18559: Fix NULL pointer dereference error in _pickle module +- bpo-18559: Fix NULL pointer dereference error in _pickle module -- Issue #18556: Check the return type of PyUnicode_AsWideChar() in ctype's +- bpo-18556: Check the return type of PyUnicode_AsWideChar() in ctype's U_set(). -- Issue #17818: aifc.getparams now returns a namedtuple. +- bpo-17818: aifc.getparams now returns a namedtuple. -- Issue #18549: Eliminate dead code in socket_ntohl() +- bpo-18549: Eliminate dead code in socket_ntohl() -- Issue #18530: Remove additional stat call from posixpath.ismount. - Patch by Alex Gaynor. +- bpo-18530: Remove additional stat call from posixpath.ismount. Patch by + Alex Gaynor. -- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj() +- bpo-18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj() -- Issue #9177: Calling read() or write() now raises ValueError, not +- bpo-9177: Calling read() or write() now raises ValueError, not AttributeError, on a closed SSL socket. Patch by Senko Rasic. -- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 + +- bpo-18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 + gcc. -- Issue #18479: Changed venv Activate.ps1 to make deactivate a function, and +- bpo-18479: Changed venv Activate.ps1 to make deactivate a function, and removed Deactivate.ps1. -- Issue #18480: Add missing call to PyType_Ready to the _elementtree extension. +- bpo-18480: Add missing call to PyType_Ready to the _elementtree extension. -- Issue #17778: Fix test discovery for test_multiprocessing. (Patch by - Zachary Ware.) +- bpo-17778: Fix test discovery for test_multiprocessing. (Patch by Zachary + Ware.) -- Issue #18393: The private module _gestalt and private functions - platform._mac_ver_gestalt, platform._mac_ver_lookup and - platform._bcd2str have been removed. This does not affect the public - interface of the platform module. +- bpo-18393: The private module _gestalt and private functions + platform._mac_ver_gestalt, platform._mac_ver_lookup and platform._bcd2str + have been removed. This does not affect the public interface of the + platform module. -- Issue #17482: functools.update_wrapper (and functools.wraps) now set the +- bpo-17482: functools.update_wrapper (and functools.wraps) now set the __wrapped__ attribute correctly even if the underlying function has a __wrapped__ attribute set. -- Issue #18431: The new email header parser now decodes RFC2047 encoded words +- bpo-18431: The new email header parser now decodes RFC2047 encoded words in structured headers. -- Issue #18432: The sched module's queue method was incorrectly returning - an iterator instead of a list. +- bpo-18432: The sched module's queue method was incorrectly returning an + iterator instead of a list. -- Issue #18044: The new email header parser was mis-parsing encoded words where +- bpo-18044: The new email header parser was mis-parsing encoded words where an encoded character immediately followed the '?' that follows the CTE - character, resulting in a decoding failure. They are now decoded correctly. + character, resulting in a decoding failure. They are now decoded + correctly. -- Issue #18101: Tcl.split() now process strings nested in a tuple as it - do with byte strings. +- bpo-18101: Tcl.split() now process strings nested in a tuple as it do with + byte strings. -- Issue #18116: getpass was always getting an error when testing /dev/tty, - and thus was always falling back to stdin, and would then raise an exception - if stdin could not be used (such as /dev/null). It also leaked an open file. - All of these issues are now fixed. +- bpo-18116: getpass was always getting an error when testing /dev/tty, and + thus was always falling back to stdin, and would then raise an exception + if stdin could not be used (such as /dev/null). It also leaked an open + file. All of these issues are now fixed. -- Issue #17198: Fix a NameError in the dbm module. Patch by Valentina +- bpo-17198: Fix a NameError in the dbm module. Patch by Valentina Mukhamedzhanova. -- Issue #18013: Fix cgi.FieldStorage to parse the W3C sample form. +- bpo-18013: Fix cgi.FieldStorage to parse the W3C sample form. -- Issue #18020: improve html.escape speed by an order of magnitude. - Patch by Matt Bryant. +- bpo-18020: improve html.escape speed by an order of magnitude. Patch by + Matt Bryant. -- Issue #18347: ElementTree's html serializer now preserves the case of - closing tags. +- bpo-18347: ElementTree's html serializer now preserves the case of closing + tags. -- Issue #17261: Ensure multiprocessing's proxies use proper address. +- bpo-17261: Ensure multiprocessing's proxies use proper address. -- Issue #18343: faulthandler.register() now keeps the previous signal handler +- bpo-18343: faulthandler.register() now keeps the previous signal handler when the function is called twice, so faulthandler.unregister() restores correctly the original signal handler. -- Issue #17097: Make multiprocessing ignore EINTR. +- bpo-17097: Make multiprocessing ignore EINTR. -- Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a +- bpo-18339: Negative ints keys in unpickler.memo dict no longer cause a segfault inside the _pickle C extension. -- Issue #18240: The HMAC module is no longer restricted to bytes and accepts +- bpo-18240: The HMAC module is no longer restricted to bytes and accepts any bytes-like object, e.g. memoryview. Original patch by Jonas Borgström. -- Issue #18224: Removed pydoc script from created venv, as it causes problems +- bpo-18224: Removed pydoc script from created venv, as it causes problems on Windows and adds no value over and above python -m pydoc ... -- Issue #18155: The csv module now correctly handles csv files that use - a delimiter character that has a special meaning in regexes, instead of +- bpo-18155: The csv module now correctly handles csv files that use a + delimiter character that has a special meaning in regexes, instead of throwing an exception. -- Issue #14360: encode_quopri can now be successfully used as an encoder - when constructing a MIMEApplication object. +- bpo-14360: encode_quopri can now be successfully used as an encoder when + constructing a MIMEApplication object. -- Issue #11390: Add -o and -f command line options to the doctest CLI to +- bpo-11390: Add -o and -f command line options to the doctest CLI to specify doctest options (and convert it to using argparse). -- Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if the input +- bpo-18135: ssl.SSLSocket.write() now raises an OverflowError if the input string in longer than 2 gigabytes, and ssl.SSLContext.load_cert_chain() raises a ValueError if the password is longer than 2 gigabytes. The ssl module does not support partial write. -- Issue #11016: Add C implementation of the stat module as _stat. +- bpo-11016: Add C implementation of the stat module as _stat. -- Issue #18248: Fix libffi build on AIX. +- bpo-18248: Fix libffi build on AIX. -- Issue #18259: Declare sethostname in socketmodule.c for AIX +- bpo-18259: Declare sethostname in socketmodule.c for AIX -- Issue #18147: Add diagnostic functions to ssl.SSLContext(). get_ca_list() +- bpo-18147: Add diagnostic functions to ssl.SSLContext(). get_ca_list() lists all loaded CA certificates and cert_store_stats() returns amount of loaded X.509 certs, X.509 CA certs and CRLs. -- Issue #18167: cgi.FieldStorage no longer fails to handle multipart/form-data +- bpo-18167: cgi.FieldStorage no longer fails to handle multipart/form-data when ``\r\n`` appears at end of 65535 bytes without other newlines. -- Issue #18076: Introduce importlib.util.decode_source(). +- bpo-18076: Introduce importlib.util.decode_source(). -- Issue #18357: add tests for dictview set difference. - Patch by Fraser Tweedale. +- bpo-18357: add tests for dictview set difference. Patch by Fraser + Tweedale. - importlib.abc.SourceLoader.get_source() no longer changes SyntaxError or UnicodeDecodeError into ImportError. -- Issue #18058, 18057: Make the namespace package loader meet the - importlib.abc.InspectLoader ABC, allowing for namespace packages to work with - runpy. +- bpo-18058: Make the namespace package loader meet the + importlib.abc.InspectLoader ABC, allowing for namespace packages to work + with runpy. (See also: bpo-18057) -- Issue #17177: The imp module is pending deprecation. +- bpo-17177: The imp module is pending deprecation. - subprocess: Prevent a possible double close of parent pipe fds when the subprocess exec runs into an error. Prevent a regular multi-close of the /dev/null fd when any of stdin, stdout and stderr was set to DEVNULL. -- Issue #18194: Introduce importlib.util.cache_from_source() and +- bpo-18194: Introduce importlib.util.cache_from_source() and source_from_cache() while documenting the equivalent functions in imp as deprecated. -- Issue #17907: Document imp.new_module() as deprecated in favour of +- bpo-17907: Document imp.new_module() as deprecated in favour of types.ModuleType. -- Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document as deprecated - imp.get_magic(). +- bpo-18192: Introduce importlib.util.MAGIC_NUMBER and document as + deprecated imp.get_magic(). -- Issue #18149: Add filecmp.clear_cache() to manually clear the filecmp cache. +- bpo-18149: Add filecmp.clear_cache() to manually clear the filecmp cache. Patch by Mark Levitt -- Issue #18193: Add importlib.reload(). +- bpo-18193: Add importlib.reload(). -- Issue #18157: Stop using imp.load_module() in pydoc. +- bpo-18157: Stop using imp.load_module() in pydoc. -- Issue #16102: Make uuid._netbios_getnode() work again on Python 3. +- bpo-16102: Make uuid._netbios_getnode() work again on Python 3. -- Issue #17134: Add ssl.enum_cert_store() as interface to Windows' cert store. +- bpo-17134: Add ssl.enum_cert_store() as interface to Windows' cert store. -- Issue #18143: Implement ssl.get_default_verify_paths() in order to debug - the default locations for cafile and capath. +- bpo-18143: Implement ssl.get_default_verify_paths() in order to debug the + default locations for cafile and capath. -- Issue #17314: Move multiprocessing.forking over to importlib. +- bpo-17314: Move multiprocessing.forking over to importlib. -- Issue #11959: SMTPServer and SMTPChannel now take an optional map, use of +- bpo-11959: SMTPServer and SMTPChannel now take an optional map, use of which avoids affecting global state. -- Issue #18109: os.uname() now decodes fields from the locale encoding, and +- bpo-18109: os.uname() now decodes fields from the locale encoding, and socket.gethostname() now decodes the hostname from the locale encoding, instead of using the UTF-8 encoding in strict mode. -- Issue #18089: Implement importlib.abc.InspectLoader.load_module. +- bpo-18089: Implement importlib.abc.InspectLoader.load_module. -- Issue #18088: Introduce importlib.abc.Loader.init_module_attrs for setting +- bpo-18088: Introduce importlib.abc.Loader.init_module_attrs for setting module attributes. Leads to the pending deprecation of importlib.util.module_for_loader. -- Issue #17403: urllib.parse.robotparser normalizes the urls before adding to - ruleline. This helps in handling certain types invalid urls in a conservative - manner. Patch contributed by Mher Movsisyan. +- bpo-17403: urllib.parse.robotparser normalizes the urls before adding to + ruleline. This helps in handling certain types invalid urls in a + conservative manner. Patch contributed by Mher Movsisyan. -- Issue #18070: Have importlib.util.module_for_loader() set attributes +- bpo-18070: Have importlib.util.module_for_loader() set attributes unconditionally in order to properly support reloading. -- Added importlib.util.module_to_load to return a context manager to provide the - proper module object to load. +- Added importlib.util.module_to_load to return a context manager to provide + the proper module object to load. -- Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw +- bpo-18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw stream's read() returns more bytes than requested. -- Issue #18011: As was originally intended, base64.b32decode() now raises a - binascii.Error if there are non-b32-alphabet characters present in the input - string, instead of a TypeError. +- bpo-18011: As was originally intended, base64.b32decode() now raises a + binascii.Error if there are non-b32-alphabet characters present in the + input string, instead of a TypeError. -- Issue #18072: Implement importlib.abc.InspectLoader.get_code() and +- bpo-18072: Implement importlib.abc.InspectLoader.get_code() and importlib.abc.ExecutionLoader.get_code(). -- Issue #8240: Set the SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag on SSL - sockets. +- bpo-8240: Set the SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag on SSL sockets. -- Issue #17269: Workaround for socket.getaddrinfo crash on MacOS X - with port None or "0" and flags AI_NUMERICSERV. +- bpo-17269: Workaround for socket.getaddrinfo crash on MacOS X with port + None or "0" and flags AI_NUMERICSERV. -- Issue #16986: ElementTree now correctly works with string input when the +- bpo-16986: ElementTree now correctly works with string input when the internal XML encoding is not UTF-8 or US-ASCII. -- Issue #17996: socket module now exposes AF_LINK constant on BSD and OSX. +- bpo-17996: socket module now exposes AF_LINK constant on BSD and OSX. -- Issue #17900: Allowed pickling of recursive OrderedDicts. Decreased pickled +- bpo-17900: Allowed pickling of recursive OrderedDicts. Decreased pickled size and pickling time. -- Issue #17914: Add os.cpu_count(). Patch by Yogesh Chaudhari, based on an +- bpo-17914: Add os.cpu_count(). Patch by Yogesh Chaudhari, based on an initial patch by Trent Nelson. -- Issue #17812: Fixed quadratic complexity of base64.b32encode(). - Optimize base64.b32encode() and base64.b32decode() (speed up to 3x). +- bpo-17812: Fixed quadratic complexity of base64.b32encode(). Optimize + base64.b32encode() and base64.b32decode() (speed up to 3x). -- Issue #17980: Fix possible abuse of ssl.match_hostname() for denial of +- bpo-17980: Fix possible abuse of ssl.match_hostname() for denial of service using certificates with many wildcards (CVE-2013-2099). -- Issue #15758: Fix FileIO.readall() so it no longer has O(n**2) complexity. +- bpo-15758: Fix FileIO.readall() so it no longer has O(n**2) complexity. -- Issue #14596: The struct.Struct() objects now use a more compact +- bpo-14596: The struct.Struct() objects now use a more compact implementation. -- Issue #17981: logging's SysLogHandler now closes the socket when it catches +- bpo-17981: logging's SysLogHandler now closes the socket when it catches socket OSErrors. -- Issue #17964: Fix os.sysconf(): the return type of the C sysconf() function +- bpo-17964: Fix os.sysconf(): the return type of the C sysconf() function is long, not int. - Fix typos in the multiprocessing module. -- Issue #17754: Make ctypes.util.find_library() independent of the locale. +- bpo-17754: Make ctypes.util.find_library() independent of the locale. -- Issue #17968: Fix memory leak in os.listxattr(). +- bpo-17968: Fix memory leak in os.listxattr(). -- Issue #17606: Fixed support of encoded byte strings in the XMLGenerator - characters() and ignorableWhitespace() methods. Original patch by Sebastian - Ortiz Vasquez. +- bpo-17606: Fixed support of encoded byte strings in the XMLGenerator + characters() and ignorableWhitespace() methods. Original patch by + Sebastian Ortiz Vasquez. -- Issue #17732: Ignore distutils.cfg options pertaining to install paths if a +- bpo-17732: Ignore distutils.cfg options pertaining to install paths if a virtual environment is active. -- Issue #17915: Fix interoperability of xml.sax with file objects returned by +- bpo-17915: Fix interoperability of xml.sax with file objects returned by codecs.open(). -- Issue #16601: Restarting iteration over tarfile really restarts rather - than continuing from where it left off. Patch by Michael Birtwell. +- bpo-16601: Restarting iteration over tarfile really restarts rather than + continuing from where it left off. Patch by Michael Birtwell. -- Issue #17289: The readline module now plays nicer with external modules - or applications changing the rl_completer_word_break_characters global +- bpo-17289: The readline module now plays nicer with external modules or + applications changing the rl_completer_word_break_characters global variable. Initial patch by Bradley Froehle. -- Issue #12181: select module: Fix struct kevent definition on OpenBSD 64-bit +- bpo-12181: select module: Fix struct kevent definition on OpenBSD 64-bit platforms. Patch by Federico Schwindt. -- Issue #11816: multiple improvements to the dis module: get_instructions +- bpo-11816: multiple improvements to the dis module: get_instructions generator, ability to redirect output to a file, Bytecode and Instruction abstractions. Patch by Nick Coghlan, Ryan Kelly and Thomas Kluyver. -- Issue #13831: Embed stringification of remote traceback in local - traceback raised when pool task raises an exception. +- bpo-13831: Embed stringification of remote traceback in local traceback + raised when pool task raises an exception. -- Issue #15528: Add weakref.finalize to support finalization using - weakref callbacks. +- bpo-15528: Add weakref.finalize to support finalization using weakref + callbacks. -- Issue #14173: Avoid crashing when reading a signal handler during - interpreter shutdown. +- bpo-14173: Avoid crashing when reading a signal handler during interpreter + shutdown. -- Issue #15902: Fix imp.load_module() accepting None as a file when loading an +- bpo-15902: Fix imp.load_module() accepting None as a file when loading an extension module. -- Issue #13721: SSLSocket.getpeercert() and SSLSocket.do_handshake() now - raise an OSError with ENOTCONN, instead of an AttributeError, when the - SSLSocket is not connected. +- bpo-13721: SSLSocket.getpeercert() and SSLSocket.do_handshake() now raise + an OSError with ENOTCONN, instead of an AttributeError, when the SSLSocket + is not connected. -- Issue #14679: add an __all__ (that contains only HTMLParser) to html.parser. +- bpo-14679: add an __all__ (that contains only HTMLParser) to html.parser. -- Issue #17802: Fix an UnboundLocalError in html.parser. Initial tests by +- bpo-17802: Fix an UnboundLocalError in html.parser. Initial tests by Thomas Barlow. -- Issue #17358: Modules loaded by imp.load_source() and load_compiled() (and by - extension load_module()) now have a better chance of working when reloaded. +- bpo-17358: Modules loaded by imp.load_source() and load_compiled() (and by + extension load_module()) now have a better chance of working when + reloaded. -- Issue #17804: New function ``struct.iter_unpack`` allows for streaming - struct unpacking. +- bpo-17804: New function ``struct.iter_unpack`` allows for streaming struct + unpacking. -- Issue #17830: When keyword.py is used to update a keyword file, it now +- bpo-17830: When keyword.py is used to update a keyword file, it now preserves the line endings of the original file. -- Issue #17272: Making the urllib.request's Request.full_url a descriptor. +- bpo-17272: Making the urllib.request's Request.full_url a descriptor. Fixes bugs with assignment to full_url. Patch by Demian Brecht. -- Issue #17353: Plistlib emitted empty data tags with deeply nested datastructures +- bpo-17353: Plistlib emitted empty data tags with deeply nested + datastructures -- Issue #11714: Use 'with' statements to assure a Semaphore releases a - condition variable. Original patch by Thomas Rachel. +- bpo-11714: Use 'with' statements to assure a Semaphore releases a + condition variable. Original patch by Thomas Rachel. -- Issue #16624: `subprocess.check_output` now accepts an `input` argument, - allowing the subprocess's stdin to be provided as a (byte) string. - Patch by Zack Weinberg. +- bpo-16624: `subprocess.check_output` now accepts an `input` argument, + allowing the subprocess's stdin to be provided as a (byte) string. Patch + by Zack Weinberg. -- Issue #17795: Reverted backwards-incompatible change in SysLogHandler with +- bpo-17795: Reverted backwards-incompatible change in SysLogHandler with Unix domain sockets. -- Issue #16694: Add a pure Python implementation of the operator module. - Patch by Zachary Ware. +- bpo-16694: Add a pure Python implementation of the operator module. Patch + by Zachary Ware. -- Issue #11182: remove the unused and undocumented pydoc.Scanner class. - Patch by Martin Morrison. +- bpo-11182: remove the unused and undocumented pydoc.Scanner class. Patch + by Martin Morrison. -- Issue #17741: Add ElementTree.XMLPullParser, an event-driven parser for - non-blocking applications. +- bpo-17741: Add ElementTree.XMLPullParser, an event-driven parser for non- + blocking applications. -- Issue #17555: Fix ForkAwareThreadLock so that size of after fork - registry does not grow exponentially with generation of process. +- bpo-17555: Fix ForkAwareThreadLock so that size of after fork registry + does not grow exponentially with generation of process. -- Issue #17707: fix regression in multiprocessing.Queue's get() method where - it did not block for short timeouts. +- bpo-17707: fix regression in multiprocessing.Queue's get() method where it + did not block for short timeouts. -- Issue #17720: Fix the Python implementation of pickle.Unpickler to correctly +- bpo-17720: Fix the Python implementation of pickle.Unpickler to correctly process the APPENDS opcode when it is used on non-list objects. -- Issue #17012: shutil.which() no longer falls back to the PATH environment - variable if an empty path argument is specified. Patch by Serhiy Storchaka. +- bpo-17012: shutil.which() no longer falls back to the PATH environment + variable if an empty path argument is specified. Patch by Serhiy + Storchaka. -- Issue #17710: Fix pickle raising a SystemError on bogus input. +- bpo-17710: Fix pickle raising a SystemError on bogus input. -- Issue #17341: Include the invalid name in the error messages from re about +- bpo-17341: Include the invalid name in the error messages from re about invalid group names. -- Issue #17702: os.environ now raises KeyError with the original environment +- bpo-17702: os.environ now raises KeyError with the original environment variable name (str on UNIX), instead of using the encoded name (bytes on UNIX). -- Issue #16163: Make the importlib based version of pkgutil.iter_importers - work for submodules. Initial patch by Berker Peksag. +- bpo-16163: Make the importlib based version of pkgutil.iter_importers work + for submodules. Initial patch by Berker Peksag. -- Issue #16804: Fix a bug in the 'site' module that caused running - 'python -S -m site' to incorrectly throw an exception. +- bpo-16804: Fix a bug in the 'site' module that caused running 'python -S + -m site' to incorrectly throw an exception. -- Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal. +- bpo-15480: Remove the deprecated and unused TYPE_INT64 code from marshal. Initial patch by Daniel Riti. -- Issue #2118: SMTPException is now a subclass of OSError. +- bpo-2118: SMTPException is now a subclass of OSError. -- Issue #17016: Get rid of possible pointer wraparounds and integer overflows +- bpo-17016: Get rid of possible pointer wraparounds and integer overflows in the re module. Patch by Nickolai Zeldovich. -- Issue #16658: add missing return to HTTPConnection.send(). - Patch by Jeff Knupp. +- bpo-16658: add missing return to HTTPConnection.send(). Patch by Jeff + Knupp. -- Issue #9556: the logging package now allows specifying a time-of-day for a +- bpo-9556: the logging package now allows specifying a time-of-day for a TimedRotatingFileHandler to rotate. -- Issue #14971: unittest test discovery no longer gets confused when a function +- bpo-14971: unittest test discovery no longer gets confused when a function has a different __name__ than its name in the TestCase class dictionary. -- Issue #17487: The wave getparams method now returns a namedtuple rather than +- bpo-17487: The wave getparams method now returns a namedtuple rather than a plain tuple. -- Issue #17675: socket repr() provides local and remote addresses (if any). +- bpo-17675: socket repr() provides local and remote addresses (if any). Patch by Giampaolo Rodola' -- Issue #17093: Make the ABCs in importlib.abc provide default values or raise - reasonable exceptions for their methods to make them more amenable to super() - calls. +- bpo-17093: Make the ABCs in importlib.abc provide default values or raise + reasonable exceptions for their methods to make them more amenable to + super() calls. -- Issue #17566: Make importlib.abc.Loader.module_repr() optional instead of an - abstractmethod; now it raises NotImplementedError so as to be ignored by default. +- bpo-17566: Make importlib.abc.Loader.module_repr() optional instead of an + abstractmethod; now it raises NotImplementedError so as to be ignored by + default. -- Issue #17678: Remove the use of deprecated method in http/cookiejar.py by +- bpo-17678: Remove the use of deprecated method in http/cookiejar.py by changing the call to get_origin_req_host() to origin_req_host. -- Issue #17666: Fix reading gzip files with an extra field. +- bpo-17666: Fix reading gzip files with an extra field. -- Issue #16475: Support object instancing, recursion and interned strings - in marshal +- bpo-16475: Support object instancing, recursion and interned strings in + marshal -- Issue #17502: Process DEFAULT values in mock side_effect that returns iterator. +- bpo-17502: Process DEFAULT values in mock side_effect that returns + iterator. -- Issue #16795: On the ast.arguments object, unify vararg with varargannotation - and kwarg and kwargannotation. Change the column offset of ast.Attribute to be - at the attribute name. +- bpo-16795: On the ast.arguments object, unify vararg with varargannotation + and kwarg and kwargannotation. Change the column offset of ast.Attribute + to be at the attribute name. -- Issue #17434: Properly raise a SyntaxError when a string occurs between future - imports. +- bpo-17434: Properly raise a SyntaxError when a string occurs between + future imports. -- Issue #17117: Import and @importlib.util.set_loader now set __loader__ when +- bpo-17117: Import and @importlib.util.set_loader now set __loader__ when it has a value of None or the attribute doesn't exist. -- Issue #17032: The "global" in the "NameError: global name 'x' is not defined" +- bpo-17032: The "global" in the "NameError: global name 'x' is not defined" error message has been removed. Patch by Ram Rachum. -- Issue #18080: When building a C extension module on OS X, if the compiler - is overridden with the CC environment variable, use the new compiler as - the default for linking if LDSHARED is not also overridden. This restores +- bpo-18080: When building a C extension module on OS X, if the compiler is + overridden with the CC environment variable, use the new compiler as the + default for linking if LDSHARED is not also overridden. This restores Distutils behavior introduced in 3.2.3 and inadvertently dropped in 3.3.0. -- Issue #18113: Fixed a refcount leak in the curses.panel module's - set_userptr() method. Reported by Atsuo Ishimoto. +- bpo-18113: Fixed a refcount leak in the curses.panel module's + set_userptr() method. Reported by Atsuo Ishimoto. - Implement PEP 443 "Single-dispatch generic functions". - Implement PEP 435 "Adding an Enum type to the Python standard library". -- Issue #15596: Faster pickling of unicode strings. +- bpo-15596: Faster pickling of unicode strings. -- Issue #17572: Avoid chained exceptions when passing bad directives to - time.strptime(). Initial patch by Claudiu Popa. +- bpo-17572: Avoid chained exceptions when passing bad directives to + time.strptime(). Initial patch by Claudiu Popa. -- Issue #17435: threading.Timer's __init__ method no longer uses mutable +- bpo-17435: threading.Timer's __init__ method no longer uses mutable default values for the args and kwargs parameters. -- Issue #17526: fix an IndexError raised while passing code without filename to +- bpo-17526: fix an IndexError raised while passing code without filename to inspect.findsource(). Initial patch by Tyler Doyle. -- Issue #17540: Added style parameter to logging formatter configuration by dict. +- bpo-17540: Added style parameter to logging formatter configuration by + dict. -- Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial - patch by Michele Orrù. +- bpo-16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial patch + by Michele Orrù. -- Issue #17025: multiprocessing: Reduce Queue and SimpleQueue contention. +- bpo-17025: multiprocessing: Reduce Queue and SimpleQueue contention. -- Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, +- bpo-17536: Add to webbrowser's browser list: www-browser, x-www-browser, iceweasel, iceape. -- Issue #17150: pprint now uses line continuations to wrap long string +- bpo-17150: pprint now uses line continuations to wrap long string literals. -- Issue #17488: Change the subprocess.Popen bufsize parameter default value +- bpo-17488: Change the subprocess.Popen bufsize parameter default value from unbuffered (0) to buffering (-1) to match the behavior existing code - expects and match the behavior of the subprocess module in Python 2 to avoid - introducing hard to track down bugs. + expects and match the behavior of the subprocess module in Python 2 to + avoid introducing hard to track down bugs. -- Issue #17521: Corrected non-enabling of logger following two calls to +- bpo-17521: Corrected non-enabling of logger following two calls to fileConfig(). -- Issue #17508: Corrected logging MemoryHandler configuration in dictConfig() +- bpo-17508: Corrected logging MemoryHandler configuration in dictConfig() where the target handler wasn't configured first. -- Issue #17209: curses.window.get_wch() now correctly handles KeyboardInterrupt +- bpo-17209: curses.window.get_wch() now correctly handles KeyboardInterrupt (CTRL+c). -- Issue #5713: smtplib now handles 421 (closing connection) error codes when - sending mail by closing the socket and reporting the 421 error code via the - exception appropriate to the command that received the error response. +- bpo-5713: smtplib now handles 421 (closing connection) error codes when + sending mail by closing the socket and reporting the 421 error code via + the exception appropriate to the command that received the error response. -- Issue #16997: unittest.TestCase now provides a subTest() context manager - to procedurally generate, in an easy way, small test instances. +- bpo-16997: unittest.TestCase now provides a subTest() context manager to + procedurally generate, in an easy way, small test instances. -- Issue #17485: Also delete the Request Content-Length header if the data +- bpo-17485: Also delete the Request Content-Length header if the data attribute is deleted. (Follow on to issue Issue #16464). -- Issue #15927: CVS now correctly parses escaped newlines and carriage - when parsing with quoting turned off. +- bpo-15927: CVS now correctly parses escaped newlines and carriage when + parsing with quoting turned off. -- Issue #17467: add readline and readlines support to mock_open in +- bpo-17467: add readline and readlines support to mock_open in unittest.mock. -- Issue #13248: removed deprecated and undocumented difflib.isbjunk, +- bpo-13248: removed deprecated and undocumented difflib.isbjunk, isbpopular. -- Issue #17192: Update the ctypes module's libffi to v3.0.13. This +- bpo-17192: Update the ctypes module's libffi to v3.0.13. This specifically addresses a stack misalignment issue on x86 and issues on some more recent platforms. -- Issue #8862: Fixed curses cleanup when getkey is interrupted by a signal. +- bpo-8862: Fixed curses cleanup when getkey is interrupted by a signal. -- Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO - in subprocess, but the imap code assumes buffered IO. In Python2 this - worked by accident. IMAP4_stream now explicitly uses buffered IO. +- bpo-17443: imaplib.IMAP4_stream was using the default unbuffered IO in + subprocess, but the imap code assumes buffered IO. In Python2 this worked + by accident. IMAP4_stream now explicitly uses buffered IO. -- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc +- bpo-17476: Fixed regression relative to Python2 in undocumented pydoc 'allmethods'; it was missing unbound methods on the class. -- Issue #17474: Remove the deprecated methods of Request class. +- bpo-17474: Remove the deprecated methods of Request class. -- Issue #16709: unittest discover order is no-longer filesystem specific. Patch +- bpo-16709: unittest discover order is no-longer filesystem specific. Patch by Jeff Ramnani. -- Use the HTTPS PyPI url for upload, overriding any plain HTTP URL in pypirc. +- Use the HTTPS PyPI url for upload, overriding any plain HTTP URL in + pypirc. -- Issue #5024: sndhdr.whichhdr now returns the frame count for WAV files - rather than -1. +- bpo-5024: sndhdr.whichhdr now returns the frame count for WAV files rather + than -1. -- Issue #17460: Remove the strict argument of HTTPConnection and removing the +- bpo-17460: Remove the strict argument of HTTPConnection and removing the DeprecationWarning being issued from 3.2 onwards. -- Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. +- bpo-16880: Do not assume _imp.load_dynamic() is defined in the imp module. -- Issue #16389: Fixed a performance regression relative to Python 3.1 in the +- bpo-16389: Fixed a performance regression relative to Python 3.1 in the caching of compiled regular expressions. - Added missing FeedParser and BytesFeedParser to email.parser.__all__. -- Issue #17431: Fix missing import of BytesFeedParser in email.parser. +- bpo-17431: Fix missing import of BytesFeedParser in email.parser. -- Issue #12921: http.server's send_error takes an explain argument to send more +- bpo-12921: http.server's send_error takes an explain argument to send more information in response. Patch contributed by Karl. -- Issue #17414: Add timeit, repeat, and default_timer to timeit.__all__. +- bpo-17414: Add timeit, repeat, and default_timer to timeit.__all__. -- Issue #1285086: Get rid of the refcounting hack and speed up +- bpo-1285086: Get rid of the refcounting hack and speed up urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). -- Issue #17099: Have importlib.find_loader() raise ValueError when __loader__ - is not set, harmonizing with what happens when the attribute is set to None. +- bpo-17099: Have importlib.find_loader() raise ValueError when __loader__ + is not set, harmonizing with what happens when the attribute is set to + None. - Expose the O_PATH constant in the os module if it is available. -- Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused +- bpo-17368: Fix an off-by-one error in the Python JSON decoder that caused a failure while decoding empty object literals when object_pairs_hook was specified. -- Issue #17385: Fix quadratic behavior in threading.Condition. The FIFO - queue now uses a deque instead of a list. +- bpo-17385: Fix quadratic behavior in threading.Condition. The FIFO queue + now uses a deque instead of a list. -- Issue #15806: Add contextlib.ignore(). This creates a context manager to - ignore specified exceptions, replacing the "except SomeException: pass" idiom. +- bpo-15806: Add contextlib.ignore(). This creates a context manager to + ignore specified exceptions, replacing the "except SomeException: pass" + idiom. -- Issue #14645: The email generator classes now produce output using the - specified linesep throughout. Previously if the prolog, epilog, or - body were stored with a different linesep, that linesep was used. This - fix corrects an RFC non-compliance issue with smtplib.send_message. +- bpo-14645: The email generator classes now produce output using the + specified linesep throughout. Previously if the prolog, epilog, or body + were stored with a different linesep, that linesep was used. This fix + corrects an RFC non- compliance issue with smtplib.send_message. -- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when - the list is being resized concurrently. +- bpo-17278: Fix a crash in heapq.heappush() and heapq.heappop() when the + list is being resized concurrently. -- Issue #16962: Use getdents64 instead of the obsolete getdents syscall - in the subprocess module on Linux. +- bpo-16962: Use getdents64 instead of the obsolete getdents syscall in the + subprocess module on Linux. -- Issue #16935: unittest now counts the module as skipped if it raises SkipTest, - instead of counting it as an error. Patch by Zachary Ware. +- bpo-16935: unittest now counts the module as skipped if it raises + SkipTest, instead of counting it as an error. Patch by Zachary Ware. -- Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. +- bpo-17018: Make Process.join() retry if os.waitpid() fails with EINTR. -- Issue #17223: array module: Fix a crasher when converting an array containing +- bpo-17223: array module: Fix a crasher when converting an array containing invalid characters (outside range [U+0000; U+10ffff]) to Unicode: - repr(array), str(array) and array.tounicode(). Patch written by Manuel Jacob. + repr(array), str(array) and array.tounicode(). Patch written by Manuel + Jacob. -- Issue #17197: profile/cProfile modules refactored so that code of run() and +- bpo-17197: profile/cProfile modules refactored so that code of run() and runctx() utility functions is not duplicated in both modules. -- Issue #14720: sqlite3: Convert datetime microseconds correctly. - Patch by Lowe Thiderman. +- bpo-14720: sqlite3: Convert datetime microseconds correctly. Patch by Lowe + Thiderman. -- Issue #15132: Allow a list for the defaultTest argument of +- bpo-15132: Allow a list for the defaultTest argument of unittest.TestProgram. Patch by Jyrki Pulliainen. -- Issue #17225: JSON decoder now counts columns in the first line starting - with 1, as in other lines. +- bpo-17225: JSON decoder now counts columns in the first line starting with + 1, as in other lines. -- Issue #6623: Added explicit DeprecationWarning for ftplib.netrc, which has +- bpo-6623: Added explicit DeprecationWarning for ftplib.netrc, which has been deprecated and undocumented for a long time. -- Issue #13700: Fix byte/string handling in imaplib authentication when an +- bpo-13700: Fix byte/string handling in imaplib authentication when an authobject is specified. -- Issue #13153: Tkinter functions now raise TclError instead of ValueError when +- bpo-13153: Tkinter functions now raise TclError instead of ValueError when a string argument contains non-BMP character. -- Issue #9669: Protect re against infinite loops on zero-width matching in - non-greedy repeat. Patch by Matthew Barnett. +- bpo-9669: Protect re against infinite loops on zero-width matching in non- + greedy repeat. Patch by Matthew Barnett. -- Issue #13169: The maximal repetition number in a regular expression has been +- bpo-13169: The maximal repetition number in a regular expression has been increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on 64-bit). -- Issue #17143: Fix a missing import in the trace module. Initial patch by +- bpo-17143: Fix a missing import in the trace module. Initial patch by Berker Peksag. -- Issue #15220: email.feedparser's line splitting algorithm is now simpler and +- bpo-15220: email.feedparser's line splitting algorithm is now simpler and faster. -- Issue #16743: Fix mmap overflow check on 32 bit Windows. +- bpo-16743: Fix mmap overflow check on 32 bit Windows. -- Issue #16996: webbrowser module now uses shutil.which() to find a - web-browser on the executable search path. +- bpo-16996: webbrowser module now uses shutil.which() to find a web-browser + on the executable search path. -- Issue #16800: tempfile.gettempdir() no longer left temporary files when - the disk is full. Original patch by Amir Szekely. +- bpo-16800: tempfile.gettempdir() no longer left temporary files when the + disk is full. Original patch by Amir Szekely. -- Issue #17192: Import libffi-3.0.12. +- bpo-17192: Import libffi-3.0.12. -- Issue #16564: Fixed regression relative to Python2 in the operation of +- bpo-16564: Fixed regression relative to Python2 in the operation of email.encoders.encode_7or8bit when used with binary data. -- Issue #17052: unittest discovery should use self.testLoader. +- bpo-17052: unittest discovery should use self.testLoader. -- Issue #4591: Uid and gid values larger than 2**31 are supported now. +- bpo-4591: Uid and gid values larger than 2**31 are supported now. -- Issue #17141: random.vonmisesvariate() no longer hangs for large kappas. +- bpo-17141: random.vonmisesvariate() no longer hangs for large kappas. -- Issue #17149: Fix random.vonmisesvariate to always return results in - [0, 2*math.pi]. +- bpo-17149: Fix random.vonmisesvariate to always return results in [0, + 2*math.pi]. -- Issue #1470548: XMLGenerator now works with binary output streams. +- bpo-1470548: XMLGenerator now works with binary output streams. -- Issue #6975: os.path.realpath() now correctly resolves multiple nested +- bpo-6975: os.path.realpath() now correctly resolves multiple nested symlinks on POSIX platforms. -- Issue #13773: sqlite3.connect() gets a new `uri` parameter to pass the +- bpo-13773: sqlite3.connect() gets a new `uri` parameter to pass the filename as a URI, allowing custom options to be passed. -- Issue #16564: Fixed regression relative to Python2 in the operation of +- bpo-16564: Fixed regression relative to Python2 in the operation of email.encoders.encode_noop when used with binary data. -- Issue #10355: The mode, name, encoding and newlines properties now work on +- bpo-10355: The mode, name, encoding and newlines properties now work on SpooledTemporaryFile objects even when they have not yet rolled over. Obsolete method xreadline (which has never worked in Python 3) has been removed. -- Issue #16686: Fixed a lot of bugs in audioop module. Fixed crashes in - avgpp(), maxpp() and ratecv(). Fixed an integer overflow in add(), bias(), - and ratecv(). reverse(), lin2lin() and ratecv() no more lose precision for - 32-bit samples. max() and rms() no more returns a negative result and - various other functions now work correctly with 32-bit sample -0x80000000. +- bpo-16686: Fixed a lot of bugs in audioop module. Fixed crashes in + avgpp(), maxpp() and ratecv(). Fixed an integer overflow in add(), + bias(), and ratecv(). reverse(), lin2lin() and ratecv() no more lose + precision for 32-bit samples. max() and rms() no more returns a negative + result and various other functions now work correctly with 32-bit sample + -0x80000000. -- Issue #17073: Fix some integer overflows in sqlite3 module. +- bpo-17073: Fix some integer overflows in sqlite3 module. -- Issue #16723: httplib.HTTPResponse no longer marked closed when the connection - is automatically closed. +- bpo-16723: httplib.HTTPResponse no longer marked closed when the + connection is automatically closed. -- Issue #15359: Add CAN_BCM protocol support to the socket module. Patch by +- bpo-15359: Add CAN_BCM protocol support to the socket module. Patch by Brian Thorne. -- Issue #16948: Fix quoted printable body encoding for non-latin1 character +- bpo-16948: Fix quoted printable body encoding for non-latin1 character sets in the email package. -- Issue #16811: Fix folding of headers with no value in the provisional email +- bpo-16811: Fix folding of headers with no value in the provisional email policies. -- Issue #17132: Update symbol for "yield from" grammar changes. +- bpo-17132: Update symbol for "yield from" grammar changes. -- Issue #17076: Make copying of xattrs more tolerant of missing FS support. +- bpo-17076: Make copying of xattrs more tolerant of missing FS support. Patch by Thomas Wouters. -- Issue #17089: Expat parser now correctly works with string input when the +- bpo-17089: Expat parser now correctly works with string input when the internal XML encoding is not UTF-8 or US-ASCII. It also now accepts bytes and strings larger than 2 GiB. -- Issue #6083: Fix multiple segmentation faults occurred when PyArg_ParseTuple +- bpo-6083: Fix multiple segmentation faults occurred when PyArg_ParseTuple parses nested mutating sequence. -- Issue #5289: Fix ctypes.util.find_library on Solaris. +- bpo-5289: Fix ctypes.util.find_library on Solaris. -- Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying +- bpo-17106: Fix a segmentation fault in io.TextIOWrapper when an underlying stream or a decoder produces data of an unexpected type (i.e. when - io.TextIOWrapper initialized with text stream or use bytes-to-bytes codec). + io.TextIOWrapper initialized with text stream or use bytes-to-bytes + codec). -- Issue #17015: When it has a spec, a Mock object now inspects its signature - when matching calls, so that arguments can be matched positionally or - by name. +- bpo-17015: When it has a spec, a Mock object now inspects its signature + when matching calls, so that arguments can be matched positionally or by + name. -- Issue #15633: httplib.HTTPResponse is now mark closed when the server - sends less than the advertised Content-Length. +- bpo-15633: httplib.HTTPResponse is now mark closed when the server sends + less than the advertised Content-Length. -- Issue #12268: The io module file object write methods no longer abort early +- bpo-12268: The io module file object write methods no longer abort early when one of its write system calls is interrupted (EINTR). -- Issue #6972: The zipfile module no longer overwrites files outside of - its destination path when extracting malicious zip files. +- bpo-6972: The zipfile module no longer overwrites files outside of its + destination path when extracting malicious zip files. -- Issue #4844: ZipFile now raises BadZipFile when opens a ZIP file with an +- bpo-4844: ZipFile now raises BadZipFile when opens a ZIP file with an incomplete "End of Central Directory" record. Original patch by Guilherme Polo and Alan McIntyre. -- Issue #17071: Signature.bind() now works when one of the keyword arguments - is named ``self``. +- bpo-17071: Signature.bind() now works when one of the keyword arguments is + named ``self``. -- Issue #12004: Fix an internal error in PyZipFile when writing an invalid - Python file. Patch by Ben Morgan. +- bpo-12004: Fix an internal error in PyZipFile when writing an invalid + Python file. Patch by Ben Morgan. -- Have py_compile use importlib as much as possible to avoid code duplication. - Code now raises FileExistsError if the file path to be used for the - byte-compiled file is a symlink or non-regular file as a warning that import - will not keep the file path type if it writes to that path. +- Have py_compile use importlib as much as possible to avoid code + duplication. Code now raises FileExistsError if the file path to be used + for the byte- compiled file is a symlink or non-regular file as a warning + that import will not keep the file path type if it writes to that path. -- Issue #16972: Have site.addpackage() consider already known paths even when +- bpo-16972: Have site.addpackage() consider already known paths even when none are explicitly passed in. Bug report and fix by Kirill. -- Issue #1602133: on Mac OS X a shared library build (``--enable-shared``) - now fills the ``os.environ`` variable correctly. +- bpo-1602133: on Mac OS X a shared library build (``--enable-shared``) now + fills the ``os.environ`` variable correctly. -- Issue #15505: `unittest.installHandler` no longer assumes SIGINT handler is +- bpo-15505: `unittest.installHandler` no longer assumes SIGINT handler is set to a callable object. -- Issue #13454: Fix a crash when deleting an iterator created by itertools.tee() - if all other iterators were very advanced before. +- bpo-13454: Fix a crash when deleting an iterator created by + itertools.tee() if all other iterators were very advanced before. -- Issue #12411: Fix to cgi.parse_multipart to correctly use bytes boundaries +- bpo-12411: Fix to cgi.parse_multipart to correctly use bytes boundaries and bytes data. Patch by Jonas Wagner. -- Issue #16957: shutil.which() no longer searches a bare file name in the +- bpo-16957: shutil.which() no longer searches a bare file name in the current directory on Unix and no longer searches a relative file path with a directory part in PATH directories. Patch by Thomas Kluyver. -- Issue #1159051: GzipFile now raises EOFError when reading a corrupted file +- bpo-1159051: GzipFile now raises EOFError when reading a corrupted file with truncated header or footer. -- Issue #16993: shutil.which() now preserves the case of the path and extension +- bpo-16993: shutil.which() now preserves the case of the path and extension on Windows. -- Issue #16992: On Windows in signal.set_wakeup_fd, validate the file +- bpo-16992: On Windows in signal.set_wakeup_fd, validate the file descriptor argument. -- Issue #16422: For compatibility with the Python version, the C version of +- bpo-16422: For compatibility with the Python version, the C version of decimal now uses strings instead of integers for rounding mode constants. -- Issue #15861: tkinter now correctly works with lists and tuples containing +- bpo-15861: tkinter now correctly works with lists and tuples containing strings with whitespaces, backslashes or unbalanced braces. -- Issue #9720: zipfile now writes correct local headers for files larger than - 4 GiB. +- bpo-9720: zipfile now writes correct local headers for files larger than 4 + GiB. -- Issue #16955: Fix the poll() method for multiprocessing's socket - connections on Windows. +- bpo-16955: Fix the poll() method for multiprocessing's socket connections + on Windows. - SSLContext.load_dh_params() now properly closes the input file. -- Issue #15031: Refactor some .pyc management code to cut down on code - duplication. Thanks to Ronan Lamy for the report and taking an initial stab - at the problem. +- bpo-15031: Refactor some .pyc management code to cut down on code + duplication. Thanks to Ronan Lamy for the report and taking an initial + stab at the problem. -- Issue #16398: Optimize deque.rotate() so that it only moves pointers - and doesn't touch the underlying data with increfs and decrefs. +- bpo-16398: Optimize deque.rotate() so that it only moves pointers and + doesn't touch the underlying data with increfs and decrefs. -- Issue #16900: Issue a ResourceWarning when an ssl socket is left unclosed. +- bpo-16900: Issue a ResourceWarning when an ssl socket is left unclosed. -- Issue #13899: ``\A``, ``\Z``, and ``\B`` now correctly match the A, Z, - and B literals when used inside character classes (e.g. ``'[\A]'``). - Patch by Matthew Barnett. +- bpo-13899: ``\A``, ``\Z``, and ``\B`` now correctly match the A, Z, and B + literals when used inside character classes (e.g. ``'[\A]'``). Patch by + Matthew Barnett. -- Issue #15545: Fix regression in sqlite3's iterdump method where it was +- bpo-15545: Fix regression in sqlite3's iterdump method where it was failing if the connection used a row factory (such as sqlite3.Row) that produced unsortable objects. (Regression was introduced by fix for 9750). - fcntl: add F_DUPFD_CLOEXEC constant, available on Linux 2.6.24+. -- Issue #15972: Fix error messages when os functions expecting a file name or +- bpo-15972: Fix error messages when os functions expecting a file name or file descriptor receive the incorrect type. -- Issue #8109: The ssl module now has support for server-side SNI, thanks - to a :meth:`SSLContext.set_servername_callback` method. Patch by Daniel - Black. +- bpo-8109: The ssl module now has support for server-side SNI, thanks to a + :meth:`SSLContext.set_servername_callback` method. Patch by Daniel Black. -- Issue #16860: In tempfile, use O_CLOEXEC when available to set the - close-on-exec flag atomically. +- bpo-16860: In tempfile, use O_CLOEXEC when available to set the close-on- + exec flag atomically. -- Issue #16674: random.getrandbits() is now 20-40% faster for small integers. +- bpo-16674: random.getrandbits() is now 20-40% faster for small integers. -- Issue #16009: JSON error messages now provide more information. +- bpo-16009: JSON error messages now provide more information. -- Issue #16828: Fix error incorrectly raised by bz2.compress(b'') and +- bpo-16828: Fix error incorrectly raised by bz2.compress(b'') and bz2.BZ2Compressor.compress(b''). Initial patch by Martin Packman. -- Issue #16833: In http.client.HTTPConnection, do not concatenate the request +- bpo-16833: In http.client.HTTPConnection, do not concatenate the request headers and body when the payload exceeds 16 KB, since it can consume more memory for no benefit. Patch by Benno Leslie. -- Issue #16541: tk_setPalette() now works with keyword arguments. +- bpo-16541: tk_setPalette() now works with keyword arguments. -- Issue #16820: In configparser, `parser.popitem()` no longer raises ValueError. - This makes `parser.clean()` work correctly. +- bpo-16820: In configparser, `parser.popitem()` no longer raises + ValueError. This makes `parser.clean()` work correctly. -- Issue #16820: In configparser, ``parser['section'] = {}`` now preserves - section order within the parser. This makes `parser.update()` preserve section - order as well. +- bpo-16820: In configparser, ``parser['section'] = {}`` now preserves + section order within the parser. This makes `parser.update()` preserve + section order as well. -- Issue #16820: In configparser, ``parser['DEFAULT'] = {}`` now correctly +- bpo-16820: In configparser, ``parser['DEFAULT'] = {}`` now correctly clears previous values stored in the default section. Same goes for ``parser.update({'DEFAULT': {}})``. -- Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy. +- bpo-9586: Redefine SEM_FAILED on MacOSX to keep compiler happy. -- Issue #16787: Increase asyncore and asynchat default output buffers size, to +- bpo-16787: Increase asyncore and asynchat default output buffers size, to decrease CPU usage and increase throughput. -- Issue #10527: make multiprocessing use poll() instead of select() if available. +- bpo-10527: make multiprocessing use poll() instead of select() if + available. -- Issue #16688: Now regexes contained backreferences correctly work with - non-ASCII strings. Patch by Matthew Barnett. +- bpo-16688: Now regexes contained backreferences correctly work with non- + ASCII strings. Patch by Matthew Barnett. -- Issue #16486: Make aifc files act as context managers. +- bpo-16486: Make aifc files act as context managers. -- Issue #16485: Now file descriptors are closed if file header patching failed +- bpo-16485: Now file descriptors are closed if file header patching failed on closing an aifc file. -- Issue #16640: Run less code under a lock in sched module. +- bpo-16640: Run less code under a lock in sched module. -- Issue #16165: sched.scheduler.run() no longer blocks a scheduler for other +- bpo-16165: sched.scheduler.run() no longer blocks a scheduler for other threads. -- Issue #16641: Default values of sched.scheduler.enter() are no longer +- bpo-16641: Default values of sched.scheduler.enter() are no longer modifiable. -- Issue #16618: Make glob.glob match consistently across strings and bytes +- bpo-16618: Make glob.glob match consistently across strings and bytes regarding leading dots. Patch by Serhiy Storchaka. -- Issue #16788: Add samestat to Lib/ntpath.py +- bpo-16788: Add samestat to Lib/ntpath.py -- Issue #16713: Parsing of 'tel' urls using urlparse separates params from +- bpo-16713: Parsing of 'tel' urls using urlparse separates params from path. -- Issue #16443: Add docstrings to regular expression match objects. - Patch by Anton Kasyanov. +- bpo-16443: Add docstrings to regular expression match objects. Patch by + Anton Kasyanov. -- Issue #15701: Fix HTTPError info method call to return the headers information. +- bpo-15701: Fix HTTPError info method call to return the headers + information. -- Issue #16752: Add a missing import to modulefinder. Patch by Berker Peksag. +- bpo-16752: Add a missing import to modulefinder. Patch by Berker Peksag. -- Issue #16646: ftplib.FTP.makeport() might lose socket error details. - (patch by Serhiy Storchaka) +- bpo-16646: ftplib.FTP.makeport() might lose socket error details. (patch + by Serhiy Storchaka) -- Issue #16626: Fix infinite recursion in glob.glob() on Windows when the +- bpo-16626: Fix infinite recursion in glob.glob() on Windows when the pattern contains a wildcard in the drive or UNC path. Patch by Serhiy Storchaka. -- Issue #15783: Except for the number methods, the C version of decimal now +- bpo-15783: Except for the number methods, the C version of decimal now supports all None default values present in decimal.py. These values were largely undocumented. -- Issue #11175: argparse.FileType now accepts encoding and errors - arguments. Patch by Lucas Maystre. +- bpo-11175: argparse.FileType now accepts encoding and errors arguments. + Patch by Lucas Maystre. -- Issue #16488: epoll() objects now support the `with` statement. Patch - by Serhiy Storchaka. +- bpo-16488: epoll() objects now support the `with` statement. Patch by + Serhiy Storchaka. -- Issue #16298: In HTTPResponse.read(), close the socket when there is no +- bpo-16298: In HTTPResponse.read(), close the socket when there is no Content-Length and the incoming stream is finished. Patch by Eran Rundstein. -- Issue #16049: Add abc.ABC class to enable the use of inheritance to create +- bpo-16049: Add abc.ABC class to enable the use of inheritance to create ABCs, rather than the more cumbersome metaclass=ABCMeta. Patch by Bruno Dupuis. - Expose the TCP_FASTOPEN and MSG_FASTOPEN flags in socket when they're available. -- Issue #15701: Add a .headers attribute to urllib.error.HTTPError. Patch +- bpo-15701: Add a .headers attribute to urllib.error.HTTPError. Patch contributed by Berker Peksag. -- Issue #15872: Fix 3.3 regression introduced by the new fd-based shutil.rmtree +- bpo-15872: Fix 3.3 regression introduced by the new fd-based shutil.rmtree that caused it to not ignore certain errors when ignore_errors was set. Patch by Alessandro Moura and Serhiy Storchaka. -- Issue #16248: Disable code execution from the user's home directory by +- bpo-16248: Disable code execution from the user's home directory by tkinter when the -E flag is passed to Python. Patch by Zachary Ware. -- Issue #13390: New function :func:`sys.getallocatedblocks()` returns the +- bpo-13390: New function :func:`sys.getallocatedblocks()` returns the number of memory blocks currently allocated. -- Issue #16628: Fix a memory leak in ctypes.resize(). +- bpo-16628: Fix a memory leak in ctypes.resize(). -- Issue #13614: Fix setup.py register failure with invalid rst in description. +- bpo-13614: Fix setup.py register failure with invalid rst in description. Patch by Julien Courteau and Pierre Paul Lefebvre. -- Issue #13512: Create ~/.pypirc securely (CVE-2011-4944). Initial patch by +- bpo-13512: Create ~/.pypirc securely (CVE-2011-4944). Initial patch by Philip Jenvey, tested by Mageia and Debian. -- Issue #7719: Make distutils ignore ``.nfs*`` files instead of choking later +- bpo-7719: Make distutils ignore ``.nfs*`` files instead of choking later on. Initial patch by SilentGhost and Jeff Ramnani. -- Issue #13120: Allow calling pdb.set_trace() from thread. - Patch by Ilya Sandler. +- bpo-13120: Allow calling pdb.set_trace() from thread. Patch by Ilya + Sandler. -- Issue #16585: Make CJK encoders support error handlers that return bytes per +- bpo-16585: Make CJK encoders support error handlers that return bytes per PEP 383. -- Issue #10182: The re module doesn't truncate indices to 32 bits anymore. +- bpo-10182: The re module doesn't truncate indices to 32 bits anymore. Patch by Serhiy Storchaka. -- Issue #16333: use (",", ": ") as default separator in json when indent is +- bpo-16333: use (",", ": ") as default separator in json when indent is specified, to avoid trailing whitespace. Patch by Serhiy Storchaka. -- Issue #16573: In 2to3, treat enumerate() like a consuming call, so superfluous - list() calls aren't added to filter(), map(), and zip() which are directly - passed enumerate(). +- bpo-16573: In 2to3, treat enumerate() like a consuming call, so + superfluous list() calls aren't added to filter(), map(), and zip() which + are directly passed enumerate(). -- Issue #16464: Reset the Content-Length header when a urllib Request is reused +- bpo-16464: Reset the Content-Length header when a urllib Request is reused with new data. -- Issue #12848: The pure Python pickle implementation now treats object - lengths as unsigned 32-bit integers, like the C implementation does. - Patch by Serhiy Storchaka. +- bpo-12848: The pure Python pickle implementation now treats object lengths + as unsigned 32-bit integers, like the C implementation does. Patch by + Serhiy Storchaka. -- Issue #16423: urllib.request now has support for ``data:`` URLs. Patch by +- bpo-16423: urllib.request now has support for ``data:`` URLs. Patch by Mathias Panzenböck. -- Issue #4473: Add a POP3.stls() to switch a clear-text POP3 session into - an encrypted POP3 session, on supported servers. Patch by Lorenzo Catucci. +- bpo-4473: Add a POP3.stls() to switch a clear-text POP3 session into an + encrypted POP3 session, on supported servers. Patch by Lorenzo Catucci. -- Issue #4473: Add a POP3.capa() method to query the capabilities advertised - by the POP3 server. Patch by Lorenzo Catucci. +- bpo-4473: Add a POP3.capa() method to query the capabilities advertised by + the POP3 server. Patch by Lorenzo Catucci. -- Issue #4473: Ensure the socket is shutdown cleanly in POP3.close(). - Patch by Lorenzo Catucci. +- bpo-4473: Ensure the socket is shutdown cleanly in POP3.close(). Patch by + Lorenzo Catucci. -- Issue #16522: added FAIL_FAST flag to doctest. +- bpo-16522: added FAIL_FAST flag to doctest. -- Issue #15627: Add the importlib.abc.InspectLoader.source_to_code() method. +- bpo-15627: Add the importlib.abc.InspectLoader.source_to_code() method. -- Issue #16408: Fix file descriptors not being closed in error conditions - in the zipfile module. Patch by Serhiy Storchaka. +- bpo-16408: Fix file descriptors not being closed in error conditions in + the zipfile module. Patch by Serhiy Storchaka. -- Issue #14631: Add a new :class:`weakref.WeakMethod` to simulate weak +- bpo-14631: Add a new :class:`weakref.WeakMethod` to simulate weak references to bound methods. -- Issue #16469: Fix exceptions from float -> Fraction and Decimal -> Fraction - conversions for special values to be consistent with those for float -> int - and Decimal -> int. Patch by Alexey Kachayev. +- bpo-16469: Fix exceptions from float -> Fraction and Decimal -> Fraction + conversions for special values to be consistent with those for float -> + int and Decimal -> int. Patch by Alexey Kachayev. -- Issue #16481: multiprocessing no longer leaks process handles on Windows. +- bpo-16481: multiprocessing no longer leaks process handles on Windows. -- Issue #12428: Add a pure Python implementation of functools.partial(). - Patch by Brian Thorne. +- bpo-12428: Add a pure Python implementation of functools.partial(). Patch + by Brian Thorne. -- Issue #16140: The subprocess module no longer double closes its child +- bpo-16140: The subprocess module no longer double closes its child subprocess.PIPE parent file descriptors on child error prior to exec(). - Remove a bare print to stdout from the subprocess module that could have @@ -8504,194 +9000,199 @@ Library - The subprocess module now raises its own SubprocessError instead of a RuntimeError in various error situations which should not normally happen. -- Issue #16327: The subprocess module no longer leaks file descriptors - used for stdin/stdout/stderr pipes to the child when fork() fails. +- bpo-16327: The subprocess module no longer leaks file descriptors used for + stdin/stdout/stderr pipes to the child when fork() fails. -- Issue #14396: Handle the odd rare case of waitpid returning 0 when not +- bpo-14396: Handle the odd rare case of waitpid returning 0 when not expected in subprocess.Popen.wait(). -- Issue #16411: Fix a bug where zlib.decompressobj().flush() might try to access - previously-freed memory. Patch by Serhiy Storchaka. +- bpo-16411: Fix a bug where zlib.decompressobj().flush() might try to + access previously- freed memory. Patch by Serhiy Storchaka. -- Issue #16357: fix calling accept() on a SSLSocket created through +- bpo-16357: fix calling accept() on a SSLSocket created through SSLContext.wrap_socket(). Original patch by Jeff McNeil. -- Issue #16409: The reporthook callback made by the legacy +- bpo-16409: The reporthook callback made by the legacy urllib.request.urlretrieve API now properly supplies a constant non-zero block_size as it did in Python 3.2 and 2.7. This matches the behavior of urllib.request.URLopener.retrieve. -- Issue #16431: Use the type information when constructing a Decimal subtype +- bpo-16431: Use the type information when constructing a Decimal subtype from a Decimal argument. -- Issue #15641: Clean up deprecated classes from importlib. - Patch by Taras Lyapun. +- bpo-15641: Clean up deprecated classes from importlib. Patch by Taras + Lyapun. -- Issue #16350: zlib.decompressobj().decompress() now accumulates data from - successive calls after EOF in unused_data, instead of only saving the argument - to the last call. decompressobj().flush() now correctly sets unused_data and - unconsumed_tail. A bug in the handling of MemoryError when setting the - unconsumed_tail attribute has also been fixed. Patch by Serhiy Storchaka. +- bpo-16350: zlib.decompressobj().decompress() now accumulates data from + successive calls after EOF in unused_data, instead of only saving the + argument to the last call. decompressobj().flush() now correctly sets + unused_data and unconsumed_tail. A bug in the handling of MemoryError when + setting the unconsumed_tail attribute has also been fixed. Patch by Serhiy + Storchaka. -- Issue #12759: sre_parse now raises a proper error when the name of the group - is missing. Initial patch by Serhiy Storchaka. +- bpo-12759: sre_parse now raises a proper error when the name of the group + is missing. Initial patch by Serhiy Storchaka. -- Issue #16152: fix tokenize to ignore whitespace at the end of the code when +- bpo-16152: fix tokenize to ignore whitespace at the end of the code when no newline is found. Patch by Ned Batchelder. -- Issue #16284: Prevent keeping unnecessary references to worker functions - in concurrent.futures ThreadPoolExecutor. +- bpo-16284: Prevent keeping unnecessary references to worker functions in + concurrent.futures ThreadPoolExecutor. -- Issue #16230: Fix a crash in select.select() when one of the lists changes +- bpo-16230: Fix a crash in select.select() when one of the lists changes size while iterated on. Patch by Serhiy Storchaka. -- Issue #16228: Fix a crash in the json module where a list changes size - while it is being encoded. Patch by Serhiy Storchaka. +- bpo-16228: Fix a crash in the json module where a list changes size while + it is being encoded. Patch by Serhiy Storchaka. -- Issue #16351: New function gc.get_stats() returns per-generation collection +- bpo-16351: New function gc.get_stats() returns per-generation collection statistics. -- Issue #14897: Enhance error messages of struct.pack and - struct.pack_into. Patch by Matti Mäki. +- bpo-14897: Enhance error messages of struct.pack and struct.pack_into. + Patch by Matti Mäki. -- Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. +- bpo-16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. Patch by Serhiy Storchaka. -- Issue #12890: cgitb no longer prints spurious

tags in text - mode when the logdir option is specified. +- bpo-12890: cgitb no longer prints spurious

tags in text mode when the + logdir option is specified. -- Issue #16307: Fix multiprocessing.Pool.map_async not calling its callbacks. +- bpo-16307: Fix multiprocessing.Pool.map_async not calling its callbacks. Patch by Janne Karila. -- Issue #16305: Fix a segmentation fault occurring when interrupting +- bpo-16305: Fix a segmentation fault occurring when interrupting math.factorial. -- Issue #16116: Fix include and library paths to be correct when building C +- bpo-16116: Fix include and library paths to be correct when building C extensions in venvs. -- Issue #16245: Fix the value of a few entities in html.entities.html5. +- bpo-16245: Fix the value of a few entities in html.entities.html5. -- Issue #16301: Fix the localhost verification in urllib/request.py for ``file://`` - urls. +- bpo-16301: Fix the localhost verification in urllib/request.py for + ``file://`` urls. -- Issue #16250: Fix the invocations of URLError which had misplaced filename +- bpo-16250: Fix the invocations of URLError which had misplaced filename attribute for exception. -- Issue #10836: Fix exception raised when file not found in urlretrieve - Initial patch by Ezio Melotti. +- bpo-10836: Fix exception raised when file not found in urlretrieve Initial + patch by Ezio Melotti. -- Issue #14398: Fix size truncation and overflow bugs in the bz2 module. +- bpo-14398: Fix size truncation and overflow bugs in the bz2 module. -- Issue #12692: Fix resource leak in urllib.request when talking to an HTTP - server that does not include a ``Connection: close`` header in its responses. +- bpo-12692: Fix resource leak in urllib.request when talking to an HTTP + server that does not include a ``Connection: close`` header in its + responses. -- Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle. +- bpo-12034: Fix bogus caching of result in check_GetFinalPathNameByHandle. Patch by Atsuo Ishimoto. - Improve performance of `lzma.LZMAFile` (see also issue #16034). -- Issue #16220: wsgiref now always calls close() on an iterable response. - Patch by Brent Tubbs. +- bpo-16220: wsgiref now always calls close() on an iterable response. Patch + by Brent Tubbs. -- Issue #16270: urllib may hang when used for retrieving files via FTP by using +- bpo-16270: urllib may hang when used for retrieving files via FTP by using a context manager. Patch by Giampaolo Rodola'. -- Issue #16461: Wave library should be able to deal with 4GB wav files, - and sample rate of 44100 Hz. +- bpo-16461: Wave library should be able to deal with 4GB wav files, and + sample rate of 44100 Hz. -- Issue #16176: Properly identify Windows 8 via platform.platform() +- bpo-16176: Properly identify Windows 8 via platform.platform() -- Issue #16088: BaseHTTPRequestHandler's send_error method includes a - Content-Length header in its response now. Patch by Antoine Pitrou. +- bpo-16088: BaseHTTPRequestHandler's send_error method includes a Content- + Length header in its response now. Patch by Antoine Pitrou. -- Issue #16114: The subprocess module no longer provides a misleading error - message stating that args[0] did not exist when either the cwd or executable - keyword arguments specified a path that did not exist. +- bpo-16114: The subprocess module no longer provides a misleading error + message stating that args[0] did not exist when either the cwd or + executable keyword arguments specified a path that did not exist. -- Issue #16169: Fix ctypes.WinError()'s confusion between errno and winerror. +- bpo-16169: Fix ctypes.WinError()'s confusion between errno and winerror. -- Issue #16110: logging.fileConfig now accepts a pre-initialised ConfigParser +- bpo-16110: logging.fileConfig now accepts a pre-initialised ConfigParser instance. -- Issue #1492704: shutil.copyfile() raises a distinct SameFileError now if +- bpo-1492704: shutil.copyfile() raises a distinct SameFileError now if source and destination are the same file. Patch by Atsuo Ishimoto. -- Issue #13896: Make shelf instances work with 'with' as context managers. +- bpo-13896: Make shelf instances work with 'with' as context managers. Original patch by Filip Gruszczyński. -- Issue #15417: Add support for csh and fish in venv activation scripts. +- bpo-15417: Add support for csh and fish in venv activation scripts. -- Issue #14377: ElementTree.write and some of the module-level functions have - a new parameter - *short_empty_elements*. It controls how elements with no +- bpo-14377: ElementTree.write and some of the module-level functions have a + new parameter - *short_empty_elements*. It controls how elements with no contents are emitted. -- Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element +- bpo-16089: Allow ElementTree.TreeBuilder to work again with a non-Element element_factory (fixes a regression in SimpleTAL). -- Issue #9650: List commonly used format codes in time.strftime and +- bpo-9650: List commonly used format codes in time.strftime and time.strptime docsttings. Original patch by Mike Hoy. -- Issue #15452: logging configuration socket listener now has a verify option +- bpo-15452: logging configuration socket listener now has a verify option that allows an application to apply a verification function to the received configuration data before it is acted upon. -- Issue #16034: Fix performance regressions in the new `bz2.BZ2File` - implementation. Initial patch by Serhiy Storchaka. +- bpo-16034: Fix performance regressions in the new `bz2.BZ2File` + implementation. Initial patch by Serhiy Storchaka. -- `pty.spawn()` now returns the child process status returned by `os.waitpid()`. +- `pty.spawn()` now returns the child process status returned by + `os.waitpid()`. -- Issue #15756: `subprocess.poll()` now properly handles `errno.ECHILD` to - return a returncode of 0 when the child has already exited or cannot be waited - on. +- bpo-15756: `subprocess.poll()` now properly handles `errno.ECHILD` to + return a returncode of 0 when the child has already exited or cannot be + waited on. -- Issue #15323: Improve failure message of `Mock.assert_called_once_with()`. +- bpo-15323: Improve failure message of `Mock.assert_called_once_with()`. -- Issue #16064: ``unittest -m`` claims executable is "python", not "python3". +- bpo-16064: ``unittest -m`` claims executable is "python", not "python3". -- Issue #12376: Pass on parameters in `TextTestResult.__init__()` super call. +- bpo-12376: Pass on parameters in `TextTestResult.__init__()` super call. -- Issue #15222: Insert blank line after each message in mbox mailboxes. +- bpo-15222: Insert blank line after each message in mbox mailboxes. -- Issue #16013: Fix `csv.Reader` parsing issue with ending quote characters. +- bpo-16013: Fix `csv.Reader` parsing issue with ending quote characters. Patch by Serhiy Storchaka. -- Issue #15421: Fix an OverflowError in `Calendar.itermonthdates()` after +- bpo-15421: Fix an OverflowError in `Calendar.itermonthdates()` after `datetime.MAXYEAR`. Patch by Cédric Krier. -- Issue #16112: platform.architecture does not correctly escape argument to - /usr/bin/file. Patch by David Benjamin. +- bpo-16112: platform.architecture does not correctly escape argument to + /usr/bin/file. Patch by David Benjamin. -- Issue #15970: `xml.etree.ElementTree` now serializes correctly the empty HTML +- bpo-15970: `xml.etree.ElementTree` now serializes correctly the empty HTML elements 'meta' and 'param'. -- Issue #15842: The `SocketIO.{readable,writable,seekable}` methods now raise - ValueError when the file-like object is closed. Patch by Alessandro Moura. +- bpo-15842: The `SocketIO.{readable,writable,seekable}` methods now raise + ValueError when the file-like object is closed. Patch by Alessandro + Moura. -- Issue #15876: Fix a refleak in the `curses` module: window.encoding. +- bpo-15876: Fix a refleak in the `curses` module: window.encoding. -- Issue #15881: Fix `atexit` hook in `multiprocessing`. Original patch by Chris - McDonough. +- bpo-15881: Fix `atexit` hook in `multiprocessing`. Original patch by + Chris McDonough. -- Issue #15841: The readable(), writable() and seekable() methods of - `io.BytesIO` and `io.StringIO` objects now raise ValueError when the object - has been closed. Patch by Alessandro Moura. +- bpo-15841: The readable(), writable() and seekable() methods of + `io.BytesIO` and `io.StringIO` objects now raise ValueError when the + object has been closed. Patch by Alessandro Moura. -- Issue #15447: Use `subprocess.DEVNULL` in webbrowser, instead of opening +- bpo-15447: Use `subprocess.DEVNULL` in webbrowser, instead of opening `os.devnull` explicitly and leaving it open. -- Issue #15509: `webbrowser.UnixBrowser` no longer passes empty arguments to +- bpo-15509: `webbrowser.UnixBrowser` no longer passes empty arguments to Popen when ``%action`` substitutions produce empty strings. -- Issue #12776, issue #11839: Call `argparse` type function (specified by - add_argument) only once. Before, the type function was called twice in the - case where the default was specified and the argument was given as well. This - was especially problematic for the FileType type, as a default file would - always be opened, even if a file argument was specified on the command line. +- bpo-12776: Call `argparse` type function (specified by add_argument) only + once. Before, the type function was called twice in the case where the + default was specified and the argument was given as well. This was + especially problematic for the FileType type, as a default file would + always be opened, even if a file argument was specified on the command + line. (See also: bpo-11839) -- Issue #15906: Fix a regression in argparse caused by the preceding change, +- bpo-15906: Fix a regression in argparse caused by the preceding change, when ``action='append'``, ``type='str'`` and ``default=[]``. -- Issue #16113: Added sha3 module based on the Keccak reference implementation +- bpo-16113: Added sha3 module based on the Keccak reference implementation 3.2. The `hashlib` module has four additional hash algorithms: `sha3_224`, `sha3_256`, `sha3_384` and `sha3_512`. As part of the patch some common code was moved from _hashopenssl.c to hashlib.h. @@ -8699,620 +9200,623 @@ Library - ctypes.call_commethod was removed, since its only usage was in the defunct samples directory. -- Issue #16692: Added TLSv1.1 and TLSv1.2 support for the ssl modules. +- bpo-16692: Added TLSv1.1 and TLSv1.2 support for the ssl modules. -- Issue #16832: add abc.get_cache_token() to expose cache validity checking +- bpo-16832: add abc.get_cache_token() to expose cache validity checking support in ABCMeta. IDLE ---- -- Issue #18429: Format / Format Paragraph, now works when comment blocks - are selected. As with text blocks, this works best when the selection - only includes complete lines. +- bpo-18429: Format / Format Paragraph, now works when comment blocks are + selected. As with text blocks, this works best when the selection only + includes complete lines. -- Issue #18226: Add docstrings and unittests for FormatParagraph.py. - Original patches by Todd Rovito and Phil Webster. +- bpo-18226: Add docstrings and unittests for FormatParagraph.py. Original + patches by Todd Rovito and Phil Webster. -- Issue #18279: Format - Strip trailing whitespace no longer marks a file as +- bpo-18279: Format - Strip trailing whitespace no longer marks a file as changed when it has not been changed. This fix followed the addition of a test file originally written by Phil Webster (the issue's main goal). -- Issue #7136: In the Idle File menu, "New Window" is renamed "New File". - Patch by Tal Einat, Roget Serwy, and Todd Rovito. +- bpo-7136: In the Idle File menu, "New Window" is renamed "New File". Patch + by Tal Einat, Roget Serwy, and Todd Rovito. - Remove dead imports of imp. -- Issue #18196: Avoid displaying spurious SystemExit tracebacks. +- bpo-18196: Avoid displaying spurious SystemExit tracebacks. -- Issue #5492: Avoid traceback when exiting IDLE caused by a race condition. +- bpo-5492: Avoid traceback when exiting IDLE caused by a race condition. -- Issue #17511: Keep IDLE find dialog open after clicking "Find Next". - Original patch by Sarah K. +- bpo-17511: Keep IDLE find dialog open after clicking "Find Next". Original + patch by Sarah K. -- Issue #18055: Move IDLE off of imp and on to importlib. +- bpo-18055: Move IDLE off of imp and on to importlib. -- Issue #15392: Create a unittest framework for IDLE. - Initial patch by Rajagopalasarma Jayakrishnan. - See Lib/idlelib/idle_test/README.txt for how to run Idle tests. +- bpo-15392: Create a unittest framework for IDLE. Initial patch by + Rajagopalasarma Jayakrishnan. See Lib/idlelib/idle_test/README.txt for how + to run Idle tests. -- Issue #14146: Highlight source line while debugging on Windows. +- bpo-14146: Highlight source line while debugging on Windows. -- Issue #17838: Allow sys.stdin to be reassigned. +- bpo-17838: Allow sys.stdin to be reassigned. -- Issue #13495: Avoid loading the color delegator twice in IDLE. +- bpo-13495: Avoid loading the color delegator twice in IDLE. -- Issue #17798: Allow IDLE to edit new files when specified on command line. +- bpo-17798: Allow IDLE to edit new files when specified on command line. -- Issue #14735: Update IDLE docs to omit "Control-z on Windows". +- bpo-14735: Update IDLE docs to omit "Control-z on Windows". -- Issue #17532: Always include Options menu for IDLE on OS X. - Patch by Guilherme Simões. +- bpo-17532: Always include Options menu for IDLE on OS X. Patch by + Guilherme Simões. -- Issue #17585: Fixed IDLE regression. Now closes when using exit() or quit(). +- bpo-17585: Fixed IDLE regression. Now closes when using exit() or quit(). -- Issue #17657: Show full Tk version in IDLE's about dialog. - Patch by Todd Rovito. +- bpo-17657: Show full Tk version in IDLE's about dialog. Patch by Todd + Rovito. -- Issue #17613: Prevent traceback when removing syntax colorizer in IDLE. +- bpo-17613: Prevent traceback when removing syntax colorizer in IDLE. -- Issue #1207589: Backwards-compatibility patch for right-click menu in IDLE. +- bpo-1207589: Backwards-compatibility patch for right-click menu in IDLE. -- Issue #16887: IDLE now accepts Cancel in tabify/untabify dialog box. +- bpo-16887: IDLE now accepts Cancel in tabify/untabify dialog box. -- Issue #17625: In IDLE, close the replace dialog after it is used. +- bpo-17625: In IDLE, close the replace dialog after it is used. -- Issue #14254: IDLE now handles readline correctly across shell restarts. +- bpo-14254: IDLE now handles readline correctly across shell restarts. -- Issue #17614: IDLE no longer raises exception when quickly closing a file. +- bpo-17614: IDLE no longer raises exception when quickly closing a file. -- Issue #6698: IDLE now opens just an editor window when configured to do so. +- bpo-6698: IDLE now opens just an editor window when configured to do so. -- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer - raises an exception. +- bpo-8900: Using keyboard shortcuts in IDLE to open a file no longer raises + an exception. -- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. +- bpo-6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. -- Issue #17114: IDLE now uses non-strict config parser. +- bpo-17114: IDLE now uses non-strict config parser. -- Issue #9290: In IDLE the sys.std* streams now implement io.TextIOBase +- bpo-9290: In IDLE the sys.std* streams now implement io.TextIOBase interface and support all mandatory methods and properties. -- Issue #5066: Update IDLE docs. Patch by Todd Rovito. +- bpo-5066: Update IDLE docs. Patch by Todd Rovito. -- Issue #16829: IDLE printing no longer fails if there are spaces or other +- bpo-16829: IDLE printing no longer fails if there are spaces or other special characters in the file path. -- Issue #16491: IDLE now prints chained exception tracebacks. +- bpo-16491: IDLE now prints chained exception tracebacks. -- Issue #16819: IDLE method completion now correctly works for bytes literals. +- bpo-16819: IDLE method completion now correctly works for bytes literals. -- Issue #16504: IDLE now catches SyntaxErrors raised by tokenizer. Patch by +- bpo-16504: IDLE now catches SyntaxErrors raised by tokenizer. Patch by Roger Serwy. -- Issue #16511: Use default IDLE width and height if config param is not valid. +- bpo-16511: Use default IDLE width and height if config param is not valid. Patch Serhiy Storchaka. -- Issue #1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu. +- bpo-1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu. Patch by Todd Rovito. -- Issue #16123: IDLE - deprecate running without a subprocess. - Patch by Roger Serwy. +- bpo-16123: IDLE - deprecate running without a subprocess. Patch by Roger + Serwy. Tests ----- -- Issue #1666318: Add a test that shutil.copytree() retains directory +- bpo-1666318: Add a test that shutil.copytree() retains directory permissions. Patch by Catherine Devlin. -- Issue #18273: move the tests in Lib/test/json_tests to Lib/test/test_json - and make them discoverable by unittest. Patch by Zachary Ware. +- bpo-18273: move the tests in Lib/test/json_tests to Lib/test/test_json and + make them discoverable by unittest. Patch by Zachary Ware. - Fix a fcntl test case on KFreeBSD, Debian #708653 (Petr Salinger). -- Issue #18396: Fix spurious test failure in test_signal on Windows when +- bpo-18396: Fix spurious test failure in test_signal on Windows when faulthandler is enabled (Patch by Jeremy Kloth) -- Issue #17046: Fix broken test_executable_without_cwd in test_subprocess. +- bpo-17046: Fix broken test_executable_without_cwd in test_subprocess. -- Issue #15415: Add new temp_dir() and change_cwd() context managers to - test.support, and refactor temp_cwd() to use them. Patch by Chris Jerdonek. +- bpo-15415: Add new temp_dir() and change_cwd() context managers to + test.support, and refactor temp_cwd() to use them. Patch by Chris + Jerdonek. -- Issue #15494: test.support is now a package rather than a module (Initial +- bpo-15494: test.support is now a package rather than a module (Initial patch by Indra Talip) -- Issue #17944: test_zipfile now discoverable and uses subclassing to - generate tests for different compression types. Fixed a bug with skipping - some tests due to use of exhausted iterators. +- bpo-17944: test_zipfile now discoverable and uses subclassing to generate + tests for different compression types. Fixed a bug with skipping some + tests due to use of exhausted iterators. -- Issue #18266: test_largefile now works with unittest test discovery and +- bpo-18266: test_largefile now works with unittest test discovery and supports running only selected tests. Patch by Zachary Ware. -- Issue #17767: test_locale now works with unittest test discovery. - Original patch by Zachary Ware. +- bpo-17767: test_locale now works with unittest test discovery. Original + patch by Zachary Ware. -- Issue #18375: Assume --randomize when --randseed is used for running the +- bpo-18375: Assume --randomize when --randseed is used for running the testsuite. -- Issue #11185: Fix test_wait4 under AIX. Patch by Sébastien Sablé. +- bpo-11185: Fix test_wait4 under AIX. Patch by Sébastien Sablé. -- Issue #18207: Fix test_ssl for some versions of OpenSSL that ignore seconds +- bpo-18207: Fix test_ssl for some versions of OpenSSL that ignore seconds in ASN1_TIME fields. -- Issue #18094: test_uuid no longer reports skipped tests as passed. +- bpo-18094: test_uuid no longer reports skipped tests as passed. -- Issue #17992: Add timeouts to asyncore and asynchat tests so that they won't +- bpo-17992: Add timeouts to asyncore and asynchat tests so that they won't accidentally hang. -- Issue #17833: Fix test_gdb failures seen on machines where debug symbols - for glibc are available (seen on PPC64 Linux). +- bpo-17833: Fix test_gdb failures seen on machines where debug symbols for + glibc are available (seen on PPC64 Linux). -- Issue #7855: Add tests for ctypes/winreg for issues found in IronPython. +- bpo-7855: Add tests for ctypes/winreg for issues found in IronPython. Initial patch by Dino Viehland. -- Issue #11078: test___all__ now checks for duplicates in __all__. - Initial patch by R. David Murray. +- bpo-11078: test___all__ now checks for duplicates in __all__. Initial + patch by R. David Murray. -- Issue #17712: Fix test_gdb failures on Ubuntu 13.04. +- bpo-17712: Fix test_gdb failures on Ubuntu 13.04. -- Issue #17835: Fix test_io when the default OS pipe buffer size is larger - than one million bytes. +- bpo-17835: Fix test_io when the default OS pipe buffer size is larger than + one million bytes. -- Issue #17065: Use process-unique key for winreg tests to avoid failures if +- bpo-17065: Use process-unique key for winreg tests to avoid failures if test is run multiple times in parallel (eg: on a buildbot host). -- Issue #12820: add tests for the xml.dom.minicompat module. - Patch by John Chandler and Phil Connell. +- bpo-12820: add tests for the xml.dom.minicompat module. Patch by John + Chandler and Phil Connell. -- Issue #17691: test_univnewlines now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17691: test_univnewlines now works with unittest test discovery. Patch + by Zachary Ware. -- Issue #17790: test_set now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17790: test_set now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #17789: test_random now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17789: test_random now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #17779: test_osx_env now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17779: test_osx_env now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #17766: test_iterlen now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17766: test_iterlen now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #17690: test_time now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17690: test_time now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #17692: test_sqlite now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17692: test_sqlite now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #11995: test_pydoc doesn't import all sys.path modules anymore. +- bpo-11995: test_pydoc doesn't import all sys.path modules anymore. -- Issue #17448: test_sax now skips if there are no xml parsers available +- bpo-17448: test_sax now skips if there are no xml parsers available instead of raising an ImportError. -- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. - Initial patch by Thomas Wouters. +- bpo-11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial + patch by Thomas Wouters. -- Issue #10652: make tcl/tk tests run after __all__ test, patch by - Zachary Ware. +- bpo-10652: make tcl/tk tests run after __all__ test, patch by Zachary + Ware. -- Issue #11963: remove human verification from test_parser and test_subprocess. +- bpo-11963: remove human verification from test_parser and test_subprocess. -- Issue #11732: add a new suppress_crash_popup() context manager to test.support - that disables crash popups on Windows and use it in test_faulthandler and - test_capi. +- bpo-11732: add a new suppress_crash_popup() context manager to + test.support that disables crash popups on Windows and use it in + test_faulthandler and test_capi. -- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. +- bpo-13898: test_ssl no longer prints a spurious stack trace on Ubuntu. -- Issue #17283: Share code between `__main__.py` and `regrtest.py` in +- bpo-17283: Share code between `__main__.py` and `regrtest.py` in `Lib/test`. -- Issue #17249: convert a test in test_capi to use unittest and reap threads. +- bpo-17249: convert a test in test_capi to use unittest and reap threads. -- Issue #17107: Test client-side SNI support in urllib.request thanks to - the new server-side SNI support in the ssl module. Initial patch by - Daniel Black. +- bpo-17107: Test client-side SNI support in urllib.request thanks to the + new server-side SNI support in the ssl module. Initial patch by Daniel + Black. -- Issue #17041: Fix testing when Python is configured with the - --without-doc-strings. +- bpo-17041: Fix testing when Python is configured with the --without-doc- + strings. -- Issue #16923: Fix ResourceWarnings in test_ssl. +- bpo-16923: Fix ResourceWarnings in test_ssl. -- Issue #15539: Added regression tests for Tools/scripts/pindent.py. +- bpo-15539: Added regression tests for Tools/scripts/pindent.py. -- Issue #17479: test_io now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17479: test_io now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #17066: test_robotparser now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17066: test_robotparser now works with unittest test discovery. Patch + by Zachary Ware. -- Issue #17334: test_index now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17334: test_index now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #17333: test_imaplib now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17333: test_imaplib now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #17082: test_dbm* now work with unittest test discovery. - Patch by Zachary Ware. +- bpo-17082: test_dbm* now work with unittest test discovery. Patch by + Zachary Ware. -- Issue #17079: test_ctypes now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17079: test_ctypes now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #17304: test_hash now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17304: test_hash now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #17303: test_future* now work with unittest test discovery. - Patch by Zachary Ware. +- bpo-17303: test_future* now work with unittest test discovery. Patch by + Zachary Ware. -- Issue #17163: test_file now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-17163: test_file now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #16925: test_configparser now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-16925: test_configparser now works with unittest test discovery. Patch + by Zachary Ware. -- Issue #16918: test_codecs now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-16918: test_codecs now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #16919: test_crypt now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-16919: test_crypt now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #16910: test_bytes, test_unicode, and test_userstring now work with +- bpo-16910: test_bytes, test_unicode, and test_userstring now work with unittest test discovery. Patch by Zachary Ware. -- Issue #16905: test_warnings now works with unittest test discovery. - Initial patch by Berker Peksag. +- bpo-16905: test_warnings now works with unittest test discovery. Initial + patch by Berker Peksag. -- Issue #16898: test_bufio now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-16898: test_bufio now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #16888: test_array now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-16888: test_array now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #16896: test_asyncore now works with unittest test discovery. - Patch by Zachary Ware. +- bpo-16896: test_asyncore now works with unittest test discovery. Patch by + Zachary Ware. -- Issue #16897: test_bisect now works with unittest test discovery. - Initial patch by Zachary Ware. +- bpo-16897: test_bisect now works with unittest test discovery. Initial + patch by Zachary Ware. -- Issue #16852: test_genericpath, test_posixpath, test_ntpath, and test_macpath +- bpo-16852: test_genericpath, test_posixpath, test_ntpath, and test_macpath now work with unittest test discovery. Patch by Zachary Ware. -- Issue #16748: test_heapq now works with unittest test discovery. +- bpo-16748: test_heapq now works with unittest test discovery. -- Issue #10646: Tests rearranged for os.samefile/samestat to check for not - just symlinks but also hard links. +- bpo-10646: Tests rearranged for os.samefile/samestat to check for not just + symlinks but also hard links. -- Issue #15302: Switch regrtest from using getopt to using argparse. +- bpo-15302: Switch regrtest from using getopt to using argparse. -- Issue #15324: Fix regrtest parsing of --fromfile, --match, and --randomize +- bpo-15324: Fix regrtest parsing of --fromfile, --match, and --randomize options. -- Issue #16702: test_urllib2_localnet tests now correctly ignores proxies for +- bpo-16702: test_urllib2_localnet tests now correctly ignores proxies for localhost tests. -- Issue #16664: Add regression tests for glob's behaviour concerning entries +- bpo-16664: Add regression tests for glob's behaviour concerning entries starting with a ".". Patch by Sebastian Kreft. -- Issue #13390: The ``-R`` option to regrtest now also checks for memory +- bpo-13390: The ``-R`` option to regrtest now also checks for memory allocation leaks, using :func:`sys.getallocatedblocks()`. -- Issue #16559: Add more tests for the json module, including some from the +- bpo-16559: Add more tests for the json module, including some from the official test suite at json.org. Patch by Serhiy Storchaka. -- Issue #16661: Fix the `os.getgrouplist()` test by not assuming that it gives +- bpo-16661: Fix the `os.getgrouplist()` test by not assuming that it gives the same output as :command:`id -G`. -- Issue #16115: Add some tests for the executable argument to +- bpo-16115: Add some tests for the executable argument to subprocess.Popen(). Initial patch by Kushal Das. -- Issue #16126: PyErr_Format format mismatch in _testcapimodule.c. - Patch by Serhiy Storchaka. +- bpo-16126: PyErr_Format format mismatch in _testcapimodule.c. Patch by + Serhiy Storchaka. -- Issue #15304: Fix warning message when `os.chdir()` fails inside +- bpo-15304: Fix warning message when `os.chdir()` fails inside `test.support.temp_cwd()`. Patch by Chris Jerdonek. -- Issue #15802: Fix test logic in `TestMaildir.test_create_tmp()`. Patch by +- bpo-15802: Fix test logic in `TestMaildir.test_create_tmp()`. Patch by Serhiy Storchaka. -- Issue #15557: Added a test suite for the webbrowser module, thanks to Anton +- bpo-15557: Added a test suite for the webbrowser module, thanks to Anton Barkovsky. -- Issue #16698: Skip posix test_getgroups when built with OS X - deployment target prior to 10.6. +- bpo-16698: Skip posix test_getgroups when built with OS X deployment + target prior to 10.6. Build ----- -- Issue #16067: Add description into MSI file to replace installer's - temporary name. +- bpo-16067: Add description into MSI file to replace installer's temporary + name. -- Issue #18257: Fix readlink usage in python-config. Install the python +- bpo-18257: Fix readlink usage in python-config. Install the python version again on Darwin. -- Issue #18481: Add C coverage reporting with gcov and lcov. A new make target - "coverage-report" creates an instrumented Python build, runs unit tests +- bpo-18481: Add C coverage reporting with gcov and lcov. A new make target + "coverage- report" creates an instrumented Python build, runs unit tests and creates a HTML. The report can be updated with "make coverage-lcov". -- Issue #17845: Clarified the message printed when some module are not built. +- bpo-17845: Clarified the message printed when some module are not built. -- Issue #18256: Compilation fix for recent AIX releases. Patch by - David Edelsohn. +- bpo-18256: Compilation fix for recent AIX releases. Patch by David + Edelsohn. -- Issue #17547: In configure, explicitly pass -Wformat for the benefit for GCC +- bpo-17547: In configure, explicitly pass -Wformat for the benefit for GCC 4.8. -- Issue #15172: Document NASM 2.10+ as requirement for building OpenSSL 1.0.1 +- bpo-15172: Document NASM 2.10+ as requirement for building OpenSSL 1.0.1 on Windows. -- Issue #17591: Use lowercase filenames when including Windows header files. +- bpo-17591: Use lowercase filenames when including Windows header files. Patch by Roumen Petrov. -- Issue #17550: Fix the --enable-profiling configure switch. +- bpo-17550: Fix the --enable-profiling configure switch. -- Issue #17425: Build with openssl 1.0.1d on Windows. +- bpo-17425: Build with openssl 1.0.1d on Windows. -- Issue #16754: Fix the incorrect shared library extension on linux. Introduce +- bpo-16754: Fix the incorrect shared library extension on linux. Introduce two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. -- Issue #5033: Fix building of the sqlite3 extension module when the - SQLite library version has "beta" in it. Patch by Andreas Pelme. +- bpo-5033: Fix building of the sqlite3 extension module when the SQLite + library version has "beta" in it. Patch by Andreas Pelme. -- Issue #17228: Fix building without pymalloc. +- bpo-17228: Fix building without pymalloc. -- Issue #3718: Use AC_ARG_VAR to set MACHDEP in configure.ac. +- bpo-3718: Use AC_ARG_VAR to set MACHDEP in configure.ac. -- Issue #16235: Implement python-config as a shell script. +- bpo-16235: Implement python-config as a shell script. -- Issue #16769: Remove outdated Visual Studio projects. +- bpo-16769: Remove outdated Visual Studio projects. -- Issue #17031: Fix running regen in cross builds. +- bpo-17031: Fix running regen in cross builds. -- Issue #3754: fix typo in pthread AC_CACHE_VAL. +- bpo-3754: fix typo in pthread AC_CACHE_VAL. -- Issue #15484: Fix _PYTHON_PROJECT_BASE for srcdir != builddir builds; - use _PYTHON_PROJECT_BASE in distutils/sysconfig.py. +- bpo-15484: Fix _PYTHON_PROJECT_BASE for srcdir != builddir builds; use + _PYTHON_PROJECT_BASE in distutils/sysconfig.py. - Drop support for Windows 2000 (changeset e52df05b496a). -- Issue #17029: Let h2py search the multiarch system include directory. +- bpo-17029: Let h2py search the multiarch system include directory. -- Issue #16953: Fix socket module compilation on platforms with +- bpo-16953: Fix socket module compilation on platforms with HAVE_BROKEN_POLL. Patch by Jeffrey Armstrong. -- Issue #16320: Remove redundant Makefile dependencies for strings and bytes. +- bpo-16320: Remove redundant Makefile dependencies for strings and bytes. -- Cross compiling needs host and build settings. configure no longer - creates a broken PYTHON_FOR_BUILD variable when --build is missing. +- Cross compiling needs host and build settings. configure no longer creates + a broken PYTHON_FOR_BUILD variable when --build is missing. -- Fix cross compiling issue in setup.py, ensure that lib_dirs and inc_dirs are - defined in cross compiling mode, too. +- Fix cross compiling issue in setup.py, ensure that lib_dirs and inc_dirs + are defined in cross compiling mode, too. -- Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. +- bpo-16836: Enable IPv6 support even if IPv6 is disabled on the build host. -- Issue #16593: Have BSD 'make -s' do the right thing, thanks to Daniel Shahaf +- bpo-16593: Have BSD 'make -s' do the right thing, thanks to Daniel Shahaf -- Issue #16262: fix out-of-src-tree builds, if mercurial is not installed. +- bpo-16262: fix out-of-src-tree builds, if mercurial is not installed. -- Issue #15298: ensure _sysconfigdata is generated in build directory, not +- bpo-15298: ensure _sysconfigdata is generated in build directory, not source directory. -- Issue #15833: Fix a regression in 3.3 that resulted in exceptions being +- bpo-15833: Fix a regression in 3.3 that resulted in exceptions being raised if importlib failed to write byte-compiled files. This affected attempts to build Python out-of-tree from a read-only source directory. -- Issue #15923: Fix a mistake in ``asdl_c.py`` that resulted in a TypeError +- bpo-15923: Fix a mistake in ``asdl_c.py`` that resulted in a TypeError after 2801bf875a24 (see #15801). -- Issue #16135: Remove OS/2 support. +- bpo-16135: Remove OS/2 support. -- Issue #15819: Make sure we can build Python out-of-tree from a read-only - source directory. (Somewhat related to issue #9860.) +- bpo-15819: Make sure we can build Python out-of-tree from a read-only + source directory. (Somewhat related to issue #9860.) -- Issue #15587: Enable Tk high-resolution text rendering on Macs with - Retina displays. Applies to Tkinter apps, such as IDLE, on OS X - framework builds linked with Cocoa Tk 8.5. +- bpo-15587: Enable Tk high-resolution text rendering on Macs with Retina + displays. Applies to Tkinter apps, such as IDLE, on OS X framework builds + linked with Cocoa Tk 8.5. -- Issue #17161: make install now also installs a python3 man page. +- bpo-17161: make install now also installs a python3 man page. -C-API +C API ----- -- Issue #18351: Fix various issues in a function in importlib provided to help +- bpo-18351: Fix various issues in a function in importlib provided to help PyImport_ExecCodeModuleWithPathnames() (and thus by extension PyImport_ExecCodeModule() and PyImport_ExecCodeModuleEx()). -- Issue #9369: The types of `char*` arguments of PyObject_CallFunction() and +- bpo-9369: The types of `char*` arguments of PyObject_CallFunction() and PyObject_CallMethod() now changed to `const char*`. Based on patches by Jörg Müller and Lars Buitinck. -- Issue #17206: Py_CLEAR(), Py_DECREF(), Py_XINCREF() and Py_XDECREF() now - expand their arguments once instead of multiple times. Patch written by Illia - Polosukhin. +- bpo-17206: Py_CLEAR(), Py_DECREF(), Py_XINCREF() and Py_XDECREF() now + expand their arguments once instead of multiple times. Patch written by + Illia Polosukhin. -- Issue #17522: Add the PyGILState_Check() API. +- bpo-17522: Add the PyGILState_Check() API. -- Issue #17327: Add PyDict_SetDefault. +- bpo-17327: Add PyDict_SetDefault. -- Issue #16881: Fix Py_ARRAY_LENGTH macro for GCC < 3.1. +- bpo-16881: Fix Py_ARRAY_LENGTH macro for GCC < 3.1. -- Issue #16505: Remove unused Py_TPFLAGS_INT_SUBCLASS. +- bpo-16505: Remove unused Py_TPFLAGS_INT_SUBCLASS. -- Issue #16086: PyTypeObject.tp_flags and PyType_Spec.flags are now unsigned +- bpo-16086: PyTypeObject.tp_flags and PyType_Spec.flags are now unsigned (unsigned long and unsigned int) to avoid an undefined behaviour with - Py_TPFLAGS_TYPE_SUBCLASS ((1 << 31). PyType_GetFlags() result type is - now unsigned too (unsigned long, instead of long). + Py_TPFLAGS_TYPE_SUBCLASS ((1 << 31). PyType_GetFlags() result type is now + unsigned too (unsigned long, instead of long). -- Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified +- bpo-16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified endianness detection and handling. Documentation ------------- -- Issue #23006: Improve the documentation and indexing of dict.__missing__. - Add an entry in the language datamodel special methods section. - Revise and index its discussion in the stdtypes mapping/dict section. +- bpo-23006: Improve the documentation and indexing of dict.__missing__. Add + an entry in the language datamodel special methods section. Revise and + index its discussion in the stdtypes mapping/dict section. -- Issue #17701: Improving strftime documentation. +- bpo-17701: Improving strftime documentation. -- Issue #18440: Clarify that `hash()` can truncate the value returned from an +- bpo-18440: Clarify that `hash()` can truncate the value returned from an object's custom `__hash__()` method. -- Issue #17844: Add links to encoders and decoders for bytes-to-bytes codecs. +- bpo-17844: Add links to encoders and decoders for bytes-to-bytes codecs. -- Issue #14097: improve the "introduction" page of the tutorial. +- bpo-14097: improve the "introduction" page of the tutorial. -- Issue #17977: The documentation for the cadefault argument's default value - in urllib.request.urlopen() is fixed to match the code. +- bpo-17977: The documentation for the cadefault argument's default value in + urllib.request.urlopen() is fixed to match the code. -- Issue #6696: add documentation for the Profile objects, and improve +- bpo-6696: add documentation for the Profile objects, and improve profile/cProfile docs. Patch by Tom Pinckney. -- Issue #15940: Specify effect of locale on time functions. +- bpo-15940: Specify effect of locale on time functions. -- Issue #17538: Document XML vulnerabilties +- bpo-17538: Document XML vulnerabilties -- Issue #16642: sched.scheduler timefunc initial default is time.monotonic. +- bpo-16642: sched.scheduler timefunc initial default is time.monotonic. Patch by Ramchandra Apte -- Issue #17047: remove doubled words in docs and docstrings - reported by Serhiy Storchaka and Matthew Barnett. +- bpo-17047: remove doubled words in docs and docstrings reported by Serhiy + Storchaka and Matthew Barnett. -- Issue #15465: Document the versioning macros in the C API docs rather than +- bpo-15465: Document the versioning macros in the C API docs rather than the standard library docs. Patch by Kushal Das. -- Issue #16406: Combine the pages for uploading and registering to PyPI. +- bpo-16406: Combine the pages for uploading and registering to PyPI. -- Issue #16403: Document how distutils uses the maintainer field in - PKG-INFO. Patch by Jyrki Pulliainen. +- bpo-16403: Document how distutils uses the maintainer field in PKG-INFO. + Patch by Jyrki Pulliainen. -- Issue #16695: Document how glob handles filenames starting with a - dot. Initial patch by Jyrki Pulliainen. +- bpo-16695: Document how glob handles filenames starting with a dot. + Initial patch by Jyrki Pulliainen. -- Issue #8890: Stop advertising an insecure practice by replacing uses - of the /tmp directory with better alternatives in the documentation. - Patch by Geoff Wilson. +- bpo-8890: Stop advertising an insecure practice by replacing uses of the + /tmp directory with better alternatives in the documentation. Patch by + Geoff Wilson. -- Issue #17203: add long option names to unittest discovery docs. +- bpo-17203: add long option names to unittest discovery docs. -- Issue #13094: add "Why do lambdas defined in a loop with different values - all return the same result?" programming FAQ. +- bpo-13094: add "Why do lambdas defined in a loop with different values all + return the same result?" programming FAQ. -- Issue #14901: Update portions of the Windows FAQ. - Patch by Ashish Nitin Patil. +- bpo-14901: Update portions of the Windows FAQ. Patch by Ashish Nitin + Patil. -- Issue #16267: Better document the 3.3+ approach to combining - @abstractmethod with @staticmethod, @classmethod and @property +- bpo-16267: Better document the 3.3+ approach to combining @abstractmethod + with @staticmethod, @classmethod and @property -- Issue #15209: Clarify exception chaining description in exceptions module +- bpo-15209: Clarify exception chaining description in exceptions module documentation -- Issue #15990: Improve argument/parameter documentation. +- bpo-15990: Improve argument/parameter documentation. -- Issue #16209: Move the documentation for the str built-in function to a new +- bpo-16209: Move the documentation for the str built-in function to a new str class entry in the "Text Sequence Type" section. -- Issue #13538: Improve str() and object.__str__() documentation. +- bpo-13538: Improve str() and object.__str__() documentation. -- Issue #16489: Make it clearer that importlib.find_loader() needs parent +- bpo-16489: Make it clearer that importlib.find_loader() needs parent packages to be explicitly imported. -- Issue #16400: Update the description of which versions of a given package +- bpo-16400: Update the description of which versions of a given package PyPI displays. -- Issue #15677: Document that zlib and gzip accept a compression level of 0 to +- bpo-15677: Document that zlib and gzip accept a compression level of 0 to mean 'no compression'. Patch by Brian Brazil. -- Issue #16197: Update winreg docstrings and documentation to match code. - Patch by Zachary Ware. +- bpo-16197: Update winreg docstrings and documentation to match code. Patch + by Zachary Ware. -- Issue #8040: added a version switcher to the documentation. Patch by - Yury Selivanov. +- bpo-8040: added a version switcher to the documentation. Patch by Yury + Selivanov. -- Issue #16241: Document -X faulthandler command line option. - Patch by Marek Å uppa. +- bpo-16241: Document -X faulthandler command line option. Patch by Marek + Å uppa. - Additional comments and some style changes in the concurrent.futures URL retrieval example -- Issue #16115: Improve subprocess.Popen() documentation around args, shell, +- bpo-16115: Improve subprocess.Popen() documentation around args, shell, and executable arguments. -- Issue #13498: Clarify docs of os.makedirs()'s exist_ok argument. Done with - great native-speaker help from R. David Murray. +- bpo-13498: Clarify docs of os.makedirs()'s exist_ok argument. Done with + great native- speaker help from R. David Murray. -- Issue #15533: Clarify docs and add tests for `subprocess.Popen()`'s cwd +- bpo-15533: Clarify docs and add tests for `subprocess.Popen()`'s cwd argument. -- Issue #15979: Improve timeit documentation. +- bpo-15979: Improve timeit documentation. -- Issue #16036: Improve documentation of built-in `int()`'s signature and +- bpo-16036: Improve documentation of built-in `int()`'s signature and arguments. -- Issue #15935: Clarification of `argparse` docs, re: add_argument() type and +- bpo-15935: Clarification of `argparse` docs, re: add_argument() type and default arguments. Patch contributed by Chris Jerdonek. -- Issue #11964: Document a change in v3.2 to the behavior of the indent +- bpo-11964: Document a change in v3.2 to the behavior of the indent parameter of json encoding operations. -- Issue #15116: Remove references to appscript as it is no longer being +- bpo-15116: Remove references to appscript as it is no longer being supported. Tools/Demos ----------- -- Issue #18817: Fix a resource warning in Lib/aifc.py demo. Patch by - Vajrasky Kok. +- bpo-18817: Fix a resource warning in Lib/aifc.py demo. Patch by Vajrasky + Kok. -- Issue #18439: Make patchcheck work on Windows for ACKS, NEWS. +- bpo-18439: Make patchcheck work on Windows for ACKS, NEWS. -- Issue #18448: Fix a typo in Tools/demo/eiffel.py. +- bpo-18448: Fix a typo in Tools/demo/eiffel.py. -- Issue #18457: Fixed saving of formulas and complex numbers in +- bpo-18457: Fixed saving of formulas and complex numbers in Tools/demo/ss1.py. -- Issue #18449: Make Tools/demo/ss1.py work again on Python 3. Patch by - Févry Thibault. +- bpo-18449: Make Tools/demo/ss1.py work again on Python 3. Patch by Févry + Thibault. -- Issue #12990: The "Python Launcher" on OSX could not launch python scripts +- bpo-12990: The "Python Launcher" on OSX could not launch python scripts that have paths that include wide characters. -- Issue #15239: Make mkstringprep.py work again on Python 3. +- bpo-15239: Make mkstringprep.py work again on Python 3. -- Issue #17028: Allowed Python arguments to be supplied to the Windows +- bpo-17028: Allowed Python arguments to be supplied to the Windows launcher. -- Issue #17156: pygettext.py now detects the encoding of source files and +- bpo-17156: pygettext.py now detects the encoding of source files and correctly writes and escapes non-ascii characters. -- Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py. Now +- bpo-15539: Fix a number of bugs in Tools/scripts/pindent.py. Now pindent.py works with a "with" statement. pindent.py no longer produces - improper indentation. pindent.py now works with continued lines broken after - "class" or "def" keywords and with continuations at the start of line. + improper indentation. pindent.py now works with continued lines broken + after "class" or "def" keywords and with continuations at the start of + line. -- Issue #11797: Add a 2to3 fixer that maps reload() to imp.reload(). +- bpo-11797: Add a 2to3 fixer that maps reload() to imp.reload(). -- Issue #10966: Remove the concept of unexpected skipped tests. +- bpo-10966: Remove the concept of unexpected skipped tests. -- Issue #9893: Removed the Misc/Vim directory. +- bpo-9893: Removed the Misc/Vim directory. - Removed the Misc/TextMate directory. -- Issue #16245: Add the Tools/scripts/parse_html5_entities.py script to parse +- bpo-16245: Add the Tools/scripts/parse_html5_entities.py script to parse the list of HTML5 entities and update the html.entities.html5 dictionary. -- Issue #15378: Fix Tools/unicode/comparecodecs.py. Patch by Serhiy Storchaka. +- bpo-15378: Fix Tools/unicode/comparecodecs.py. Patch by Serhiy Storchaka. -- Issue #16549: Make json.tool work again on Python 3 and add tests. - Initial patch by Berker Peksag and Serhiy Storchaka. +- bpo-16549: Make json.tool work again on Python 3 and add tests. Initial + patch by Berker Peksag and Serhiy Storchaka. -- Issue #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. - Patch by Serhiy Storchaka. +- bpo-13301: use ast.literal_eval() instead of eval() in + Tools/i18n/msgfmt.py. Patch by Serhiy Storchaka. Windows ------- -- Issue #18569: The installer now adds .py to the PATHEXT variable when extensions - are registered. Patch by Paul Moore. +- bpo-18569: The installer now adds .py to the PATHEXT variable when + extensions are registered. Patch by Paul Moore. + **(For information about older versions, consult the HISTORY file.)** diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 10fbcfe..08fceca 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -913,8 +913,8 @@ deque_index(dequeobject *deque, PyObject *args) size_t start_state = deque->state; if (!PyArg_ParseTuple(args, "O|O&O&:index", &v, - _PyEval_SliceIndex, &start, - _PyEval_SliceIndex, &stop)) + _PyEval_SliceIndexNotNone, &start, + _PyEval_SliceIndexNotNone, &stop)) return NULL; if (start < 0) { start += Py_SIZE(deque); @@ -2169,7 +2169,7 @@ static PyTypeObject defdict_type = { PyDoc_STRVAR(_count_elements_doc, "_count_elements(mapping, iterable) -> None\n\ \n\ -Count elements in the iterable, updating the mappping"); +Count elements in the iterable, updating the mapping"); static PyObject * _count_elements(PyObject *self, PyObject *args) diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index b32a0ce..33fe659 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -4279,11 +4279,10 @@ Array_subscript(PyObject *myself, PyObject *item) PyObject *np; Py_ssize_t start, stop, step, slicelen, cur, i; - if (PySlice_GetIndicesEx(item, - self->b_length, &start, &stop, - &step, &slicelen) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return NULL; } + slicelen = PySlice_AdjustIndices(self->b_length, &start, &stop, step); stgdict = PyObject_stgdict((PyObject *)self); assert(stgdict); /* Cannot be NULL for array object instances */ @@ -4420,11 +4419,10 @@ Array_ass_subscript(PyObject *myself, PyObject *item, PyObject *value) else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelen, otherlen, i, cur; - if (PySlice_GetIndicesEx(item, - self->b_length, &start, &stop, - &step, &slicelen) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return -1; } + slicelen = PySlice_AdjustIndices(self->b_length, &start, &stop, step); if ((step < 0 && start < stop) || (step > 0 && start > stop)) stop = start; diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c index 3c7f892..e3240c5 100644 --- a/Modules/_ctypes/_ctypes_test.c +++ b/Modules/_ctypes/_ctypes_test.c @@ -44,6 +44,19 @@ _testfunc_cbk_large_struct(Test in, void (*func)(Test)) func(in); } +/* + * See issue 29565. Update a structure passed by value; + * the caller should not see any change. + */ + +EXPORT(void) +_testfunc_large_struct_update_value(Test in) +{ + ((volatile Test *)&in)->first = 0x0badf00d; + ((volatile Test *)&in)->second = 0x0badf00d; + ((volatile Test *)&in)->third = 0x0badf00d; +} + EXPORT(void)testfunc_array(int values[4]) { printf("testfunc_array %d %d %d %d\n", diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index abd3bc9..70e416b 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -672,7 +672,7 @@ static int ConvParam(PyObject *obj, Py_ssize_t index, struct argument *pa) #ifdef CTYPES_UNICODE if (PyUnicode_Check(obj)) { pa->ffi_type = &ffi_type_pointer; - pa->value.p = PyUnicode_AsWideCharString(obj, NULL); + pa->value.p = _PyUnicode_AsWideCharString(obj); if (pa->value.p == NULL) return -1; pa->keep = PyCapsule_New(pa->value.p, CTYPES_CAPSULE_NAME_PYMEM, pymem_destructor); @@ -1235,14 +1235,15 @@ The handle may be used to locate exported functions in this\n\ module.\n"; static PyObject *load_library(PyObject *self, PyObject *args) { - WCHAR *name; + const WCHAR *name; PyObject *nameobj; PyObject *ignored; HMODULE hMod; - if (!PyArg_ParseTuple(args, "O|O:LoadLibrary", &nameobj, &ignored)) + + if (!PyArg_ParseTuple(args, "U|O:LoadLibrary", &nameobj, &ignored)) return NULL; - name = PyUnicode_AsUnicode(nameobj); + name = _PyUnicode_AsUnicode(nameobj); if (!name) return NULL; diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c index d666be5..cb5c3ce 100644 --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -1386,7 +1386,7 @@ Z_set(void *ptr, PyObject *value, Py_ssize_t size) /* We must create a wchar_t* buffer from the unicode object, and keep it alive */ - buffer = PyUnicode_AsWideCharString(value, NULL); + buffer = _PyUnicode_AsWideCharString(value); if (!buffer) return NULL; keep = PyCapsule_New(buffer, CTYPES_CFIELD_CAPSULE_NAME_PYMEM, pymem_destructor); diff --git a/Modules/_ctypes/libffi_msvc/ffi.c b/Modules/_ctypes/libffi_msvc/ffi.c index 1d82929..91a27dc 100644 --- a/Modules/_ctypes/libffi_msvc/ffi.c +++ b/Modules/_ctypes/libffi_msvc/ffi.c @@ -239,6 +239,16 @@ ffi_call(/*@dependent@*/ ffi_cif *cif, break; #else case FFI_SYSV: + /* If a single argument takes more than 8 bytes, + then a copy is passed by reference. */ + for (unsigned i = 0; i < cif->nargs; i++) { + size_t z = cif->arg_types[i]->size; + if (z > 8) { + void *temp = alloca(z); + memcpy(temp, avalue[i], z); + avalue[i] = temp; + } + } /*@-usedef@*/ return ffi_call_AMD64(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 896d40d..0cf17de 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -342,10 +342,11 @@ static int PyCurses_ConvertToString(PyCursesWindowObject *win, PyObject *obj, PyObject **bytes, wchar_t **wstr) { + char *str; if (PyUnicode_Check(obj)) { #ifdef HAVE_NCURSESW assert (wstr != NULL); - *wstr = PyUnicode_AsWideCharString(obj, NULL); + *wstr = _PyUnicode_AsWideCharString(obj); if (*wstr == NULL) return 0; return 2; @@ -354,12 +355,20 @@ PyCurses_ConvertToString(PyCursesWindowObject *win, PyObject *obj, *bytes = PyUnicode_AsEncodedString(obj, win->encoding, NULL); if (*bytes == NULL) return 0; + /* check for embedded null bytes */ + if (PyBytes_AsStringAndSize(*bytes, &str, NULL) < 0) { + return 0; + } return 1; #endif } else if (PyBytes_Check(obj)) { Py_INCREF(obj); *bytes = obj; + /* check for embedded null bytes */ + if (PyBytes_AsStringAndSize(*bytes, &str, NULL) < 0) { + return 0; + } return 1; } diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index 6efdc91..e15941a 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -1119,12 +1119,12 @@ context_getattr(PyObject *self, PyObject *name) PyObject *retval; if (PyUnicode_Check(name)) { - if (_PyUnicode_EqualToASCIIString(name, "traps")) { + if (PyUnicode_CompareWithASCIIString(name, "traps") == 0) { retval = ((PyDecContextObject *)self)->traps; Py_INCREF(retval); return retval; } - if (_PyUnicode_EqualToASCIIString(name, "flags")) { + if (PyUnicode_CompareWithASCIIString(name, "flags") == 0) { retval = ((PyDecContextObject *)self)->flags; Py_INCREF(retval); return retval; @@ -1144,10 +1144,10 @@ context_setattr(PyObject *self, PyObject *name, PyObject *value) } if (PyUnicode_Check(name)) { - if (_PyUnicode_EqualToASCIIString(name, "traps")) { + if (PyUnicode_CompareWithASCIIString(name, "traps") == 0) { return context_settraps_dict(self, value); } - if (_PyUnicode_EqualToASCIIString(name, "flags")) { + if (PyUnicode_CompareWithASCIIString(name, "flags") == 0) { return context_setstatus_dict(self, value); } } @@ -2446,14 +2446,14 @@ dectuple_as_str(PyObject *dectuple) tmp = PyTuple_GET_ITEM(dectuple, 2); if (PyUnicode_Check(tmp)) { /* special */ - if (_PyUnicode_EqualToASCIIString(tmp, "F")) { + if (PyUnicode_CompareWithASCIIString(tmp, "F") == 0) { strcat(sign_special, "Inf"); is_infinite = 1; } - else if (_PyUnicode_EqualToASCIIString(tmp, "n")) { + else if (PyUnicode_CompareWithASCIIString(tmp, "n") == 0) { strcat(sign_special, "NaN"); } - else if (_PyUnicode_EqualToASCIIString(tmp, "N")) { + else if (PyUnicode_CompareWithASCIIString(tmp, "N") == 0) { strcat(sign_special, "sNaN"); } else { diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 7d50dd0..fedef10 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -155,7 +155,7 @@ deepcopy(PyObject* object, PyObject* memo) LOCAL(PyObject*) list_join(PyObject* list) { - /* join list elements (destroying the list in the process) */ + /* join list elements */ PyObject* joiner; PyObject* result; @@ -164,8 +164,6 @@ list_join(PyObject* list) return NULL; result = PyUnicode_Join(joiner, list); Py_DECREF(joiner); - if (result) - Py_DECREF(list); return result; } @@ -534,15 +532,17 @@ element_get_text(ElementObject* self) { /* return borrowed reference to text attribute */ - PyObject* res = self->text; + PyObject *res = self->text; if (JOIN_GET(res)) { res = JOIN_OBJ(res); if (PyList_CheckExact(res)) { - res = list_join(res); - if (!res) + PyObject *tmp = list_join(res); + if (!tmp) return NULL; - self->text = res; + self->text = tmp; + Py_DECREF(res); + res = tmp; } } @@ -554,15 +554,17 @@ element_get_tail(ElementObject* self) { /* return borrowed reference to text attribute */ - PyObject* res = self->tail; + PyObject *res = self->tail; if (JOIN_GET(res)) { res = JOIN_OBJ(res); if (PyList_CheckExact(res)) { - res = list_join(res); - if (!res) + PyObject *tmp = list_join(res); + if (!tmp) return NULL; - self->tail = res; + self->tail = tmp; + Py_DECREF(res); + res = tmp; } } @@ -1686,11 +1688,11 @@ element_subscr(PyObject* self_, PyObject* item) if (!self->extra) return PyList_New(0); - if (PySlice_GetIndicesEx(item, - self->extra->length, - &start, &stop, &step, &slicelen) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return NULL; } + slicelen = PySlice_AdjustIndices(self->extra->length, &start, &stop, + step); if (slicelen <= 0) return PyList_New(0); @@ -1742,11 +1744,11 @@ element_ass_subscr(PyObject* self_, PyObject* item, PyObject* value) return -1; } - if (PySlice_GetIndicesEx(item, - self->extra->length, - &start, &stop, &step, &slicelen) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return -1; } + slicelen = PySlice_AdjustIndices(self->extra->length, &start, &stop, + step); if (value == NULL) { /* Delete slice */ @@ -2147,6 +2149,12 @@ elementiter_next(ElementIterObject *it) cur_parent = it->parent_stack->parent; child_index = it->parent_stack->child_index; if (cur_parent->extra && child_index < cur_parent->extra->length) { + if (!PyObject_TypeCheck(cur_parent->extra->children[child_index], &Element_Type)) { + PyErr_Format(PyExc_AttributeError, + "'%.100s' object has no attribute 'iter'", + Py_TYPE(cur_parent->extra->children[child_index])->tp_name); + return NULL; + } elem = (ElementObject *)cur_parent->extra->children[child_index]; it->parent_stack->child_index++; it->parent_stack = parent_stack_push_new(it->parent_stack, @@ -2435,40 +2443,51 @@ treebuilder_dealloc(TreeBuilderObject *self) /* helpers for handling of arbitrary element-like objects */ static int -treebuilder_set_element_text_or_tail(PyObject *element, PyObject *data, +treebuilder_set_element_text_or_tail(PyObject *element, PyObject **data, PyObject **dest, _Py_Identifier *name) { if (Element_CheckExact(element)) { - Py_DECREF(JOIN_OBJ(*dest)); - *dest = JOIN_SET(data, PyList_CheckExact(data)); + PyObject *tmp = JOIN_OBJ(*dest); + *dest = JOIN_SET(*data, PyList_CheckExact(*data)); + *data = NULL; + Py_DECREF(tmp); return 0; } else { - PyObject *joined = list_join(data); + PyObject *joined = list_join(*data); int r; if (joined == NULL) return -1; r = _PyObject_SetAttrId(element, name, joined); Py_DECREF(joined); - return r; + if (r < 0) + return -1; + Py_CLEAR(*data); + return 0; } } -/* These two functions steal a reference to data */ -static int -treebuilder_set_element_text(PyObject *element, PyObject *data) +LOCAL(int) +treebuilder_flush_data(TreeBuilderObject* self) { - _Py_IDENTIFIER(text); - return treebuilder_set_element_text_or_tail( - element, data, &((ElementObject *) element)->text, &PyId_text); -} + PyObject *element = self->last; -static int -treebuilder_set_element_tail(PyObject *element, PyObject *data) -{ - _Py_IDENTIFIER(tail); - return treebuilder_set_element_text_or_tail( - element, data, &((ElementObject *) element)->tail, &PyId_tail); + if (!self->data) { + return 0; + } + + if (self->this == element) { + _Py_IDENTIFIER(text); + return treebuilder_set_element_text_or_tail( + element, &self->data, + &((ElementObject *) element)->text, &PyId_text); + } + else { + _Py_IDENTIFIER(tail); + return treebuilder_set_element_text_or_tail( + element, &self->data, + &((ElementObject *) element)->tail, &PyId_tail); + } } static int @@ -2517,16 +2536,8 @@ treebuilder_handle_start(TreeBuilderObject* self, PyObject* tag, PyObject* this; elementtreestate *st = ET_STATE_GLOBAL; - if (self->data) { - if (self->this == self->last) { - if (treebuilder_set_element_text(self->last, self->data)) - return NULL; - } - else { - if (treebuilder_set_element_tail(self->last, self->data)) - return NULL; - } - self->data = NULL; + if (treebuilder_flush_data(self) < 0) { + return NULL; } if (self->element_factory && self->element_factory != Py_None) { @@ -2622,15 +2633,8 @@ treebuilder_handle_end(TreeBuilderObject* self, PyObject* tag) { PyObject* item; - if (self->data) { - if (self->this == self->last) { - if (treebuilder_set_element_text(self->last, self->data)) - return NULL; - } else { - if (treebuilder_set_element_tail(self->last, self->data)) - return NULL; - } - self->data = NULL; + if (treebuilder_flush_data(self) < 0) { + return NULL; } if (self->index == 0) { @@ -3948,6 +3952,11 @@ PyInit__elementtree(void) st->deepcopy_obj = PyObject_GetAttrString(temp, "deepcopy"); Py_XDECREF(temp); + if (st->deepcopy_obj == NULL) { + return NULL; + } + + assert(!PyErr_Occurred()); if (!(st->elementpath_obj = PyImport_ImportModule("xml.etree.ElementPath"))) return NULL; diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index 9c9ab5f..985bcb6 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -88,10 +88,13 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw) if (kw == NULL) { pto->kw = PyDict_New(); } - else { + else if (Py_REFCNT(kw) == 1) { Py_INCREF(kw); pto->kw = kw; } + else { + pto->kw = PyDict_Copy(kw); + } } else { pto->kw = PyDict_Copy(pkw); @@ -231,8 +234,11 @@ partial_repr(partialobject *pto) /* Pack keyword arguments */ assert (PyDict_Check(pto->kw)); for (i = 0; PyDict_Next(pto->kw, &i, &key, &value);) { - Py_SETREF(arglist, PyUnicode_FromFormat("%U, %U=%R", arglist, + /* Prevent key.__str__ from deleting the value. */ + Py_INCREF(value); + Py_SETREF(arglist, PyUnicode_FromFormat("%U, %S=%R", arglist, key, value)); + Py_DECREF(value); if (arglist == NULL) goto done; } @@ -864,42 +870,56 @@ bounded_lru_cache_wrapper(lru_cache_object *self, PyObject *args, PyObject *kwds } if (self->full && self->root.next != &self->root) { /* Use the oldest item to store the new key and result. */ - PyObject *oldkey, *oldresult; + PyObject *oldkey, *oldresult, *popresult; /* Extricate the oldest item. */ link = self->root.next; lru_cache_extricate_link(link); /* Remove it from the cache. The cache dict holds one reference to the link, and the linked list holds yet one reference to it. */ - if (_PyDict_DelItem_KnownHash(self->cache, link->key, - link->hash) < 0) { + popresult = _PyDict_Pop_KnownHash((PyDictObject *)self->cache, + link->key, link->hash, + Py_None); + if (popresult == Py_None) { + /* Getting here means that this same key was added to the + cache while the lock was released. Since the link + update is already done, we need only return the + computed result and update the count of misses. */ + Py_DECREF(popresult); + Py_DECREF(link); + Py_DECREF(key); + } + else if (popresult == NULL) { lru_cache_append_link(self, link); Py_DECREF(key); Py_DECREF(result); return NULL; } - /* Keep a reference to the old key and old result to - prevent their ref counts from going to zero during the - update. That will prevent potentially arbitrary object - clean-up code (i.e. __del__) from running while we're - still adjusting the links. */ - oldkey = link->key; - oldresult = link->result; - - link->hash = hash; - link->key = key; - link->result = result; - if (_PyDict_SetItem_KnownHash(self->cache, key, (PyObject *)link, - hash) < 0) { - Py_DECREF(link); + else { + Py_DECREF(popresult); + /* Keep a reference to the old key and old result to + prevent their ref counts from going to zero during the + update. That will prevent potentially arbitrary object + clean-up code (i.e. __del__) from running while we're + still adjusting the links. */ + oldkey = link->key; + oldresult = link->result; + + link->hash = hash; + link->key = key; + link->result = result; + if (_PyDict_SetItem_KnownHash(self->cache, key, (PyObject *)link, + hash) < 0) { + Py_DECREF(link); + Py_DECREF(oldkey); + Py_DECREF(oldresult); + return NULL; + } + lru_cache_append_link(self, link); + Py_INCREF(result); /* for return */ Py_DECREF(oldkey); Py_DECREF(oldresult); - return NULL; } - lru_cache_append_link(self, link); - Py_INCREF(result); /* for return */ - Py_DECREF(oldkey); - Py_DECREF(oldresult); } else { /* Put result in a new link at the front of the queue. */ link = (lru_list_elem *)PyObject_GC_New(lru_list_elem, diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 6d67751..909c4fa 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -1416,8 +1416,18 @@ buffered_repr(buffered *self) res = PyUnicode_FromFormat("<%s>", Py_TYPE(self)->tp_name); } else { - res = PyUnicode_FromFormat("<%s name=%R>", - Py_TYPE(self)->tp_name, nameobj); + int status = Py_ReprEnter((PyObject *)self); + res = NULL; + if (status == 0) { + res = PyUnicode_FromFormat("<%s name=%R>", + Py_TYPE(self)->tp_name, nameobj); + Py_ReprLeave((PyObject *)self); + } + else if (status > 0) { + PyErr_Format(PyExc_RuntimeError, + "reentrant call inside %s.__repr__", + Py_TYPE(self)->tp_name); + } Py_DECREF(nameobj); } return res; diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c index 919cf50..c77f055 100644 --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -1093,9 +1093,19 @@ fileio_repr(fileio *self) self->fd, mode_string(self), self->closefd ? "True" : "False"); } else { - res = PyUnicode_FromFormat( - "<_io.FileIO name=%R mode='%s' closefd=%s>", - nameobj, mode_string(self), self->closefd ? "True" : "False"); + int status = Py_ReprEnter((PyObject *)self); + res = NULL; + if (status == 0) { + res = PyUnicode_FromFormat( + "<_io.FileIO name=%R mode='%s' closefd=%s>", + nameobj, mode_string(self), self->closefd ? "True" : "False"); + Py_ReprLeave((PyObject *)self); + } + else if (status > 0) { + PyErr_Format(PyExc_RuntimeError, + "reentrant call inside %s.__repr__", + Py_TYPE(self)->tp_name); + } Py_DECREF(nameobj); } return res; diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c index 57541a8..9acd146 100644 --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -625,7 +625,8 @@ iobase_iternext(PyObject *self) if (line == NULL) return NULL; - if (PyObject_Size(line) == 0) { + if (PyObject_Size(line) <= 0) { + /* Error or empty */ Py_DECREF(line); return NULL; } @@ -650,7 +651,7 @@ _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint) /*[clinic end generated code: output=2f50421677fa3dea input=1961c4a95e96e661]*/ { Py_ssize_t length = 0; - PyObject *result; + PyObject *result, *it = NULL; result = PyList_New(0); if (result == NULL) @@ -664,19 +665,23 @@ _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint) PyObject *ret = _PyObject_CallMethodId(result, &PyId_extend, "O", self); if (ret == NULL) { - Py_DECREF(result); - return NULL; + goto error; } Py_DECREF(ret); return result; } + it = PyObject_GetIter(self); + if (it == NULL) { + goto error; + } + while (1) { - PyObject *line = PyIter_Next(self); + Py_ssize_t line_length; + PyObject *line = PyIter_Next(it); if (line == NULL) { if (PyErr_Occurred()) { - Py_DECREF(result); - return NULL; + goto error; } else break; /* StopIteration raised */ @@ -684,16 +689,25 @@ _io__IOBase_readlines_impl(PyObject *self, Py_ssize_t hint) if (PyList_Append(result, line) < 0) { Py_DECREF(line); - Py_DECREF(result); - return NULL; + goto error; } - length += PyObject_Size(line); + line_length = PyObject_Size(line); Py_DECREF(line); - - if (length > hint) + if (line_length < 0) { + goto error; + } + if (line_length > hint - length) break; + length += line_length; } + + Py_DECREF(it); return result; + + error: + Py_XDECREF(it); + Py_DECREF(result); + return NULL; } /*[clinic input] diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c index 46c99b5..3ab1138 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -1012,7 +1012,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer, errors); if (self->encoder == NULL) goto error; - /* Get the normalized named of the codec */ + /* Get the normalized name of the codec */ res = _PyObject_GetAttrId(codec_info, &PyId_name); if (res == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) @@ -2483,6 +2483,7 @@ static PyObject * textiowrapper_repr(textio *self) { PyObject *nameobj, *modeobj, *res, *s; + int status; CHECK_INITIALIZED(self); @@ -2490,6 +2491,15 @@ textiowrapper_repr(textio *self) if (res == NULL) return NULL; + status = Py_ReprEnter((PyObject *)self); + if (status != 0) { + if (status > 0) { + PyErr_Format(PyExc_RuntimeError, + "reentrant call inside %s.__repr__", + Py_TYPE(self)->tp_name); + } + goto error; + } nameobj = _PyObject_GetAttrId((PyObject *) self, &PyId_name); if (nameobj == NULL) { if (PyErr_ExceptionMatches(PyExc_Exception)) @@ -2504,7 +2514,7 @@ textiowrapper_repr(textio *self) goto error; PyUnicode_AppendAndDel(&res, s); if (res == NULL) - return NULL; + goto error; } modeobj = _PyObject_GetAttrId((PyObject *) self, &PyId_mode); if (modeobj == NULL) { @@ -2520,14 +2530,21 @@ textiowrapper_repr(textio *self) goto error; PyUnicode_AppendAndDel(&res, s); if (res == NULL) - return NULL; + goto error; } s = PyUnicode_FromFormat("%U encoding=%R>", res, self->encoding); Py_DECREF(res); + if (status == 0) { + Py_ReprLeave((PyObject *)self); + } return s; -error: + + error: Py_XDECREF(res); + if (status == 0) { + Py_ReprLeave((PyObject *)self); + } return NULL; } diff --git a/Modules/_json.c b/Modules/_json.c index f82af34..346bd55 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -89,16 +89,12 @@ static PyObject * _build_rval_index_tuple(PyObject *rval, Py_ssize_t idx); static PyObject * scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds); -static int -scanner_init(PyObject *self, PyObject *args, PyObject *kwds); static void scanner_dealloc(PyObject *self); static int scanner_clear(PyObject *self); static PyObject * encoder_new(PyTypeObject *type, PyObject *args, PyObject *kwds); -static int -encoder_init(PyObject *self, PyObject *args, PyObject *kwds); static void encoder_dealloc(PyObject *self); static int @@ -845,14 +841,16 @@ _parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssi int kind; Py_ssize_t end_idx; PyObject *val = NULL; - PyObject *rval = PyList_New(0); + PyObject *rval; Py_ssize_t next_idx; - if (rval == NULL) - return NULL; if (PyUnicode_READY(pystr) == -1) return NULL; + rval = PyList_New(0); + if (rval == NULL) + return NULL; + str = PyUnicode_DATA(pystr); kind = PyUnicode_KIND(pystr); end_idx = PyUnicode_GET_LENGTH(pystr) - 1; @@ -1201,38 +1199,21 @@ static PyObject * scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyScannerObject *s; - s = (PyScannerObject *)type->tp_alloc(type, 0); - if (s != NULL) { - s->strict = NULL; - s->object_hook = NULL; - s->object_pairs_hook = NULL; - s->parse_float = NULL; - s->parse_int = NULL; - s->parse_constant = NULL; - } - return (PyObject *)s; -} - -static int -scanner_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - /* Initialize Scanner object */ PyObject *ctx; static char *kwlist[] = {"context", NULL}; - PyScannerObject *s; - - assert(PyScanner_Check(self)); - s = (PyScannerObject *)self; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:make_scanner", kwlist, &ctx)) - return -1; + return NULL; - if (s->memo == NULL) { - s->memo = PyDict_New(); - if (s->memo == NULL) - goto bail; + s = (PyScannerObject *)type->tp_alloc(type, 0); + if (s == NULL) { + return NULL; } + s->memo = PyDict_New(); + if (s->memo == NULL) + goto bail; + /* All of these will fail "gracefully" so we don't need to verify them */ s->strict = PyObject_GetAttrString(ctx, "strict"); if (s->strict == NULL) @@ -1253,16 +1234,11 @@ scanner_init(PyObject *self, PyObject *args, PyObject *kwds) if (s->parse_constant == NULL) goto bail; - return 0; + return (PyObject *)s; bail: - Py_CLEAR(s->strict); - Py_CLEAR(s->object_hook); - Py_CLEAR(s->object_pairs_hook); - Py_CLEAR(s->parse_float); - Py_CLEAR(s->parse_int); - Py_CLEAR(s->parse_constant); - return -1; + Py_DECREF(s); + return NULL; } PyDoc_STRVAR(scanner_doc, "JSON scanner object"); @@ -1304,7 +1280,7 @@ PyTypeObject PyScannerType = { 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - scanner_init, /* tp_init */ + 0, /* tp_init */ 0,/* PyType_GenericAlloc, */ /* tp_alloc */ scanner_new, /* tp_new */ 0,/* PyObject_GC_Del, */ /* tp_free */ @@ -1313,25 +1289,6 @@ PyTypeObject PyScannerType = { static PyObject * encoder_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - PyEncoderObject *s; - s = (PyEncoderObject *)type->tp_alloc(type, 0); - if (s != NULL) { - s->markers = NULL; - s->defaultfn = NULL; - s->encoder = NULL; - s->indent = NULL; - s->key_separator = NULL; - s->item_separator = NULL; - s->sort_keys = NULL; - s->skipkeys = NULL; - } - return (PyObject *)s; -} - -static int -encoder_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - /* initialize Encoder object */ static char *kwlist[] = {"markers", "default", "encoder", "indent", "key_separator", "item_separator", "sort_keys", "skipkeys", "allow_nan", NULL}; PyEncoderObject *s; @@ -1339,22 +1296,23 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds) PyObject *item_separator, *sort_keys, *skipkeys; int allow_nan; - assert(PyEncoder_Check(self)); - s = (PyEncoderObject *)self; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOOUUOOp:make_encoder", kwlist, &markers, &defaultfn, &encoder, &indent, &key_separator, &item_separator, &sort_keys, &skipkeys, &allow_nan)) - return -1; + return NULL; if (markers != Py_None && !PyDict_Check(markers)) { PyErr_Format(PyExc_TypeError, "make_encoder() argument 1 must be dict or None, " "not %.200s", Py_TYPE(markers)->tp_name); - return -1; + return NULL; } + s = (PyEncoderObject *)type->tp_alloc(type, 0); + if (s == NULL) + return NULL; + s->markers = markers; s->defaultfn = defaultfn; s->encoder = encoder; @@ -1381,7 +1339,7 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds) Py_INCREF(s->item_separator); Py_INCREF(s->sort_keys); Py_INCREF(s->skipkeys); - return 0; + return (PyObject *)s; } static PyObject * @@ -1559,8 +1517,11 @@ encoder_listencode_obj(PyEncoderObject *s, _PyAccu *acc, return -1; } - if (Py_EnterRecursiveCall(" while encoding a JSON object")) + if (Py_EnterRecursiveCall(" while encoding a JSON object")) { + Py_DECREF(newobj); + Py_XDECREF(ident); return -1; + } rv = encoder_listencode_obj(s, acc, newobj, indent_level); Py_LeaveRecursiveCall(); @@ -1604,7 +1565,7 @@ encoder_listencode_dict(PyEncoderObject *s, _PyAccu *acc, if (open_dict == NULL || close_dict == NULL || empty_dict == NULL) return -1; } - if (Py_SIZE(dct) == 0) + if (PyDict_Size(dct) == 0) /* Fast path */ return _PyAccu_Accumulate(acc, empty_dict); if (s->markers != Py_None) { @@ -1640,8 +1601,10 @@ encoder_listencode_dict(PyEncoderObject *s, _PyAccu *acc, if (items == NULL) goto bail; sortkeys = PyObject_IsTrue(s->sort_keys); - if (sortkeys < 0 || (sortkeys && PyList_Sort(items) < 0)) + if (sortkeys < 0 || (sortkeys && PyList_Sort(items) < 0)) { + Py_DECREF(items); goto bail; + } it = PyObject_GetIter(items); Py_DECREF(items); if (it == NULL) @@ -1909,7 +1872,7 @@ PyTypeObject PyEncoderType = { 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - encoder_init, /* tp_init */ + 0, /* tp_init */ 0, /* tp_alloc */ encoder_new, /* tp_new */ 0, /* tp_free */ @@ -1952,10 +1915,8 @@ PyInit__json(void) PyObject *m = PyModule_Create(&jsonmodule); if (!m) return NULL; - PyScannerType.tp_new = PyType_GenericNew; if (PyType_Ready(&PyScannerType) < 0) goto fail; - PyEncoderType.tp_new = PyType_GenericNew; if (PyType_Ready(&PyEncoderType) < 0) goto fail; Py_INCREF((PyObject*)&PyScannerType); diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index b1307ef..39e0c54 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -215,10 +215,10 @@ PyLocale_strcoll(PyObject* self, PyObject* args) if (!PyArg_ParseTuple(args, "UU:strcoll", &os1, &os2)) return NULL; /* Convert the unicode strings to wchar[]. */ - ws1 = PyUnicode_AsWideCharString(os1, NULL); + ws1 = _PyUnicode_AsWideCharString(os1); if (ws1 == NULL) goto done; - ws2 = PyUnicode_AsWideCharString(os2, NULL); + ws2 = _PyUnicode_AsWideCharString(os2); if (ws2 == NULL) goto done; /* Collate the strings. */ @@ -252,6 +252,11 @@ PyLocale_strxfrm(PyObject* self, PyObject* args) s = PyUnicode_AsWideCharString(str, &n1); if (s == NULL) goto exit; + if (wcslen(s) != (size_t)n1) { + PyErr_SetString(PyExc_ValueError, + "embedded null character"); + goto exit; + } /* assume no change in size, first */ n1 = n1 + 1; diff --git a/Modules/_pickle.c b/Modules/_pickle.c index ac7f5c4..0f62b1c 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -1548,9 +1548,9 @@ memo_put(PicklerObject *self, PyObject *obj) } static PyObject * -get_dotted_path(PyObject *obj, PyObject *name) { +get_dotted_path(PyObject *obj, PyObject *name) +{ _Py_static_string(PyId_dot, "."); - _Py_static_string(PyId_locals, ""); PyObject *dotted_path; Py_ssize_t i, n; @@ -1561,12 +1561,7 @@ get_dotted_path(PyObject *obj, PyObject *name) { assert(n >= 1); for (i = 0; i < n; i++) { PyObject *subpath = PyList_GET_ITEM(dotted_path, i); - PyObject *result = PyUnicode_RichCompare( - subpath, _PyUnicode_FromId(&PyId_locals), Py_EQ); - int is_equal = (result == Py_True); - assert(PyBool_Check(result)); - Py_DECREF(result); - if (is_equal) { + if (_PyUnicode_EqualToASCIIString(subpath, "")) { if (obj == NULL) PyErr_Format(PyExc_AttributeError, "Can't pickle local object %R", name); @@ -3537,13 +3532,12 @@ save_reduce(PicklerObject *self, PyObject *args, PyObject *obj) else if (PyUnicode_Check(name)) { if (self->proto >= 4) { _Py_IDENTIFIER(__newobj_ex__); - use_newobj_ex = PyUnicode_Compare( - name, _PyUnicode_FromId(&PyId___newobj_ex__)) == 0; + use_newobj_ex = _PyUnicode_EqualToASCIIId( + name, &PyId___newobj_ex__); } if (!use_newobj_ex) { _Py_IDENTIFIER(__newobj__); - use_newobj = PyUnicode_Compare( - name, _PyUnicode_FromId(&PyId___newobj__)) == 0; + use_newobj = _PyUnicode_EqualToASCIIId(name, &PyId___newobj__); } } Py_XDECREF(name); diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index c0240e2..48c1953 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -112,13 +112,17 @@ _is_fdescfs_mounted_on_dev_fd(void) static int _sanity_check_python_fd_sequence(PyObject *fd_sequence) { - Py_ssize_t seq_idx, seq_len = PySequence_Length(fd_sequence); + Py_ssize_t seq_idx; long prev_fd = -1; - for (seq_idx = 0; seq_idx < seq_len; ++seq_idx) { - PyObject* py_fd = PySequence_Fast_GET_ITEM(fd_sequence, seq_idx); - long iter_fd = PyLong_AsLong(py_fd); + for (seq_idx = 0; seq_idx < PyTuple_GET_SIZE(fd_sequence); ++seq_idx) { + PyObject* py_fd = PyTuple_GET_ITEM(fd_sequence, seq_idx); + long iter_fd; + if (!PyLong_Check(py_fd)) { + return 1; + } + iter_fd = PyLong_AsLong(py_fd); if (iter_fd < 0 || iter_fd <= prev_fd || iter_fd > INT_MAX) { - /* Negative, overflow, not a Long, unsorted, too big for a fd. */ + /* Negative, overflow, unsorted, too big for a fd. */ return 1; } prev_fd = iter_fd; @@ -133,13 +137,12 @@ _is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence) { /* Binary search. */ Py_ssize_t search_min = 0; - Py_ssize_t search_max = PySequence_Length(fd_sequence) - 1; + Py_ssize_t search_max = PyTuple_GET_SIZE(fd_sequence) - 1; if (search_max < 0) return 0; do { long middle = (search_min + search_max) / 2; - long middle_fd = PyLong_AsLong( - PySequence_Fast_GET_ITEM(fd_sequence, middle)); + long middle_fd = PyLong_AsLong(PyTuple_GET_ITEM(fd_sequence, middle)); if (fd == middle_fd) return 1; if (fd > middle_fd) @@ -155,9 +158,9 @@ make_inheritable(PyObject *py_fds_to_keep, int errpipe_write) { Py_ssize_t i, len; - len = PySequence_Length(py_fds_to_keep); + len = PyTuple_GET_SIZE(py_fds_to_keep); for (i = 0; i < len; ++i) { - PyObject* fdobj = PySequence_Fast_GET_ITEM(py_fds_to_keep, i); + PyObject* fdobj = PyTuple_GET_ITEM(py_fds_to_keep, i); long fd = PyLong_AsLong(fdobj); assert(!PyErr_Occurred()); assert(0 <= fd && fd <= INT_MAX); @@ -214,14 +217,13 @@ static void _close_fds_by_brute_force(long start_fd, PyObject *py_fds_to_keep) { long end_fd = safe_get_max_fd(); - Py_ssize_t num_fds_to_keep = PySequence_Length(py_fds_to_keep); + Py_ssize_t num_fds_to_keep = PyTuple_GET_SIZE(py_fds_to_keep); Py_ssize_t keep_seq_idx; int fd_num; /* As py_fds_to_keep is sorted we can loop through the list closing * fds inbetween any in the keep list falling within our range. */ for (keep_seq_idx = 0; keep_seq_idx < num_fds_to_keep; ++keep_seq_idx) { - PyObject* py_keep_fd = PySequence_Fast_GET_ITEM(py_fds_to_keep, - keep_seq_idx); + PyObject* py_keep_fd = PyTuple_GET_ITEM(py_fds_to_keep, keep_seq_idx); int keep_fd = PyLong_AsLong(py_keep_fd); if (keep_fd < start_fd) continue; @@ -307,7 +309,7 @@ _close_open_fds_safe(int start_fd, PyObject* py_fds_to_keep) /* Close all open file descriptors from start_fd and higher. - * Do not close any in the sorted py_fds_to_keep list. + * Do not close any in the sorted py_fds_to_keep tuple. * * This function violates the strict use of async signal safe functions. :( * It calls opendir(), readdir() and closedir(). Of these, the one most @@ -563,8 +565,9 @@ subprocess_fork_exec(PyObject* self, PyObject *args) #endif if (!PyArg_ParseTuple( - args, "OOpOOOiiiiiiiiiiO:fork_exec", - &process_args, &executable_list, &close_fds, &py_fds_to_keep, + args, "OOpO!OOiiiiiiiiiiO:fork_exec", + &process_args, &executable_list, + &close_fds, &PyTuple_Type, &py_fds_to_keep, &cwd_obj, &env_list, &p2cread, &p2cwrite, &c2pread, &c2pwrite, &errread, &errwrite, &errpipe_read, &errpipe_write, @@ -575,10 +578,6 @@ subprocess_fork_exec(PyObject* self, PyObject *args) PyErr_SetString(PyExc_ValueError, "errpipe_write must be >= 3"); return NULL; } - if (PySequence_Length(py_fds_to_keep) < 0) { - PyErr_SetString(PyExc_ValueError, "cannot get length of fds_to_keep"); - return NULL; - } if (_sanity_check_python_fd_sequence(py_fds_to_keep)) { PyErr_SetString(PyExc_ValueError, "bad value(s) in fds_to_keep"); return NULL; @@ -632,6 +631,10 @@ subprocess_fork_exec(PyObject* self, PyObject *args) goto cleanup; for (arg_num = 0; arg_num < num_args; ++arg_num) { PyObject *borrowed_arg, *converted_arg; + if (PySequence_Fast_GET_SIZE(fast_args) != num_args) { + PyErr_SetString(PyExc_RuntimeError, "args changed during iteration"); + goto cleanup; + } borrowed_arg = PySequence_Fast_GET_ITEM(fast_args, arg_num); if (PyUnicode_FSConverter(borrowed_arg, &converted_arg) == 0) goto cleanup; diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c index 95ad4a4..acb116d 100644 --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -2,7 +2,7 @@ /* ------------------------------------------------------------------ The code in this module was based on a download from: - http://www.math.keio.ac.jp/~matumoto/MT2002/emt19937ar.html + http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html It was modified in 2002 by Raymond Hettinger as follows: @@ -60,8 +60,8 @@ Any feedback is very welcome. - http://www.math.keio.ac.jp/matumoto/emt.html - email: matumoto@math.keio.ac.jp + http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html + email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) */ /* ---------------------------------------------------------------*/ @@ -313,6 +313,7 @@ random_setstate(RandomObject *self, PyObject *state) int i; unsigned long element; long index; + PY_UINT32_T new_state[N]; if (!PyTuple_Check(state)) { PyErr_SetString(PyExc_TypeError, @@ -329,7 +330,7 @@ random_setstate(RandomObject *self, PyObject *state) element = PyLong_AsUnsignedLong(PyTuple_GET_ITEM(state, i)); if (element == (unsigned long)-1 && PyErr_Occurred()) return NULL; - self->state[i] = (PY_UINT32_T)element; + new_state[i] = (PY_UINT32_T)element; } index = PyLong_AsLong(PyTuple_GET_ITEM(state, i)); @@ -340,6 +341,8 @@ random_setstate(RandomObject *self, PyObject *state) return NULL; } self->index = (int)index; + for (i = 0; i < N; i++) + self->state[i] = new_state[i]; Py_INCREF(Py_None); return Py_None; diff --git a/Modules/_sre.c b/Modules/_sre.c index 09b5835..4b376ec 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2015,6 +2015,7 @@ match_getslice_by_index(MatchObject* self, Py_ssize_t index, PyObject* def) Py_buffer view; PyObject *result; void* ptr; + Py_ssize_t i, j; if (index < 0 || index >= self->groups) { /* raise IndexError if we were given a bad group number */ @@ -2036,8 +2037,12 @@ match_getslice_by_index(MatchObject* self, Py_ssize_t index, PyObject* def) ptr = getstring(self->string, &length, &isbytes, &charsize, &view); if (ptr == NULL) return NULL; - result = getslice(isbytes, ptr, - self->string, self->mark[index], self->mark[index+1]); + + i = self->mark[index]; + j = self->mark[index+1]; + i = Py_MIN(i, length); + j = Py_MIN(j, length); + result = getslice(isbytes, ptr, self->string, i, j); if (isbytes && view.buf != NULL) PyBuffer_Release(&view); return result; diff --git a/Modules/_ssl.c b/Modules/_ssl.c index a79c3a8..3b2d3ad 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -570,6 +570,7 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock, self->ssl = NULL; self->Socket = NULL; self->ctx = sslctx; + Py_INCREF(sslctx); self->shutdown_seen_zero = 0; self->handshake_done = 0; self->owner = NULL; @@ -584,8 +585,6 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock, self->server_hostname = hostname; } - Py_INCREF(sslctx); - /* Make sure the SSL error state is initialized */ (void) ERR_get_state(); ERR_clear_error(); @@ -1181,10 +1180,6 @@ _get_crl_dp(X509 *certificate) { int i, j; PyObject *lst, *res = NULL; -#if OPENSSL_VERSION_NUMBER >= 0x10001000L - /* Calls x509v3_cache_extensions and sets up crldp */ - X509_check_ca(certificate); -#endif dps = X509_get_ext_d2i(certificate, NID_crl_distribution_points, NULL, NULL); if (dps == NULL) @@ -1229,9 +1224,7 @@ _get_crl_dp(X509 *certificate) { done: Py_XDECREF(lst); -#if OPENSSL_VERSION_NUMBER < 0x10001000L - sk_DIST_POINT_free(dps); -#endif + CRL_DIST_POINTS_free(dps); return res; } @@ -2418,12 +2411,12 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version) #endif -#ifndef OPENSSL_NO_ECDH +#if !defined(OPENSSL_NO_ECDH) && !defined(OPENSSL_VERSION_1_1) /* Allow automatic ECDH curve selection (on OpenSSL 1.0.2+), or use prime256v1 by default. This is Apache mod_ssl's initialization policy, so we should be safe. OpenSSL 1.1 has it enabled by default. */ -#if defined(SSL_CTX_set_ecdh_auto) && !defined(OPENSSL_VERSION_1_1) +#if defined(SSL_CTX_set_ecdh_auto) SSL_CTX_set_ecdh_auto(self->ctx, 1); #else { diff --git a/Modules/_struct.c b/Modules/_struct.c index f965541..2273129 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -519,7 +519,7 @@ np_ubyte(char *p, PyObject *v, const formatdef *f) "ubyte format requires 0 <= number <= 255"); return -1; } - *p = (char)x; + *(unsigned char *)p = (unsigned char)x; return 0; } @@ -850,6 +850,7 @@ bp_int(char *p, PyObject *v, const formatdef *f) { long x; Py_ssize_t i; + unsigned char *q = (unsigned char *)p; if (get_long(v, &x) < 0) return -1; i = f->size; @@ -862,7 +863,7 @@ bp_int(char *p, PyObject *v, const formatdef *f) #endif } do { - p[--i] = (char)x; + q[--i] = (unsigned char)(x & 0xffL); x >>= 8; } while (i > 0); return 0; @@ -873,6 +874,7 @@ bp_uint(char *p, PyObject *v, const formatdef *f) { unsigned long x; Py_ssize_t i; + unsigned char *q = (unsigned char *)p; if (get_ulong(v, &x) < 0) return -1; i = f->size; @@ -883,7 +885,7 @@ bp_uint(char *p, PyObject *v, const formatdef *f) RANGE_ERROR(x, f, 1, maxint - 1); } do { - p[--i] = (char)x; + q[--i] = (unsigned char)(x & 0xffUL); x >>= 8; } while (i > 0); return 0; @@ -1070,6 +1072,7 @@ lp_int(char *p, PyObject *v, const formatdef *f) { long x; Py_ssize_t i; + unsigned char *q = (unsigned char *)p; if (get_long(v, &x) < 0) return -1; i = f->size; @@ -1082,7 +1085,7 @@ lp_int(char *p, PyObject *v, const formatdef *f) #endif } do { - *p++ = (char)x; + *q++ = (unsigned char)(x & 0xffL); x >>= 8; } while (--i > 0); return 0; @@ -1093,6 +1096,7 @@ lp_uint(char *p, PyObject *v, const formatdef *f) { unsigned long x; Py_ssize_t i; + unsigned char *q = (unsigned char *)p; if (get_ulong(v, &x) < 0) return -1; i = f->size; @@ -1103,7 +1107,7 @@ lp_uint(char *p, PyObject *v, const formatdef *f) RANGE_ERROR(x, f, 1, maxint - 1); } do { - *p++ = (char)x; + *q++ = (unsigned char)(x & 0xffUL); x >>= 8; } while (--i > 0); return 0; diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c index 43db8a8..0885a03 100644 --- a/Modules/_testbuffer.c +++ b/Modules/_testbuffer.c @@ -1714,10 +1714,10 @@ init_slice(Py_buffer *base, PyObject *key, int dim) { Py_ssize_t start, stop, step, slicelength; - if (PySlice_GetIndicesEx(key, base->shape[dim], - &start, &stop, &step, &slicelength) < 0) { + if (PySlice_Unpack(key, &start, &stop, &step) < 0) { return -1; } + slicelength = PySlice_AdjustIndices(base->shape[dim], &start, &stop, step); if (base->suboffsets == NULL || dim == 0) { @@ -1934,9 +1934,10 @@ slice_indices(PyObject *self, PyObject *args) "first argument must be a slice object"); return NULL; } - if (PySlice_GetIndicesEx(key, len, &s[0], &s[1], &s[2], &s[3]) < 0) { + if (PySlice_Unpack(key, &s[0], &s[1], &s[2]) < 0) { return NULL; } + s[3] = PySlice_AdjustIndices(len, &s[0], &s[1], s[2]); ret = PyTuple_New(4); if (ret == NULL) diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 060a92d..fabcaab 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1548,7 +1548,7 @@ parse_tuple_and_keywords(PyObject *self, PyObject *args) { PyObject *sub_args; PyObject *sub_kwargs; - char *sub_format; + const char *sub_format; PyObject *sub_keywords; Py_ssize_t i, size; @@ -1561,7 +1561,7 @@ parse_tuple_and_keywords(PyObject *self, PyObject *args) double buffers[8][4]; /* double ensures alignment where necessary */ - if (!PyArg_ParseTuple(args, "OOyO:parse_tuple_and_keywords", + if (!PyArg_ParseTuple(args, "OOsO:parse_tuple_and_keywords", &sub_args, &sub_kwargs, &sub_format, &sub_keywords)) return NULL; diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 163c87f..34f2d09 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -3620,7 +3620,7 @@ PyInit__tkinter(void) return NULL; } if (str_path != NULL) { - wcs_path = PyUnicode_AsWideCharString(str_path, NULL); + wcs_path = _PyUnicode_AsWideCharString(str_path); if (wcs_path == NULL) { return NULL; } diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 65bf7a3..e2a8e69 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -62,12 +62,15 @@ typedef struct #ifdef __GNUC__ __attribute__((packed)) #elif defined(_MSC_VER) -_declspec(align(4)) +#pragma pack(push, 4) #endif { PyObject *filename; unsigned int lineno; } frame_t; +#ifdef _MSC_VER +#pragma pack(pop) +#endif typedef struct { Py_uhash_t hash; @@ -1408,7 +1411,7 @@ _PyTraceMalloc_Init(void) if (key == NULL) return -1; - value = PyDict_GetItemWithError(xoptions, key); + value = PyDict_GetItemWithError(xoptions, key); /* borrowed */ Py_DECREF(key); if (value == NULL) { if (PyErr_Occurred()) @@ -1419,7 +1422,6 @@ _PyTraceMalloc_Init(void) } nframe = parse_sys_xoptions(value); - Py_DECREF(value); if (nframe < 0) { Py_FatalError("-X tracemalloc=NFRAME: invalid number of frames"); } diff --git a/Modules/_winapi.c b/Modules/_winapi.c index edc6cf4..a911a39 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -722,23 +722,42 @@ getenvironment(PyObject* environment) return NULL; } - envsize = PyMapping_Length(environment); - keys = PyMapping_Keys(environment); values = PyMapping_Values(environment); if (!keys || !values) goto error; + envsize = PySequence_Fast_GET_SIZE(keys); + if (PySequence_Fast_GET_SIZE(values) != envsize) { + PyErr_SetString(PyExc_RuntimeError, + "environment changed size during iteration"); + goto error; + } + totalsize = 1; /* trailing null character */ for (i = 0; i < envsize; i++) { - PyObject* key = PyList_GET_ITEM(keys, i); - PyObject* value = PyList_GET_ITEM(values, i); + PyObject* key = PySequence_Fast_GET_ITEM(keys, i); + PyObject* value = PySequence_Fast_GET_ITEM(values, i); if (! PyUnicode_Check(key) || ! PyUnicode_Check(value)) { PyErr_SetString(PyExc_TypeError, "environment can only contain strings"); goto error; } + if (PyUnicode_FindChar(key, '\0', 0, PyUnicode_GET_LENGTH(key), 1) != -1 || + PyUnicode_FindChar(value, '\0', 0, PyUnicode_GET_LENGTH(value), 1) != -1) + { + PyErr_SetString(PyExc_ValueError, "embedded null character"); + goto error; + } + /* Search from index 1 because on Windows starting '=' is allowed for + defining hidden environment variables. */ + if (PyUnicode_GET_LENGTH(key) == 0 || + PyUnicode_FindChar(key, '=', 1, PyUnicode_GET_LENGTH(key), 1) != -1) + { + PyErr_SetString(PyExc_ValueError, "illegal environment variable name"); + goto error; + } if (totalsize > PY_SSIZE_T_MAX - PyUnicode_GET_LENGTH(key) - 1) { PyErr_SetString(PyExc_OverflowError, "environment too long"); goto error; @@ -760,8 +779,8 @@ getenvironment(PyObject* environment) end = buffer + totalsize; for (i = 0; i < envsize; i++) { - PyObject* key = PyList_GET_ITEM(keys, i); - PyObject* value = PyList_GET_ITEM(values, i); + PyObject* key = PySequence_Fast_GET_ITEM(keys, i); + PyObject* value = PySequence_Fast_GET_ITEM(values, i); if (!PyUnicode_AsUCS4(key, p, end - p, 0)) goto error; p += PyUnicode_GET_LENGTH(key); @@ -841,12 +860,13 @@ _winapi_CreateProcess_impl(PyObject *module, Py_UNICODE *application_name, if (env_mapping != Py_None) { environment = getenvironment(env_mapping); - if (! environment) + if (environment == NULL) { return NULL; + } + /* contains embedded null characters */ wenvironment = PyUnicode_AsUnicode(environment); - if (wenvironment == NULL) - { - Py_XDECREF(environment); + if (wenvironment == NULL) { + Py_DECREF(environment); return NULL; } } diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index a4966b4..f615a69 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -331,35 +331,51 @@ II_getitem(arrayobject *ap, Py_ssize_t i) (unsigned long) ((unsigned int *)ap->ob_item)[i]); } +static PyObject * +get_int_unless_float(PyObject *v) +{ + if (PyFloat_Check(v)) { + PyErr_SetString(PyExc_TypeError, + "array item must be integer"); + return NULL; + } + return (PyObject *)_PyLong_FromNbInt(v); +} + static int II_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) { unsigned long x; - if (PyLong_Check(v)) { - x = PyLong_AsUnsignedLong(v); - if (x == (unsigned long) -1 && PyErr_Occurred()) + int do_decref = 0; /* if nb_int was called */ + + if (!PyLong_Check(v)) { + v = get_int_unless_float(v); + if (NULL == v) { return -1; + } + do_decref = 1; } - else { - long y; - if (!PyArg_Parse(v, "l;array item must be integer", &y)) - return -1; - if (y < 0) { - PyErr_SetString(PyExc_OverflowError, - "unsigned int is less than minimum"); - return -1; + x = PyLong_AsUnsignedLong(v); + if (x == (unsigned long)-1 && PyErr_Occurred()) { + if (do_decref) { + Py_DECREF(v); } - x = (unsigned long)y; - + return -1; } if (x > UINT_MAX) { PyErr_SetString(PyExc_OverflowError, - "unsigned int is greater than maximum"); + "unsigned int is greater than maximum"); + if (do_decref) { + Py_DECREF(v); + } return -1; } - if (i >= 0) ((unsigned int *)ap->ob_item)[i] = (unsigned int)x; + + if (do_decref) { + Py_DECREF(v); + } return 0; } @@ -390,31 +406,28 @@ static int LL_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) { unsigned long x; - if (PyLong_Check(v)) { - x = PyLong_AsUnsignedLong(v); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return -1; - } - else { - long y; - if (!PyArg_Parse(v, "l;array item must be integer", &y)) - return -1; - if (y < 0) { - PyErr_SetString(PyExc_OverflowError, - "unsigned long is less than minimum"); + int do_decref = 0; /* if nb_int was called */ + + if (!PyLong_Check(v)) { + v = get_int_unless_float(v); + if (NULL == v) { return -1; } - x = (unsigned long)y; - + do_decref = 1; } - if (x > ULONG_MAX) { - PyErr_SetString(PyExc_OverflowError, - "unsigned long is greater than maximum"); + x = PyLong_AsUnsignedLong(v); + if (x == (unsigned long)-1 && PyErr_Occurred()) { + if (do_decref) { + Py_DECREF(v); + } return -1; } - if (i >= 0) ((unsigned long *)ap->ob_item)[i] = x; + + if (do_decref) { + Py_DECREF(v); + } return 0; } @@ -448,25 +461,28 @@ static int QQ_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) { unsigned PY_LONG_LONG x; - if (PyLong_Check(v)) { - x = PyLong_AsUnsignedLongLong(v); - if (x == (unsigned PY_LONG_LONG) -1 && PyErr_Occurred()) + int do_decref = 0; /* if nb_int was called */ + + if (!PyLong_Check(v)) { + v = get_int_unless_float(v); + if (NULL == v) { return -1; + } + do_decref = 1; } - else { - PY_LONG_LONG y; - if (!PyArg_Parse(v, "L;array item must be integer", &y)) - return -1; - if (y < 0) { - PyErr_SetString(PyExc_OverflowError, - "unsigned long long is less than minimum"); - return -1; + x = PyLong_AsUnsignedLongLong(v); + if (x == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred()) { + if (do_decref) { + Py_DECREF(v); } - x = (unsigned PY_LONG_LONG)y; + return -1; } - if (i >= 0) ((unsigned PY_LONG_LONG *)ap->ob_item)[i] = x; + + if (do_decref) { + Py_DECREF(v); + } return 0; } #endif @@ -2327,10 +2343,11 @@ array_subscr(arrayobject* self, PyObject* item) arrayobject* ar; int itemsize = self->ob_descr->itemsize; - if (PySlice_GetIndicesEx(item, Py_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return NULL; } + slicelength = PySlice_AdjustIndices(Py_SIZE(self), &start, &stop, + step); if (slicelength <= 0) { return newarrayobject(&Arraytype, 0, self->ob_descr); @@ -2398,11 +2415,11 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value) return (*self->ob_descr->setitem)(self, i, value); } else if (PySlice_Check(item)) { - if (PySlice_GetIndicesEx(item, - Py_SIZE(self), &start, &stop, - &step, &slicelength) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return -1; } + slicelength = PySlice_AdjustIndices(Py_SIZE(self), &start, &stop, + step); } else { PyErr_SetString(PyExc_TypeError, diff --git a/Modules/atexitmodule.c b/Modules/atexitmodule.c index 3cdf2d7..35ebf08 100644 --- a/Modules/atexitmodule.c +++ b/Modules/atexitmodule.c @@ -97,7 +97,7 @@ atexit_callfuncs(void) Py_XDECREF(exc_tb); } PyErr_Fetch(&exc_type, &exc_value, &exc_tb); - if (!PyErr_ExceptionMatches(PyExc_SystemExit)) { + if (!PyErr_GivenExceptionMatches(exc_type, PyExc_SystemExit)) { PySys_WriteStderr("Error in atexit._run_exitfuncs:\n"); PyErr_NormalizeException(&exc_type, &exc_value, &exc_tb); PyErr_Display(exc_type, exc_value, exc_tb); diff --git a/Modules/cjkcodecs/_codecs_cn.c b/Modules/cjkcodecs/_codecs_cn.c index 1a070f2..1fcc220 100644 --- a/Modules/cjkcodecs/_codecs_cn.c +++ b/Modules/cjkcodecs/_codecs_cn.c @@ -279,7 +279,9 @@ DECODER(gb18030) REQUIRE_INBUF(4); c3 = INBYTE3; c4 = INBYTE4; - if (c < 0x81 || c3 < 0x81 || c4 < 0x30 || c4 > 0x39) + if (c < 0x81 || c > 0xFE || + c3 < 0x81 || c3 > 0xFE || + c4 < 0x30 || c4 > 0x39) return 1; c -= 0x81; c2 -= 0x30; c3 -= 0x81; c4 -= 0x30; @@ -348,15 +350,17 @@ ENCODER(hz) DBCHAR code; if (c < 0x80) { - if (state->i == 0) { - WRITEBYTE1((unsigned char)c); - NEXT(1, 1); - } - else { - WRITEBYTE3('~', '}', (unsigned char)c); - NEXT(1, 3); + if (state->i) { + WRITEBYTE2('~', '}'); + NEXT_OUT(2); state->i = 0; } + WRITEBYTE1((unsigned char)c); + NEXT(1, 1); + if (c == '~') { + WRITEBYTE1('~'); + NEXT_OUT(1); + } continue; } @@ -407,17 +411,14 @@ DECODER(hz) unsigned char c2 = INBYTE2; REQUIRE_INBUF(2); - if (c2 == '~') { + if (c2 == '~' && state->i == 0) OUTCHAR('~'); - NEXT_IN(2); - continue; - } else if (c2 == '{' && state->i == 0) state->i = 1; /* set GB */ + else if (c2 == '\n' && state->i == 0) + ; /* line-continuation */ else if (c2 == '}' && state->i == 1) state->i = 0; /* set ASCII */ - else if (c2 == '\n') - ; /* line-continuation */ else return 1; NEXT_IN(2); diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index f5c8421..61750ed 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -1670,6 +1670,9 @@ _multibytecodec_MultibyteStreamWriter_writelines(MultibyteStreamWriterObject *se if (r == -1) return NULL; } + /* PySequence_Length() can fail */ + if (PyErr_Occurred()) + return NULL; Py_RETURN_NONE; } diff --git a/Modules/expat/COPYING b/Modules/expat/COPYING index dcb4506..8d288f0 100644 --- a/Modules/expat/COPYING +++ b/Modules/expat/COPYING @@ -1,6 +1,5 @@ -Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - and Clark Cooper -Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers. +Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper +Copyright (c) 2001-2017 Expat maintainers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/Modules/expat/amigaconfig.h b/Modules/expat/amigaconfig.h deleted file mode 100644 index 86c6115..0000000 --- a/Modules/expat/amigaconfig.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef AMIGACONFIG_H -#define AMIGACONFIG_H - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#define BYTEORDER 4321 - -/* Define to 1 if you have the `bcopy' function. */ -#define HAVE_BCOPY 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_CHECK_H - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* whether byteorder is bigendian */ -#define WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#define XML_CONTEXT_BYTES 1024 - -/* Define to make parameter entity parsing functionality available. */ -#define XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#define XML_NS - -#endif /* AMIGACONFIG_H */ diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h index e8eefdd..28b0f95 100644 --- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -95,7 +95,9 @@ enum XML_Error { /* Added in 2.0. */ XML_ERROR_RESERVED_PREFIX_XML, XML_ERROR_RESERVED_PREFIX_XMLNS, - XML_ERROR_RESERVED_NAMESPACE_URI + XML_ERROR_RESERVED_NAMESPACE_URI, + /* Added in 2.2.1. */ + XML_ERROR_INVALID_ARGUMENT }; enum XML_Content_Type { @@ -342,7 +344,7 @@ XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler); /* OBSOLETE -- OBSOLETE -- OBSOLETE - This handler has been superceded by the EntityDeclHandler above. + This handler has been superseded by the EntityDeclHandler above. It is provided here for backward compatibility. This is called for a declaration of an unparsed (NDATA) entity. @@ -706,6 +708,7 @@ XML_UseParserAsHandlerArg(XML_Parser parser); be called, despite an external subset being parsed. Note: If XML_DTD is not defined when Expat is compiled, returns XML_ERROR_FEATURE_REQUIRES_XML_DTD. + Note: If parser == NULL, returns XML_ERROR_INVALID_ARGUMENT. */ XMLPARSEAPI(enum XML_Error) XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); @@ -729,15 +732,16 @@ XML_GetBase(XML_Parser parser); to the XML_StartElementHandler that were specified in the start-tag rather than defaulted. Each attribute/value pair counts as 2; thus this correspondds to an index into the atts array passed to the - XML_StartElementHandler. + XML_StartElementHandler. Returns -1 if parser == NULL. */ XMLPARSEAPI(int) XML_GetSpecifiedAttributeCount(XML_Parser parser); /* Returns the index of the ID attribute passed in the last call to - XML_StartElementHandler, or -1 if there is no ID attribute. Each - attribute/value pair counts as 2; thus this correspondds to an - index into the atts array passed to the XML_StartElementHandler. + XML_StartElementHandler, or -1 if there is no ID attribute or + parser == NULL. Each attribute/value pair counts as 2; thus this + correspondds to an index into the atts array passed to the + XML_StartElementHandler. */ XMLPARSEAPI(int) XML_GetIdAttributeIndex(XML_Parser parser); @@ -901,6 +905,7 @@ enum XML_ParamEntityParsing { entities is requested; otherwise it will return non-zero. Note: If XML_SetParamEntityParsing is called after XML_Parse or XML_ParseBuffer, then it has no effect and will always return 0. + Note: If parser == NULL, the function will do nothing and return 0. */ XMLPARSEAPI(int) XML_SetParamEntityParsing(XML_Parser parser, @@ -910,13 +915,12 @@ XML_SetParamEntityParsing(XML_Parser parser, Helps in preventing DoS attacks based on predicting hash function behavior. This must be called before parsing is started. Returns 1 if successful, 0 when called after parsing has started. + Note: If parser == NULL, the function will do nothing and return 0. */ XMLPARSEAPI(int) XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt); -#define XML_HAS_SET_HASH_SALT /* Python Only: Defined for pyexpat.c. */ - /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then XML_GetErrorCode returns information about the error. */ @@ -938,6 +942,10 @@ XML_GetErrorCode(XML_Parser parser); the location is the location of the character at which the error was detected; otherwise the location is the location of the last parse event, as described above. + + Note: XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber + return 0 to indicate an error. + Note: XML_GetCurrentByteIndex returns -1 to indicate an error. */ XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); @@ -975,9 +983,12 @@ XML_FreeContentModel(XML_Parser parser, XML_Content *model); /* Exposing the memory handling functions used in Expat */ XMLPARSEAPI(void *) +XML_ATTR_MALLOC +XML_ATTR_ALLOC_SIZE(2) XML_MemMalloc(XML_Parser parser, size_t size); XMLPARSEAPI(void *) +XML_ATTR_ALLOC_SIZE(3) XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); XMLPARSEAPI(void) @@ -1033,13 +1044,11 @@ XMLPARSEAPI(const XML_Feature *) XML_GetFeatureList(void); -/* Expat follows the GNU/Linux convention of odd number minor version for - beta/development releases and even number minor version for stable - releases. Micro is bumped with each release, and set to 0 with each - change to major or minor version. +/* Expat follows the semantic versioning convention. + See http://semver.org. */ #define XML_MAJOR_VERSION 2 -#define XML_MINOR_VERSION 1 +#define XML_MINOR_VERSION 2 #define XML_MICRO_VERSION 1 #ifdef __cplusplus diff --git a/Modules/expat/expat_external.h b/Modules/expat/expat_external.h index f337e1c..4c9e5ea 100644 --- a/Modules/expat/expat_external.h +++ b/Modules/expat/expat_external.h @@ -69,12 +69,26 @@ #endif #endif /* not defined XML_STATIC */ +#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4) +#define XMLIMPORT __attribute__ ((visibility ("default"))) +#endif /* If we didn't define it above, define it away: */ #ifndef XMLIMPORT #define XMLIMPORT #endif +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) +#define XML_ATTR_MALLOC __attribute__((__malloc__)) +#else +#define XML_ATTR_MALLOC +#endif + +#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) +#define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) +#else +#define XML_ATTR_ALLOC_SIZE(x) +#endif #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL @@ -83,7 +97,10 @@ extern "C" { #endif #ifdef XML_UNICODE_WCHAR_T -#define XML_UNICODE +# define XML_UNICODE +# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2) +# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc" +# endif #endif #ifdef XML_UNICODE /* Information is UTF-16 encoded. */ diff --git a/Modules/expat/internal.h b/Modules/expat/internal.h index dd54548..94cb98e 100644 --- a/Modules/expat/internal.h +++ b/Modules/expat/internal.h @@ -71,3 +71,25 @@ #define inline #endif #endif + +#ifndef UNUSED_P +# ifdef __GNUC__ +# define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__)) +# else +# define UNUSED_P(p) UNUSED_ ## p +# endif +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +void +align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef); + + +#ifdef __cplusplus +} +#endif diff --git a/Modules/expat/macconfig.h b/Modules/expat/macconfig.h deleted file mode 100644 index 2725caa..0000000 --- a/Modules/expat/macconfig.h +++ /dev/null @@ -1,53 +0,0 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) -** -*/ - -#ifndef MACCONFIG_H -#define MACCONFIG_H - - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#define BYTEORDER 4321 - -/* Define to 1 if you have the `bcopy' function. */ -#undef HAVE_BCOPY - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* whether byteorder is bigendian */ -#define WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#undef XML_CONTEXT_BYTES - -/* Define to make parameter entity parsing functionality available. */ -#define XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#define XML_NS - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `long' if does not define. */ -#define off_t long - -/* Define to `unsigned' if does not define. */ -#undef size_t - - -#endif /* ifndef MACCONFIG_H */ diff --git a/Modules/expat/siphash.h b/Modules/expat/siphash.h new file mode 100644 index 0000000..23b56d2 --- /dev/null +++ b/Modules/expat/siphash.h @@ -0,0 +1,344 @@ +/* ========================================================================== + * siphash.h - SipHash-2-4 in a single header file + * -------------------------------------------------------------------------- + * Derived by William Ahern from the reference implementation[1] published[2] + * by Jean-Philippe Aumasson and Daniel J. Berstein. Licensed in kind. + * by Jean-Philippe Aumasson and Daniel J. Berstein. + * Minimal changes by Sebastian Pipping on top, details below. + * Licensed under the CC0 Public Domain Dedication license. + * + * 1. https://www.131002.net/siphash/siphash24.c + * 2. https://www.131002.net/siphash/ + * -------------------------------------------------------------------------- + * HISTORY: + * + * 2017-06-10 (Sebastian Pipping) + * - Clarify license note in the header + * - Address C89 issues: + * - Stop using inline keyword (and let compiler decide) + * - Turn integer suffix ULL to UL + * - Replace _Bool by int + * - Turn macro siphash24 into a function + * - Address invalid conversion (void pointer) by explicit cast + * - Always expose sip24_valid (for self-tests) + * + * 2012-11-04 - Born. (William Ahern) + * -------------------------------------------------------------------------- + * USAGE: + * + * SipHash-2-4 takes as input two 64-bit words as the key, some number of + * message bytes, and outputs a 64-bit word as the message digest. This + * implementation employs two data structures: a struct sipkey for + * representing the key, and a struct siphash for representing the hash + * state. + * + * For converting a 16-byte unsigned char array to a key, use either the + * macro sip_keyof or the routine sip_tokey. The former instantiates a + * compound literal key, while the latter requires a key object as a + * parameter. + * + * unsigned char secret[16]; + * arc4random_buf(secret, sizeof secret); + * struct sipkey *key = sip_keyof(secret); + * + * For hashing a message, use either the convenience macro siphash24 or the + * routines sip24_init, sip24_update, and sip24_final. + * + * struct siphash state; + * void *msg; + * size_t len; + * uint64_t hash; + * + * sip24_init(&state, key); + * sip24_update(&state, msg, len); + * hash = sip24_final(&state); + * + * or + * + * hash = siphash24(msg, len, key); + * + * To convert the 64-bit hash value to a canonical 8-byte little-endian + * binary representation, use either the macro sip_binof or the routine + * sip_tobin. The former instantiates and returns a compound literal array, + * while the latter requires an array object as a parameter. + * -------------------------------------------------------------------------- + * NOTES: + * + * o Neither sip_keyof, sip_binof, nor siphash24 will work with compilers + * lacking compound literal support. Instead, you must use the lower-level + * interfaces which take as parameters the temporary state objects. + * + * o Uppercase macros may evaluate parameters more than once. Lowercase + * macros should not exhibit any such side effects. + * ========================================================================== + */ +#ifndef SIPHASH_H +#define SIPHASH_H + +#include /* size_t */ +#include /* uint64_t uint32_t uint8_t */ + + +#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ( (x) >> (64 - (b)))) + +#define SIP_U32TO8_LE(p, v) \ + (p)[0] = (uint8_t)((v) >> 0); (p)[1] = (uint8_t)((v) >> 8); \ + (p)[2] = (uint8_t)((v) >> 16); (p)[3] = (uint8_t)((v) >> 24); + +#define SIP_U64TO8_LE(p, v) \ + SIP_U32TO8_LE((p) + 0, (uint32_t)((v) >> 0)); \ + SIP_U32TO8_LE((p) + 4, (uint32_t)((v) >> 32)); + +#define SIP_U8TO64_LE(p) \ + (((uint64_t)((p)[0]) << 0) | \ + ((uint64_t)((p)[1]) << 8) | \ + ((uint64_t)((p)[2]) << 16) | \ + ((uint64_t)((p)[3]) << 24) | \ + ((uint64_t)((p)[4]) << 32) | \ + ((uint64_t)((p)[5]) << 40) | \ + ((uint64_t)((p)[6]) << 48) | \ + ((uint64_t)((p)[7]) << 56)) + + +#define SIPHASH_INITIALIZER { 0, 0, 0, 0, { 0 }, 0, 0 } + +struct siphash { + uint64_t v0, v1, v2, v3; + + unsigned char buf[8], *p; + uint64_t c; +}; /* struct siphash */ + + +#define SIP_KEYLEN 16 + +struct sipkey { + uint64_t k[2]; +}; /* struct sipkey */ + +#define sip_keyof(k) sip_tokey(&(struct sipkey){ { 0 } }, (k)) + +static struct sipkey *sip_tokey(struct sipkey *key, const void *src) { + key->k[0] = SIP_U8TO64_LE((const unsigned char *)src); + key->k[1] = SIP_U8TO64_LE((const unsigned char *)src + 8); + return key; +} /* sip_tokey() */ + + +#define sip_binof(v) sip_tobin((unsigned char[8]){ 0 }, (v)) + +static void *sip_tobin(void *dst, uint64_t u64) { + SIP_U64TO8_LE((unsigned char *)dst, u64); + return dst; +} /* sip_tobin() */ + + +static void sip_round(struct siphash *H, const int rounds) { + int i; + + for (i = 0; i < rounds; i++) { + H->v0 += H->v1; + H->v1 = SIP_ROTL(H->v1, 13); + H->v1 ^= H->v0; + H->v0 = SIP_ROTL(H->v0, 32); + + H->v2 += H->v3; + H->v3 = SIP_ROTL(H->v3, 16); + H->v3 ^= H->v2; + + H->v0 += H->v3; + H->v3 = SIP_ROTL(H->v3, 21); + H->v3 ^= H->v0; + + H->v2 += H->v1; + H->v1 = SIP_ROTL(H->v1, 17); + H->v1 ^= H->v2; + H->v2 = SIP_ROTL(H->v2, 32); + } +} /* sip_round() */ + + +static struct siphash *sip24_init(struct siphash *H, const struct sipkey *key) { + H->v0 = 0x736f6d6570736575UL ^ key->k[0]; + H->v1 = 0x646f72616e646f6dUL ^ key->k[1]; + H->v2 = 0x6c7967656e657261UL ^ key->k[0]; + H->v3 = 0x7465646279746573UL ^ key->k[1]; + + H->p = H->buf; + H->c = 0; + + return H; +} /* sip24_init() */ + + +#define sip_endof(a) (&(a)[sizeof (a) / sizeof *(a)]) + +static struct siphash *sip24_update(struct siphash *H, const void *src, size_t len) { + const unsigned char *p = (const unsigned char *)src, *pe = p + len; + uint64_t m; + + do { + while (p < pe && H->p < sip_endof(H->buf)) + *H->p++ = *p++; + + if (H->p < sip_endof(H->buf)) + break; + + m = SIP_U8TO64_LE(H->buf); + H->v3 ^= m; + sip_round(H, 2); + H->v0 ^= m; + + H->p = H->buf; + H->c += 8; + } while (p < pe); + + return H; +} /* sip24_update() */ + + +static uint64_t sip24_final(struct siphash *H) { + char left = H->p - H->buf; + uint64_t b = (H->c + left) << 56; + + switch (left) { + case 7: b |= (uint64_t)H->buf[6] << 48; + case 6: b |= (uint64_t)H->buf[5] << 40; + case 5: b |= (uint64_t)H->buf[4] << 32; + case 4: b |= (uint64_t)H->buf[3] << 24; + case 3: b |= (uint64_t)H->buf[2] << 16; + case 2: b |= (uint64_t)H->buf[1] << 8; + case 1: b |= (uint64_t)H->buf[0] << 0; + case 0: break; + } + + H->v3 ^= b; + sip_round(H, 2); + H->v0 ^= b; + H->v2 ^= 0xff; + sip_round(H, 4); + + return H->v0 ^ H->v1 ^ H->v2 ^ H->v3; +} /* sip24_final() */ + + +static uint64_t siphash24(const void *src, size_t len, const struct sipkey *key) { + struct siphash state = SIPHASH_INITIALIZER; + return sip24_final(sip24_update(sip24_init(&state, key), src, len)); +} /* siphash24() */ + + +/* + * SipHash-2-4 output with + * k = 00 01 02 ... + * and + * in = (empty string) + * in = 00 (1 byte) + * in = 00 01 (2 bytes) + * in = 00 01 02 (3 bytes) + * ... + * in = 00 01 02 ... 3e (63 bytes) + */ +static int sip24_valid(void) { + static const unsigned char vectors[64][8] = { + { 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, }, + { 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, }, + { 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, }, + { 0x2d, 0x7e, 0xfb, 0xd7, 0x96, 0x66, 0x67, 0x85, }, + { 0xb7, 0x87, 0x71, 0x27, 0xe0, 0x94, 0x27, 0xcf, }, + { 0x8d, 0xa6, 0x99, 0xcd, 0x64, 0x55, 0x76, 0x18, }, + { 0xce, 0xe3, 0xfe, 0x58, 0x6e, 0x46, 0xc9, 0xcb, }, + { 0x37, 0xd1, 0x01, 0x8b, 0xf5, 0x00, 0x02, 0xab, }, + { 0x62, 0x24, 0x93, 0x9a, 0x79, 0xf5, 0xf5, 0x93, }, + { 0xb0, 0xe4, 0xa9, 0x0b, 0xdf, 0x82, 0x00, 0x9e, }, + { 0xf3, 0xb9, 0xdd, 0x94, 0xc5, 0xbb, 0x5d, 0x7a, }, + { 0xa7, 0xad, 0x6b, 0x22, 0x46, 0x2f, 0xb3, 0xf4, }, + { 0xfb, 0xe5, 0x0e, 0x86, 0xbc, 0x8f, 0x1e, 0x75, }, + { 0x90, 0x3d, 0x84, 0xc0, 0x27, 0x56, 0xea, 0x14, }, + { 0xee, 0xf2, 0x7a, 0x8e, 0x90, 0xca, 0x23, 0xf7, }, + { 0xe5, 0x45, 0xbe, 0x49, 0x61, 0xca, 0x29, 0xa1, }, + { 0xdb, 0x9b, 0xc2, 0x57, 0x7f, 0xcc, 0x2a, 0x3f, }, + { 0x94, 0x47, 0xbe, 0x2c, 0xf5, 0xe9, 0x9a, 0x69, }, + { 0x9c, 0xd3, 0x8d, 0x96, 0xf0, 0xb3, 0xc1, 0x4b, }, + { 0xbd, 0x61, 0x79, 0xa7, 0x1d, 0xc9, 0x6d, 0xbb, }, + { 0x98, 0xee, 0xa2, 0x1a, 0xf2, 0x5c, 0xd6, 0xbe, }, + { 0xc7, 0x67, 0x3b, 0x2e, 0xb0, 0xcb, 0xf2, 0xd0, }, + { 0x88, 0x3e, 0xa3, 0xe3, 0x95, 0x67, 0x53, 0x93, }, + { 0xc8, 0xce, 0x5c, 0xcd, 0x8c, 0x03, 0x0c, 0xa8, }, + { 0x94, 0xaf, 0x49, 0xf6, 0xc6, 0x50, 0xad, 0xb8, }, + { 0xea, 0xb8, 0x85, 0x8a, 0xde, 0x92, 0xe1, 0xbc, }, + { 0xf3, 0x15, 0xbb, 0x5b, 0xb8, 0x35, 0xd8, 0x17, }, + { 0xad, 0xcf, 0x6b, 0x07, 0x63, 0x61, 0x2e, 0x2f, }, + { 0xa5, 0xc9, 0x1d, 0xa7, 0xac, 0xaa, 0x4d, 0xde, }, + { 0x71, 0x65, 0x95, 0x87, 0x66, 0x50, 0xa2, 0xa6, }, + { 0x28, 0xef, 0x49, 0x5c, 0x53, 0xa3, 0x87, 0xad, }, + { 0x42, 0xc3, 0x41, 0xd8, 0xfa, 0x92, 0xd8, 0x32, }, + { 0xce, 0x7c, 0xf2, 0x72, 0x2f, 0x51, 0x27, 0x71, }, + { 0xe3, 0x78, 0x59, 0xf9, 0x46, 0x23, 0xf3, 0xa7, }, + { 0x38, 0x12, 0x05, 0xbb, 0x1a, 0xb0, 0xe0, 0x12, }, + { 0xae, 0x97, 0xa1, 0x0f, 0xd4, 0x34, 0xe0, 0x15, }, + { 0xb4, 0xa3, 0x15, 0x08, 0xbe, 0xff, 0x4d, 0x31, }, + { 0x81, 0x39, 0x62, 0x29, 0xf0, 0x90, 0x79, 0x02, }, + { 0x4d, 0x0c, 0xf4, 0x9e, 0xe5, 0xd4, 0xdc, 0xca, }, + { 0x5c, 0x73, 0x33, 0x6a, 0x76, 0xd8, 0xbf, 0x9a, }, + { 0xd0, 0xa7, 0x04, 0x53, 0x6b, 0xa9, 0x3e, 0x0e, }, + { 0x92, 0x59, 0x58, 0xfc, 0xd6, 0x42, 0x0c, 0xad, }, + { 0xa9, 0x15, 0xc2, 0x9b, 0xc8, 0x06, 0x73, 0x18, }, + { 0x95, 0x2b, 0x79, 0xf3, 0xbc, 0x0a, 0xa6, 0xd4, }, + { 0xf2, 0x1d, 0xf2, 0xe4, 0x1d, 0x45, 0x35, 0xf9, }, + { 0x87, 0x57, 0x75, 0x19, 0x04, 0x8f, 0x53, 0xa9, }, + { 0x10, 0xa5, 0x6c, 0xf5, 0xdf, 0xcd, 0x9a, 0xdb, }, + { 0xeb, 0x75, 0x09, 0x5c, 0xcd, 0x98, 0x6c, 0xd0, }, + { 0x51, 0xa9, 0xcb, 0x9e, 0xcb, 0xa3, 0x12, 0xe6, }, + { 0x96, 0xaf, 0xad, 0xfc, 0x2c, 0xe6, 0x66, 0xc7, }, + { 0x72, 0xfe, 0x52, 0x97, 0x5a, 0x43, 0x64, 0xee, }, + { 0x5a, 0x16, 0x45, 0xb2, 0x76, 0xd5, 0x92, 0xa1, }, + { 0xb2, 0x74, 0xcb, 0x8e, 0xbf, 0x87, 0x87, 0x0a, }, + { 0x6f, 0x9b, 0xb4, 0x20, 0x3d, 0xe7, 0xb3, 0x81, }, + { 0xea, 0xec, 0xb2, 0xa3, 0x0b, 0x22, 0xa8, 0x7f, }, + { 0x99, 0x24, 0xa4, 0x3c, 0xc1, 0x31, 0x57, 0x24, }, + { 0xbd, 0x83, 0x8d, 0x3a, 0xaf, 0xbf, 0x8d, 0xb7, }, + { 0x0b, 0x1a, 0x2a, 0x32, 0x65, 0xd5, 0x1a, 0xea, }, + { 0x13, 0x50, 0x79, 0xa3, 0x23, 0x1c, 0xe6, 0x60, }, + { 0x93, 0x2b, 0x28, 0x46, 0xe4, 0xd7, 0x06, 0x66, }, + { 0xe1, 0x91, 0x5f, 0x5c, 0xb1, 0xec, 0xa4, 0x6c, }, + { 0xf3, 0x25, 0x96, 0x5c, 0xa1, 0x6d, 0x62, 0x9f, }, + { 0x57, 0x5f, 0xf2, 0x8e, 0x60, 0x38, 0x1b, 0xe5, }, + { 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, } + }; + unsigned char in[64]; + struct sipkey k; + size_t i; + + sip_tokey(&k, "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017"); + + for (i = 0; i < sizeof in; ++i) { + in[i] = i; + + if (siphash24(in, i, &k) != SIP_U8TO64_LE(vectors[i])) + return 0; + } + + return 1; +} /* sip24_valid() */ + + +#if SIPHASH_MAIN + +#include + +int main(void) { + int ok = sip24_valid(); + + if (ok) + puts("OK"); + else + puts("FAIL"); + + return !ok; +} /* main() */ + +#endif /* SIPHASH_MAIN */ + + +#endif /* SIPHASH_H */ diff --git a/Modules/expat/watcomconfig.h b/Modules/expat/watcomconfig.h deleted file mode 100644 index 2f05e3f..0000000 --- a/Modules/expat/watcomconfig.h +++ /dev/null @@ -1,47 +0,0 @@ -/* expat_config.h for use with Open Watcom 1.5 and above. */ - -#ifndef WATCOMCONFIG_H -#define WATCOMCONFIG_H - -#ifdef __NT__ -#define WIN32_LEAN_AND_MEAN -#include -#undef WIN32_LEAN_AND_MEAN -#endif - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#define BYTEORDER 1234 - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "expat-bugs@mail.libexpat.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "expat" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "expat 2.0.0" - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.0.0" - -/* Define to specify how much context to retain around the current parse - point. */ -#define XML_CONTEXT_BYTES 1024 - -/* Define to make parameter entity parsing functionality available. */ -#define XML_DTD 1 - -/* Define to make XML Namespaces functionality available. */ -#define XML_NS 1 - -#endif - diff --git a/Modules/expat/winconfig.h b/Modules/expat/winconfig.h index c1b791d..9bf014d 100644 --- a/Modules/expat/winconfig.h +++ b/Modules/expat/winconfig.h @@ -17,6 +17,12 @@ #include #include + +#if defined(HAVE_EXPAT_CONFIG_H) /* e.g. MinGW */ +# include +#else /* !defined(HAVE_EXPAT_CONFIG_H) */ + + #define XML_NS 1 #define XML_DTD 1 #define XML_CONTEXT_BYTES 1024 @@ -27,4 +33,8 @@ /* Windows has memmove() available. */ #define HAVE_MEMMOVE + +#endif /* !defined(HAVE_EXPAT_CONFIG_H) */ + + #endif /* ndef WINCONFIG_H */ diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c index 4128387..daec151 100644 --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -1,29 +1,37 @@ /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd See the file COPYING for copying permission. -*/ -#define XML_BUILDING_EXPAT 1 + 77fea421d361dca90041d0040ecf1dca651167fadf2af79e990e35168d70d933 (2.2.1+) +*/ -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#elif defined(HAVE_EXPAT_CONFIG_H) -#include -#endif /* ndef COMPILED_FROM_DSP */ +#define _GNU_SOURCE 1 /* syscall prototype */ #include #include /* memset(), memcpy() */ #include #include /* UINT_MAX */ -#include /* time() */ +#include /* fprintf */ +#include /* getenv */ + +#ifdef _WIN32 +#define getpid GetCurrentProcessId +#else +#include /* gettimeofday() */ +#include /* getpid() */ +#include /* getpid() */ +#endif + +#define XML_BUILDING_EXPAT 1 + +#ifdef _WIN32 +#include "winconfig.h" +#elif defined(HAVE_EXPAT_CONFIG_H) +#include +#endif /* ndef _WIN32 */ #include "ascii.h" #include "expat.h" +#include "siphash.h" #ifdef XML_UNICODE #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX @@ -102,17 +110,11 @@ typedef struct { const XML_Memory_Handling_Suite *mem; } HASH_TABLE; -/* Basic character hash algorithm, taken from Python's string hash: - h = h * 1000003 ^ character, the constant being a prime number. +static size_t +keylen(KEY s); -*/ -#ifdef XML_UNICODE -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned short)(c)) -#else -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned char)(c)) -#endif +static void +copy_salt_to_sipkey(XML_Parser parser, struct sipkey * key); /* For probing (after a collision) we need a step size relative prime to the hash table size, which is a power of 2. We use double-hashing, @@ -348,6 +350,8 @@ doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr, XML_Bool haveMore); #endif /* XML_DTD */ +static void +freeBindings(XML_Parser parser, BINDING *bindings); static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const char *s, TAG_NAME *tagNamePtr, BINDING **bindingsPtr); @@ -432,7 +436,7 @@ static ELEMENT_TYPE * getElementType(XML_Parser parser, const ENCODING *enc, const char *ptr, const char *end); -static unsigned long generate_hash_secret_salt(void); +static unsigned long generate_hash_secret_salt(XML_Parser parser); static XML_Bool startParsing(XML_Parser parser); static XML_Parser @@ -690,12 +694,155 @@ static const XML_Char implicitContext[] = { ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0' }; + +#if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) +# include + +# if defined(HAVE_GETRANDOM) +# include /* getrandom */ +# else +# include /* syscall */ +# include /* SYS_getrandom */ +# endif + +/* Obtain entropy on Linux 3.17+ */ +static int +writeRandomBytes_getrandom(void * target, size_t count) { + int success = 0; /* full count bytes written? */ + size_t bytesWrittenTotal = 0; + const unsigned int getrandomFlags = 0; + + do { + void * const currentTarget = (void*)((char*)target + bytesWrittenTotal); + const size_t bytesToWrite = count - bytesWrittenTotal; + + const int bytesWrittenMore = +#if defined(HAVE_GETRANDOM) + getrandom(currentTarget, bytesToWrite, getrandomFlags); +#else + syscall(SYS_getrandom, currentTarget, bytesToWrite, getrandomFlags); +#endif + + if (bytesWrittenMore > 0) { + bytesWrittenTotal += bytesWrittenMore; + if (bytesWrittenTotal >= count) + success = 1; + } + } while (! success && (errno == EINTR || errno == EAGAIN)); + + return success; +} + +#endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */ + + +#ifdef _WIN32 + +typedef BOOLEAN (APIENTRY *RTLGENRANDOM_FUNC)(PVOID, ULONG); + +/* Obtain entropy on Windows XP / Windows Server 2003 and later. + * Hint on RtlGenRandom and the following article from libsodioum. + * + * Michael Howard: Cryptographically Secure Random number on Windows without using CryptoAPI + * https://blogs.msdn.microsoft.com/michael_howard/2005/01/14/cryptographically-secure-random-number-on-windows-without-using-cryptoapi/ + */ +static int +writeRandomBytes_RtlGenRandom(void * target, size_t count) { + int success = 0; /* full count bytes written? */ + const HMODULE advapi32 = LoadLibrary("ADVAPI32.DLL"); + + if (advapi32) { + const RTLGENRANDOM_FUNC RtlGenRandom + = (RTLGENRANDOM_FUNC)GetProcAddress(advapi32, "SystemFunction036"); + if (RtlGenRandom) { + if (RtlGenRandom((PVOID)target, (ULONG)count) == TRUE) { + success = 1; + } + } + FreeLibrary(advapi32); + } + + return success; +} + +#endif /* _WIN32 */ + + static unsigned long -generate_hash_secret_salt(void) +gather_time_entropy(void) { - unsigned int seed = time(NULL) % UINT_MAX; - srand(seed); - return rand(); +#ifdef _WIN32 + FILETIME ft; + GetSystemTimeAsFileTime(&ft); /* never fails */ + return ft.dwHighDateTime ^ ft.dwLowDateTime; +#else + struct timeval tv; + int gettimeofday_res; + + gettimeofday_res = gettimeofday(&tv, NULL); + assert (gettimeofday_res == 0); + + /* Microseconds time is <20 bits entropy */ + return tv.tv_usec; +#endif +} + +#if defined(HAVE_ARC4RANDOM_BUF) && defined(HAVE_LIBBSD) +# include +#endif + +static unsigned long +ENTROPY_DEBUG(const char * label, unsigned long entropy) { + const char * const EXPAT_ENTROPY_DEBUG = getenv("EXPAT_ENTROPY_DEBUG"); + if (EXPAT_ENTROPY_DEBUG && ! strcmp(EXPAT_ENTROPY_DEBUG, "1")) { + fprintf(stderr, "Entropy: %s --> 0x%0*lx (%lu bytes)\n", + label, + (int)sizeof(entropy) * 2, entropy, + (unsigned long)sizeof(entropy)); + } + return entropy; +} + +static unsigned long +generate_hash_secret_salt(XML_Parser parser) +{ + unsigned long entropy; + (void)parser; +#if defined(HAVE_ARC4RANDOM_BUF) || defined(__CloudABI__) + (void)gather_time_entropy; + arc4random_buf(&entropy, sizeof(entropy)); + return ENTROPY_DEBUG("arc4random_buf", entropy); +#else + /* Try high quality providers first .. */ +#ifdef _WIN32 + if (writeRandomBytes_RtlGenRandom((void *)&entropy, sizeof(entropy))) { + return ENTROPY_DEBUG("RtlGenRandom", entropy); + } +#elif defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) + if (writeRandomBytes_getrandom((void *)&entropy, sizeof(entropy))) { + return ENTROPY_DEBUG("getrandom", entropy); + } +#endif + /* .. and self-made low quality for backup: */ + + /* Process ID is 0 bits entropy if attacker has local access */ + entropy = gather_time_entropy() ^ getpid(); + + /* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */ + if (sizeof(unsigned long) == 4) { + return ENTROPY_DEBUG("fallback(4)", entropy * 2147483647); + } else { + return ENTROPY_DEBUG("fallback(8)", + entropy * (unsigned long)2305843009213693951); + } +#endif +} + +static unsigned long +get_hash_secret_salt(XML_Parser parser) { + if (parser->m_parentParser != NULL) + return get_hash_secret_salt(parser->m_parentParser); + return parser->m_hash_secret_salt; } static XML_Bool /* only valid for root parser */ @@ -703,7 +850,7 @@ startParsing(XML_Parser parser) { /* hash functions must be initialized before setContext() is called */ if (hash_secret_salt == 0) - hash_secret_salt = generate_hash_secret_salt(); + hash_secret_salt = generate_hash_secret_salt(parser); if (ns) { /* implicit context only set for root parser, since child parsers (i.e. external entity parsers) will inherit it @@ -926,6 +1073,10 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) { TAG *tStk; OPEN_INTERNAL_ENTITY *openEntityList; + + if (parser == NULL) + return XML_FALSE; + if (parentParser) return XML_FALSE; /* move tagStack to freeTagList */ @@ -960,6 +1111,8 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) enum XML_Status XMLCALL XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) { + if (parser == NULL) + return XML_STATUS_ERROR; /* Block after XML_Parse()/XML_ParseBuffer() has been called. XXX There's no way for the caller to determine which of the XXX possible error cases caused the XML_STATUS_ERROR return. @@ -983,52 +1136,88 @@ XML_ExternalEntityParserCreate(XML_Parser oldParser, { XML_Parser parser = oldParser; DTD *newDtd = NULL; - DTD *oldDtd = _dtd; - XML_StartElementHandler oldStartElementHandler = startElementHandler; - XML_EndElementHandler oldEndElementHandler = endElementHandler; - XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; - XML_ProcessingInstructionHandler oldProcessingInstructionHandler - = processingInstructionHandler; - XML_CommentHandler oldCommentHandler = commentHandler; - XML_StartCdataSectionHandler oldStartCdataSectionHandler - = startCdataSectionHandler; - XML_EndCdataSectionHandler oldEndCdataSectionHandler - = endCdataSectionHandler; - XML_DefaultHandler oldDefaultHandler = defaultHandler; - XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler - = unparsedEntityDeclHandler; - XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler; - XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler - = startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler - = endNamespaceDeclHandler; - XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; - XML_ExternalEntityRefHandler oldExternalEntityRefHandler - = externalEntityRefHandler; - XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler; - XML_UnknownEncodingHandler oldUnknownEncodingHandler - = unknownEncodingHandler; - XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler; - XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler; - XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler; - XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler; - ELEMENT_TYPE * oldDeclElementType = declElementType; - - void *oldUserData = userData; - void *oldHandlerArg = handlerArg; - XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities; - XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; + DTD *oldDtd; + XML_StartElementHandler oldStartElementHandler; + XML_EndElementHandler oldEndElementHandler; + XML_CharacterDataHandler oldCharacterDataHandler; + XML_ProcessingInstructionHandler oldProcessingInstructionHandler; + XML_CommentHandler oldCommentHandler; + XML_StartCdataSectionHandler oldStartCdataSectionHandler; + XML_EndCdataSectionHandler oldEndCdataSectionHandler; + XML_DefaultHandler oldDefaultHandler; + XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler; + XML_NotationDeclHandler oldNotationDeclHandler; + XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler; + XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler; + XML_NotStandaloneHandler oldNotStandaloneHandler; + XML_ExternalEntityRefHandler oldExternalEntityRefHandler; + XML_SkippedEntityHandler oldSkippedEntityHandler; + XML_UnknownEncodingHandler oldUnknownEncodingHandler; + XML_ElementDeclHandler oldElementDeclHandler; + XML_AttlistDeclHandler oldAttlistDeclHandler; + XML_EntityDeclHandler oldEntityDeclHandler; + XML_XmlDeclHandler oldXmlDeclHandler; + ELEMENT_TYPE * oldDeclElementType; + + void *oldUserData; + void *oldHandlerArg; + XML_Bool oldDefaultExpandInternalEntities; + XML_Parser oldExternalEntityRefHandlerArg; #ifdef XML_DTD - enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing; - int oldInEntityValue = prologState.inEntityValue; + enum XML_ParamEntityParsing oldParamEntityParsing; + int oldInEntityValue; +#endif + XML_Bool oldns_triplets; + /* Note that the new parser shares the same hash secret as the old + parser, so that dtdCopy and copyEntityTable can lookup values + from hash tables associated with either parser without us having + to worry which hash secrets each table has. + */ + unsigned long oldhash_secret_salt; + + /* Validate the oldParser parameter before we pull everything out of it */ + if (oldParser == NULL) + return NULL; + + /* Stash the original parser contents on the stack */ + oldDtd = _dtd; + oldStartElementHandler = startElementHandler; + oldEndElementHandler = endElementHandler; + oldCharacterDataHandler = characterDataHandler; + oldProcessingInstructionHandler = processingInstructionHandler; + oldCommentHandler = commentHandler; + oldStartCdataSectionHandler = startCdataSectionHandler; + oldEndCdataSectionHandler = endCdataSectionHandler; + oldDefaultHandler = defaultHandler; + oldUnparsedEntityDeclHandler = unparsedEntityDeclHandler; + oldNotationDeclHandler = notationDeclHandler; + oldStartNamespaceDeclHandler = startNamespaceDeclHandler; + oldEndNamespaceDeclHandler = endNamespaceDeclHandler; + oldNotStandaloneHandler = notStandaloneHandler; + oldExternalEntityRefHandler = externalEntityRefHandler; + oldSkippedEntityHandler = skippedEntityHandler; + oldUnknownEncodingHandler = unknownEncodingHandler; + oldElementDeclHandler = elementDeclHandler; + oldAttlistDeclHandler = attlistDeclHandler; + oldEntityDeclHandler = entityDeclHandler; + oldXmlDeclHandler = xmlDeclHandler; + oldDeclElementType = declElementType; + + oldUserData = userData; + oldHandlerArg = handlerArg; + oldDefaultExpandInternalEntities = defaultExpandInternalEntities; + oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; +#ifdef XML_DTD + oldParamEntityParsing = paramEntityParsing; + oldInEntityValue = prologState.inEntityValue; #endif - XML_Bool oldns_triplets = ns_triplets; + oldns_triplets = ns_triplets; /* Note that the new parser shares the same hash secret as the old parser, so that dtdCopy and copyEntityTable can lookup values from hash tables associated with either parser without us having to worry which hash secrets each table has. */ - unsigned long oldhash_secret_salt = hash_secret_salt; + oldhash_secret_salt = hash_secret_salt; #ifdef XML_DTD if (!context) @@ -1194,12 +1383,15 @@ XML_ParserFree(XML_Parser parser) void XMLCALL XML_UseParserAsHandlerArg(XML_Parser parser) { - handlerArg = parser; + if (parser != NULL) + handlerArg = parser; } enum XML_Error XMLCALL XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) { + if (parser == NULL) + return XML_ERROR_INVALID_ARGUMENT; #ifdef XML_DTD /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) @@ -1214,6 +1406,8 @@ XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) void XMLCALL XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) { + if (parser == NULL) + return; /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return; @@ -1223,6 +1417,8 @@ XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) void XMLCALL XML_SetUserData(XML_Parser parser, void *p) { + if (parser == NULL) + return; if (handlerArg == userData) handlerArg = userData = p; else @@ -1232,6 +1428,8 @@ XML_SetUserData(XML_Parser parser, void *p) enum XML_Status XMLCALL XML_SetBase(XML_Parser parser, const XML_Char *p) { + if (parser == NULL) + return XML_STATUS_ERROR; if (p) { p = poolCopyString(&_dtd->pool, p); if (!p) @@ -1246,18 +1444,24 @@ XML_SetBase(XML_Parser parser, const XML_Char *p) const XML_Char * XMLCALL XML_GetBase(XML_Parser parser) { + if (parser == NULL) + return NULL; return curBase; } int XMLCALL XML_GetSpecifiedAttributeCount(XML_Parser parser) { + if (parser == NULL) + return -1; return nSpecifiedAtts; } int XMLCALL XML_GetIdAttributeIndex(XML_Parser parser) { + if (parser == NULL) + return -1; return idAttIndex; } @@ -1265,6 +1469,8 @@ XML_GetIdAttributeIndex(XML_Parser parser) const XML_AttrInfo * XMLCALL XML_GetAttributeInfo(XML_Parser parser) { + if (parser == NULL) + return NULL; return attInfo; } #endif @@ -1274,6 +1480,8 @@ XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end) { + if (parser == NULL) + return; startElementHandler = start; endElementHandler = end; } @@ -1281,34 +1489,39 @@ XML_SetElementHandler(XML_Parser parser, void XMLCALL XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler start) { - startElementHandler = start; + if (parser != NULL) + startElementHandler = start; } void XMLCALL XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler end) { - endElementHandler = end; + if (parser != NULL) + endElementHandler = end; } void XMLCALL XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler) { - characterDataHandler = handler; + if (parser != NULL) + characterDataHandler = handler; } void XMLCALL XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler) { - processingInstructionHandler = handler; + if (parser != NULL) + processingInstructionHandler = handler; } void XMLCALL XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler) { - commentHandler = handler; + if (parser != NULL) + commentHandler = handler; } void XMLCALL @@ -1316,6 +1529,8 @@ XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end) { + if (parser == NULL) + return; startCdataSectionHandler = start; endCdataSectionHandler = end; } @@ -1323,19 +1538,23 @@ XML_SetCdataSectionHandler(XML_Parser parser, void XMLCALL XML_SetStartCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start) { - startCdataSectionHandler = start; + if (parser != NULL) + startCdataSectionHandler = start; } void XMLCALL XML_SetEndCdataSectionHandler(XML_Parser parser, XML_EndCdataSectionHandler end) { - endCdataSectionHandler = end; + if (parser != NULL) + endCdataSectionHandler = end; } void XMLCALL XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler) { + if (parser == NULL) + return; defaultHandler = handler; defaultExpandInternalEntities = XML_FALSE; } @@ -1344,6 +1563,8 @@ void XMLCALL XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler) { + if (parser == NULL) + return; defaultHandler = handler; defaultExpandInternalEntities = XML_TRUE; } @@ -1353,6 +1574,8 @@ XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end) { + if (parser == NULL) + return; startDoctypeDeclHandler = start; endDoctypeDeclHandler = end; } @@ -1360,27 +1583,31 @@ XML_SetDoctypeDeclHandler(XML_Parser parser, void XMLCALL XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start) { - startDoctypeDeclHandler = start; + if (parser != NULL) + startDoctypeDeclHandler = start; } void XMLCALL XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end) { - endDoctypeDeclHandler = end; + if (parser != NULL) + endDoctypeDeclHandler = end; } void XMLCALL XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler) { - unparsedEntityDeclHandler = handler; + if (parser != NULL) + unparsedEntityDeclHandler = handler; } void XMLCALL XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler) { - notationDeclHandler = handler; + if (parser != NULL) + notationDeclHandler = handler; } void XMLCALL @@ -1388,6 +1615,8 @@ XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end) { + if (parser == NULL) + return; startNamespaceDeclHandler = start; endNamespaceDeclHandler = end; } @@ -1395,32 +1624,38 @@ XML_SetNamespaceDeclHandler(XML_Parser parser, void XMLCALL XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start) { - startNamespaceDeclHandler = start; + if (parser != NULL) + startNamespaceDeclHandler = start; } void XMLCALL XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end) { - endNamespaceDeclHandler = end; + if (parser != NULL) + endNamespaceDeclHandler = end; } void XMLCALL XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler) { - notStandaloneHandler = handler; + if (parser != NULL) + notStandaloneHandler = handler; } void XMLCALL XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler) { - externalEntityRefHandler = handler; + if (parser != NULL) + externalEntityRefHandler = handler; } void XMLCALL XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) { + if (parser == NULL) + return; if (arg) externalEntityRefHandlerArg = (XML_Parser)arg; else @@ -1431,7 +1666,8 @@ void XMLCALL XML_SetSkippedEntityHandler(XML_Parser parser, XML_SkippedEntityHandler handler) { - skippedEntityHandler = handler; + if (parser != NULL) + skippedEntityHandler = handler; } void XMLCALL @@ -1439,6 +1675,8 @@ XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *data) { + if (parser == NULL) + return; unknownEncodingHandler = handler; unknownEncodingHandlerData = data; } @@ -1447,33 +1685,39 @@ void XMLCALL XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl) { - elementDeclHandler = eldecl; + if (parser != NULL) + elementDeclHandler = eldecl; } void XMLCALL XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl) { - attlistDeclHandler = attdecl; + if (parser != NULL) + attlistDeclHandler = attdecl; } void XMLCALL XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler) { - entityDeclHandler = handler; + if (parser != NULL) + entityDeclHandler = handler; } void XMLCALL XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler handler) { - xmlDeclHandler = handler; + if (parser != NULL) + xmlDeclHandler = handler; } int XMLCALL XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing peParsing) { + if (parser == NULL) + return 0; /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return 0; @@ -1489,6 +1733,10 @@ int XMLCALL XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) { + if (parser == NULL) + return 0; + if (parser->m_parentParser) + return XML_SetHashSalt(parser->m_parentParser, hash_salt); /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return 0; @@ -1499,6 +1747,10 @@ XML_SetHashSalt(XML_Parser parser, enum XML_Status XMLCALL XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) { + if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) { + errorCode = XML_ERROR_INVALID_ARGUMENT; + return XML_STATUS_ERROR; + } switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; @@ -1551,6 +1803,13 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) const char *end; int nLeftOver; enum XML_Status result; + /* Detect overflow (a+b > MAX <==> b > MAX-a) */ + if (len > ((XML_Size)-1) / 2 - parseEndByteIndex) { + errorCode = XML_ERROR_NO_MEMORY; + eventPtr = eventEndPtr = NULL; + processor = errorProcessor; + return XML_STATUS_ERROR; + } parseEndByteIndex += len; positionPtr = s; ps_finalBuffer = (XML_Bool)isFinal; @@ -1583,11 +1842,14 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) nLeftOver = s + len - end; if (nLeftOver) { if (buffer == NULL || nLeftOver > bufferLim - buffer) { - /* FIXME avoid integer overflow */ - char *temp; - temp = (buffer == NULL - ? (char *)MALLOC(len * 2) - : (char *)REALLOC(buffer, len * 2)); + /* avoid _signed_ integer overflow */ + char *temp = NULL; + const int bytesToAllocate = (int)((unsigned)len * 2U); + if (bytesToAllocate > 0) { + temp = (buffer == NULL + ? (char *)MALLOC(bytesToAllocate) + : (char *)REALLOC(buffer, bytesToAllocate)); + } if (temp == NULL) { errorCode = XML_ERROR_NO_MEMORY; eventPtr = eventEndPtr = NULL; @@ -1595,7 +1857,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) return XML_STATUS_ERROR; } buffer = temp; - bufferLim = buffer + len * 2; + bufferLim = buffer + bytesToAllocate; } memcpy(buffer, end, nLeftOver); } @@ -1625,6 +1887,8 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal) const char *start; enum XML_Status result = XML_STATUS_OK; + if (parser == NULL) + return XML_STATUS_ERROR; switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; @@ -1678,6 +1942,8 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal) void * XMLCALL XML_GetBuffer(XML_Parser parser, int len) { + if (parser == NULL) + return NULL; if (len < 0) { errorCode = XML_ERROR_NO_MEMORY; return NULL; @@ -1695,15 +1961,15 @@ XML_GetBuffer(XML_Parser parser, int len) if (len > bufferLim - bufferEnd) { #ifdef XML_CONTEXT_BYTES int keep; -#endif - int neededSize = len + (int)(bufferEnd - bufferPtr); +#endif /* defined XML_CONTEXT_BYTES */ + /* Do not invoke signed arithmetic overflow: */ + int neededSize = (int) ((unsigned)len + (unsigned)(bufferEnd - bufferPtr)); if (neededSize < 0) { errorCode = XML_ERROR_NO_MEMORY; return NULL; } #ifdef XML_CONTEXT_BYTES keep = (int)(bufferPtr - buffer); - if (keep > XML_CONTEXT_BYTES) keep = XML_CONTEXT_BYTES; neededSize += keep; @@ -1728,7 +1994,8 @@ XML_GetBuffer(XML_Parser parser, int len) if (bufferSize == 0) bufferSize = INIT_BUFFER_SIZE; do { - bufferSize *= 2; + /* Do not invoke signed arithmetic overflow: */ + bufferSize = (int) (2U * (unsigned) bufferSize); } while (bufferSize < neededSize && bufferSize > 0); if (bufferSize <= 0) { errorCode = XML_ERROR_NO_MEMORY; @@ -1773,6 +2040,8 @@ XML_GetBuffer(XML_Parser parser, int len) enum XML_Status XMLCALL XML_StopParser(XML_Parser parser, XML_Bool resumable) { + if (parser == NULL) + return XML_STATUS_ERROR; switch (ps_parsing) { case XML_SUSPENDED: if (resumable) { @@ -1805,6 +2074,8 @@ XML_ResumeParser(XML_Parser parser) { enum XML_Status result = XML_STATUS_OK; + if (parser == NULL) + return XML_STATUS_ERROR; if (ps_parsing != XML_SUSPENDED) { errorCode = XML_ERROR_NOT_SUSPENDED; return XML_STATUS_ERROR; @@ -1841,6 +2112,8 @@ XML_ResumeParser(XML_Parser parser) void XMLCALL XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) { + if (parser == NULL) + return; assert(status != NULL); *status = parser->m_parsingStatus; } @@ -1848,20 +2121,26 @@ XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) enum XML_Error XMLCALL XML_GetErrorCode(XML_Parser parser) { + if (parser == NULL) + return XML_ERROR_INVALID_ARGUMENT; return errorCode; } XML_Index XMLCALL XML_GetCurrentByteIndex(XML_Parser parser) { + if (parser == NULL) + return -1; if (eventPtr) - return parseEndByteIndex - (parseEndPtr - eventPtr); + return (XML_Index)(parseEndByteIndex - (parseEndPtr - eventPtr)); return -1; } int XMLCALL XML_GetCurrentByteCount(XML_Parser parser) { + if (parser == NULL) + return 0; if (eventEndPtr && eventPtr) return (int)(eventEndPtr - eventPtr); return 0; @@ -1871,11 +2150,19 @@ const char * XMLCALL XML_GetInputContext(XML_Parser parser, int *offset, int *size) { #ifdef XML_CONTEXT_BYTES + if (parser == NULL) + return NULL; if (eventPtr && buffer) { - *offset = (int)(eventPtr - buffer); - *size = (int)(bufferEnd - buffer); + if (offset != NULL) + *offset = (int)(eventPtr - buffer); + if (size != NULL) + *size = (int)(bufferEnd - buffer); return buffer; } +#else + (void)parser; + (void)offset; + (void)size; #endif /* defined XML_CONTEXT_BYTES */ return (char *) 0; } @@ -1883,6 +2170,8 @@ XML_GetInputContext(XML_Parser parser, int *offset, int *size) XML_Size XMLCALL XML_GetCurrentLineNumber(XML_Parser parser) { + if (parser == NULL) + return 0; if (eventPtr && eventPtr >= positionPtr) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr = eventPtr; @@ -1893,6 +2182,8 @@ XML_GetCurrentLineNumber(XML_Parser parser) XML_Size XMLCALL XML_GetCurrentColumnNumber(XML_Parser parser) { + if (parser == NULL) + return 0; if (eventPtr && eventPtr >= positionPtr) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr = eventPtr; @@ -1903,30 +2194,38 @@ XML_GetCurrentColumnNumber(XML_Parser parser) void XMLCALL XML_FreeContentModel(XML_Parser parser, XML_Content *model) { - FREE(model); + if (parser != NULL) + FREE(model); } void * XMLCALL XML_MemMalloc(XML_Parser parser, size_t size) { + if (parser == NULL) + return NULL; return MALLOC(size); } void * XMLCALL XML_MemRealloc(XML_Parser parser, void *ptr, size_t size) { + if (parser == NULL) + return NULL; return REALLOC(ptr, size); } void XMLCALL XML_MemFree(XML_Parser parser, void *ptr) { - FREE(ptr); + if (parser != NULL) + FREE(ptr); } void XMLCALL XML_DefaultCurrent(XML_Parser parser) { + if (parser == NULL) + return; if (defaultHandler) { if (openInternalEntities) reportDefault(parser, @@ -2429,11 +2728,11 @@ doContent(XML_Parser parser, for (;;) { int bufSize; int convLen; - XmlConvert(enc, + const enum XML_Convert_Result convert_res = XmlConvert(enc, &fromPtr, rawNameEnd, (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); convLen = (int)(toPtr - (XML_Char *)tag->buf); - if (fromPtr == rawNameEnd) { + if ((fromPtr >= rawNameEnd) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) { tag->name.strLen = convLen; break; } @@ -2476,8 +2775,10 @@ doContent(XML_Parser parser, return XML_ERROR_NO_MEMORY; poolFinish(&tempPool); result = storeAtts(parser, enc, s, &name, &bindings); - if (result) + if (result != XML_ERROR_NONE) { + freeBindings(parser, bindings); return result; + } poolFinish(&tempPool); if (startElementHandler) { startElementHandler(handlerArg, name.str, (const XML_Char **)atts); @@ -2492,15 +2793,7 @@ doContent(XML_Parser parser, if (noElmHandlers && defaultHandler) reportDefault(parser, enc, s, next); poolClear(&tempPool); - while (bindings) { - BINDING *b = bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } + freeBindings(parser, bindings); } if (tagLevel == 0) return epilogProcessor(parser, next, end, nextPtr); @@ -2654,11 +2947,11 @@ doContent(XML_Parser parser, if (MUST_CONVERT(enc, s)) { for (;;) { ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); + const enum XML_Convert_Result convert_res = XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; charDataHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); - if (s == next) + if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) break; *eventPP = s; } @@ -2698,6 +2991,29 @@ doContent(XML_Parser parser, /* not reached */ } +/* This function does not call free() on the allocated memory, merely + * moving it to the parser's freeBindingList where it can be freed or + * reused as appropriate. + */ +static void +freeBindings(XML_Parser parser, BINDING *bindings) +{ + while (bindings) { + BINDING *b = bindings; + + /* startNamespaceDeclHandler will have been called for this + * binding in addBindings(), so call the end handler now. + */ + if (endNamespaceDeclHandler) + endNamespaceDeclHandler(handlerArg, b->prefix->name); + + bindings = bindings->nextTagBinding; + b->nextTagBinding = freeBindingList; + freeBindingList = b; + b->prefix->binding = b->prevPrefixBinding; + } +} + /* Precondition: all arguments must be non-NULL; Purpose: - normalize attributes @@ -2922,7 +3238,13 @@ storeAtts(XML_Parser parser, const ENCODING *enc, if (s[-1] == 2) { /* prefixed */ ATTRIBUTE_ID *id; const BINDING *b; - unsigned long uriHash = hash_secret_salt; + unsigned long uriHash; + struct siphash sip_state; + struct sipkey sip_key; + + copy_salt_to_sipkey(parser, &sip_key); + sip24_init(&sip_state, &sip_key); + ((XML_Char *)s)[-1] = 0; /* clear flag */ id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); if (!id || !id->prefix) @@ -2931,22 +3253,26 @@ storeAtts(XML_Parser parser, const ENCODING *enc, if (!b) return XML_ERROR_UNBOUND_PREFIX; - /* as we expand the name we also calculate its hash value */ for (j = 0; j < b->uriLen; j++) { const XML_Char c = b->uri[j]; if (!poolAppendChar(&tempPool, c)) return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); } + + sip24_update(&sip_state, b->uri, b->uriLen * sizeof(XML_Char)); + while (*s++ != XML_T(ASCII_COLON)) ; + + sip24_update(&sip_state, s, keylen(s) * sizeof(XML_Char)); + do { /* copies null terminator */ - const XML_Char c = *s; if (!poolAppendChar(&tempPool, *s)) return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); } while (*s++); + uriHash = (unsigned long)sip24_final(&sip_state); + { /* Check hash table for duplicate of expanded name (uriName). Derived from code in lookup(parser, HASH_TABLE *table, ...). */ @@ -3264,11 +3590,11 @@ doCdataSection(XML_Parser parser, if (MUST_CONVERT(enc, s)) { for (;;) { ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); + const enum XML_Convert_Result convert_res = XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = next; charDataHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); - if (s == next) + if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) break; *eventPP = s; } @@ -3660,6 +3986,14 @@ entityValueInitProcessor(XML_Parser parser, *nextPtr = next; return XML_ERROR_NONE; } + /* If we get this token, we have the start of what might be a + normal tag, but not a declaration (i.e. it doesn't begin with + "internalEventEndPtr = NULL; textStart = (char *)entity->textPtr; textEnd = (char *)(entity->textPtr + entity->textLen); + /* Set a safe default value in case 'next' does not get set */ + next = textStart; #ifdef XML_DTD if (entity->is_param) { @@ -4881,6 +5217,8 @@ internalEntityProcessor(XML_Parser parser, entity = openEntity->entity; textStart = ((char *)entity->textPtr) + entity->processed; textEnd = (char *)(entity->textPtr + entity->textLen); + /* Set a safe default value in case 'next' does not get set */ + next = textStart; #ifdef XML_DTD if (entity->is_param) { @@ -4927,9 +5265,9 @@ internalEntityProcessor(XML_Parser parser, static enum XML_Error PTRCALL errorProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) + const char *UNUSED_P(s), + const char *UNUSED_P(end), + const char **UNUSED_P(nextPtr)) { return errorCode; } @@ -5345,6 +5683,7 @@ reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, const char *end) { if (MUST_CONVERT(enc, s)) { + enum XML_Convert_Result convert_res; const char **eventPP; const char **eventEndPP; if (enc == encoding) { @@ -5357,11 +5696,11 @@ reportDefault(XML_Parser parser, const ENCODING *enc, } do { ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); + convert_res = XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); *eventPP = s; - } while (s != end); + } while ((convert_res != XML_CONVERT_COMPLETED) && (convert_res != XML_CONVERT_INPUT_INCOMPLETE)); } else defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s)); @@ -5840,7 +6179,6 @@ dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_H newE->defaultAtts = (DEFAULT_ATTRIBUTE *) ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); if (!newE->defaultAtts) { - ms->free_fcn(newE); return 0; } } @@ -5975,13 +6313,32 @@ keyeq(KEY s1, KEY s2) return XML_FALSE; } +static size_t +keylen(KEY s) +{ + size_t len = 0; + for (; *s; s++, len++); + return len; +} + +static void +copy_salt_to_sipkey(XML_Parser parser, struct sipkey * key) +{ + key->k[0] = 0; + key->k[1] = get_hash_secret_salt(parser); +} + static unsigned long FASTCALL hash(XML_Parser parser, KEY s) { - unsigned long h = hash_secret_salt; - while (*s) - h = CHAR_HASH(h, *s++); - return h; + struct siphash state; + struct sipkey key; + (void)sip_tobin; + (void)sip24_valid; + copy_salt_to_sipkey(parser, &key); + sip24_init(&state, &key); + sip24_update(&state, s, keylen(s) * sizeof(XML_Char)); + return (unsigned long)sip24_final(&state); } static NAMED * @@ -6166,8 +6523,8 @@ poolAppend(STRING_POOL *pool, const ENCODING *enc, if (!pool->ptr && !poolGrow(pool)) return NULL; for (;;) { - XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); - if (ptr == end) + const enum XML_Convert_Result convert_res = XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); + if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) break; if (!poolGrow(pool)) return NULL; @@ -6224,6 +6581,35 @@ poolStoreString(STRING_POOL *pool, const ENCODING *enc, return pool->start; } +static size_t +poolBytesToAllocateFor(int blockSize) +{ + /* Unprotected math would be: + ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char); + ** + ** Detect overflow, avoiding _signed_ overflow undefined behavior + ** For a + b * c we check b * c in isolation first, so that addition of a + ** on top has no chance of making us accept a small non-negative number + */ + const size_t stretch = sizeof(XML_Char); /* can be 4 bytes */ + + if (blockSize <= 0) + return 0; + + if (blockSize > (int)(INT_MAX / stretch)) + return 0; + + { + const int stretchedBlockSize = blockSize * (int)stretch; + const int bytesToAllocate = (int)( + offsetof(BLOCK, s) + (unsigned)stretchedBlockSize); + if (bytesToAllocate < 0) + return 0; + + return (size_t)bytesToAllocate; + } +} + static XML_Bool FASTCALL poolGrow(STRING_POOL *pool) { @@ -6251,11 +6637,19 @@ poolGrow(STRING_POOL *pool) } } if (pool->blocks && pool->start == pool->blocks->s) { - int blockSize = (int)(pool->end - pool->start)*2; - BLOCK *temp = (BLOCK *) - pool->mem->realloc_fcn(pool->blocks, - (offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char))); + BLOCK *temp; + int blockSize = (int)((unsigned)(pool->end - pool->start)*2U); + size_t bytesToAllocate; + + if (blockSize < 0) + return XML_FALSE; + + bytesToAllocate = poolBytesToAllocateFor(blockSize); + if (bytesToAllocate == 0) + return XML_FALSE; + + temp = (BLOCK *) + pool->mem->realloc_fcn(pool->blocks, (unsigned)bytesToAllocate); if (temp == NULL) return XML_FALSE; pool->blocks = temp; @@ -6267,12 +6661,26 @@ poolGrow(STRING_POOL *pool) else { BLOCK *tem; int blockSize = (int)(pool->end - pool->start); + size_t bytesToAllocate; + + if (blockSize < 0) + return XML_FALSE; + if (blockSize < INIT_BLOCK_SIZE) blockSize = INIT_BLOCK_SIZE; - else + else { + /* Detect overflow, avoiding _signed_ overflow undefined behavior */ + if ((int)((unsigned)blockSize * 2U) < 0) { + return XML_FALSE; + } blockSize *= 2; - tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char)); + } + + bytesToAllocate = poolBytesToAllocateFor(blockSize); + if (bytesToAllocate == 0) + return XML_FALSE; + + tem = (BLOCK *)pool->mem->malloc_fcn(bytesToAllocate); if (!tem) return XML_FALSE; tem->size = blockSize; diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c index 44772e2..a7c5630 100644 --- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -4,19 +4,13 @@ #include -#ifdef COMPILED_FROM_DSP +#ifdef _WIN32 #include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" #else #ifdef HAVE_EXPAT_CONFIG_H #include #endif -#endif /* ndef COMPILED_FROM_DSP */ +#endif /* ndef _WIN32 */ #include "expat_external.h" #include "internal.h" @@ -195,9 +189,9 @@ prolog1(PROLOG_STATE *state, static int PTRCALL prolog2(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -216,9 +210,9 @@ prolog2(PROLOG_STATE *state, static int PTRCALL doctype0(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -264,9 +258,9 @@ doctype1(PROLOG_STATE *state, static int PTRCALL doctype2(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -281,9 +275,9 @@ doctype2(PROLOG_STATE *state, static int PTRCALL doctype3(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -298,9 +292,9 @@ doctype3(PROLOG_STATE *state, static int PTRCALL doctype4(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -318,9 +312,9 @@ doctype4(PROLOG_STATE *state, static int PTRCALL doctype5(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -437,9 +431,9 @@ externalSubset1(PROLOG_STATE *state, static int PTRCALL entity0(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -457,9 +451,9 @@ entity0(PROLOG_STATE *state, static int PTRCALL entity1(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -502,9 +496,9 @@ entity2(PROLOG_STATE *state, static int PTRCALL entity3(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -519,9 +513,9 @@ entity3(PROLOG_STATE *state, static int PTRCALL entity4(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -559,9 +553,9 @@ entity5(PROLOG_STATE *state, static int PTRCALL entity6(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -605,9 +599,9 @@ entity7(PROLOG_STATE *state, static int PTRCALL entity8(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -622,9 +616,9 @@ entity8(PROLOG_STATE *state, static int PTRCALL entity9(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -639,9 +633,9 @@ entity9(PROLOG_STATE *state, static int PTRCALL entity10(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -656,9 +650,9 @@ entity10(PROLOG_STATE *state, static int PTRCALL notation0(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -697,9 +691,9 @@ notation1(PROLOG_STATE *state, static int PTRCALL notation2(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -714,9 +708,9 @@ notation2(PROLOG_STATE *state, static int PTRCALL notation3(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -732,9 +726,9 @@ notation3(PROLOG_STATE *state, static int PTRCALL notation4(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -753,9 +747,9 @@ notation4(PROLOG_STATE *state, static int PTRCALL attlist0(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -771,9 +765,9 @@ attlist0(PROLOG_STATE *state, static int PTRCALL attlist1(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -833,9 +827,9 @@ attlist2(PROLOG_STATE *state, static int PTRCALL attlist3(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -852,9 +846,9 @@ attlist3(PROLOG_STATE *state, static int PTRCALL attlist4(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -872,9 +866,9 @@ attlist4(PROLOG_STATE *state, static int PTRCALL attlist5(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -889,9 +883,9 @@ attlist5(PROLOG_STATE *state, static int PTRCALL attlist6(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -906,9 +900,9 @@ attlist6(PROLOG_STATE *state, static int PTRCALL attlist7(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -967,9 +961,9 @@ attlist8(PROLOG_STATE *state, static int PTRCALL attlist9(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -984,9 +978,9 @@ attlist9(PROLOG_STATE *state, static int PTRCALL element0(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1072,9 +1066,9 @@ element2(PROLOG_STATE *state, static int PTRCALL element3(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1097,9 +1091,9 @@ element3(PROLOG_STATE *state, static int PTRCALL element4(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1115,9 +1109,9 @@ element4(PROLOG_STATE *state, static int PTRCALL element5(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1136,9 +1130,9 @@ element5(PROLOG_STATE *state, static int PTRCALL element6(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1166,9 +1160,9 @@ element6(PROLOG_STATE *state, static int PTRCALL element7(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1240,9 +1234,9 @@ condSect0(PROLOG_STATE *state, static int PTRCALL condSect1(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1258,9 +1252,9 @@ condSect1(PROLOG_STATE *state, static int PTRCALL condSect2(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1277,9 +1271,9 @@ condSect2(PROLOG_STATE *state, static int PTRCALL declClose(PROLOG_STATE *state, int tok, - const char *ptr, - const char *end, - const ENCODING *enc) + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { switch (tok) { case XML_TOK_PROLOG_S: @@ -1292,11 +1286,11 @@ declClose(PROLOG_STATE *state, } static int PTRCALL -error(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) +error(PROLOG_STATE *UNUSED_P(state), + int UNUSED_P(tok), + const char *UNUSED_P(ptr), + const char *UNUSED_P(end), + const ENCODING *UNUSED_P(enc)) { return XML_ROLE_NONE; } diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c index bf09dfc..cdf0720 100644 --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -4,19 +4,13 @@ #include -#ifdef COMPILED_FROM_DSP +#ifdef _WIN32 #include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" #else #ifdef HAVE_EXPAT_CONFIG_H #include #endif -#endif /* ndef COMPILED_FROM_DSP */ +#endif /* ndef _WIN32 */ #include "expat_external.h" #include "internal.h" @@ -46,7 +40,7 @@ #define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) #define UCS2_GET_NAMING(pages, hi, lo) \ - (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) + (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1u << ((lo) & 0x1F))) /* A 2 byte UTF-8 representation splits the characters 11 bits between the bottom 5 and 6 bits of the bytes. We need 8 bits to index into @@ -56,7 +50,7 @@ (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ + ((((byte)[0]) & 3) << 1) \ + ((((byte)[1]) >> 5) & 1)] \ - & (1 << (((byte)[1]) & 0x1F))) + & (1u << (((byte)[1]) & 0x1F))) /* A 3 byte UTF-8 representation splits the characters 16 bits between the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index @@ -69,7 +63,7 @@ << 3) \ + ((((byte)[1]) & 3) << 1) \ + ((((byte)[2]) >> 5) & 1)] \ - & (1 << (((byte)[2]) & 0x1F))) + & (1u << (((byte)[2]) & 0x1F))) #define UTF8_GET_NAMING(pages, p, n) \ ((n) == 2 \ @@ -122,19 +116,19 @@ ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0))) static int PTRFASTCALL -isNever(const ENCODING *enc, const char *p) +isNever(const ENCODING *UNUSED_P(enc), const char *UNUSED_P(p)) { return 0; } static int PTRFASTCALL -utf8_isName2(const ENCODING *enc, const char *p) +utf8_isName2(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); } static int PTRFASTCALL -utf8_isName3(const ENCODING *enc, const char *p) +utf8_isName3(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); } @@ -142,13 +136,13 @@ utf8_isName3(const ENCODING *enc, const char *p) #define utf8_isName4 isNever static int PTRFASTCALL -utf8_isNmstrt2(const ENCODING *enc, const char *p) +utf8_isNmstrt2(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); } static int PTRFASTCALL -utf8_isNmstrt3(const ENCODING *enc, const char *p) +utf8_isNmstrt3(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); } @@ -156,19 +150,19 @@ utf8_isNmstrt3(const ENCODING *enc, const char *p) #define utf8_isNmstrt4 isNever static int PTRFASTCALL -utf8_isInvalid2(const ENCODING *enc, const char *p) +utf8_isInvalid2(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_INVALID2((const unsigned char *)p); } static int PTRFASTCALL -utf8_isInvalid3(const ENCODING *enc, const char *p) +utf8_isInvalid3(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_INVALID3((const unsigned char *)p); } static int PTRFASTCALL -utf8_isInvalid4(const ENCODING *enc, const char *p) +utf8_isInvalid4(const ENCODING *UNUSED_P(enc), const char *p) { return UTF8_INVALID4((const unsigned char *)p); } @@ -222,6 +216,17 @@ struct normal_encoding { E ## isInvalid3, \ E ## isInvalid4 +#define NULL_VTABLE \ + /* isName2 */ NULL, \ + /* isName3 */ NULL, \ + /* isName4 */ NULL, \ + /* isNmstrt2 */ NULL, \ + /* isNmstrt3 */ NULL, \ + /* isNmstrt4 */ NULL, \ + /* isInvalid2 */ NULL, \ + /* isInvalid3 */ NULL, \ + /* isInvalid4 */ NULL + static int FASTCALL checkCharRefNumber(int); #include "xmltok_impl.h" @@ -318,39 +323,89 @@ enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ UTF8_cval4 = 0xf0 }; -static void PTRCALL -utf8_toUtf8(const ENCODING *enc, +void +align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef) +{ + const char * fromLim = *fromLimRef; + size_t walked = 0; + for (; fromLim > from; fromLim--, walked++) { + const unsigned char prev = (unsigned char)fromLim[-1]; + if ((prev & 0xf8u) == 0xf0u) { /* 4-byte character, lead by 0b11110xxx byte */ + if (walked + 1 >= 4) { + fromLim += 4 - 1; + break; + } else { + walked = 0; + } + } else if ((prev & 0xf0u) == 0xe0u) { /* 3-byte character, lead by 0b1110xxxx byte */ + if (walked + 1 >= 3) { + fromLim += 3 - 1; + break; + } else { + walked = 0; + } + } else if ((prev & 0xe0u) == 0xc0u) { /* 2-byte character, lead by 0b110xxxxx byte */ + if (walked + 1 >= 2) { + fromLim += 2 - 1; + break; + } else { + walked = 0; + } + } else if ((prev & 0x80u) == 0x00u) { /* 1-byte character, matching 0b0xxxxxxx */ + break; + } + } + *fromLimRef = fromLim; +} + +static enum XML_Convert_Result PTRCALL +utf8_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { char *to; const char *from; - if (fromLim - *fromP > toLim - *toP) { - /* Avoid copying partial characters. */ - for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) - if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) - break; - } - for (to = *toP, from = *fromP; from != fromLim; from++, to++) + const char *fromLimInitial = fromLim; + + /* Avoid copying partial characters. */ + align_limit_to_full_utf8_characters(*fromP, &fromLim); + + for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++) *to = *from; *fromP = from; *toP = to; + + if (fromLim < fromLimInitial) + return XML_CONVERT_INPUT_INCOMPLETE; + else if ((to == toLim) && (from < fromLim)) + return XML_CONVERT_OUTPUT_EXHAUSTED; + else + return XML_CONVERT_COMPLETED; } -static void PTRCALL +static enum XML_Convert_Result PTRCALL utf8_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) { + enum XML_Convert_Result res = XML_CONVERT_COMPLETED; unsigned short *to = *toP; const char *from = *fromP; - while (from != fromLim && to != toLim) { + while (from < fromLim && to < toLim) { switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { case BT_LEAD2: + if (fromLim - from < 2) { + res = XML_CONVERT_INPUT_INCOMPLETE; + goto after; + } *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); from += 2; break; case BT_LEAD3: + if (fromLim - from < 3) { + res = XML_CONVERT_INPUT_INCOMPLETE; + goto after; + } *to++ = (unsigned short)(((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); from += 3; @@ -358,8 +413,14 @@ utf8_toUtf16(const ENCODING *enc, case BT_LEAD4: { unsigned long n; - if (to + 1 == toLim) + if (toLim - to < 2) { + res = XML_CONVERT_OUTPUT_EXHAUSTED; + goto after; + } + if (fromLim - from < 4) { + res = XML_CONVERT_INPUT_INCOMPLETE; goto after; + } n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); n -= 0x10000; @@ -374,9 +435,12 @@ utf8_toUtf16(const ENCODING *enc, break; } } + if (from < fromLim) + res = XML_CONVERT_OUTPUT_EXHAUSTED; after: *fromP = from; *toP = to; + return res; } #ifdef XML_NS @@ -425,38 +489,43 @@ static const struct normal_encoding internal_utf8_encoding = { STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) }; -static void PTRCALL -latin1_toUtf8(const ENCODING *enc, +static enum XML_Convert_Result PTRCALL +latin1_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { for (;;) { unsigned char c; if (*fromP == fromLim) - break; + return XML_CONVERT_COMPLETED; c = (unsigned char)**fromP; if (c & 0x80) { if (toLim - *toP < 2) - break; + return XML_CONVERT_OUTPUT_EXHAUSTED; *(*toP)++ = (char)((c >> 6) | UTF8_cval2); *(*toP)++ = (char)((c & 0x3f) | 0x80); (*fromP)++; } else { if (*toP == toLim) - break; + return XML_CONVERT_OUTPUT_EXHAUSTED; *(*toP)++ = *(*fromP)++; } } } -static void PTRCALL -latin1_toUtf16(const ENCODING *enc, +static enum XML_Convert_Result PTRCALL +latin1_toUtf16(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) { - while (*fromP != fromLim && *toP != toLim) + while (*fromP < fromLim && *toP < toLim) *(*toP)++ = (unsigned char)*(*fromP)++; + + if ((*toP == toLim) && (*fromP < fromLim)) + return XML_CONVERT_OUTPUT_EXHAUSTED; + else + return XML_CONVERT_COMPLETED; } #ifdef XML_NS @@ -467,7 +536,7 @@ static const struct normal_encoding latin1_encoding_ns = { #include "asciitab.h" #include "latin1tab.h" }, - STANDARD_VTABLE(sb_) + STANDARD_VTABLE(sb_) NULL_VTABLE }; #endif @@ -480,16 +549,21 @@ static const struct normal_encoding latin1_encoding = { #undef BT_COLON #include "latin1tab.h" }, - STANDARD_VTABLE(sb_) + STANDARD_VTABLE(sb_) NULL_VTABLE }; -static void PTRCALL -ascii_toUtf8(const ENCODING *enc, +static enum XML_Convert_Result PTRCALL +ascii_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { - while (*fromP != fromLim && *toP != toLim) + while (*fromP < fromLim && *toP < toLim) *(*toP)++ = *(*fromP)++; + + if ((*toP == toLim) && (*fromP < fromLim)) + return XML_CONVERT_OUTPUT_EXHAUSTED; + else + return XML_CONVERT_COMPLETED; } #ifdef XML_NS @@ -500,7 +574,7 @@ static const struct normal_encoding ascii_encoding_ns = { #include "asciitab.h" /* BT_NONXML == 0 */ }, - STANDARD_VTABLE(sb_) + STANDARD_VTABLE(sb_) NULL_VTABLE }; #endif @@ -513,7 +587,7 @@ static const struct normal_encoding ascii_encoding = { #undef BT_COLON /* BT_NONXML == 0 */ }, - STANDARD_VTABLE(sb_) + STANDARD_VTABLE(sb_) NULL_VTABLE }; static int PTRFASTCALL @@ -536,13 +610,14 @@ unicode_byte_type(char hi, char lo) } #define DEFINE_UTF16_TO_UTF8(E) \ -static void PTRCALL \ -E ## toUtf8(const ENCODING *enc, \ +static enum XML_Convert_Result PTRCALL \ +E ## toUtf8(const ENCODING *UNUSED_P(enc), \ const char **fromP, const char *fromLim, \ char **toP, const char *toLim) \ { \ - const char *from; \ - for (from = *fromP; from != fromLim; from += 2) { \ + const char *from = *fromP; \ + fromLim = from + (((fromLim - from) >> 1) << 1); /* shrink to even */ \ + for (; from < fromLim; from += 2) { \ int plane; \ unsigned char lo2; \ unsigned char lo = GET_LO(from); \ @@ -552,7 +627,7 @@ E ## toUtf8(const ENCODING *enc, \ if (lo < 0x80) { \ if (*toP == toLim) { \ *fromP = from; \ - return; \ + return XML_CONVERT_OUTPUT_EXHAUSTED; \ } \ *(*toP)++ = lo; \ break; \ @@ -562,7 +637,7 @@ E ## toUtf8(const ENCODING *enc, \ case 0x4: case 0x5: case 0x6: case 0x7: \ if (toLim - *toP < 2) { \ *fromP = from; \ - return; \ + return XML_CONVERT_OUTPUT_EXHAUSTED; \ } \ *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ *(*toP)++ = ((lo & 0x3f) | 0x80); \ @@ -570,7 +645,7 @@ E ## toUtf8(const ENCODING *enc, \ default: \ if (toLim - *toP < 3) { \ *fromP = from; \ - return; \ + return XML_CONVERT_OUTPUT_EXHAUSTED; \ } \ /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ @@ -580,7 +655,11 @@ E ## toUtf8(const ENCODING *enc, \ case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ if (toLim - *toP < 4) { \ *fromP = from; \ - return; \ + return XML_CONVERT_OUTPUT_EXHAUSTED; \ + } \ + if (fromLim - from < 4) { \ + *fromP = from; \ + return XML_CONVERT_INPUT_INCOMPLETE; \ } \ plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ @@ -596,20 +675,32 @@ E ## toUtf8(const ENCODING *enc, \ } \ } \ *fromP = from; \ + if (from < fromLim) \ + return XML_CONVERT_INPUT_INCOMPLETE; \ + else \ + return XML_CONVERT_COMPLETED; \ } #define DEFINE_UTF16_TO_UTF16(E) \ -static void PTRCALL \ -E ## toUtf16(const ENCODING *enc, \ +static enum XML_Convert_Result PTRCALL \ +E ## toUtf16(const ENCODING *UNUSED_P(enc), \ const char **fromP, const char *fromLim, \ unsigned short **toP, const unsigned short *toLim) \ { \ + enum XML_Convert_Result res = XML_CONVERT_COMPLETED; \ + fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */ \ /* Avoid copying first half only of surrogate */ \ if (fromLim - *fromP > ((toLim - *toP) << 1) \ - && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ + && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) { \ fromLim -= 2; \ - for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ + res = XML_CONVERT_INPUT_INCOMPLETE; \ + } \ + for (; *fromP < fromLim && *toP < toLim; *fromP += 2) \ *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ + if ((*toP == toLim) && (*fromP < fromLim)) \ + return XML_CONVERT_OUTPUT_EXHAUSTED; \ + else \ + return res; \ } #define SET2(ptr, ch) \ @@ -726,7 +817,7 @@ static const struct normal_encoding little2_encoding_ns = { #include "asciitab.h" #include "latin1tab.h" }, - STANDARD_VTABLE(little2_) + STANDARD_VTABLE(little2_) NULL_VTABLE }; #endif @@ -745,7 +836,7 @@ static const struct normal_encoding little2_encoding = { #undef BT_COLON #include "latin1tab.h" }, - STANDARD_VTABLE(little2_) + STANDARD_VTABLE(little2_) NULL_VTABLE }; #if BYTEORDER != 4321 @@ -758,7 +849,7 @@ static const struct normal_encoding internal_little2_encoding_ns = { #include "iasciitab.h" #include "latin1tab.h" }, - STANDARD_VTABLE(little2_) + STANDARD_VTABLE(little2_) NULL_VTABLE }; #endif @@ -771,7 +862,7 @@ static const struct normal_encoding internal_little2_encoding = { #undef BT_COLON #include "latin1tab.h" }, - STANDARD_VTABLE(little2_) + STANDARD_VTABLE(little2_) NULL_VTABLE }; #endif @@ -867,7 +958,7 @@ static const struct normal_encoding big2_encoding_ns = { #include "asciitab.h" #include "latin1tab.h" }, - STANDARD_VTABLE(big2_) + STANDARD_VTABLE(big2_) NULL_VTABLE }; #endif @@ -886,7 +977,7 @@ static const struct normal_encoding big2_encoding = { #undef BT_COLON #include "latin1tab.h" }, - STANDARD_VTABLE(big2_) + STANDARD_VTABLE(big2_) NULL_VTABLE }; #if BYTEORDER != 1234 @@ -899,7 +990,7 @@ static const struct normal_encoding internal_big2_encoding_ns = { #include "iasciitab.h" #include "latin1tab.h" }, - STANDARD_VTABLE(big2_) + STANDARD_VTABLE(big2_) NULL_VTABLE }; #endif @@ -912,7 +1003,7 @@ static const struct normal_encoding internal_big2_encoding = { #undef BT_COLON #include "latin1tab.h" }, - STANDARD_VTABLE(big2_) + STANDARD_VTABLE(big2_) NULL_VTABLE }; #endif @@ -938,7 +1029,7 @@ streqci(const char *s1, const char *s2) } static void PTRCALL -initUpdatePosition(const ENCODING *enc, const char *ptr, +initUpdatePosition(const ENCODING *UNUSED_P(enc), const char *ptr, const char *end, POSITION *pos) { normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); @@ -1288,7 +1379,7 @@ unknown_isInvalid(const ENCODING *enc, const char *p) return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; } -static void PTRCALL +static enum XML_Convert_Result PTRCALL unknown_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) @@ -1299,21 +1390,21 @@ unknown_toUtf8(const ENCODING *enc, const char *utf8; int n; if (*fromP == fromLim) - break; + return XML_CONVERT_COMPLETED; utf8 = uenc->utf8[(unsigned char)**fromP]; n = *utf8++; if (n == 0) { int c = uenc->convert(uenc->userData, *fromP); n = XmlUtf8Encode(c, buf); if (n > toLim - *toP) - break; + return XML_CONVERT_OUTPUT_EXHAUSTED; utf8 = buf; *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - (BT_LEAD2 - 2)); } else { if (n > toLim - *toP) - break; + return XML_CONVERT_OUTPUT_EXHAUSTED; (*fromP)++; } do { @@ -1322,13 +1413,13 @@ unknown_toUtf8(const ENCODING *enc, } } -static void PTRCALL +static enum XML_Convert_Result PTRCALL unknown_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - while (*fromP != fromLim && *toP != toLim) { + while (*fromP < fromLim && *toP < toLim) { unsigned short c = uenc->utf16[(unsigned char)**fromP]; if (c == 0) { c = (unsigned short) @@ -1340,6 +1431,11 @@ unknown_toUtf16(const ENCODING *enc, (*fromP)++; *(*toP)++ = c; } + + if ((*toP == toLim) && (*fromP < fromLim)) + return XML_CONVERT_OUTPUT_EXHAUSTED; + else + return XML_CONVERT_COMPLETED; } ENCODING * @@ -1503,7 +1599,7 @@ initScan(const ENCODING * const *encodingTable, { const ENCODING **encPtr; - if (ptr == end) + if (ptr >= end) return XML_TOK_NONE; encPtr = enc->encPtr; if (ptr + 1 == end) { diff --git a/Modules/expat/xmltok.h b/Modules/expat/xmltok.h index ca867aa..752007e 100644 --- a/Modules/expat/xmltok.h +++ b/Modules/expat/xmltok.h @@ -130,6 +130,12 @@ typedef int (PTRCALL *SCANNER)(const ENCODING *, const char *, const char **); +enum XML_Convert_Result { + XML_CONVERT_COMPLETED = 0, + XML_CONVERT_INPUT_INCOMPLETE = 1, + XML_CONVERT_OUTPUT_EXHAUSTED = 2 /* and therefore potentially input remaining as well */ +}; + struct encoding { SCANNER scanners[XML_N_STATES]; SCANNER literalScanners[XML_N_LITERAL_TYPES]; @@ -158,12 +164,12 @@ struct encoding { const char *ptr, const char *end, const char **badPtr); - void (PTRCALL *utf8Convert)(const ENCODING *enc, + enum XML_Convert_Result (PTRCALL *utf8Convert)(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim); - void (PTRCALL *utf16Convert)(const ENCODING *enc, + enum XML_Convert_Result (PTRCALL *utf16Convert)(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, diff --git a/Modules/expat/xmltok_impl.c b/Modules/expat/xmltok_impl.c index 9c2895b..5f779c0 100644 --- a/Modules/expat/xmltok_impl.c +++ b/Modules/expat/xmltok_impl.c @@ -87,27 +87,45 @@ #define PREFIX(ident) ident #endif + +#define HAS_CHARS(enc, ptr, end, count) \ + (end - ptr >= count * MINBPC(enc)) + +#define HAS_CHAR(enc, ptr, end) \ + HAS_CHARS(enc, ptr, end, 1) + +#define REQUIRE_CHARS(enc, ptr, end, count) \ + { \ + if (! HAS_CHARS(enc, ptr, end, count)) { \ + return XML_TOK_PARTIAL; \ + } \ + } + +#define REQUIRE_CHAR(enc, ptr, end) \ + REQUIRE_CHARS(enc, ptr, end, 1) + + /* ptr points to character following " */ switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: @@ -175,7 +191,7 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, } static int PTRCALL -PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, +PREFIX(checkPiTarget)(const ENCODING *UNUSED_P(enc), const char *ptr, const char *end, int *tokPtr) { int upper = 0; @@ -225,15 +241,14 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr, { int tok; const char *target = ptr; - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) default: *nextTokPtr = ptr; return XML_TOK_INVALID; } - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_S: case BT_CR: case BT_LF: @@ -242,13 +257,12 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr, return XML_TOK_INVALID; } ptr += MINBPC(enc); - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { INVALID_CASES(ptr, nextTokPtr) case BT_QUEST: ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { *nextTokPtr = ptr + MINBPC(enc); return tok; @@ -266,8 +280,7 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr, return XML_TOK_INVALID; } ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { *nextTokPtr = ptr + MINBPC(enc); return tok; @@ -282,15 +295,14 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr, } static int PTRCALL -PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, +PREFIX(scanCdataSection)(const ENCODING *UNUSED_P(enc), const char *ptr, const char *end, const char **nextTokPtr) { static const char CDATA_LSQB[] = { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, ASCII_LSQB }; int i; /* CDATA[ */ - if (end - ptr < 6 * MINBPC(enc)) - return XML_TOK_PARTIAL; + REQUIRE_CHARS(enc, ptr, end, 6); for (i = 0; i < 6; i++, ptr += MINBPC(enc)) { if (!CHAR_MATCHES(enc, ptr, CDATA_LSQB[i])) { *nextTokPtr = ptr; @@ -305,7 +317,7 @@ static int PTRCALL PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { - if (ptr == end) + if (ptr >= end) return XML_TOK_NONE; if (MINBPC(enc) > 1) { size_t n = end - ptr; @@ -319,13 +331,11 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, switch (BYTE_TYPE(enc, ptr)) { case BT_RSQB: ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) break; ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { ptr -= MINBPC(enc); break; @@ -334,8 +344,7 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, return XML_TOK_CDATA_SECT_CLOSE; case BT_CR: ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); *nextTokPtr = ptr; @@ -348,7 +357,7 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, ptr += MINBPC(enc); break; } - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ @@ -383,19 +392,18 @@ static int PTRCALL PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) default: *nextTokPtr = ptr; return XML_TOK_INVALID; } - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_S: case BT_CR: case BT_LF: - for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { + for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) { switch (BYTE_TYPE(enc, ptr)) { case BT_S: case BT_CR: case BT_LF: break; @@ -432,7 +440,7 @@ static int PTRCALL PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { - if (ptr != end) { + if (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { case BT_DIGIT: case BT_HEX: @@ -441,7 +449,7 @@ PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr, *nextTokPtr = ptr; return XML_TOK_INVALID; } - for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { + for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) { switch (BYTE_TYPE(enc, ptr)) { case BT_DIGIT: case BT_HEX: @@ -464,7 +472,7 @@ static int PTRCALL PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { - if (ptr != end) { + if (HAS_CHAR(enc, ptr, end)) { if (CHAR_MATCHES(enc, ptr, ASCII_x)) return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); switch (BYTE_TYPE(enc, ptr)) { @@ -474,7 +482,7 @@ PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr, *nextTokPtr = ptr; return XML_TOK_INVALID; } - for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { + for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) { switch (BYTE_TYPE(enc, ptr)) { case BT_DIGIT: break; @@ -496,8 +504,7 @@ static int PTRCALL PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) case BT_NUM: @@ -506,7 +513,7 @@ PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end, *nextTokPtr = ptr; return XML_TOK_INVALID; } - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_SEMI: @@ -529,7 +536,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, #ifdef XML_NS int hadColon = 0; #endif - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) #ifdef XML_NS @@ -540,8 +547,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, } hadColon = 1; ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) default: @@ -555,8 +561,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, int t; ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); t = BYTE_TYPE(enc, ptr); if (t == BT_EQUALS) break; @@ -579,8 +584,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, #endif for (;;) { ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); open = BYTE_TYPE(enc, ptr); if (open == BT_QUOT || open == BT_APOS) break; @@ -598,8 +602,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, /* in attribute value */ for (;;) { int t; - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); t = BYTE_TYPE(enc, ptr); if (t == open) break; @@ -624,8 +627,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, } } ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { case BT_S: case BT_CR: @@ -642,8 +644,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, /* ptr points to closing quote */ for (;;) { ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) case BT_S: case BT_CR: case BT_LF: @@ -655,8 +656,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, case BT_SOL: sol: ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { *nextTokPtr = ptr; return XML_TOK_INVALID; @@ -688,13 +688,12 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end, #ifdef XML_NS int hadColon; #endif - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) case BT_EXCL: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; + ptr += MINBPC(enc); + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { case BT_MINUS: return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr); @@ -716,7 +715,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end, hadColon = 0; #endif /* we have a start-tag */ - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) #ifdef XML_NS @@ -727,8 +726,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end, } hadColon = 1; ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) default: @@ -740,7 +738,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end, case BT_S: case BT_CR: case BT_LF: { ptr += MINBPC(enc); - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) case BT_GT: @@ -765,8 +763,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end, case BT_SOL: sol: ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { *nextTokPtr = ptr; return XML_TOK_INVALID; @@ -785,7 +782,7 @@ static int PTRCALL PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { - if (ptr == end) + if (ptr >= end) return XML_TOK_NONE; if (MINBPC(enc) > 1) { size_t n = end - ptr; @@ -803,7 +800,7 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_CR: ptr += MINBPC(enc); - if (ptr == end) + if (! HAS_CHAR(enc, ptr, end)) return XML_TOK_TRAILING_CR; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); @@ -814,12 +811,12 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, return XML_TOK_DATA_NEWLINE; case BT_RSQB: ptr += MINBPC(enc); - if (ptr == end) + if (! HAS_CHAR(enc, ptr, end)) return XML_TOK_TRAILING_RSQB; if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) break; ptr += MINBPC(enc); - if (ptr == end) + if (! HAS_CHAR(enc, ptr, end)) return XML_TOK_TRAILING_RSQB; if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { ptr -= MINBPC(enc); @@ -832,7 +829,7 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, ptr += MINBPC(enc); break; } - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ @@ -845,12 +842,12 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_RSQB: - if (ptr + MINBPC(enc) != end) { + if (HAS_CHARS(enc, ptr, end, 2)) { if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { ptr += MINBPC(enc); break; } - if (ptr + 2*MINBPC(enc) != end) { + if (HAS_CHARS(enc, ptr, end, 3)) { if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) { ptr += MINBPC(enc); break; @@ -884,8 +881,7 @@ static int PTRCALL PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: @@ -895,7 +891,7 @@ PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, *nextTokPtr = ptr; return XML_TOK_INVALID; } - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_SEMI: @@ -913,15 +909,14 @@ static int PTRCALL PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) default: *nextTokPtr = ptr; return XML_TOK_INVALID; } - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_CR: case BT_LF: case BT_S: @@ -941,7 +936,7 @@ PREFIX(scanLit)(int open, const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { int t = BYTE_TYPE(enc, ptr); switch (t) { INVALID_CASES(ptr, nextTokPtr) @@ -950,7 +945,7 @@ PREFIX(scanLit)(int open, const ENCODING *enc, ptr += MINBPC(enc); if (t != open) break; - if (ptr == end) + if (! HAS_CHAR(enc, ptr, end)) return -XML_TOK_LITERAL; *nextTokPtr = ptr; switch (BYTE_TYPE(enc, ptr)) { @@ -973,7 +968,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { int tok; - if (ptr == end) + if (ptr >= end) return XML_TOK_NONE; if (MINBPC(enc) > 1) { size_t n = end - ptr; @@ -992,8 +987,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, case BT_LT: { ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { case BT_EXCL: return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); @@ -1021,7 +1015,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, case BT_S: case BT_LF: for (;;) { ptr += MINBPC(enc); - if (ptr == end) + if (! HAS_CHAR(enc, ptr, end)) break; switch (BYTE_TYPE(enc, ptr)) { case BT_S: case BT_LF: @@ -1048,11 +1042,10 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, return XML_TOK_OPEN_BRACKET; case BT_RSQB: ptr += MINBPC(enc); - if (ptr == end) + if (! HAS_CHAR(enc, ptr, end)) return -XML_TOK_CLOSE_BRACKET; if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if (ptr + MINBPC(enc) == end) - return XML_TOK_PARTIAL; + REQUIRE_CHARS(enc, ptr, end, 2); if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) { *nextTokPtr = ptr + 2*MINBPC(enc); return XML_TOK_COND_SECT_CLOSE; @@ -1065,7 +1058,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, return XML_TOK_OPEN_PAREN; case BT_RPAR: ptr += MINBPC(enc); - if (ptr == end) + if (! HAS_CHAR(enc, ptr, end)) return -XML_TOK_CLOSE_PAREN; switch (BYTE_TYPE(enc, ptr)) { case BT_AST: @@ -1141,7 +1134,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, *nextTokPtr = ptr; return XML_TOK_INVALID; } - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_GT: case BT_RPAR: case BT_COMMA: @@ -1154,8 +1147,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, ptr += MINBPC(enc); switch (tok) { case XML_TOK_NAME: - if (ptr == end) - return XML_TOK_PARTIAL; + REQUIRE_CHAR(enc, ptr, end); tok = XML_TOK_PREFIXED_NAME; switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) @@ -1204,10 +1196,12 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { const char *start; - if (ptr == end) + if (ptr >= end) return XML_TOK_NONE; + else if (! HAS_CHAR(enc, ptr, end)) + return XML_TOK_PARTIAL; start = ptr; - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: ptr += n; break; @@ -1232,7 +1226,7 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, case BT_CR: if (ptr == start) { ptr += MINBPC(enc); - if (ptr == end) + if (! HAS_CHAR(enc, ptr, end)) return XML_TOK_TRAILING_CR; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); @@ -1262,10 +1256,12 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { const char *start; - if (ptr == end) + if (ptr >= end) return XML_TOK_NONE; + else if (! HAS_CHAR(enc, ptr, end)) + return XML_TOK_PARTIAL; start = ptr; - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: ptr += n; break; @@ -1294,7 +1290,7 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, case BT_CR: if (ptr == start) { ptr += MINBPC(enc); - if (ptr == end) + if (! HAS_CHAR(enc, ptr, end)) return XML_TOK_TRAILING_CR; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); @@ -1326,15 +1322,15 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, end = ptr + n; } } - while (ptr != end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { INVALID_CASES(ptr, nextTokPtr) case BT_LT: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; + ptr += MINBPC(enc); + REQUIRE_CHAR(enc, ptr, end); if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; + ptr += MINBPC(enc); + REQUIRE_CHAR(enc, ptr, end); if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) { ++level; ptr += MINBPC(enc); @@ -1342,11 +1338,11 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, } break; case BT_RSQB: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; + ptr += MINBPC(enc); + REQUIRE_CHAR(enc, ptr, end); if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; + ptr += MINBPC(enc); + REQUIRE_CHAR(enc, ptr, end); if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { ptr += MINBPC(enc); if (level == 0) { @@ -1373,7 +1369,7 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, { ptr += MINBPC(enc); end -= MINBPC(enc); - for (; ptr != end; ptr += MINBPC(enc)) { + for (; HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) { switch (BYTE_TYPE(enc, ptr)) { case BT_DIGIT: case BT_HEX: @@ -1521,7 +1517,7 @@ PREFIX(getAtts)(const ENCODING *enc, const char *ptr, } static int PTRFASTCALL -PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) +PREFIX(charRefNumber)(const ENCODING *UNUSED_P(enc), const char *ptr) { int result = 0; /* skip &# */ @@ -1565,7 +1561,7 @@ PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) } static int PTRCALL -PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, +PREFIX(predefinedEntityName)(const ENCODING *UNUSED_P(enc), const char *ptr, const char *end) { switch ((end - ptr)/MINBPC(enc)) { @@ -1683,11 +1679,11 @@ PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) } static int PTRCALL -PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, +PREFIX(nameMatchesAscii)(const ENCODING *UNUSED_P(enc), const char *ptr1, const char *end1, const char *ptr2) { for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { - if (ptr1 == end1) + if (end1 - ptr1 < MINBPC(enc)) return 0; if (!CHAR_MATCHES(enc, ptr1, *ptr2)) return 0; @@ -1744,7 +1740,7 @@ PREFIX(updatePosition)(const ENCODING *enc, const char *end, POSITION *pos) { - while (ptr < end) { + while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ @@ -1760,7 +1756,7 @@ PREFIX(updatePosition)(const ENCODING *enc, case BT_CR: pos->lineNumber++; ptr += MINBPC(enc); - if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) + if (HAS_CHAR(enc, ptr, end) && BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); pos->columnNumber = (XML_Size)-1; break; diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index f1fda48..56285b6 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -124,6 +124,7 @@ static const unsigned char faulthandler_nsignals = \ #ifdef HAVE_SIGALTSTACK static stack_t stack; +static stack_t old_stack; #endif @@ -1148,7 +1149,7 @@ int _PyFaulthandler_Init(void) stack.ss_size = SIGSTKSZ; stack.ss_sp = PyMem_Malloc(stack.ss_size); if (stack.ss_sp != NULL) { - err = sigaltstack(&stack, NULL); + err = sigaltstack(&stack, &old_stack); if (err) { PyMem_Free(stack.ss_sp); stack.ss_sp = NULL; @@ -1204,6 +1205,20 @@ void _PyFaulthandler_Fini(void) faulthandler_disable(); #ifdef HAVE_SIGALTSTACK if (stack.ss_sp != NULL) { + /* Fetch the current alt stack */ + stack_t current_stack; + if (sigaltstack(NULL, ¤t_stack) == 0) { + if (current_stack.ss_sp == stack.ss_sp) { + /* The current alt stack is the one that we installed. + It is safe to restore the old stack that we found when + we installed ours */ + sigaltstack(&old_stack, NULL); + } else { + /* Someone switched to a different alt stack and didn't + restore ours when they were done (if they're done). + There's not much we can do in this unlikely case */ + } + } PyMem_Free(stack.ss_sp); stack.ss_sp = NULL; } diff --git a/Modules/getbuildinfo.c b/Modules/getbuildinfo.c index 0971a64..5f941a2 100644 --- a/Modules/getbuildinfo.c +++ b/Modules/getbuildinfo.c @@ -21,47 +21,47 @@ #endif /* XXX Only unix build process has been tested */ -#ifndef HGVERSION -#define HGVERSION "" +#ifndef GITVERSION +#define GITVERSION "" #endif -#ifndef HGTAG -#define HGTAG "" +#ifndef GITTAG +#define GITTAG "" #endif -#ifndef HGBRANCH -#define HGBRANCH "" +#ifndef GITBRANCH +#define GITBRANCH "" #endif const char * Py_GetBuildInfo(void) { - static char buildinfo[50 + sizeof(HGVERSION) + - ((sizeof(HGTAG) > sizeof(HGBRANCH)) ? - sizeof(HGTAG) : sizeof(HGBRANCH))]; - const char *revision = _Py_hgversion(); + static char buildinfo[50 + sizeof(GITVERSION) + + ((sizeof(GITTAG) > sizeof(GITBRANCH)) ? + sizeof(GITTAG) : sizeof(GITBRANCH))]; + const char *revision = _Py_gitversion(); const char *sep = *revision ? ":" : ""; - const char *hgid = _Py_hgidentifier(); - if (!(*hgid)) - hgid = "default"; + const char *gitid = _Py_gitidentifier(); + if (!(*gitid)) + gitid = "default"; PyOS_snprintf(buildinfo, sizeof(buildinfo), - "%s%s%s, %.20s, %.9s", hgid, sep, revision, + "%s%s%s, %.20s, %.9s", gitid, sep, revision, DATE, TIME); return buildinfo; } const char * -_Py_hgversion(void) +_Py_gitversion(void) { - return HGVERSION; + return GITVERSION; } const char * -_Py_hgidentifier(void) +_Py_gitidentifier(void) { - const char *hgtag, *hgid; - hgtag = HGTAG; - if ((*hgtag) && strcmp(hgtag, "tip") != 0) - hgid = hgtag; + const char *gittag, *gitid; + gittag = GITTAG; + if ((*gittag) && strcmp(gittag, "undefined") != 0) + gitid = gittag; else - hgid = HGBRANCH; - return hgid; + gitid = GITBRANCH; + return gitid; } diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index 3a134a0..277fce4 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -140,6 +140,7 @@ grp_getgrnam_impl(PyObject *module, PyObject *name) if ((bytes = PyUnicode_EncodeFSDefault(name)) == NULL) return NULL; + /* check for embedded null bytes */ if (PyBytes_AsStringAndSize(bytes, &name_chars, NULL) == -1) goto out; diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index be0f498..584dc6e 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -1854,33 +1854,37 @@ chain_next(chainobject *lz) { PyObject *item; - if (lz->source == NULL) - return NULL; /* already stopped */ - - if (lz->active == NULL) { - PyObject *iterable = PyIter_Next(lz->source); - if (iterable == NULL) { - Py_CLEAR(lz->source); - return NULL; /* no more input sources */ - } - lz->active = PyObject_GetIter(iterable); - Py_DECREF(iterable); + /* lz->source is the iterator of iterables. If it's NULL, we've already + * consumed them all. lz->active is the current iterator. If it's NULL, + * we should grab a new one from lz->source. */ + while (lz->source != NULL) { if (lz->active == NULL) { - Py_CLEAR(lz->source); - return NULL; /* input not iterable */ + PyObject *iterable = PyIter_Next(lz->source); + if (iterable == NULL) { + Py_CLEAR(lz->source); + return NULL; /* no more input sources */ + } + lz->active = PyObject_GetIter(iterable); + Py_DECREF(iterable); + if (lz->active == NULL) { + Py_CLEAR(lz->source); + return NULL; /* input not iterable */ + } } + item = (*Py_TYPE(lz->active)->tp_iternext)(lz->active); + if (item != NULL) + return item; + if (PyErr_Occurred()) { + if (PyErr_ExceptionMatches(PyExc_StopIteration)) + PyErr_Clear(); + else + return NULL; /* input raised an exception */ + } + /* lz->active is consumed, try with the next iterable. */ + Py_CLEAR(lz->active); } - item = PyIter_Next(lz->active); - if (item != NULL) - return item; - if (PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_StopIteration)) - PyErr_Clear(); - else - return NULL; /* input raised an exception */ - } - Py_CLEAR(lz->active); - return chain_next(lz); /* recurse and use next active */ + /* Everything had been consumed already. */ + return NULL; } static PyObject * diff --git a/Modules/main.c b/Modules/main.c index e4c955e..d36db6d 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -50,7 +50,7 @@ static char *usage_1 = "\ Options and arguments (and corresponding environment variables):\n\ -b : issue warnings about str(bytes_instance), str(bytearray_instance)\n\ and comparing bytes/bytearray with str. (-bb: issue errors)\n\ --B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\ +-B : don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x\n\ -c cmd : program passed in as string (terminates option list)\n\ -d : debug output from parser; also PYTHONDEBUG=x\n\ -E : ignore PYTHON* environment variables (such as PYTHONPATH)\n\ @@ -223,7 +223,7 @@ static int RunModule(wchar_t *modname, int set_argv0) static int RunMainFromImporter(wchar_t *filename) { - PyObject *argv0 = NULL, *importer, *sys_path; + PyObject *argv0 = NULL, *importer, *sys_path, *sys_path0; int sts; argv0 = PyUnicode_FromWideChar(filename, wcslen(filename)); @@ -248,7 +248,17 @@ RunMainFromImporter(wchar_t *filename) PyErr_SetString(PyExc_RuntimeError, "unable to get sys.path"); goto error; } - if (PyList_SetItem(sys_path, 0, argv0)) { + sys_path0 = PyList_GetItem(sys_path, 0); + sts = 0; + if (!sys_path0) { + PyErr_Clear(); + sts = PyList_Append(sys_path, argv0); + } else if (PyObject_IsTrue(sys_path0)) { + sts = PyList_Insert(sys_path, 0, argv0); + } else { + sts = PyList_SetItem(sys_path, 0, argv0); + } + if (sts) { argv0 = NULL; goto error; } diff --git a/Modules/makesetup b/Modules/makesetup index e204a05..8db8de8 100755 --- a/Modules/makesetup +++ b/Modules/makesetup @@ -259,7 +259,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | for mod in $MODS do EXTDECLS="${EXTDECLS}extern PyObject* PyInit_$mod(void);$NL" - INITBITS="${INITBITS} {\"$mod\", PyInit_$mod},$NL" + INITBITS="${INITBITS} {\"$mod\", PyInit_$mod},$NL" done diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 4eb9274..d80b1f6 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -807,10 +807,10 @@ mmap_subscript(mmap_object *self, PyObject *item) else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelen; - if (PySlice_GetIndicesEx(item, self->size, - &start, &stop, &step, &slicelen) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return NULL; } + slicelen = PySlice_AdjustIndices(self->size, &start, &stop, step); if (slicelen <= 0) return PyBytes_FromStringAndSize("", 0); @@ -933,11 +933,10 @@ mmap_ass_subscript(mmap_object *self, PyObject *item, PyObject *value) Py_ssize_t start, stop, step, slicelen; Py_buffer vbuf; - if (PySlice_GetIndicesEx(item, - self->size, &start, &stop, - &step, &slicelen) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return -1; } + slicelen = PySlice_AdjustIndices(self->size, &start, &stop, step); if (value == NULL) { PyErr_SetString(PyExc_TypeError, "mmap object doesn't support slice deletion"); diff --git a/Modules/nismodule.c b/Modules/nismodule.c index 64eb5db..3942acb 100644 --- a/Modules/nismodule.c +++ b/Modules/nismodule.c @@ -173,6 +173,7 @@ nis_match (PyObject *self, PyObject *args, PyObject *kwdict) return NULL; if ((bkey = PyUnicode_EncodeFSDefault(ukey)) == NULL) return NULL; + /* check for embedded null bytes */ if (PyBytes_AsStringAndSize(bkey, &key, &keylen) == -1) { Py_DECREF(bkey); return NULL; diff --git a/Modules/overlapped.c b/Modules/overlapped.c index f85e5bc..3b31d11 100644 --- a/Modules/overlapped.c +++ b/Modules/overlapped.c @@ -1151,7 +1151,7 @@ ConnectPipe(OverlappedObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "U", &AddressObj)) return NULL; - Address = PyUnicode_AsWideCharString(AddressObj, NULL); + Address = _PyUnicode_AsWideCharString(AddressObj); if (Address == NULL) return NULL; diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index 6471b8e..fe095e5 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -763,6 +763,9 @@ build_node_children(PyObject *tuple, node *root, int *line_num) Py_ssize_t i; int err; + if (len < 0) { + return NULL; + } for (i = 1; i < len; ++i) { /* elem must always be a sequence, however simple */ PyObject* elem = PySequence_GetItem(tuple, i); @@ -783,7 +786,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num) if (type == -1 && PyErr_Occurred()) { Py_DECREF(temp); Py_DECREF(elem); - return 0; + return NULL; } } Py_DECREF(temp); @@ -795,7 +798,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num) PyErr_SetObject(parser_error, err); Py_XDECREF(err); Py_XDECREF(elem); - return (0); + return NULL; } if (ISTERMINAL(type)) { Py_ssize_t len = PyObject_Size(elem); @@ -804,11 +807,14 @@ build_node_children(PyObject *tuple, node *root, int *line_num) if ((len != 2) && (len != 3)) { err_string("terminal nodes must have 2 or 3 entries"); - return 0; + Py_DECREF(elem); + return NULL; } temp = PySequence_GetItem(elem, 1); - if (temp == NULL) - return 0; + if (temp == NULL) { + Py_DECREF(elem); + return NULL; + } if (!PyUnicode_Check(temp)) { PyErr_Format(parser_error, "second item in terminal node must be a string," @@ -816,46 +822,49 @@ build_node_children(PyObject *tuple, node *root, int *line_num) Py_TYPE(temp)->tp_name); Py_DECREF(temp); Py_DECREF(elem); - return 0; + return NULL; } if (len == 3) { PyObject *o = PySequence_GetItem(elem, 2); - if (o != NULL) { - if (PyLong_Check(o)) { - int num = _PyLong_AsInt(o); - if (num == -1 && PyErr_Occurred()) { - Py_DECREF(o); - Py_DECREF(temp); - Py_DECREF(elem); - return 0; - } - *line_num = num; - } - else { - PyErr_Format(parser_error, - "third item in terminal node must be an" - " integer, found %s", - Py_TYPE(temp)->tp_name); + if (o == NULL) { + Py_DECREF(temp); + Py_DECREF(elem); + return NULL; + } + if (PyLong_Check(o)) { + int num = _PyLong_AsInt(o); + if (num == -1 && PyErr_Occurred()) { Py_DECREF(o); Py_DECREF(temp); Py_DECREF(elem); - return 0; + return NULL; } + *line_num = num; + } + else { + PyErr_Format(parser_error, + "third item in terminal node must be an" + " integer, found %s", + Py_TYPE(temp)->tp_name); Py_DECREF(o); + Py_DECREF(temp); + Py_DECREF(elem); + return NULL; } + Py_DECREF(o); } temp_str = _PyUnicode_AsStringAndSize(temp, &len); if (temp_str == NULL) { Py_DECREF(temp); - Py_XDECREF(elem); - return 0; + Py_DECREF(elem); + return NULL; } strn = (char *)PyObject_MALLOC(len + 1); if (strn == NULL) { Py_DECREF(temp); - Py_XDECREF(elem); + Py_DECREF(elem); PyErr_NoMemory(); - return 0; + return NULL; } (void) memcpy(strn, temp_str, len + 1); Py_DECREF(temp); @@ -865,20 +874,21 @@ build_node_children(PyObject *tuple, node *root, int *line_num) * It has to be one or the other; this is an error. * Raise an exception. */ - PyObject *err = Py_BuildValue("os", elem, "unknown node type."); + PyObject *err = Py_BuildValue("Os", elem, "unknown node type."); PyErr_SetObject(parser_error, err); Py_XDECREF(err); - Py_XDECREF(elem); - return (0); + Py_DECREF(elem); + return NULL; } err = PyNode_AddChild(root, type, strn, *line_num, 0); if (err == E_NOMEM) { - Py_XDECREF(elem); + Py_DECREF(elem); PyObject_FREE(strn); - return (node *) PyErr_NoMemory(); + PyErr_NoMemory(); + return NULL; } if (err == E_OVERFLOW) { - Py_XDECREF(elem); + Py_DECREF(elem); PyObject_FREE(strn); PyErr_SetString(PyExc_ValueError, "unsupported number of child nodes"); @@ -889,14 +899,14 @@ build_node_children(PyObject *tuple, node *root, int *line_num) node* new_child = CHILD(root, i - 1); if (new_child != build_node_children(elem, new_child, line_num)) { - Py_XDECREF(elem); - return (0); + Py_DECREF(elem); + return NULL; } } else if (type == NEWLINE) { /* It's true: we increment the */ ++(*line_num); /* line number *after* the newline! */ } - Py_XDECREF(elem); + Py_DECREF(elem); } return root; } @@ -931,10 +941,23 @@ build_node_tree(PyObject *tuple) if (num == encoding_decl) { encoding = PySequence_GetItem(tuple, 2); + if (encoding == NULL) { + PyErr_SetString(parser_error, "missed encoding"); + return NULL; + } + if (!PyUnicode_Check(encoding)) { + PyErr_Format(parser_error, + "encoding must be a string, found %.200s", + Py_TYPE(encoding)->tp_name); + Py_DECREF(encoding); + return NULL; + } /* tuple isn't borrowed anymore here, need to DECREF */ tuple = PySequence_GetSlice(tuple, 0, 2); - if (tuple == NULL) + if (tuple == NULL) { + Py_DECREF(encoding); return NULL; + } } res = PyNode_New(num); if (res != NULL) { @@ -947,31 +970,33 @@ build_node_tree(PyObject *tuple) const char *temp; temp = _PyUnicode_AsStringAndSize(encoding, &len); if (temp == NULL) { - Py_DECREF(res); + PyNode_Free(res); Py_DECREF(encoding); Py_DECREF(tuple); return NULL; } res->n_str = (char *)PyObject_MALLOC(len + 1); if (res->n_str == NULL) { - Py_DECREF(res); + PyNode_Free(res); Py_DECREF(encoding); Py_DECREF(tuple); PyErr_NoMemory(); return NULL; } (void) memcpy(res->n_str, temp, len + 1); - Py_DECREF(encoding); - Py_DECREF(tuple); } } + if (encoding != NULL) { + Py_DECREF(encoding); + Py_DECREF(tuple); + } } else { /* The tuple is illegal -- if the number is neither TERMINAL nor * NONTERMINAL, we can't use it. Not sure the implementation * allows this condition, but the API doesn't preclude it. */ - PyObject *err = Py_BuildValue("os", tuple, + PyObject *err = Py_BuildValue("Os", tuple, "Illegal component tuple."); PyErr_SetObject(parser_error, err); Py_XDECREF(err); @@ -3433,7 +3458,6 @@ parser__pickler(PyObject *self, PyObject *args) result = Py_BuildValue("O(O)", pickle_constructor, tuple); Py_DECREF(tuple); } - Py_DECREF(empty_dict); Py_DECREF(newargs); } finally: diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 3e446a5..d42416b 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3642,8 +3642,8 @@ _posix_listdir(path_t *path, PyObject *list) char *name; if (path->narrow) { name = path->narrow; - /* only return bytes if they specified a bytes object */ - return_str = !(PyBytes_Check(path->object)); + /* only return bytes if they specified a bytes-like object */ + return_str = !PyObject_CheckBuffer(path->object); } else { name = "."; @@ -3821,9 +3821,9 @@ os__getfinalpathname_impl(PyObject *module, PyObject *path) wchar_t *target_path; int result_length; PyObject *result; - wchar_t *path_wchar; + const wchar_t *path_wchar; - path_wchar = PyUnicode_AsUnicode(path); + path_wchar = _PyUnicode_AsUnicode(path); if (path_wchar == NULL) return NULL; @@ -4964,8 +4964,16 @@ parse_envlist(PyObject* env, Py_ssize_t *envc_ptr) goto error; } - k = PyBytes_AsString(key2); - v = PyBytes_AsString(val2); + k = PyBytes_AS_STRING(key2); + v = PyBytes_AS_STRING(val2); + /* Search from index 1 because on Windows starting '=' is allowed for + defining hidden environment variables. */ + if (*k == '\0' || strchr(k + 1, '=') != NULL) { + Py_DECREF(key2); + Py_DECREF(val2); + PyErr_SetString(PyExc_ValueError, "illegal environment variable name"); + goto error; + } len = PyBytes_GET_SIZE(key2) + PyBytes_GET_SIZE(val2) + 2; p = PyMem_NEW(char, len); @@ -6755,7 +6763,7 @@ static PyObject * os_setgroups(PyObject *module, PyObject *groups) /*[clinic end generated code: output=3fcb32aad58c5ecd input=fa742ca3daf85a7e]*/ { - int i, len; + Py_ssize_t i, len; gid_t grouplist[MAX_GROUPS]; if (!PySequence_Check(groups)) { @@ -6763,6 +6771,9 @@ os_setgroups(PyObject *module, PyObject *groups) return NULL; } len = PySequence_Size(groups); + if (len < 0) { + return NULL; + } if (len > MAX_GROUPS) { PyErr_SetString(PyExc_ValueError, "too many groups"); return NULL; @@ -7153,7 +7164,7 @@ exit: static PyObject * win_readlink(PyObject *self, PyObject *args, PyObject *kwargs) { - wchar_t *path; + const wchar_t *path; DWORD n_bytes_returned; DWORD io_result; PyObject *po, *result; @@ -7172,7 +7183,7 @@ win_readlink(PyObject *self, PyObject *args, PyObject *kwargs) )) return NULL; - path = PyUnicode_AsUnicode(po); + path = _PyUnicode_AsUnicode(po); if (path == NULL) return NULL; @@ -8076,9 +8087,9 @@ os_read_impl(PyObject *module, int fd, Py_ssize_t length) #if (defined(HAVE_SENDFILE) && (defined(__FreeBSD__) || defined(__DragonFly__) \ || defined(__APPLE__))) || defined(HAVE_READV) || defined(HAVE_WRITEV) static Py_ssize_t -iov_setup(struct iovec **iov, Py_buffer **buf, PyObject *seq, int cnt, int type) +iov_setup(struct iovec **iov, Py_buffer **buf, PyObject *seq, Py_ssize_t cnt, int type) { - int i, j; + Py_ssize_t i, j; Py_ssize_t blen, total = 0; *iov = PyMem_New(struct iovec, cnt); @@ -8155,8 +8166,7 @@ static Py_ssize_t os_readv_impl(PyObject *module, int fd, PyObject *buffers) /*[clinic end generated code: output=792da062d3fcebdb input=e679eb5dbfa0357d]*/ { - int cnt; - Py_ssize_t n; + Py_ssize_t cnt, n; int async_err = 0; struct iovec *iov; Py_buffer *buf; @@ -8168,6 +8178,8 @@ os_readv_impl(PyObject *module, int fd, PyObject *buffers) } cnt = PySequence_Size(buffers); + if (cnt < 0) + return -1; if (iov_setup(&iov, &buf, buffers, cnt, PyBUF_WRITABLE) < 0) return -1; @@ -8310,15 +8322,24 @@ posix_sendfile(PyObject *self, PyObject *args, PyObject *kwdict) "sendfile() headers must be a sequence"); return NULL; } else { - Py_ssize_t i = 0; /* Avoid uninitialized warning */ - sf.hdr_cnt = PySequence_Size(headers); - if (sf.hdr_cnt > 0 && - (i = iov_setup(&(sf.headers), &hbuf, - headers, sf.hdr_cnt, PyBUF_SIMPLE)) < 0) + Py_ssize_t i = PySequence_Size(headers); + if (i < 0) + return NULL; + if (i > INT_MAX) { + PyErr_SetString(PyExc_OverflowError, + "sendfile() header is too large"); return NULL; + } + if (i > 0) { + sf.hdr_cnt = (int)i; + i = iov_setup(&(sf.headers), &hbuf, + headers, sf.hdr_cnt, PyBUF_SIMPLE); + if (i < 0) + return NULL; #ifdef __APPLE__ - sbytes += i; + sbytes += i; #endif + } } } if (trailers != NULL) { @@ -8327,15 +8348,24 @@ posix_sendfile(PyObject *self, PyObject *args, PyObject *kwdict) "sendfile() trailers must be a sequence"); return NULL; } else { - Py_ssize_t i = 0; /* Avoid uninitialized warning */ - sf.trl_cnt = PySequence_Size(trailers); - if (sf.trl_cnt > 0 && - (i = iov_setup(&(sf.trailers), &tbuf, - trailers, sf.trl_cnt, PyBUF_SIMPLE)) < 0) + Py_ssize_t i = PySequence_Size(trailers); + if (i < 0) return NULL; + if (i > INT_MAX) { + PyErr_SetString(PyExc_OverflowError, + "sendfile() trailer is too large"); + return NULL; + } + if (i > 0) { + sf.trl_cnt = (int)i; + i = iov_setup(&(sf.trailers), &tbuf, + trailers, sf.trl_cnt, PyBUF_SIMPLE); + if (i < 0) + return NULL; #ifdef __APPLE__ - sbytes += i; + sbytes += i; #endif + } } } @@ -8605,7 +8635,7 @@ static Py_ssize_t os_writev_impl(PyObject *module, int fd, PyObject *buffers) /*[clinic end generated code: output=56565cfac3aac15b input=5b8d17fe4189d2fe]*/ { - int cnt; + Py_ssize_t cnt; Py_ssize_t result; int async_err = 0; struct iovec *iov; @@ -8617,6 +8647,8 @@ os_writev_impl(PyObject *module, int fd, PyObject *buffers) return -1; } cnt = PySequence_Size(buffers); + if (cnt < 0) + return -1; if (iov_setup(&iov, &buf, buffers, cnt, PyBUF_SIMPLE) < 0) { return -1; @@ -9043,23 +9075,36 @@ static PyObject * os_putenv_impl(PyObject *module, PyObject *name, PyObject *value) /*[clinic end generated code: output=d29a567d6b2327d2 input=ba586581c2e6105f]*/ { - wchar_t *env; + const wchar_t *env; + Py_ssize_t size; + /* Search from index 1 because on Windows starting '=' is allowed for + defining hidden environment variables. */ + if (PyUnicode_GET_LENGTH(name) == 0 || + PyUnicode_FindChar(name, '=', 1, PyUnicode_GET_LENGTH(name), 1) != -1) + { + PyErr_SetString(PyExc_ValueError, "illegal environment variable name"); + return NULL; + } PyObject *unicode = PyUnicode_FromFormat("%U=%U", name, value); if (unicode == NULL) { - PyErr_NoMemory(); return NULL; } - if (_MAX_ENV < PyUnicode_GET_LENGTH(unicode)) { + + env = PyUnicode_AsUnicodeAndSize(unicode, &size); + if (env == NULL) + goto error; + if (size > _MAX_ENV) { PyErr_Format(PyExc_ValueError, "the environment variable is longer than %u characters", _MAX_ENV); goto error; } - - env = PyUnicode_AsUnicode(unicode); - if (env == NULL) + if (wcslen(env) != (size_t)size) { + PyErr_SetString(PyExc_ValueError, "embedded null character"); goto error; + } + if (_wputenv(env)) { posix_error(); goto error; @@ -9089,12 +9134,15 @@ os_putenv_impl(PyObject *module, PyObject *name, PyObject *value) { PyObject *bytes = NULL; char *env; - char *name_string = PyBytes_AsString(name); - char *value_string = PyBytes_AsString(value); + const char *name_string = PyBytes_AS_STRING(name); + const char *value_string = PyBytes_AS_STRING(value); + if (strchr(name_string, '=') != NULL) { + PyErr_SetString(PyExc_ValueError, "illegal environment variable name"); + return NULL; + } bytes = PyBytes_FromFormat("%s=%s", name_string, value_string); if (bytes == NULL) { - PyErr_NoMemory(); return NULL; } @@ -11912,7 +11960,7 @@ DirEntry_from_posix_info(path_t *path, char *name, Py_ssize_t name_len, if (!joined_path) goto error; - if (!path->narrow || !PyBytes_Check(path->object)) { + if (!path->narrow || !PyObject_CheckBuffer(path->object)) { entry->name = PyUnicode_DecodeFSDefaultAndSize(name, name_len); entry->path = PyUnicode_DecodeFSDefault(joined_path); } @@ -12788,7 +12836,7 @@ all_ins(PyObject *m) if (PyModule_AddIntMacro(m, SCHED_RR)) return -1; #endif #ifdef SCHED_SPORADIC - if (PyModule_AddIntMacro(m, SCHED_SPORADIC) return -1; + if (PyModule_AddIntMacro(m, SCHED_SPORADIC)) return -1; #endif #ifdef SCHED_BATCH if (PyModule_AddIntMacro(m, SCHED_BATCH)) return -1; diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index 7416cf7..1b0d499 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -150,6 +150,7 @@ pwd_getpwnam_impl(PyObject *module, PyObject *arg) if ((bytes = PyUnicode_EncodeFSDefault(arg)) == NULL) return NULL; + /* check for embedded null bytes */ if (PyBytes_AsStringAndSize(bytes, &name, NULL) == -1) goto out; if ((p = getpwnam(name)) == NULL) { diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 00c96a1..adc9b6c 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1190,10 +1190,8 @@ newxmlparseobject(const char *encoding, const char *namespace_separator, PyObjec Py_DECREF(self); return NULL; } -#if ((XML_MAJOR_VERSION >= 2) && (XML_MINOR_VERSION >= 1)) || defined(XML_HAS_SET_HASH_SALT) - /* This feature was added upstream in libexpat 2.1.0. Our expat copy - * has a backport of this feature where we also define XML_HAS_SET_HASH_SALT - * to indicate that we can still use it. */ +#if XML_COMBINED_VERSION >= 20100 + /* This feature was added upstream in libexpat 2.1.0. */ XML_SetHashSalt(self->itself, (unsigned long)_Py_HashSecret.expat.hashsalt); #endif diff --git a/Modules/readline.c b/Modules/readline.c index 54f15bc..c6035e2 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -1330,15 +1330,17 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt) if (n > 0) { const char *line; int length = _py_get_history_length(); - if (length > 0) + if (length > 0) { + HIST_ENTRY *hist_ent; #ifdef __APPLE__ if (using_libedit_emulation) { /* handle older 0-based or newer 1-based indexing */ - line = (const char *)history_get(length + libedit_history_start - 1)->line; + hist_ent = history_get(length + libedit_history_start - 1); } else #endif /* __APPLE__ */ - line = (const char *)history_get(length)->line; - else + hist_ent = history_get(length); + line = hist_ent ? hist_ent->line : ""; + } else line = ""; if (strcmp(p, line)) add_history(p); diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 753d987..e0d06b4 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -139,6 +139,10 @@ timeval_from_double(double d, struct timeval *tv) { tv->tv_sec = floor(d); tv->tv_usec = fmod(d, 1.0) * 1000000.0; + /* Don't disable the timer if the computation above rounds down to zero. */ + if (d > 0.0 && tv->tv_sec == 0 && tv->tv_usec == 0) { + tv->tv_usec = 1; + } } Py_LOCAL_INLINE(double) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index af6cc94..47abe8d 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1183,9 +1183,9 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto) { struct sockaddr_un *a = (struct sockaddr_un *) addr; #ifdef linux - if (a->sun_path[0] == 0) { /* Linux abstract namespace */ - addrlen -= offsetof(struct sockaddr_un, sun_path); - return PyBytes_FromStringAndSize(a->sun_path, addrlen); + size_t linuxaddrlen = addrlen - offsetof(struct sockaddr_un, sun_path); + if (linuxaddrlen > 0 && a->sun_path[0] == 0) { /* Linux abstract namespace */ + return PyBytes_FromStringAndSize(a->sun_path, linuxaddrlen); } else #endif /* linux */ diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c index 4b9f3cd..065f79c 100644 --- a/Modules/spwdmodule.c +++ b/Modules/spwdmodule.c @@ -134,6 +134,7 @@ spwd_getspnam_impl(PyObject *module, PyObject *arg) if ((bytes = PyUnicode_EncodeFSDefault(arg)) == NULL) return NULL; + /* check for embedded null bytes */ if (PyBytes_AsStringAndSize(bytes, &name, NULL) == -1) goto out; if ((p = getspnam(name)) == NULL) { diff --git a/Modules/timemodule.c b/Modules/timemodule.c index d2caacd..252fdcf 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -596,7 +596,7 @@ time_strftime(PyObject *self, PyObject *args) buf.tm_isdst = 1; #ifdef HAVE_WCSFTIME - format = PyUnicode_AsWideCharString(format_arg, NULL); + format = _PyUnicode_AsWideCharString(format_arg); if (format == NULL) return NULL; fmt = format; diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c index 40c1760..ea620fd 100644 --- a/Modules/xxlimited.c +++ b/Modules/xxlimited.c @@ -31,7 +31,7 @@ static XxoObject * newXxoObject(PyObject *arg) { XxoObject *self; - self = PyObject_New(XxoObject, (PyTypeObject*)Xxo_Type); + self = PyObject_GC_New(XxoObject, (PyTypeObject*)Xxo_Type); if (self == NULL) return NULL; self->x_attr = NULL; diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 7473a8f..feef98f 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -1104,7 +1104,7 @@ get_decompress_func(void) _Py_IDENTIFIER(decompress); if (importing_zlib != 0) - /* Someone has a zlib.py[co] in their Zip file; + /* Someone has a zlib.pyc in their Zip file; let's avoid a stack overflow. */ return NULL; importing_zlib = 1; @@ -1263,7 +1263,12 @@ eq_mtime(time_t t1, time_t t2) return d <= 1; } -/* Given the contents of a .py[co] file in a buffer, unmarshal the data +/* Issue #29537: handle issue27286 bytecode incompatibility + * See Lib/importlib/_bootstrap_external.py for general discussion + */ +extern PY_UINT32_T _Py_BACKCOMPAT_MAGIC_NUMBER; + +/* Given the contents of a .pyc file in a buffer, unmarshal the data and return the code object. Return None if it the magic word doesn't match (we do this instead of raising an exception as we fall back to .py if available and we don't want to mask other errors). @@ -1274,6 +1279,7 @@ unmarshal_code(PyObject *pathname, PyObject *data, time_t mtime) PyObject *code; unsigned char *buf = (unsigned char *)PyBytes_AsString(data); Py_ssize_t size = PyBytes_Size(data); + PY_UINT32_T magic; if (size < 12) { PyErr_SetString(ZipImportError, @@ -1281,7 +1287,10 @@ unmarshal_code(PyObject *pathname, PyObject *data, time_t mtime) return NULL; } - if (get_uint32(buf) != (unsigned int)PyImport_GetMagicNumber()) { + magic = get_uint32(buf); + if (magic != (unsigned int)PyImport_GetMagicNumber() + /* Issue #29537: handle issue27286 bytecode incompatibility */ + && magic != _Py_BACKCOMPAT_MAGIC_NUMBER) { if (Py_VerboseFlag) { PySys_FormatStderr("# %R has bad magic\n", pathname); @@ -1405,7 +1414,7 @@ get_mtime_of_source(ZipImporter *self, PyObject *path) PyObject *toc_entry, *stripped; time_t mtime; - /* strip 'c' or 'o' from *.py[co] */ + /* strip 'c' from *.pyc */ if (PyUnicode_READY(path) == -1) return (time_t)-1; stripped = PyUnicode_FromKindAndData(PyUnicode_KIND(path), diff --git a/Modules/zlib/ChangeLog b/Modules/zlib/ChangeLog index f22aaba..30199a6 100644 --- a/Modules/zlib/ChangeLog +++ b/Modules/zlib/ChangeLog @@ -1,10 +1,53 @@ ChangeLog file for zlib +Changes in 1.2.11 (15 Jan 2017) +- Fix deflate stored bug when pulling last block from window +- Permit immediate deflateParams changes before any deflate input + +Changes in 1.2.10 (2 Jan 2017) +- Avoid warnings on snprintf() return value +- Fix bug in deflate_stored() for zero-length input +- Fix bug in gzwrite.c that produced corrupt gzip files +- Remove files to be installed before copying them in Makefile.in +- Add warnings when compiling with assembler code + +Changes in 1.2.9 (31 Dec 2016) +- Fix contrib/minizip to permit unzipping with desktop API [Zouzou] +- Improve contrib/blast to return unused bytes +- Assure that gzoffset() is correct when appending +- Improve compress() and uncompress() to support large lengths +- Fix bug in test/example.c where error code not saved +- Remedy Coverity warning [Randers-Pehrson] +- Improve speed of gzprintf() in transparent mode +- Fix inflateInit2() bug when windowBits is 16 or 32 +- Change DEBUG macro to ZLIB_DEBUG +- Avoid uninitialized access by gzclose_w() +- Allow building zlib outside of the source directory +- Fix bug that accepted invalid zlib header when windowBits is zero +- Fix gzseek() problem on MinGW due to buggy _lseeki64 there +- Loop on write() calls in gzwrite.c in case of non-blocking I/O +- Add --warn (-w) option to ./configure for more compiler warnings +- Reject a window size of 256 bytes if not using the zlib wrapper +- Fix bug when level 0 used with Z_HUFFMAN or Z_RLE +- Add --debug (-d) option to ./configure to define ZLIB_DEBUG +- Fix bugs in creating a very large gzip header +- Add uncompress2() function, which returns the input size used +- Assure that deflateParams() will not switch functions mid-block +- Dramatically speed up deflation for level 0 (storing) +- Add gzfread(), duplicating the interface of fread() +- Add gzfwrite(), duplicating the interface of fwrite() +- Add deflateGetDictionary() function +- Use snprintf() for later versions of Microsoft C +- Fix *Init macros to use z_ prefix when requested +- Replace as400 with os400 for OS/400 support [Monnerat] +- Add crc32_z() and adler32_z() functions with size_t lengths +- Update Visual Studio project files [AraHaan] + Changes in 1.2.8 (28 Apr 2013) - Update contrib/minizip/iowin32.c for Windows RT [Vollant] - Do not force Z_CONST for C++ -- Clean up contrib/vstudio [Ro§] +- Clean up contrib/vstudio [Roß] - Correct spelling error in zlib.h - Fix mixed line endings in contrib/vstudio @@ -34,7 +77,7 @@ Changes in 1.2.7.1 (24 Mar 2013) - Clean up the usage of z_const and respect const usage within zlib - Clean up examples/gzlog.[ch] comparisons of different types - Avoid shift equal to bits in type (caused endless loop) -- Fix unintialized value bug in gzputc() introduced by const patches +- Fix uninitialized value bug in gzputc() introduced by const patches - Fix memory allocation error in examples/zran.c [Nor] - Fix bug where gzopen(), gzclose() would write an empty file - Fix bug in gzclose() when gzwrite() runs out of memory @@ -194,7 +237,7 @@ Changes in 1.2.5.2 (17 Dec 2011) - Add a transparent write mode to gzopen() when 'T' is in the mode - Update python link in zlib man page - Get inffixed.h and MAKEFIXED result to match -- Add a ./config --solo option to make zlib subset with no libary use +- Add a ./config --solo option to make zlib subset with no library use - Add undocumented inflateResetKeep() function for CAB file decoding - Add --cover option to ./configure for gcc coverage testing - Add #define ZLIB_CONST option to use const in the z_stream interface @@ -564,7 +607,7 @@ Changes in 1.2.3.1 (16 August 2006) - Update make_vms.com [Zinser] - Use -fPIC for shared build in configure [Teredesai, Nicholson] - Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen] -- Use fdopen() (not _fdopen()) for Interix in zutil.h [BŠck] +- Use fdopen() (not _fdopen()) for Interix in zutil.h [Bäck] - Add some FAQ entries about the contrib directory - Update the MVS question in the FAQ - Avoid extraneous reads after EOF in gzio.c [Brown] @@ -1178,7 +1221,7 @@ Changes in 1.0.6 (19 Jan 1998) 386 asm code replacing longest_match(). contrib/iostream/ by Kevin Ruland A C++ I/O streams interface to the zlib gz* functions - contrib/iostream2/ by Tyge Løvset + contrib/iostream2/ by Tyge Løvset Another C++ I/O streams interface contrib/untgz/ by "Pedro A. Aranda Guti\irrez" A very simple tar.gz file extractor using zlib @@ -1267,7 +1310,7 @@ Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] - fix array overlay in deflate.c which sometimes caused bad compressed data - fix inflate bug with empty stored block - fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generated bad compressed data. +- fix deflateParams() which could generate bad compressed data. - Bytef is define'd instead of typedef'ed (work around Borland bug) - added an INDEX file - new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), diff --git a/Modules/zlib/Makefile.in b/Modules/zlib/Makefile.in index c61aa30..1852192 100644 --- a/Modules/zlib/Makefile.in +++ b/Modules/zlib/Makefile.in @@ -1,5 +1,5 @@ # Makefile for zlib -# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler +# Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler # For conditions of distribution and use, see copyright notice in zlib.h # To compile and test, type: @@ -20,7 +20,7 @@ CC=cc CFLAGS=-O #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-g -DDEBUG +#CFLAGS=-g -DZLIB_DEBUG #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ # -Wstrict-prototypes -Wmissing-prototypes @@ -32,7 +32,7 @@ CPP=$(CC) -E STATICLIB=libz.a SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.8 +SHAREDLIBV=libz.so.1.2.10 SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) @@ -53,6 +53,9 @@ includedir = ${prefix}/include mandir = ${prefix}/share/man man3dir = ${mandir}/man3 pkgconfigdir = ${libdir}/pkgconfig +SRCDIR= +ZINC= +ZINCOUT=-I. OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o @@ -113,8 +116,8 @@ test64: all64 fi; \ rm -f $$TMP64 -infcover.o: test/infcover.c zlib.h zconf.h - $(CC) $(CFLAGS) -I. -c -o $@ test/infcover.c +infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h + $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c infcover: infcover.o libz.a $(CC) $(CFLAGS) -o $@ infcover.o libz.a @@ -140,24 +143,140 @@ match.lo: match.S mv _match.o match.lo rm -f _match.s -example.o: test/example.c zlib.h zconf.h - $(CC) $(CFLAGS) -I. -c -o $@ test/example.c +example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h + $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c -minigzip.o: test/minigzip.c zlib.h zconf.h - $(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c +minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h + $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c -example64.o: test/example.c zlib.h zconf.h - $(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/example.c +example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h + $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c -minigzip64.o: test/minigzip.c zlib.h zconf.h - $(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/minigzip.c +minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h + $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c -.SUFFIXES: .lo -.c.lo: +adler32.o: $(SRCDIR)adler32.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c + +crc32.o: $(SRCDIR)crc32.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c + +deflate.o: $(SRCDIR)deflate.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c + +infback.o: $(SRCDIR)infback.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c + +inffast.o: $(SRCDIR)inffast.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c + +inflate.o: $(SRCDIR)inflate.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c + +inftrees.o: $(SRCDIR)inftrees.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c + +trees.o: $(SRCDIR)trees.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c + +zutil.o: $(SRCDIR)zutil.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c + +compress.o: $(SRCDIR)compress.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c + +uncompr.o: $(SRCDIR)uncompr.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c + +gzclose.o: $(SRCDIR)gzclose.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c + +gzlib.o: $(SRCDIR)gzlib.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c + +gzread.o: $(SRCDIR)gzread.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c + +gzwrite.o: $(SRCDIR)gzwrite.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c + + +adler32.lo: $(SRCDIR)adler32.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c + -@mv objs/adler32.o $@ + +crc32.lo: $(SRCDIR)crc32.c -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $< - -@mv objs/$*.o $@ + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c + -@mv objs/crc32.o $@ + +deflate.lo: $(SRCDIR)deflate.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c + -@mv objs/deflate.o $@ + +infback.lo: $(SRCDIR)infback.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c + -@mv objs/infback.o $@ + +inffast.lo: $(SRCDIR)inffast.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c + -@mv objs/inffast.o $@ + +inflate.lo: $(SRCDIR)inflate.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c + -@mv objs/inflate.o $@ + +inftrees.lo: $(SRCDIR)inftrees.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c + -@mv objs/inftrees.o $@ + +trees.lo: $(SRCDIR)trees.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c + -@mv objs/trees.o $@ + +zutil.lo: $(SRCDIR)zutil.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c + -@mv objs/zutil.o $@ + +compress.lo: $(SRCDIR)compress.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c + -@mv objs/compress.o $@ + +uncompr.lo: $(SRCDIR)uncompr.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c + -@mv objs/uncompr.o $@ + +gzclose.lo: $(SRCDIR)gzclose.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c + -@mv objs/gzclose.o $@ + +gzlib.lo: $(SRCDIR)gzlib.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c + -@mv objs/gzlib.o $@ + +gzread.lo: $(SRCDIR)gzread.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c + -@mv objs/gzread.o $@ + +gzwrite.lo: $(SRCDIR)gzwrite.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c + -@mv objs/gzwrite.o $@ + placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS) @@ -190,10 +309,12 @@ install-libs: $(LIBS) -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi + rm -f $(DESTDIR)$(libdir)/$(STATICLIB) cp $(STATICLIB) $(DESTDIR)$(libdir) chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB) -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1 -@if test -n "$(SHAREDLIBV)"; then \ + rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \ cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \ echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \ chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \ @@ -203,8 +324,10 @@ install-libs: $(LIBS) ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \ ($(LDCONFIG) || true) >/dev/null 2>&1; \ fi - cp zlib.3 $(DESTDIR)$(man3dir) + rm -f $(DESTDIR)$(man3dir)/zlib.3 + cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir) chmod 644 $(DESTDIR)$(man3dir)/zlib.3 + rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc cp zlib.pc $(DESTDIR)$(pkgconfigdir) chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc # The ranlib in install is needed on NeXTSTEP which checks file times @@ -212,7 +335,8 @@ install-libs: $(LIBS) install: install-libs -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi - cp zlib.h zconf.h $(DESTDIR)$(includedir) + rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h + cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir) chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h uninstall: @@ -226,18 +350,18 @@ uninstall: docs: zlib.3.pdf -zlib.3.pdf: zlib.3 - groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf +zlib.3.pdf: $(SRCDIR)zlib.3 + groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@ -zconf.h.cmakein: zconf.h.in +zconf.h.cmakein: $(SRCDIR)zconf.h.in -@ TEMPFILE=zconfh_$$; \ echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\ - sed -f $$TEMPFILE zconf.h.in > zconf.h.cmakein &&\ - touch -r zconf.h.in zconf.h.cmakein &&\ + sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\ + touch -r $(SRCDIR)zconf.h.in $@ &&\ rm $$TEMPFILE -zconf: zconf.h.in - cp -p zconf.h.in zconf.h +zconf: $(SRCDIR)zconf.h.in + cp -p $(SRCDIR)zconf.h.in zconf.h mostlyclean: clean clean: @@ -255,34 +379,32 @@ maintainer-clean: distclean distclean: clean zconf zconf.h.cmakein docs rm -f Makefile zlib.pc configure.log -@rm -f .DS_Store - -@printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile - -@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile - -@touch -r Makefile.in Makefile + @if [ -f Makefile.in ]; then \ + printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \ + printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \ + touch -r $(SRCDIR)Makefile.in Makefile ; fi + @if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi + @if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi tags: - etags *.[ch] - -depend: - makedepend -- $(CFLAGS) -- *.[ch] - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -adler32.o zutil.o: zutil.h zlib.h zconf.h -gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h -compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h -crc32.o: zutil.h zlib.h zconf.h crc32.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h - -adler32.lo zutil.lo: zutil.h zlib.h zconf.h -gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h -compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h -crc32.lo: zutil.h zlib.h zconf.h crc32.h -deflate.lo: deflate.h zutil.h zlib.h zconf.h -infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h -inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inftrees.lo: zutil.h zlib.h zconf.h inftrees.h -trees.lo: deflate.h zutil.h zlib.h zconf.h trees.h + etags $(SRCDIR)*.[ch] + +adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h +compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h +crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h +deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h +inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h +inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h +trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h + +adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h +compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h +crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h +deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h +inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h +inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h +trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h diff --git a/Modules/zlib/README b/Modules/zlib/README index 5ca9d12..51106de 100644 --- a/Modules/zlib/README +++ b/Modules/zlib/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.8 is a general purpose data compression library. All the code is +zlib 1.2.11 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . -The changes made in version 1.2.8 are documented in the file ChangeLog. +The changes made in version 1.2.11 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -84,7 +84,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2013 Jean-loup Gailly and Mark Adler + (C) 1995-2017 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Modules/zlib/adler32.c b/Modules/zlib/adler32.c index a868f07..d0be438 100644 --- a/Modules/zlib/adler32.c +++ b/Modules/zlib/adler32.c @@ -1,5 +1,5 @@ /* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2011 Mark Adler + * Copyright (C) 1995-2011, 2016 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -7,11 +7,9 @@ #include "zutil.h" -#define local static - local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); -#define BASE 65521 /* largest prime smaller than 65536 */ +#define BASE 65521U /* largest prime smaller than 65536 */ #define NMAX 5552 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ @@ -62,10 +60,10 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); #endif /* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) +uLong ZEXPORT adler32_z(adler, buf, len) uLong adler; const Bytef *buf; - uInt len; + z_size_t len; { unsigned long sum2; unsigned n; @@ -133,6 +131,15 @@ uLong ZEXPORT adler32(adler, buf, len) } /* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + return adler32_z(adler, buf, len); +} + +/* ========================================================================= */ local uLong adler32_combine_(adler1, adler2, len2) uLong adler1; uLong adler2; @@ -156,7 +163,7 @@ local uLong adler32_combine_(adler1, adler2, len2) sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; if (sum1 >= BASE) sum1 -= BASE; if (sum1 >= BASE) sum1 -= BASE; - if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); + if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1); if (sum2 >= BASE) sum2 -= BASE; return sum1 | (sum2 << 16); } diff --git a/Modules/zlib/compress.c b/Modules/zlib/compress.c index 6e97626..e2db404 100644 --- a/Modules/zlib/compress.c +++ b/Modules/zlib/compress.c @@ -1,5 +1,5 @@ /* compress.c -- compress a memory buffer - * Copyright (C) 1995-2005 Jean-loup Gailly. + * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -28,16 +28,11 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) { z_stream stream; int err; + const uInt max = (uInt)-1; + uLong left; - stream.next_in = (z_const Bytef *)source; - stream.avail_in = (uInt)sourceLen; -#ifdef MAXSEG_64K - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; -#endif - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + left = *destLen; + *destLen = 0; stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; @@ -46,15 +41,26 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) err = deflateInit(&stream, level); if (err != Z_OK) return err; - err = deflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - deflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; - } - *destLen = stream.total_out; + stream.next_out = dest; + stream.avail_out = 0; + stream.next_in = (z_const Bytef *)source; + stream.avail_in = 0; + + do { + if (stream.avail_out == 0) { + stream.avail_out = left > (uLong)max ? max : (uInt)left; + left -= stream.avail_out; + } + if (stream.avail_in == 0) { + stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen; + sourceLen -= stream.avail_in; + } + err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH); + } while (err == Z_OK); - err = deflateEnd(&stream); - return err; + *destLen = stream.total_out; + deflateEnd(&stream); + return err == Z_STREAM_END ? Z_OK : err; } /* =========================================================================== diff --git a/Modules/zlib/configure b/Modules/zlib/configure index b77a8a8..e974d1f 100755 --- a/Modules/zlib/configure +++ b/Modules/zlib/configure @@ -18,6 +18,18 @@ echo -------------------- >> configure.log echo $0 $* >> configure.log date >> configure.log +# get source directory +SRCDIR=`dirname $0` +if test $SRCDIR = "."; then + ZINC="" + ZINCOUT="-I." + SRCDIR="" +else + ZINC='-include zconf.h' + ZINCOUT='-I. -I$(SRCDIR)' + SRCDIR="$SRCDIR/" +fi + # set command prefix for cross-compilation if [ -n "${CHOST}" ]; then uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`" @@ -28,10 +40,10 @@ fi STATICLIB=libz.a # extract zlib version numbers from zlib.h -VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` -VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h` -VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h` -VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h` +VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h` +VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h` +VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h` +VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h` # establish commands for library building if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then @@ -73,6 +85,8 @@ zprefix=0 zconst=0 build64=0 gcc=0 +warn=0 +debug=0 old_cc="$CC" old_cflags="$CFLAGS" OBJC='$(OBJZ) $(OBJG)' @@ -121,6 +135,8 @@ case "$1" in --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; -c* | --const) zconst=1; shift ;; + -w* | --warn) warn=1; shift ;; + -d* | --debug) debug=1; shift ;; *) echo "unknown option: $1" | tee -a configure.log echo "$0 --help for help" | tee -a configure.log @@ -159,34 +175,42 @@ case "$cc" in esac case `$cc -v 2>&1` in *gcc*) gcc=1 ;; + *clang*) gcc=1 ;; esac show $cc -c $test.c if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then echo ... using gcc >> configure.log CC="$cc" - CFLAGS="${CFLAGS--O3} ${ARCHS}" + CFLAGS="${CFLAGS--O3}" SFLAGS="${CFLAGS--O3} -fPIC" - LDFLAGS="${LDFLAGS} ${ARCHS}" + if test "$ARCHS"; then + CFLAGS="${CFLAGS} ${ARCHS}" + LDFLAGS="${LDFLAGS} ${ARCHS}" + fi if test $build64 -eq 1; then CFLAGS="${CFLAGS} -m64" SFLAGS="${SFLAGS} -m64" fi - if test "${ZLIBGCCWARN}" = "YES"; then + if test "$warn" -eq 1; then if test "$zconst" -eq 1; then CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST" else CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" fi fi + if test $debug -eq 1; then + CFLAGS="${CFLAGS} -DZLIB_DEBUG" + SFLAGS="${SFLAGS} -DZLIB_DEBUG" + fi if test -z "$uname"; then uname=`(uname -s || echo unknown) 2>/dev/null` fi case "$uname" in Linux* | linux* | GNU | GNU/* | solaris*) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;; + LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;; *BSD | *bsd* | DragonFly) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} + LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} LDCONFIG="ldconfig -m" ;; CYGWIN* | Cygwin* | cygwin* | OS/2*) EXE='.exe' ;; @@ -287,6 +311,9 @@ else esac fi fi + if test -n "$ZINC"; then + ZINC='-I- -I. -I$(SRCDIR)' + fi ;; SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} CFLAGS=${CFLAGS-"-O2"} @@ -337,16 +364,16 @@ if ($CC -c $CFLAGS $test.c) 2>/dev/null; then } echo - using any output from compiler to indicate an error >> configure.log else -try() -{ - show $* - ( $* ) >> configure.log 2>&1 - ret=$? - if test $ret -ne 0; then - echo "(exit code "$ret")" >> configure.log - fi - return $ret -} + try() + { + show $* + ( $* ) >> configure.log 2>&1 + ret=$? + if test $ret -ne 0; then + echo "(exit code "$ret")" >> configure.log + fi + return $ret + } fi tryboth() @@ -422,6 +449,65 @@ esac echo >> configure.log +# check for size_t +cat > $test.c < +#include +size_t dummy = 0; +EOF +if try $CC -c $CFLAGS $test.c; then + echo "Checking for size_t... Yes." | tee -a configure.log + need_sizet=0 +else + echo "Checking for size_t... No." | tee -a configure.log + need_sizet=1 +fi + +echo >> configure.log + +# find the size_t integer type, if needed +if test $need_sizet -eq 1; then + cat > $test.c < $test.c < +int main(void) { + if (sizeof(void *) <= sizeof(int)) puts("int"); + else if (sizeof(void *) <= sizeof(long)) puts("long"); + else puts("z_longlong"); + return 0; +} +EOF + else + echo "Checking for long long... No." | tee -a configure.log + cat > $test.c < +int main(void) { + if (sizeof(void *) <= sizeof(int)) puts("int"); + else puts("long"); + return 0; +} +EOF + fi + if try $CC $CFLAGS -o $test $test.c; then + sizet=`./$test` + echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log + else + echo "Failed to find a pointer-size integer type." | tee -a configure.log + leave 1 + fi +fi + +if test $need_sizet -eq 1; then + CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}" + SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}" +fi + +echo >> configure.log + # check for large file support, and if none, check for fseeko() cat > $test.c < @@ -470,7 +556,7 @@ else fi # copy clean zconf.h for subsequent edits -cp -p zconf.h.in zconf.h +cp -p ${SRCDIR}zconf.h.in zconf.h echo >> configure.log @@ -764,6 +850,7 @@ echo STATICLIB = $STATICLIB >> configure.log echo TEST = $TEST >> configure.log echo VER = $VER >> configure.log echo Z_U4 = $Z_U4 >> configure.log +echo SRCDIR = $SRCDIR >> configure.log echo exec_prefix = $exec_prefix >> configure.log echo includedir = $includedir >> configure.log echo libdir = $libdir >> configure.log @@ -773,7 +860,7 @@ echo sharedlibdir = $sharedlibdir >> configure.log echo uname = $uname >> configure.log # udpate Makefile with the configure results -sed < Makefile.in " +sed < ${SRCDIR}Makefile.in " /^CC *=/s#=.*#=$CC# /^CFLAGS *=/s#=.*#=$CFLAGS# /^SFLAGS *=/s#=.*#=$SFLAGS# @@ -790,6 +877,9 @@ sed < Makefile.in " /^LDCONFIG *=/s#=.*#=$LDCONFIG# /^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC# /^EXE *=/s#=.*#=$EXE# +/^SRCDIR *=/s#=.*#=$SRCDIR# +/^ZINC *=/s#=.*#=$ZINC# +/^ZINCOUT *=/s#=.*#=$ZINCOUT# /^prefix *=/s#=.*#=$prefix# /^exec_prefix *=/s#=.*#=$exec_prefix# /^libdir *=/s#=.*#=$libdir# @@ -803,7 +893,7 @@ sed < Makefile.in " " > Makefile # create zlib.pc with the configure results -sed < zlib.pc.in " +sed < ${SRCDIR}zlib.pc.in " /^CC *=/s#=.*#=$CC# /^CFLAGS *=/s#=.*#=$CFLAGS# /^CPP *=/s#=.*#=$CPP# diff --git a/Modules/zlib/crc32.c b/Modules/zlib/crc32.c index 979a719..9580440 100644 --- a/Modules/zlib/crc32.c +++ b/Modules/zlib/crc32.c @@ -1,5 +1,5 @@ /* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler + * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * * Thanks to Rodney Brown for his contribution of faster @@ -30,17 +30,15 @@ #include "zutil.h" /* for STDC and FAR definitions */ -#define local static - /* Definitions for doing the crc four data bytes at a time. */ #if !defined(NOBYFOUR) && defined(Z_U4) # define BYFOUR #endif #ifdef BYFOUR local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, unsigned)); + const unsigned char FAR *, z_size_t)); local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, unsigned)); + const unsigned char FAR *, z_size_t)); # define TBLS 8 #else # define TBLS 1 @@ -201,10 +199,10 @@ const z_crc_t FAR * ZEXPORT get_crc_table() #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 /* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) +unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; - uInt len; + z_size_t len; { if (buf == Z_NULL) return 0UL; @@ -235,8 +233,29 @@ unsigned long ZEXPORT crc32(crc, buf, len) return crc ^ 0xffffffffUL; } +/* ========================================================================= */ +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + uInt len; +{ + return crc32_z(crc, buf, len); +} + #ifdef BYFOUR +/* + This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit + integer pointer type. This violates the strict aliasing rule, where a + compiler can assume, for optimization purposes, that two pointers to + fundamentally different types won't ever point to the same memory. This can + manifest as a problem only if one of the pointers is written to. This code + only reads from those pointers. So long as this code remains isolated in + this compilation unit, there won't be a problem. For this reason, this code + should not be copied and pasted into a compilation unit in which other code + writes to the buffer that is passed to these routines. + */ + /* ========================================================================= */ #define DOLIT4 c ^= *buf4++; \ c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ @@ -247,7 +266,7 @@ unsigned long ZEXPORT crc32(crc, buf, len) local unsigned long crc32_little(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; - unsigned len; + z_size_t len; { register z_crc_t c; register const z_crc_t FAR *buf4; @@ -278,7 +297,7 @@ local unsigned long crc32_little(crc, buf, len) } /* ========================================================================= */ -#define DOBIG4 c ^= *++buf4; \ +#define DOBIG4 c ^= *buf4++; \ c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 @@ -287,7 +306,7 @@ local unsigned long crc32_little(crc, buf, len) local unsigned long crc32_big(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; - unsigned len; + z_size_t len; { register z_crc_t c; register const z_crc_t FAR *buf4; @@ -300,7 +319,6 @@ local unsigned long crc32_big(crc, buf, len) } buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - buf4--; while (len >= 32) { DOBIG32; len -= 32; @@ -309,7 +327,6 @@ local unsigned long crc32_big(crc, buf, len) DOBIG4; len -= 4; } - buf4++; buf = (const unsigned char FAR *)buf4; if (len) do { diff --git a/Modules/zlib/deflate.c b/Modules/zlib/deflate.c index 6969577..1ec7614 100644 --- a/Modules/zlib/deflate.c +++ b/Modules/zlib/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -73,6 +73,8 @@ typedef enum { typedef block_state (*compress_func) OF((deflate_state *s, int flush)); /* Compression function. Returns the block state after the call. */ +local int deflateStateCheck OF((z_streamp strm)); +local void slide_hash OF((deflate_state *s)); local void fill_window OF((deflate_state *s)); local block_state deflate_stored OF((deflate_state *s, int flush)); local block_state deflate_fast OF((deflate_state *s, int flush)); @@ -84,15 +86,16 @@ local block_state deflate_huff OF((deflate_state *s, int flush)); local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); -local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); #ifdef ASMV +# pragma message("Assembler code may have bugs -- use at your own risk") void match_init OF((void)); /* asm code initialization */ uInt longest_match OF((deflate_state *s, IPos cur_match)); #else local uInt longest_match OF((deflate_state *s, IPos cur_match)); #endif -#ifdef DEBUG +#ifdef ZLIB_DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, int length)); #endif @@ -148,21 +151,14 @@ local const config configuration_table[10] = { * meaning. */ -#define EQUAL 0 -/* result of memcmp for equal strings */ - -#ifndef NO_DUMMY_DECL -struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ -#endif - /* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ -#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0)) +#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0)) /* =========================================================================== * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive - * input characters, so that a running hash key can be computed from the - * previous key instead of complete recalculation each time. + * IN assertion: all calls to UPDATE_HASH are made with consecutive input + * characters, so that a running hash key can be computed from the previous + * key instead of complete recalculation each time. */ #define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) @@ -173,9 +169,9 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). + * IN assertion: all calls to INSERT_STRING are made with consecutive input + * characters and the first MIN_MATCH bytes of str are valid (except for + * the last MIN_MATCH-1 bytes of the input file). */ #ifdef FASTEST #define INSERT_STRING(s, str, match_head) \ @@ -197,6 +193,37 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ s->head[s->hash_size-1] = NIL; \ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); +/* =========================================================================== + * Slide the hash table when sliding the window down (could be avoided with 32 + * bit values at the expense of memory usage). We slide even when level == 0 to + * keep the hash table consistent if we switch back to level > 0 later. + */ +local void slide_hash(s) + deflate_state *s; +{ + unsigned n, m; + Posf *p; + uInt wsize = s->w_size; + + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m - wsize : NIL); + } while (--n); + n = wsize; +#ifndef FASTEST + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m - wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); +#endif +} + /* ========================================================================= */ int ZEXPORT deflateInit_(strm, level, version, stream_size) z_streamp strm; @@ -270,7 +297,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, #endif if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { + strategy < 0 || strategy > Z_FIXED || (windowBits == 8 && wrap != 1)) { return Z_STREAM_ERROR; } if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ @@ -278,14 +305,15 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (s == Z_NULL) return Z_MEM_ERROR; strm->state = (struct internal_state FAR *)s; s->strm = strm; + s->status = INIT_STATE; /* to pass state test in deflateReset() */ s->wrap = wrap; s->gzhead = Z_NULL; - s->w_bits = windowBits; + s->w_bits = (uInt)windowBits; s->w_size = 1 << s->w_bits; s->w_mask = s->w_size - 1; - s->hash_bits = memLevel + 7; + s->hash_bits = (uInt)memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); @@ -319,6 +347,31 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, return deflateReset(strm); } +/* ========================================================================= + * Check for a valid deflate stream state. Return 0 if ok, 1 if not. + */ +local int deflateStateCheck (strm) + z_streamp strm; +{ + deflate_state *s; + if (strm == Z_NULL || + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) + return 1; + s = strm->state; + if (s == Z_NULL || s->strm != strm || (s->status != INIT_STATE && +#ifdef GZIP + s->status != GZIP_STATE && +#endif + s->status != EXTRA_STATE && + s->status != NAME_STATE && + s->status != COMMENT_STATE && + s->status != HCRC_STATE && + s->status != BUSY_STATE && + s->status != FINISH_STATE)) + return 1; + return 0; +} + /* ========================================================================= */ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) z_streamp strm; @@ -331,7 +384,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) unsigned avail; z_const unsigned char *next; - if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) + if (deflateStateCheck(strm) || dictionary == Z_NULL) return Z_STREAM_ERROR; s = strm->state; wrap = s->wrap; @@ -389,13 +442,34 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ +int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) + z_streamp strm; + Bytef *dictionary; + uInt *dictLength; +{ + deflate_state *s; + uInt len; + + if (deflateStateCheck(strm)) + return Z_STREAM_ERROR; + s = strm->state; + len = s->strstart + s->lookahead; + if (len > s->w_size) + len = s->w_size; + if (dictionary != Z_NULL && len) + zmemcpy(dictionary, s->window + s->strstart + s->lookahead - len, len); + if (dictLength != Z_NULL) + *dictLength = len; + return Z_OK; +} + +/* ========================================================================= */ int ZEXPORT deflateResetKeep (strm) z_streamp strm; { deflate_state *s; - if (strm == Z_NULL || strm->state == Z_NULL || - strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { + if (deflateStateCheck(strm)) { return Z_STREAM_ERROR; } @@ -410,7 +484,11 @@ int ZEXPORT deflateResetKeep (strm) if (s->wrap < 0) { s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ } - s->status = s->wrap ? INIT_STATE : BUSY_STATE; + s->status = +#ifdef GZIP + s->wrap == 2 ? GZIP_STATE : +#endif + s->wrap ? INIT_STATE : BUSY_STATE; strm->adler = #ifdef GZIP s->wrap == 2 ? crc32(0L, Z_NULL, 0) : @@ -440,8 +518,8 @@ int ZEXPORT deflateSetHeader (strm, head) z_streamp strm; gz_headerp head; { - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - if (strm->state->wrap != 2) return Z_STREAM_ERROR; + if (deflateStateCheck(strm) || strm->state->wrap != 2) + return Z_STREAM_ERROR; strm->state->gzhead = head; return Z_OK; } @@ -452,7 +530,7 @@ int ZEXPORT deflatePending (strm, pending, bits) int *bits; z_streamp strm; { - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; if (pending != Z_NULL) *pending = strm->state->pending; if (bits != Z_NULL) @@ -469,7 +547,7 @@ int ZEXPORT deflatePrime (strm, bits, value) deflate_state *s; int put; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; @@ -494,9 +572,8 @@ int ZEXPORT deflateParams(strm, level, strategy) { deflate_state *s; compress_func func; - int err = Z_OK; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; #ifdef FASTEST @@ -510,13 +587,22 @@ int ZEXPORT deflateParams(strm, level, strategy) func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && - strm->total_in != 0) { + s->high_water) { /* Flush the last buffer: */ - err = deflate(strm, Z_BLOCK); - if (err == Z_BUF_ERROR && s->pending == 0) - err = Z_OK; + int err = deflate(strm, Z_BLOCK); + if (err == Z_STREAM_ERROR) + return err; + if (strm->avail_out == 0) + return Z_BUF_ERROR; } if (s->level != level) { + if (s->level == 0 && s->matches != 0) { + if (s->matches == 1) + slide_hash(s); + else + CLEAR_HASH(s); + s->matches = 0; + } s->level = level; s->max_lazy_match = configuration_table[level].max_lazy; s->good_match = configuration_table[level].good_length; @@ -524,7 +610,7 @@ int ZEXPORT deflateParams(strm, level, strategy) s->max_chain_length = configuration_table[level].max_chain; } s->strategy = strategy; - return err; + return Z_OK; } /* ========================================================================= */ @@ -537,12 +623,12 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) { deflate_state *s; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; - s->good_match = good_length; - s->max_lazy_match = max_lazy; + s->good_match = (uInt)good_length; + s->max_lazy_match = (uInt)max_lazy; s->nice_match = nice_length; - s->max_chain_length = max_chain; + s->max_chain_length = (uInt)max_chain; return Z_OK; } @@ -569,14 +655,13 @@ uLong ZEXPORT deflateBound(strm, sourceLen) { deflate_state *s; uLong complen, wraplen; - Bytef *str; /* conservative upper bound for compressed data */ complen = sourceLen + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; /* if can't get parameters, return conservative bound plus zlib wrapper */ - if (strm == Z_NULL || strm->state == Z_NULL) + if (deflateStateCheck(strm)) return complen + 6; /* compute wrapper length */ @@ -588,9 +673,11 @@ uLong ZEXPORT deflateBound(strm, sourceLen) case 1: /* zlib wrapper */ wraplen = 6 + (s->strstart ? 4 : 0); break; +#ifdef GZIP case 2: /* gzip wrapper */ wraplen = 18; if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ + Bytef *str; if (s->gzhead->extra != Z_NULL) wraplen += 2 + s->gzhead->extra_len; str = s->gzhead->name; @@ -607,6 +694,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) wraplen += 2; } break; +#endif default: /* for compiler happiness */ wraplen = 6; } @@ -634,10 +722,10 @@ local void putShortMSB (s, b) } /* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->next_out buffer and copying into it. - * (See also read_buf()). + * Flush as much pending output as possible. All deflate() output, except for + * some deflate_stored() output, goes through this function so some + * applications may wish to modify it to avoid allocating a large + * strm->next_out buffer and copying into it. (See also read_buf()). */ local void flush_pending(strm) z_streamp strm; @@ -654,13 +742,23 @@ local void flush_pending(strm) strm->next_out += len; s->pending_out += len; strm->total_out += len; - strm->avail_out -= len; - s->pending -= len; + strm->avail_out -= len; + s->pending -= len; if (s->pending == 0) { s->pending_out = s->pending_buf; } } +/* =========================================================================== + * Update the header CRC with the bytes s->pending_buf[beg..s->pending - 1]. + */ +#define HCRC_UPDATE(beg) \ + do { \ + if (s->gzhead->hcrc && s->pending > (beg)) \ + strm->adler = crc32(strm->adler, s->pending_buf + (beg), \ + s->pending - (beg)); \ + } while (0) + /* ========================================================================= */ int ZEXPORT deflate (strm, flush) z_streamp strm; @@ -669,230 +767,229 @@ int ZEXPORT deflate (strm, flush) int old_flush; /* value of flush param for previous deflate call */ deflate_state *s; - if (strm == Z_NULL || strm->state == Z_NULL || - flush > Z_BLOCK || flush < 0) { + if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) { return Z_STREAM_ERROR; } s = strm->state; if (strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0) || + (strm->avail_in != 0 && strm->next_in == Z_NULL) || (s->status == FINISH_STATE && flush != Z_FINISH)) { ERR_RETURN(strm, Z_STREAM_ERROR); } if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); - s->strm = strm; /* just in case */ old_flush = s->last_flush; s->last_flush = flush; + /* Flush as much pending output as possible */ + if (s->pending != 0) { + flush_pending(strm); + if (strm->avail_out == 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s->last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && + flush != Z_FINISH) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s->status == FINISH_STATE && strm->avail_in != 0) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + /* Write the header */ if (s->status == INIT_STATE) { -#ifdef GZIP - if (s->wrap == 2) { - strm->adler = crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (s->gzhead == Z_NULL) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s->status = BUSY_STATE; - } - else { - put_byte(s, (s->gzhead->text ? 1 : 0) + - (s->gzhead->hcrc ? 2 : 0) + - (s->gzhead->extra == Z_NULL ? 0 : 4) + - (s->gzhead->name == Z_NULL ? 0 : 8) + - (s->gzhead->comment == Z_NULL ? 0 : 16) - ); - put_byte(s, (Byte)(s->gzhead->time & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, s->gzhead->os & 0xff); - if (s->gzhead->extra != Z_NULL) { - put_byte(s, s->gzhead->extra_len & 0xff); - put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); - } - if (s->gzhead->hcrc) - strm->adler = crc32(strm->adler, s->pending_buf, - s->pending); - s->gzindex = 0; - s->status = EXTRA_STATE; - } - } + /* zlib header */ + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags; + + if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) + level_flags = 0; + else if (s->level < 6) + level_flags = 1; + else if (s->level == 6) + level_flags = 2; else -#endif - { - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - uInt level_flags; - - if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) - level_flags = 0; - else if (s->level < 6) - level_flags = 1; - else if (s->level == 6) - level_flags = 2; - else - level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; - header += 31 - (header % 31); + level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + putShortMSB(s, header); + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = adler32(0L, Z_NULL, 0); + s->status = BUSY_STATE; + + /* Compression must start with an empty pending buffer */ + flush_pending(strm); + if (s->pending != 0) { + s->last_flush = -1; + return Z_OK; + } + } +#ifdef GZIP + if (s->status == GZIP_STATE) { + /* gzip header */ + strm->adler = crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (s->gzhead == Z_NULL) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); s->status = BUSY_STATE; - putShortMSB(s, header); - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); + /* Compression must start with an empty pending buffer */ + flush_pending(strm); + if (s->pending != 0) { + s->last_flush = -1; + return Z_OK; + } + } + else { + put_byte(s, (s->gzhead->text ? 1 : 0) + + (s->gzhead->hcrc ? 2 : 0) + + (s->gzhead->extra == Z_NULL ? 0 : 4) + + (s->gzhead->name == Z_NULL ? 0 : 8) + + (s->gzhead->comment == Z_NULL ? 0 : 16) + ); + put_byte(s, (Byte)(s->gzhead->time & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, s->gzhead->os & 0xff); + if (s->gzhead->extra != Z_NULL) { + put_byte(s, s->gzhead->extra_len & 0xff); + put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); } - strm->adler = adler32(0L, Z_NULL, 0); + if (s->gzhead->hcrc) + strm->adler = crc32(strm->adler, s->pending_buf, + s->pending); + s->gzindex = 0; + s->status = EXTRA_STATE; } } -#ifdef GZIP if (s->status == EXTRA_STATE) { if (s->gzhead->extra != Z_NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - - while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) - break; + ulg beg = s->pending; /* start of bytes to update crc */ + uInt left = (s->gzhead->extra_len & 0xffff) - s->gzindex; + while (s->pending + left > s->pending_buf_size) { + uInt copy = s->pending_buf_size - s->pending; + zmemcpy(s->pending_buf + s->pending, + s->gzhead->extra + s->gzindex, copy); + s->pending = s->pending_buf_size; + HCRC_UPDATE(beg); + s->gzindex += copy; + flush_pending(strm); + if (s->pending != 0) { + s->last_flush = -1; + return Z_OK; } - put_byte(s, s->gzhead->extra[s->gzindex]); - s->gzindex++; - } - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (s->gzindex == s->gzhead->extra_len) { - s->gzindex = 0; - s->status = NAME_STATE; + beg = 0; + left -= copy; } + zmemcpy(s->pending_buf + s->pending, + s->gzhead->extra + s->gzindex, left); + s->pending += left; + HCRC_UPDATE(beg); + s->gzindex = 0; } - else - s->status = NAME_STATE; + s->status = NAME_STATE; } if (s->status == NAME_STATE) { if (s->gzhead->name != Z_NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ + ulg beg = s->pending; /* start of bytes to update crc */ int val; - do { if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); + HCRC_UPDATE(beg); flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; + if (s->pending != 0) { + s->last_flush = -1; + return Z_OK; } + beg = 0; } val = s->gzhead->name[s->gzindex++]; put_byte(s, val); } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) { - s->gzindex = 0; - s->status = COMMENT_STATE; - } + HCRC_UPDATE(beg); + s->gzindex = 0; } - else - s->status = COMMENT_STATE; + s->status = COMMENT_STATE; } if (s->status == COMMENT_STATE) { if (s->gzhead->comment != Z_NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ + ulg beg = s->pending; /* start of bytes to update crc */ int val; - do { if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); + HCRC_UPDATE(beg); flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; + if (s->pending != 0) { + s->last_flush = -1; + return Z_OK; } + beg = 0; } val = s->gzhead->comment[s->gzindex++]; put_byte(s, val); } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) - s->status = HCRC_STATE; + HCRC_UPDATE(beg); } - else - s->status = HCRC_STATE; + s->status = HCRC_STATE; } if (s->status == HCRC_STATE) { if (s->gzhead->hcrc) { - if (s->pending + 2 > s->pending_buf_size) + if (s->pending + 2 > s->pending_buf_size) { flush_pending(strm); - if (s->pending + 2 <= s->pending_buf_size) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - strm->adler = crc32(0L, Z_NULL, 0); - s->status = BUSY_STATE; + if (s->pending != 0) { + s->last_flush = -1; + return Z_OK; + } } + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + strm->adler = crc32(0L, Z_NULL, 0); } - else - s->status = BUSY_STATE; - } -#endif + s->status = BUSY_STATE; - /* Flush as much pending output as possible */ - if (s->pending != 0) { + /* Compression must start with an empty pending buffer */ flush_pending(strm); - if (strm->avail_out == 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ + if (s->pending != 0) { s->last_flush = -1; return Z_OK; } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && - flush != Z_FINISH) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s->status == FINISH_STATE && strm->avail_in != 0) { - ERR_RETURN(strm, Z_BUF_ERROR); } +#endif /* Start a new block or continue the current one. */ @@ -900,9 +997,10 @@ int ZEXPORT deflate (strm, flush) (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { block_state bstate; - bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : - (s->strategy == Z_RLE ? deflate_rle(s, flush) : - (*(configuration_table[s->level].func))(s, flush)); + bstate = s->level == 0 ? deflate_stored(s, flush) : + s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : + s->strategy == Z_RLE ? deflate_rle(s, flush) : + (*(configuration_table[s->level].func))(s, flush); if (bstate == finish_started || bstate == finish_done) { s->status = FINISH_STATE; @@ -944,7 +1042,6 @@ int ZEXPORT deflate (strm, flush) } } } - Assert(strm->avail_out > 0, "bug2"); if (flush != Z_FINISH) return Z_OK; if (s->wrap <= 0) return Z_STREAM_END; @@ -981,18 +1078,9 @@ int ZEXPORT deflateEnd (strm) { int status; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; status = strm->state->status; - if (status != INIT_STATE && - status != EXTRA_STATE && - status != NAME_STATE && - status != COMMENT_STATE && - status != HCRC_STATE && - status != BUSY_STATE && - status != FINISH_STATE) { - return Z_STREAM_ERROR; - } /* Deallocate in reverse order of allocations: */ TRY_FREE(strm, strm->state->pending_buf); @@ -1023,7 +1111,7 @@ int ZEXPORT deflateCopy (dest, source) ushf *overlay; - if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { + if (deflateStateCheck(source) || dest == Z_NULL) { return Z_STREAM_ERROR; } @@ -1073,7 +1161,7 @@ int ZEXPORT deflateCopy (dest, source) * allocating a large strm->next_in buffer and copying from it. * (See also flush_pending()). */ -local int read_buf(strm, buf, size) +local unsigned read_buf(strm, buf, size) z_streamp strm; Bytef *buf; unsigned size; @@ -1097,7 +1185,7 @@ local int read_buf(strm, buf, size) strm->next_in += len; strm->total_in += len; - return (int)len; + return len; } /* =========================================================================== @@ -1151,9 +1239,9 @@ local uInt longest_match(s, cur_match) { unsigned chain_length = s->max_chain_length;/* max hash chain length */ register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ + register Bytef *match; /* matched string */ register int len; /* length of current match */ - int best_len = s->prev_length; /* best match length so far */ + int best_len = (int)s->prev_length; /* best match length so far */ int nice_match = s->nice_match; /* stop if match long enough */ IPos limit = s->strstart > (IPos)MAX_DIST(s) ? s->strstart - (IPos)MAX_DIST(s) : NIL; @@ -1188,7 +1276,7 @@ local uInt longest_match(s, cur_match) /* Do not look for matches beyond the end of the input. This is necessary * to make deflate deterministic. */ - if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; + if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead; Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); @@ -1349,7 +1437,11 @@ local uInt longest_match(s, cur_match) #endif /* FASTEST */ -#ifdef DEBUG +#ifdef ZLIB_DEBUG + +#define EQUAL 0 +/* result of memcmp for equal strings */ + /* =========================================================================== * Check that the match at match_start is indeed a match. */ @@ -1375,7 +1467,7 @@ local void check_match(s, start, match, length) } #else # define check_match(s, start, match, length) -#endif /* DEBUG */ +#endif /* ZLIB_DEBUG */ /* =========================================================================== * Fill the window when the lookahead becomes insufficient. @@ -1390,8 +1482,7 @@ local void check_match(s, start, match, length) local void fill_window(s) deflate_state *s; { - register unsigned n, m; - register Posf *p; + unsigned n; unsigned more; /* Amount of free space at the end of the window. */ uInt wsize = s->w_size; @@ -1418,35 +1509,11 @@ local void fill_window(s) */ if (s->strstart >= wsize+MAX_DIST(s)) { - zmemcpy(s->window, s->window+wsize, (unsigned)wsize); + zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - n = s->hash_size; - p = &s->head[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - } while (--n); - - n = wsize; -#ifndef FASTEST - p = &s->prev[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); -#endif + slide_hash(s); more += wsize; } if (s->strm->avail_in == 0) break; @@ -1552,70 +1619,199 @@ local void fill_window(s) if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ } +/* Maximum stored block length in deflate format (not including header). */ +#define MAX_STORED 65535 + +/* Minimum of a and b. */ +#define MIN(a, b) ((a) > (b) ? (b) : (a)) + /* =========================================================================== * Copy without compression as much as possible from the input stream, return * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. + * + * In case deflateParams() is used to later switch to a non-zero compression + * level, s->matches (otherwise unused when storing) keeps track of the number + * of hash table slides to perform. If s->matches is 1, then one hash table + * slide will be done when switching. If s->matches is 2, the maximum value + * allowed here, then the hash table will be cleared, since two or more slides + * is the same as a clear. + * + * deflate_stored() is written to minimize the number of times an input byte is + * copied. It is most efficient with large input and output buffers, which + * maximizes the opportunites to have a single copy from next_in to next_out. */ local block_state deflate_stored(s, flush) deflate_state *s; int flush; { - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: + /* Smallest worthy block size when not flushing or finishing. By default + * this is 32K. This can be as small as 507 bytes for memLevel == 1. For + * large input and output buffers, the stored block size will be larger. */ - ulg max_block_size = 0xffff; - ulg max_start; - - if (max_block_size > s->pending_buf_size - 5) { - max_block_size = s->pending_buf_size - 5; - } + unsigned min_block = MIN(s->pending_buf_size - 5, s->w_size); - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s->lookahead <= 1) { - - Assert(s->strstart < s->w_size+MAX_DIST(s) || - s->block_start >= (long)s->w_size, "slide too late"); + /* Copy as many min_block or larger stored blocks directly to next_out as + * possible. If flushing, copy the remaining available input to next_out as + * stored blocks, if there is enough space. + */ + unsigned len, left, have, last = 0; + unsigned used = s->strm->avail_in; + do { + /* Set len to the maximum size block that we can copy directly with the + * available input data and output space. Set left to how much of that + * would be copied from what's left in the window. + */ + len = MAX_STORED; /* maximum deflate stored block length */ + have = (s->bi_valid + 42) >> 3; /* number of header bytes */ + if (s->strm->avail_out < have) /* need room for header */ + break; + /* maximum stored block length that will fit in avail_out: */ + have = s->strm->avail_out - have; + left = s->strstart - s->block_start; /* bytes left in window */ + if (len > (ulg)left + s->strm->avail_in) + len = left + s->strm->avail_in; /* limit len to the input */ + if (len > have) + len = have; /* limit len to the output */ + + /* If the stored block would be less than min_block in length, or if + * unable to copy all of the available input when flushing, then try + * copying to the window and the pending buffer instead. Also don't + * write an empty block when flushing -- deflate() does that. + */ + if (len < min_block && ((len == 0 && flush != Z_FINISH) || + flush == Z_NO_FLUSH || + len != left + s->strm->avail_in)) + break; - fill_window(s); - if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; + /* Make a dummy stored block in pending to get the header bytes, + * including any pending bits. This also updates the debugging counts. + */ + last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0; + _tr_stored_block(s, (char *)0, 0L, last); + + /* Replace the lengths in the dummy stored block with len. */ + s->pending_buf[s->pending - 4] = len; + s->pending_buf[s->pending - 3] = len >> 8; + s->pending_buf[s->pending - 2] = ~len; + s->pending_buf[s->pending - 1] = ~len >> 8; + + /* Write the stored block header bytes. */ + flush_pending(s->strm); + +#ifdef ZLIB_DEBUG + /* Update debugging counts for the data about to be copied. */ + s->compressed_len += len << 3; + s->bits_sent += len << 3; +#endif - if (s->lookahead == 0) break; /* flush the current block */ + /* Copy uncompressed bytes from the window to next_out. */ + if (left) { + if (left > len) + left = len; + zmemcpy(s->strm->next_out, s->window + s->block_start, left); + s->strm->next_out += left; + s->strm->avail_out -= left; + s->strm->total_out += left; + s->block_start += left; + len -= left; } - Assert(s->block_start >= 0L, "block gone"); - - s->strstart += s->lookahead; - s->lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - max_start = s->block_start + max_block_size; - if (s->strstart == 0 || (ulg)s->strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s->lookahead = (uInt)(s->strstart - max_start); - s->strstart = (uInt)max_start; - FLUSH_BLOCK(s, 0); + + /* Copy uncompressed bytes directly from next_in to next_out, updating + * the check value. + */ + if (len) { + read_buf(s->strm, s->strm->next_out, len); + s->strm->next_out += len; + s->strm->avail_out -= len; + s->strm->total_out += len; } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: + } while (last == 0); + + /* Update the sliding window with the last s->w_size bytes of the copied + * data, or append all of the copied data to the existing window if less + * than s->w_size bytes were copied. Also update the number of bytes to + * insert in the hash tables, in the event that deflateParams() switches to + * a non-zero compression level. + */ + used -= s->strm->avail_in; /* number of input bytes directly copied */ + if (used) { + /* If any input was used, then no unused input remains in the window, + * therefore s->block_start == s->strstart. */ - if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { - FLUSH_BLOCK(s, 0); + if (used >= s->w_size) { /* supplant the previous history */ + s->matches = 2; /* clear hash */ + zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size); + s->strstart = s->w_size; } + else { + if (s->window_size - s->strstart <= used) { + /* Slide the window down. */ + s->strstart -= s->w_size; + zmemcpy(s->window, s->window + s->w_size, s->strstart); + if (s->matches < 2) + s->matches++; /* add a pending slide_hash() */ + } + zmemcpy(s->window + s->strstart, s->strm->next_in - used, used); + s->strstart += used; + } + s->block_start = s->strstart; + s->insert += MIN(used, s->w_size - s->insert); } - s->insert = 0; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); + if (s->high_water < s->strstart) + s->high_water = s->strstart; + + /* If the last block was written to next_out, then done. */ + if (last) return finish_done; + + /* If flushing and all input has been consumed, then done. */ + if (flush != Z_NO_FLUSH && flush != Z_FINISH && + s->strm->avail_in == 0 && (long)s->strstart == s->block_start) + return block_done; + + /* Fill the window with any remaining input. */ + have = s->window_size - s->strstart - 1; + if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) { + /* Slide the window down. */ + s->block_start -= s->w_size; + s->strstart -= s->w_size; + zmemcpy(s->window, s->window + s->w_size, s->strstart); + if (s->matches < 2) + s->matches++; /* add a pending slide_hash() */ + have += s->w_size; /* more space now */ } - if ((long)s->strstart > s->block_start) - FLUSH_BLOCK(s, 0); - return block_done; + if (have > s->strm->avail_in) + have = s->strm->avail_in; + if (have) { + read_buf(s->strm, s->window + s->strstart, have); + s->strstart += have; + } + if (s->high_water < s->strstart) + s->high_water = s->strstart; + + /* There was not enough avail_out to write a complete worthy or flushed + * stored block to next_out. Write a stored block to pending instead, if we + * have enough input for a worthy block, or if flushing and there is enough + * room for the remaining input as a stored block in the pending buffer. + */ + have = (s->bi_valid + 42) >> 3; /* number of header bytes */ + /* maximum stored block length that will fit in pending: */ + have = MIN(s->pending_buf_size - have, MAX_STORED); + min_block = MIN(have, s->w_size); + left = s->strstart - s->block_start; + if (left >= min_block || + ((left || flush == Z_FINISH) && flush != Z_NO_FLUSH && + s->strm->avail_in == 0 && left <= have)) { + len = MIN(left, have); + last = flush == Z_FINISH && s->strm->avail_in == 0 && + len == left ? 1 : 0; + _tr_stored_block(s, (charf *)s->window + s->block_start, len, last); + s->block_start += len; + flush_pending(s->strm); + } + + /* We've done all we can with the available input and output. */ + return last ? finish_started : need_more; } /* =========================================================================== @@ -1892,7 +2088,7 @@ local block_state deflate_rle(s, flush) prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && scan < strend); - s->match_length = MAX_MATCH - (int)(strend - scan); + s->match_length = MAX_MATCH - (uInt)(strend - scan); if (s->match_length > s->lookahead) s->match_length = s->lookahead; } diff --git a/Modules/zlib/deflate.h b/Modules/zlib/deflate.h index ce0299e..23ecdd3 100644 --- a/Modules/zlib/deflate.h +++ b/Modules/zlib/deflate.h @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2012 Jean-loup Gailly + * Copyright (C) 1995-2016 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -51,13 +51,16 @@ #define Buf_size 16 /* size of bit buffer in bi_buf */ -#define INIT_STATE 42 -#define EXTRA_STATE 69 -#define NAME_STATE 73 -#define COMMENT_STATE 91 -#define HCRC_STATE 103 -#define BUSY_STATE 113 -#define FINISH_STATE 666 +#define INIT_STATE 42 /* zlib header -> BUSY_STATE */ +#ifdef GZIP +# define GZIP_STATE 57 /* gzip header -> BUSY_STATE | EXTRA_STATE */ +#endif +#define EXTRA_STATE 69 /* gzip extra block -> NAME_STATE */ +#define NAME_STATE 73 /* gzip file name -> COMMENT_STATE */ +#define COMMENT_STATE 91 /* gzip comment -> HCRC_STATE */ +#define HCRC_STATE 103 /* gzip header CRC -> BUSY_STATE */ +#define BUSY_STATE 113 /* deflate -> FINISH_STATE */ +#define FINISH_STATE 666 /* stream complete */ /* Stream status */ @@ -83,7 +86,7 @@ typedef struct static_tree_desc_s static_tree_desc; typedef struct tree_desc_s { ct_data *dyn_tree; /* the dynamic tree */ int max_code; /* largest code with non zero frequency */ - static_tree_desc *stat_desc; /* the corresponding static tree */ + const static_tree_desc *stat_desc; /* the corresponding static tree */ } FAR tree_desc; typedef ush Pos; @@ -100,10 +103,10 @@ typedef struct internal_state { Bytef *pending_buf; /* output still pending */ ulg pending_buf_size; /* size of pending_buf */ Bytef *pending_out; /* next pending byte to output to the stream */ - uInt pending; /* nb of bytes in the pending buffer */ + ulg pending; /* nb of bytes in the pending buffer */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ gz_headerp gzhead; /* gzip header information to write */ - uInt gzindex; /* where in extra, name, or comment */ + ulg gzindex; /* where in extra, name, or comment */ Byte method; /* can only be DEFLATED */ int last_flush; /* value of flush param for previous deflate call */ @@ -249,7 +252,7 @@ typedef struct internal_state { uInt matches; /* number of string matches in current block */ uInt insert; /* bytes at end of window left to insert */ -#ifdef DEBUG +#ifdef ZLIB_DEBUG ulg compressed_len; /* total bit length of compressed file mod 2^32 */ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ #endif @@ -275,7 +278,7 @@ typedef struct internal_state { /* Output a byte on the stream. * IN assertion: there is enough room in pending_buf. */ -#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} +#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);} #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) @@ -309,7 +312,7 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, * used. */ -#ifndef DEBUG +#ifndef ZLIB_DEBUG /* Inline versions of _tr_tally for speed: */ #if defined(GEN_TREES_H) || !defined(STDC) @@ -328,8 +331,8 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, flush = (s->last_lit == s->lit_bufsize-1); \ } # define _tr_tally_dist(s, distance, length, flush) \ - { uch len = (length); \ - ush dist = (distance); \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ s->d_buf[s->last_lit] = dist; \ s->l_buf[s->last_lit++] = len; \ dist--; \ diff --git a/Modules/zlib/gzguts.h b/Modules/zlib/gzguts.h index d87659d..990a4d2 100644 --- a/Modules/zlib/gzguts.h +++ b/Modules/zlib/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -25,6 +25,10 @@ # include # include #endif + +#ifndef _POSIX_SOURCE +# define _POSIX_SOURCE +#endif #include #ifdef _WIN32 @@ -35,6 +39,10 @@ # include #endif +#if defined(_WIN32) || defined(__CYGWIN__) +# define WIDECHAR +#endif + #ifdef WINAPI_FAMILY # define open _open # define read _read @@ -95,18 +103,19 @@ # endif #endif -/* unlike snprintf (which is required in C99, yet still not supported by - Microsoft more than a decade later!), _snprintf does not guarantee null - termination of the result -- however this is only used in gzlib.c where +/* unlike snprintf (which is required in C99), _snprintf does not guarantee + null termination of the result -- however this is only used in gzlib.c where the result is assured to fit in the space provided */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1900 # define snprintf _snprintf #endif #ifndef local # define local static #endif -/* compile with -Dlocal if your debugger can't find static symbols */ +/* since "static" is used to mean two completely different things in C, we + define "local" for the non-static meaning of "static", for readability + (compile with -Dlocal if your debugger can't find static symbols) */ /* gz* functions always use library allocation functions */ #ifndef STDC @@ -170,7 +179,7 @@ typedef struct { char *path; /* path or fd for error messages */ unsigned size; /* buffer size, zero if not allocated yet */ unsigned want; /* requested buffer size, default is GZBUFSIZE */ - unsigned char *in; /* input buffer */ + unsigned char *in; /* input buffer (double-sized when writing) */ unsigned char *out; /* output buffer (double-sized when reading) */ int direct; /* 0 if processing gzip, 1 if transparent */ /* just for reading */ diff --git a/Modules/zlib/gzlib.c b/Modules/zlib/gzlib.c index fae202e..4105e6a 100644 --- a/Modules/zlib/gzlib.c +++ b/Modules/zlib/gzlib.c @@ -1,11 +1,11 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004, 2010, 2011, 2012, 2013 Mark Adler + * Copyright (C) 2004-2017 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "gzguts.h" -#if defined(_WIN32) && !defined(__BORLANDC__) +#if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__) # define LSEEK _lseeki64 #else #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 @@ -94,7 +94,7 @@ local gzFile gz_open(path, fd, mode) const char *mode; { gz_statep state; - size_t len; + z_size_t len; int oflag; #ifdef O_CLOEXEC int cloexec = 0; @@ -188,10 +188,10 @@ local gzFile gz_open(path, fd, mode) } /* save the path name for error messages */ -#ifdef _WIN32 +#ifdef WIDECHAR if (fd == -2) { len = wcstombs(NULL, path, 0); - if (len == (size_t)-1) + if (len == (z_size_t)-1) len = 0; } else @@ -202,7 +202,7 @@ local gzFile gz_open(path, fd, mode) free(state); return NULL; } -#ifdef _WIN32 +#ifdef WIDECHAR if (fd == -2) if (len) wcstombs(state->path, path, len + 1); @@ -211,7 +211,7 @@ local gzFile gz_open(path, fd, mode) else #endif #if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(state->path, len + 1, "%s", (const char *)path); + (void)snprintf(state->path, len + 1, "%s", (const char *)path); #else strcpy(state->path, path); #endif @@ -239,7 +239,7 @@ local gzFile gz_open(path, fd, mode) /* open the file with the appropriate flags (or just use fd) */ state->fd = fd > -1 ? fd : ( -#ifdef _WIN32 +#ifdef WIDECHAR fd == -2 ? _wopen(path, oflag, 0666) : #endif open((const char *)path, oflag, 0666)); @@ -248,8 +248,10 @@ local gzFile gz_open(path, fd, mode) free(state); return NULL; } - if (state->mode == GZ_APPEND) + if (state->mode == GZ_APPEND) { + LSEEK(state->fd, 0, SEEK_END); /* so gzoffset() is correct */ state->mode = GZ_WRITE; /* simplify later checks */ + } /* save the current position for rewinding (only if reading) */ if (state->mode == GZ_READ) { @@ -291,7 +293,7 @@ gzFile ZEXPORT gzdopen(fd, mode) if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL) return NULL; #if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(path, 7 + 3 * sizeof(int), "", fd); /* for debugging */ + (void)snprintf(path, 7 + 3 * sizeof(int), "", fd); #else sprintf(path, "", fd); /* for debugging */ #endif @@ -301,7 +303,7 @@ gzFile ZEXPORT gzdopen(fd, mode) } /* -- see zlib.h -- */ -#ifdef _WIN32 +#ifdef WIDECHAR gzFile ZEXPORT gzopen_w(path, mode) const wchar_t *path; const char *mode; @@ -329,6 +331,8 @@ int ZEXPORT gzbuffer(file, size) return -1; /* check and set requested size */ + if ((size << 1) < size) + return -1; /* need to be able to double it */ if (size < 2) size = 2; /* need two bytes to check magic header */ state->want = size; @@ -604,14 +608,13 @@ void ZLIB_INTERNAL gz_error(state, err, msg) return; } #if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, - "%s%s%s", state->path, ": ", msg); + (void)snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, + "%s%s%s", state->path, ": ", msg); #else strcpy(state->msg, state->path); strcat(state->msg, ": "); strcat(state->msg, msg); #endif - return; } #ifndef INT_MAX diff --git a/Modules/zlib/gzread.c b/Modules/zlib/gzread.c index bf4538e..956b91e 100644 --- a/Modules/zlib/gzread.c +++ b/Modules/zlib/gzread.c @@ -1,5 +1,5 @@ /* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -12,6 +12,7 @@ local int gz_look OF((gz_statep)); local int gz_decomp OF((gz_statep)); local int gz_fetch OF((gz_statep)); local int gz_skip OF((gz_statep, z_off64_t)); +local z_size_t gz_read OF((gz_statep, voidp, z_size_t)); /* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from state->fd, and update state->eof, state->err, and state->msg as appropriate. @@ -24,13 +25,17 @@ local int gz_load(state, buf, len, have) unsigned *have; { int ret; + unsigned get, max = ((unsigned)-1 >> 2) + 1; *have = 0; do { - ret = read(state->fd, buf + *have, len - *have); + get = len - *have; + if (get > max) + get = max; + ret = read(state->fd, buf + *have, get); if (ret <= 0) break; - *have += ret; + *have += (unsigned)ret; } while (*have < len); if (ret < 0) { gz_error(state, Z_ERRNO, zstrerror()); @@ -94,10 +99,8 @@ local int gz_look(state) state->in = (unsigned char *)malloc(state->want); state->out = (unsigned char *)malloc(state->want << 1); if (state->in == NULL || state->out == NULL) { - if (state->out != NULL) - free(state->out); - if (state->in != NULL) - free(state->in); + free(state->out); + free(state->in); gz_error(state, Z_MEM_ERROR, "out of memory"); return -1; } @@ -284,33 +287,17 @@ local int gz_skip(state, len) return 0; } -/* -- see zlib.h -- */ -int ZEXPORT gzread(file, buf, len) - gzFile file; +/* Read len bytes into buf from file, or less than len up to the end of the + input. Return the number of bytes read. If zero is returned, either the + end of file was reached, or there was an error. state->err must be + consulted in that case to determine which. */ +local z_size_t gz_read(state, buf, len) + gz_statep state; voidp buf; - unsigned len; + z_size_t len; { - unsigned got, n; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* since an int is returned, make sure len fits in one, otherwise return - with an error (this avoids the flaw in the interface) */ - if ((int)len < 0) { - gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); - return -1; - } + z_size_t got; + unsigned n; /* if len is zero, avoid unnecessary operations */ if (len == 0) @@ -320,32 +307,38 @@ int ZEXPORT gzread(file, buf, len) if (state->seek) { state->seek = 0; if (gz_skip(state, state->skip) == -1) - return -1; + return 0; } /* get len bytes to buf, or less than len if at the end */ got = 0; do { + /* set n to the maximum amount of len that fits in an unsigned int */ + n = -1; + if (n > len) + n = len; + /* first just try copying data from the output buffer */ if (state->x.have) { - n = state->x.have > len ? len : state->x.have; + if (state->x.have < n) + n = state->x.have; memcpy(buf, state->x.next, n); state->x.next += n; state->x.have -= n; } /* output buffer empty -- return if we're at the end of the input */ - else if (state->eof && strm->avail_in == 0) { + else if (state->eof && state->strm.avail_in == 0) { state->past = 1; /* tried to read past end */ break; } /* need output data -- for small len or new stream load up our output buffer */ - else if (state->how == LOOK || len < (state->size << 1)) { + else if (state->how == LOOK || n < (state->size << 1)) { /* get more output, looking for header if required */ if (gz_fetch(state) == -1) - return -1; + return 0; continue; /* no progress yet -- go back to copy above */ /* the copy above assures that we will leave with space in the output buffer, allowing at least one gzungetc() to succeed */ @@ -353,16 +346,16 @@ int ZEXPORT gzread(file, buf, len) /* large len -- read directly into user buffer */ else if (state->how == COPY) { /* read directly */ - if (gz_load(state, (unsigned char *)buf, len, &n) == -1) - return -1; + if (gz_load(state, (unsigned char *)buf, n, &n) == -1) + return 0; } /* large len -- decompress directly into user buffer */ else { /* state->how == GZIP */ - strm->avail_out = len; - strm->next_out = (unsigned char *)buf; + state->strm.avail_out = n; + state->strm.next_out = (unsigned char *)buf; if (gz_decomp(state) == -1) - return -1; + return 0; n = state->x.have; state->x.have = 0; } @@ -374,8 +367,75 @@ int ZEXPORT gzread(file, buf, len) state->x.pos += n; } while (len); - /* return number of bytes read into user buffer (will fit in int) */ - return (int)got; + /* return number of bytes read into user buffer */ + return got; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzread(file, buf, len) + gzFile file; + voidp buf; + unsigned len; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're reading and that there's no (serious) error */ + if (state->mode != GZ_READ || + (state->err != Z_OK && state->err != Z_BUF_ERROR)) + return -1; + + /* since an int is returned, make sure len fits in one, otherwise return + with an error (this avoids a flaw in the interface) */ + if ((int)len < 0) { + gz_error(state, Z_STREAM_ERROR, "request does not fit in an int"); + return -1; + } + + /* read len or fewer bytes to buf */ + len = gz_read(state, buf, len); + + /* check for an error */ + if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR) + return -1; + + /* return the number of bytes read (this is assured to fit in an int) */ + return (int)len; +} + +/* -- see zlib.h -- */ +z_size_t ZEXPORT gzfread(buf, size, nitems, file) + voidp buf; + z_size_t size; + z_size_t nitems; + gzFile file; +{ + z_size_t len; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + + /* check that we're reading and that there's no (serious) error */ + if (state->mode != GZ_READ || + (state->err != Z_OK && state->err != Z_BUF_ERROR)) + return 0; + + /* compute bytes to read -- error on overflow */ + len = nitems * size; + if (size && len / size != nitems) { + gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t"); + return 0; + } + + /* read len or fewer bytes to buf, return the number of full items read */ + return len ? gz_read(state, buf, len) / size : 0; } /* -- see zlib.h -- */ @@ -408,8 +468,8 @@ int ZEXPORT gzgetc(file) return *(state->x.next)++; } - /* nothing there -- try gzread() */ - ret = gzread(file, buf, 1); + /* nothing there -- try gz_read() */ + ret = gz_read(state, buf, 1); return ret < 1 ? -1 : buf[0]; } @@ -451,7 +511,7 @@ int ZEXPORT gzungetc(c, file) if (state->x.have == 0) { state->x.have = 1; state->x.next = state->out + (state->size << 1) - 1; - state->x.next[0] = c; + state->x.next[0] = (unsigned char)c; state->x.pos--; state->past = 0; return c; @@ -473,7 +533,7 @@ int ZEXPORT gzungetc(c, file) } state->x.have++; state->x.next--; - state->x.next[0] = c; + state->x.next[0] = (unsigned char)c; state->x.pos--; state->past = 0; return c; diff --git a/Modules/zlib/gzwrite.c b/Modules/zlib/gzwrite.c index aa767fb..c7b5651 100644 --- a/Modules/zlib/gzwrite.c +++ b/Modules/zlib/gzwrite.c @@ -1,5 +1,5 @@ /* gzwrite.c -- zlib functions for writing gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler + * Copyright (C) 2004-2017 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,17 +9,19 @@ local int gz_init OF((gz_statep)); local int gz_comp OF((gz_statep, int)); local int gz_zero OF((gz_statep, z_off64_t)); +local z_size_t gz_write OF((gz_statep, voidpc, z_size_t)); /* Initialize state for writing a gzip file. Mark initialization by setting - state->size to non-zero. Return -1 on failure or 0 on success. */ + state->size to non-zero. Return -1 on a memory allocation failure, or 0 on + success. */ local int gz_init(state) gz_statep state; { int ret; z_streamp strm = &(state->strm); - /* allocate input buffer */ - state->in = (unsigned char *)malloc(state->want); + /* allocate input buffer (double size for gzprintf) */ + state->in = (unsigned char *)malloc(state->want << 1); if (state->in == NULL) { gz_error(state, Z_MEM_ERROR, "out of memory"); return -1; @@ -47,6 +49,7 @@ local int gz_init(state) gz_error(state, Z_MEM_ERROR, "out of memory"); return -1; } + strm->next_in = NULL; } /* mark state as initialized */ @@ -62,17 +65,17 @@ local int gz_init(state) } /* Compress whatever is at avail_in and next_in and write to the output file. - Return -1 if there is an error writing to the output file, otherwise 0. - flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH, - then the deflate() state is reset to start a new gzip stream. If gz->direct - is true, then simply write to the output file without compressing, and - ignore flush. */ + Return -1 if there is an error writing to the output file or if gz_init() + fails to allocate memory, otherwise 0. flush is assumed to be a valid + deflate() flush value. If flush is Z_FINISH, then the deflate() state is + reset to start a new gzip stream. If gz->direct is true, then simply write + to the output file without compressing, and ignore flush. */ local int gz_comp(state, flush) gz_statep state; int flush; { - int ret, got; - unsigned have; + int ret, writ; + unsigned have, put, max = ((unsigned)-1 >> 2) + 1; z_streamp strm = &(state->strm); /* allocate memory if this is the first time through */ @@ -81,12 +84,16 @@ local int gz_comp(state, flush) /* write directly if requested */ if (state->direct) { - got = write(state->fd, strm->next_in, strm->avail_in); - if (got < 0 || (unsigned)got != strm->avail_in) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; + while (strm->avail_in) { + put = strm->avail_in > max ? max : strm->avail_in; + writ = write(state->fd, strm->next_in, put); + if (writ < 0) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + strm->avail_in -= (unsigned)writ; + strm->next_in += writ; } - strm->avail_in = 0; return 0; } @@ -97,17 +104,21 @@ local int gz_comp(state, flush) doing Z_FINISH then don't write until we get to Z_STREAM_END */ if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && (flush != Z_FINISH || ret == Z_STREAM_END))) { - have = (unsigned)(strm->next_out - state->x.next); - if (have && ((got = write(state->fd, state->x.next, have)) < 0 || - (unsigned)got != have)) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; + while (strm->next_out > state->x.next) { + put = strm->next_out - state->x.next > (int)max ? max : + (unsigned)(strm->next_out - state->x.next); + writ = write(state->fd, state->x.next, put); + if (writ < 0) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + state->x.next += writ; } if (strm->avail_out == 0) { strm->avail_out = state->size; strm->next_out = state->out; + state->x.next = state->out; } - state->x.next = strm->next_out; } /* compress */ @@ -129,7 +140,8 @@ local int gz_comp(state, flush) return 0; } -/* Compress len zeros to output. Return -1 on error, 0 on success. */ +/* Compress len zeros to output. Return -1 on a write error or memory + allocation failure by gz_comp(), or 0 on success. */ local int gz_zero(state, len) gz_statep state; z_off64_t len; @@ -161,32 +173,14 @@ local int gz_zero(state, len) return 0; } -/* -- see zlib.h -- */ -int ZEXPORT gzwrite(file, buf, len) - gzFile file; +/* Write len bytes from buf to file. Return the number of bytes written. If + the returned value is less than len, then there was an error. */ +local z_size_t gz_write(state, buf, len) + gz_statep state; voidpc buf; - unsigned len; + z_size_t len; { - unsigned put = len; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* since an int is returned, make sure len fits in one, otherwise return - with an error (this avoids the flaw in the interface) */ - if ((int)len < 0) { - gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); - return 0; - } + z_size_t put = len; /* if len is zero, avoid unnecessary operations */ if (len == 0) @@ -209,14 +203,15 @@ int ZEXPORT gzwrite(file, buf, len) do { unsigned have, copy; - if (strm->avail_in == 0) - strm->next_in = state->in; - have = (unsigned)((strm->next_in + strm->avail_in) - state->in); + if (state->strm.avail_in == 0) + state->strm.next_in = state->in; + have = (unsigned)((state->strm.next_in + state->strm.avail_in) - + state->in); copy = state->size - have; if (copy > len) copy = len; memcpy(state->in + have, buf, copy); - strm->avail_in += copy; + state->strm.avail_in += copy; state->x.pos += copy; buf = (const char *)buf + copy; len -= copy; @@ -226,19 +221,83 @@ int ZEXPORT gzwrite(file, buf, len) } else { /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) + if (state->strm.avail_in && gz_comp(state, Z_NO_FLUSH) == -1) return 0; /* directly compress user buffer to file */ - strm->avail_in = len; - strm->next_in = (z_const Bytef *)buf; - state->x.pos += len; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return 0; + state->strm.next_in = (z_const Bytef *)buf; + do { + unsigned n = (unsigned)-1; + if (n > len) + n = len; + state->strm.avail_in = n; + state->x.pos += n; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return 0; + len -= n; + } while (len); + } + + /* input was all buffered or compressed */ + return put; +} + +/* -- see zlib.h -- */ +int ZEXPORT gzwrite(file, buf, len) + gzFile file; + voidpc buf; + unsigned len; +{ + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* since an int is returned, make sure len fits in one, otherwise return + with an error (this avoids a flaw in the interface) */ + if ((int)len < 0) { + gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); + return 0; + } + + /* write len bytes from buf (the return value will fit in an int) */ + return (int)gz_write(state, buf, len); +} + +/* -- see zlib.h -- */ +z_size_t ZEXPORT gzfwrite(buf, size, nitems, file) + voidpc buf; + z_size_t size; + z_size_t nitems; + gzFile file; +{ + z_size_t len; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return 0; + state = (gz_statep)file; + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return 0; + + /* compute bytes to read -- error on overflow */ + len = nitems * size; + if (size && len / size != nitems) { + gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t"); + return 0; } - /* input was all buffered or compressed (put will fit in int) */ - return (int)put; + /* write len bytes to buf, return the number of full items written */ + return len ? gz_write(state, buf, len) / size : 0; } /* -- see zlib.h -- */ @@ -275,7 +334,7 @@ int ZEXPORT gzputc(file, c) strm->next_in = state->in; have = (unsigned)((strm->next_in + strm->avail_in) - state->in); if (have < state->size) { - state->in[have] = c; + state->in[have] = (unsigned char)c; strm->avail_in++; state->x.pos++; return c & 0xff; @@ -283,8 +342,8 @@ int ZEXPORT gzputc(file, c) } /* no room in buffer or not initialized, use gz_write() */ - buf[0] = c; - if (gzwrite(file, buf, 1) != 1) + buf[0] = (unsigned char)c; + if (gz_write(state, buf, 1) != 1) return -1; return c & 0xff; } @@ -295,11 +354,21 @@ int ZEXPORT gzputs(file, str) const char *str; { int ret; - unsigned len; + z_size_t len; + gz_statep state; + + /* get internal structure */ + if (file == NULL) + return -1; + state = (gz_statep)file; + + /* check that we're writing and that there's no error */ + if (state->mode != GZ_WRITE || state->err != Z_OK) + return -1; /* write string */ - len = (unsigned)strlen(str); - ret = gzwrite(file, str, len); + len = strlen(str); + ret = gz_write(state, str, len); return ret == 0 && len != 0 ? -1 : ret; } @@ -309,63 +378,73 @@ int ZEXPORT gzputs(file, str) /* -- see zlib.h -- */ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) { - int size, len; + int len; + unsigned left; + char *next; gz_statep state; z_streamp strm; /* get internal structure */ if (file == NULL) - return -1; + return Z_STREAM_ERROR; state = (gz_statep)file; strm = &(state->strm); /* check that we're writing and that there's no error */ if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; + return Z_STREAM_ERROR; /* make sure we have some buffer space */ if (state->size == 0 && gz_init(state) == -1) - return 0; + return state->err; /* check for seek request */ if (state->seek) { state->seek = 0; if (gz_zero(state, state->skip) == -1) - return 0; + return state->err; } - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - - /* do the printf() into the input buffer, put length in len */ - size = (int)(state->size); - state->in[size - 1] = 0; + /* do the printf() into the input buffer, put length in len -- the input + buffer is double-sized just for this function, so there is guaranteed to + be state->size bytes available after the current contents */ + if (strm->avail_in == 0) + strm->next_in = state->in; + next = (char *)(state->in + (strm->next_in - state->in) + strm->avail_in); + next[state->size - 1] = 0; #ifdef NO_vsnprintf # ifdef HAS_vsprintf_void - (void)vsprintf((char *)(state->in), format, va); - for (len = 0; len < size; len++) - if (state->in[len] == 0) break; + (void)vsprintf(next, format, va); + for (len = 0; len < state->size; len++) + if (next[len] == 0) break; # else - len = vsprintf((char *)(state->in), format, va); + len = vsprintf(next, format, va); # endif #else # ifdef HAS_vsnprintf_void - (void)vsnprintf((char *)(state->in), size, format, va); - len = strlen((char *)(state->in)); + (void)vsnprintf(next, state->size, format, va); + len = strlen(next); # else - len = vsnprintf((char *)(state->in), size, format, va); + len = vsnprintf(next, state->size, format, va); # endif #endif /* check that printf() results fit in buffer */ - if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) + if (len == 0 || (unsigned)len >= state->size || next[state->size - 1] != 0) return 0; - /* update buffer and position, defer compression until needed */ - strm->avail_in = (unsigned)len; - strm->next_in = state->in; + /* update buffer and position, compress first half if past that */ + strm->avail_in += (unsigned)len; state->x.pos += len; + if (strm->avail_in >= state->size) { + left = strm->avail_in - state->size; + strm->avail_in = state->size; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return state->err; + memcpy(state->in, state->in + state->size, left); + strm->next_in = state->in; + strm->avail_in = left; + } return len; } @@ -390,73 +469,82 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; { - int size, len; + unsigned len, left; + char *next; gz_statep state; z_streamp strm; /* get internal structure */ if (file == NULL) - return -1; + return Z_STREAM_ERROR; state = (gz_statep)file; strm = &(state->strm); /* check that can really pass pointer in ints */ if (sizeof(int) != sizeof(void *)) - return 0; + return Z_STREAM_ERROR; /* check that we're writing and that there's no error */ if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; + return Z_STREAM_ERROR; /* make sure we have some buffer space */ if (state->size == 0 && gz_init(state) == -1) - return 0; + return state->error; /* check for seek request */ if (state->seek) { state->seek = 0; if (gz_zero(state, state->skip) == -1) - return 0; + return state->error; } - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - - /* do the printf() into the input buffer, put length in len */ - size = (int)(state->size); - state->in[size - 1] = 0; + /* do the printf() into the input buffer, put length in len -- the input + buffer is double-sized just for this function, so there is guaranteed to + be state->size bytes available after the current contents */ + if (strm->avail_in == 0) + strm->next_in = state->in; + next = (char *)(strm->next_in + strm->avail_in); + next[state->size - 1] = 0; #ifdef NO_snprintf # ifdef HAS_sprintf_void - sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, + a13, a14, a15, a16, a17, a18, a19, a20); for (len = 0; len < size; len++) - if (state->in[len] == 0) break; + if (next[len] == 0) + break; # else - len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, + a12, a13, a14, a15, a16, a17, a18, a19, a20); # endif #else # ifdef HAS_snprintf_void - snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen((char *)(state->in)); + snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = strlen(next); # else - len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, - a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, - a19, a20); + len = snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); # endif #endif /* check that printf() results fit in buffer */ - if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) + if (len == 0 || len >= state->size || next[state->size - 1] != 0) return 0; - /* update buffer and position, defer compression until needed */ - strm->avail_in = (unsigned)len; - strm->next_in = state->in; + /* update buffer and position, compress first half if past that */ + strm->avail_in += len; state->x.pos += len; - return len; + if (strm->avail_in >= state->size) { + left = strm->avail_in - state->size; + strm->avail_in = state->size; + if (gz_comp(state, Z_NO_FLUSH) == -1) + return state->err; + memcpy(state->in, state->in + state->size, left); + strm->next_in = state->in; + strm->avail_in = left; + } + return (int)len; } #endif @@ -470,7 +558,7 @@ int ZEXPORT gzflush(file, flush) /* get internal structure */ if (file == NULL) - return -1; + return Z_STREAM_ERROR; state = (gz_statep)file; /* check that we're writing and that there's no error */ @@ -485,11 +573,11 @@ int ZEXPORT gzflush(file, flush) if (state->seek) { state->seek = 0; if (gz_zero(state, state->skip) == -1) - return -1; + return state->err; } /* compress remaining data with requested flush */ - gz_comp(state, flush); + (void)gz_comp(state, flush); return state->err; } @@ -520,13 +608,13 @@ int ZEXPORT gzsetparams(file, level, strategy) if (state->seek) { state->seek = 0; if (gz_zero(state, state->skip) == -1) - return -1; + return state->err; } /* change compression parameters for subsequent input */ if (state->size) { /* flush previous input with previous parameters before changing */ - if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1) + if (strm->avail_in && gz_comp(state, Z_BLOCK) == -1) return state->err; deflateParams(strm, level, strategy); } diff --git a/Modules/zlib/infback.c b/Modules/zlib/infback.c index f3833c2..59679ec 100644 --- a/Modules/zlib/infback.c +++ b/Modules/zlib/infback.c @@ -1,5 +1,5 @@ /* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2011 Mark Adler + * Copyright (C) 1995-2016 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -61,7 +61,7 @@ int stream_size; Tracev((stderr, "inflate: allocated\n")); strm->state = (struct internal_state FAR *)state; state->dmax = 32768U; - state->wbits = windowBits; + state->wbits = (uInt)windowBits; state->wsize = 1U << windowBits; state->window = window; state->wnext = 0; diff --git a/Modules/zlib/inffast.c b/Modules/zlib/inffast.c index bda59ce..0dbd1db 100644 --- a/Modules/zlib/inffast.c +++ b/Modules/zlib/inffast.c @@ -1,5 +1,5 @@ /* inffast.c -- fast decoding - * Copyright (C) 1995-2008, 2010, 2013 Mark Adler + * Copyright (C) 1995-2017 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -8,26 +8,9 @@ #include "inflate.h" #include "inffast.h" -#ifndef ASMINF - -/* Allow machine dependent optimization for post-increment or pre-increment. - Based on testing to date, - Pre-increment preferred for: - - PowerPC G3 (Adler) - - MIPS R5000 (Randers-Pehrson) - Post-increment preferred for: - - none - No measurable difference: - - Pentium III (Anderson) - - M68060 (Nikl) - */ -#ifdef POSTINC -# define OFF 0 -# define PUP(a) *(a)++ +#ifdef ASMINF +# pragma message("Assembler code may have bugs -- use at your own risk") #else -# define OFF 1 -# define PUP(a) *++(a) -#endif /* Decode literal, length, and distance codes and write out the resulting @@ -96,9 +79,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ /* copy state to local variables */ state = (struct inflate_state FAR *)strm->state; - in = strm->next_in - OFF; + in = strm->next_in; last = in + (strm->avail_in - 5); - out = strm->next_out - OFF; + out = strm->next_out; beg = out - (start - strm->avail_out); end = out + (strm->avail_out - 257); #ifdef INFLATE_STRICT @@ -119,9 +102,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ input data or output space */ do { if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; } here = lcode[hold & lmask]; @@ -134,14 +117,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", here.val)); - PUP(out) = (unsigned char)(here.val); + *out++ = (unsigned char)(here.val); } else if (op & 16) { /* length base */ len = (unsigned)(here.val); op &= 15; /* number of extra bits */ if (op) { if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; } len += (unsigned)hold & ((1U << op) - 1); @@ -150,9 +133,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ } Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; } here = dcode[hold & dmask]; @@ -165,10 +148,10 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ dist = (unsigned)(here.val); op &= 15; /* number of extra bits */ if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; } } @@ -196,30 +179,30 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR if (len <= op - whave) { do { - PUP(out) = 0; + *out++ = 0; } while (--len); continue; } len -= op - whave; do { - PUP(out) = 0; + *out++ = 0; } while (--op > whave); if (op == 0) { from = out - dist; do { - PUP(out) = PUP(from); + *out++ = *from++; } while (--len); continue; } #endif } - from = window - OFF; + from = window; if (wnext == 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; do { - PUP(out) = PUP(from); + *out++ = *from++; } while (--op); from = out - dist; /* rest from output */ } @@ -230,14 +213,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ if (op < len) { /* some from end of window */ len -= op; do { - PUP(out) = PUP(from); + *out++ = *from++; } while (--op); - from = window - OFF; + from = window; if (wnext < len) { /* some from start of window */ op = wnext; len -= op; do { - PUP(out) = PUP(from); + *out++ = *from++; } while (--op); from = out - dist; /* rest from output */ } @@ -248,35 +231,35 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ if (op < len) { /* some from window */ len -= op; do { - PUP(out) = PUP(from); + *out++ = *from++; } while (--op); from = out - dist; /* rest from output */ } } while (len > 2) { - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); + *out++ = *from++; + *out++ = *from++; + *out++ = *from++; len -= 3; } if (len) { - PUP(out) = PUP(from); + *out++ = *from++; if (len > 1) - PUP(out) = PUP(from); + *out++ = *from++; } } else { from = out - dist; /* copy direct from output */ do { /* minimum length is three */ - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); + *out++ = *from++; + *out++ = *from++; + *out++ = *from++; len -= 3; } while (len > 2); if (len) { - PUP(out) = PUP(from); + *out++ = *from++; if (len > 1) - PUP(out) = PUP(from); + *out++ = *from++; } } } @@ -313,8 +296,8 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ hold &= (1U << bits) - 1; /* update state and return */ - strm->next_in = in + OFF; - strm->next_out = out + OFF; + strm->next_in = in; + strm->next_out = out; strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); strm->avail_out = (unsigned)(out < end ? 257 + (end - out) : 257 - (out - end)); diff --git a/Modules/zlib/inflate.c b/Modules/zlib/inflate.c index 870f89b..ac333e8 100644 --- a/Modules/zlib/inflate.c +++ b/Modules/zlib/inflate.c @@ -1,5 +1,5 @@ /* inflate.c -- zlib decompression - * Copyright (C) 1995-2012 Mark Adler + * Copyright (C) 1995-2016 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -92,6 +92,7 @@ #endif /* function prototypes */ +local int inflateStateCheck OF((z_streamp strm)); local void fixedtables OF((struct inflate_state FAR *state)); local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, unsigned copy)); @@ -101,12 +102,26 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, unsigned len)); +local int inflateStateCheck(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + if (strm == Z_NULL || + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) + return 1; + state = (struct inflate_state FAR *)strm->state; + if (state == Z_NULL || state->strm != strm || + state->mode < HEAD || state->mode > SYNC) + return 1; + return 0; +} + int ZEXPORT inflateResetKeep(strm) z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; strm->total_in = strm->total_out = state->total = 0; strm->msg = Z_NULL; @@ -131,7 +146,7 @@ z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; state->wsize = 0; state->whave = 0; @@ -147,7 +162,7 @@ int windowBits; struct inflate_state FAR *state; /* get the state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; /* extract wrap request from windowBits parameter */ @@ -156,7 +171,7 @@ int windowBits; windowBits = -windowBits; } else { - wrap = (windowBits >> 4) + 1; + wrap = (windowBits >> 4) + 5; #ifdef GUNZIP if (windowBits < 48) windowBits &= 15; @@ -210,7 +225,9 @@ int stream_size; if (state == Z_NULL) return Z_MEM_ERROR; Tracev((stderr, "inflate: allocated\n")); strm->state = (struct internal_state FAR *)state; + state->strm = strm; state->window = Z_NULL; + state->mode = HEAD; /* to pass state test in inflateReset2() */ ret = inflateReset2(strm, windowBits); if (ret != Z_OK) { ZFREE(strm, state); @@ -234,17 +251,17 @@ int value; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (bits < 0) { state->hold = 0; state->bits = 0; return Z_OK; } - if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; + if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR; value &= (1L << bits) - 1; - state->hold += value << state->bits; - state->bits += bits; + state->hold += (unsigned)value << state->bits; + state->bits += (uInt)bits; return Z_OK; } @@ -625,7 +642,7 @@ int flush; static const unsigned short order[19] = /* permutation of code lengths */ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || + if (inflateStateCheck(strm) || strm->next_out == Z_NULL || (strm->next_in == Z_NULL && strm->avail_in != 0)) return Z_STREAM_ERROR; @@ -645,6 +662,8 @@ int flush; NEEDBITS(16); #ifdef GUNZIP if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ + if (state->wbits == 0) + state->wbits = 15; state->check = crc32(0L, Z_NULL, 0); CRC2(state->check, hold); INITBITS(); @@ -672,7 +691,7 @@ int flush; len = BITS(4) + 8; if (state->wbits == 0) state->wbits = len; - else if (len > state->wbits) { + if (len > 15 || len > state->wbits) { strm->msg = (char *)"invalid window size"; state->mode = BAD; break; @@ -699,14 +718,16 @@ int flush; } if (state->head != Z_NULL) state->head->text = (int)((hold >> 8) & 1); - if (state->flags & 0x0200) CRC2(state->check, hold); + if ((state->flags & 0x0200) && (state->wrap & 4)) + CRC2(state->check, hold); INITBITS(); state->mode = TIME; case TIME: NEEDBITS(32); if (state->head != Z_NULL) state->head->time = hold; - if (state->flags & 0x0200) CRC4(state->check, hold); + if ((state->flags & 0x0200) && (state->wrap & 4)) + CRC4(state->check, hold); INITBITS(); state->mode = OS; case OS: @@ -715,7 +736,8 @@ int flush; state->head->xflags = (int)(hold & 0xff); state->head->os = (int)(hold >> 8); } - if (state->flags & 0x0200) CRC2(state->check, hold); + if ((state->flags & 0x0200) && (state->wrap & 4)) + CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; case EXLEN: @@ -724,7 +746,8 @@ int flush; state->length = (unsigned)(hold); if (state->head != Z_NULL) state->head->extra_len = (unsigned)hold; - if (state->flags & 0x0200) CRC2(state->check, hold); + if ((state->flags & 0x0200) && (state->wrap & 4)) + CRC2(state->check, hold); INITBITS(); } else if (state->head != Z_NULL) @@ -742,7 +765,7 @@ int flush; len + copy > state->head->extra_max ? state->head->extra_max - len : copy); } - if (state->flags & 0x0200) + if ((state->flags & 0x0200) && (state->wrap & 4)) state->check = crc32(state->check, next, copy); have -= copy; next += copy; @@ -761,9 +784,9 @@ int flush; if (state->head != Z_NULL && state->head->name != Z_NULL && state->length < state->head->name_max) - state->head->name[state->length++] = len; + state->head->name[state->length++] = (Bytef)len; } while (len && copy < have); - if (state->flags & 0x0200) + if ((state->flags & 0x0200) && (state->wrap & 4)) state->check = crc32(state->check, next, copy); have -= copy; next += copy; @@ -782,9 +805,9 @@ int flush; if (state->head != Z_NULL && state->head->comment != Z_NULL && state->length < state->head->comm_max) - state->head->comment[state->length++] = len; + state->head->comment[state->length++] = (Bytef)len; } while (len && copy < have); - if (state->flags & 0x0200) + if ((state->flags & 0x0200) && (state->wrap & 4)) state->check = crc32(state->check, next, copy); have -= copy; next += copy; @@ -796,7 +819,7 @@ int flush; case HCRC: if (state->flags & 0x0200) { NEEDBITS(16); - if (hold != (state->check & 0xffff)) { + if ((state->wrap & 4) && hold != (state->check & 0xffff)) { strm->msg = (char *)"header crc mismatch"; state->mode = BAD; break; @@ -1177,11 +1200,11 @@ int flush; out -= left; strm->total_out += out; state->total += out; - if (out) + if ((state->wrap & 4) && out) strm->adler = state->check = UPDATE(state->check, put - out, out); out = left; - if (( + if ((state->wrap & 4) && ( #ifdef GUNZIP state->flags ? hold : #endif @@ -1240,10 +1263,10 @@ int flush; strm->total_in += in; strm->total_out += out; state->total += out; - if (state->wrap && out) + if ((state->wrap & 4) && out) strm->adler = state->check = UPDATE(state->check, strm->next_out - out, out); - strm->data_type = state->bits + (state->last ? 64 : 0) + + strm->data_type = (int)state->bits + (state->last ? 64 : 0) + (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) @@ -1255,7 +1278,7 @@ int ZEXPORT inflateEnd(strm) z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->window != Z_NULL) ZFREE(strm, state->window); @@ -1273,7 +1296,7 @@ uInt *dictLength; struct inflate_state FAR *state; /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; /* copy dictionary */ @@ -1298,7 +1321,7 @@ uInt dictLength; int ret; /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->wrap != 0 && state->mode != DICT) return Z_STREAM_ERROR; @@ -1330,7 +1353,7 @@ gz_headerp head; struct inflate_state FAR *state; /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; @@ -1383,7 +1406,7 @@ z_streamp strm; struct inflate_state FAR *state; /* check parameters */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; @@ -1430,7 +1453,7 @@ z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; return state->mode == STORED && state->bits == 0; } @@ -1445,8 +1468,7 @@ z_streamp source; unsigned wsize; /* check input */ - if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || - source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) + if (inflateStateCheck(source) || dest == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)source->state; @@ -1467,6 +1489,7 @@ z_streamp source; /* copy state */ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state)); + copy->strm = dest; if (state->lencode >= state->codes && state->lencode <= state->codes + ENOUGH - 1) { copy->lencode = copy->codes + (state->lencode - state->codes); @@ -1488,25 +1511,51 @@ int subvert; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; - state->sane = !subvert; #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR + state->sane = !subvert; return Z_OK; #else + (void)subvert; state->sane = 1; return Z_DATA_ERROR; #endif } +int ZEXPORT inflateValidate(strm, check) +z_streamp strm; +int check; +{ + struct inflate_state FAR *state; + + if (inflateStateCheck(strm)) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (check) + state->wrap |= 4; + else + state->wrap &= ~4; + return Z_OK; +} + long ZEXPORT inflateMark(strm) z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; + if (inflateStateCheck(strm)) + return -(1L << 16); state = (struct inflate_state FAR *)strm->state; - return ((long)(state->back) << 16) + + return (long)(((unsigned long)((long)state->back)) << 16) + (state->mode == COPY ? state->length : (state->mode == MATCH ? state->was - state->length : 0)); } + +unsigned long ZEXPORT inflateCodesUsed(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + if (inflateStateCheck(strm)) return (unsigned long)-1; + state = (struct inflate_state FAR *)strm->state; + return (unsigned long)(state->next - state->codes); +} diff --git a/Modules/zlib/inflate.h b/Modules/zlib/inflate.h index 95f4986..a46cce6 100644 --- a/Modules/zlib/inflate.h +++ b/Modules/zlib/inflate.h @@ -1,5 +1,5 @@ /* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2009 Mark Adler + * Copyright (C) 1995-2016 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -18,7 +18,7 @@ /* Possible inflate modes between inflate() calls */ typedef enum { - HEAD, /* i: waiting for magic header */ + HEAD = 16180, /* i: waiting for magic header */ FLAGS, /* i: waiting for method and flags (gzip) */ TIME, /* i: waiting for modification time (gzip) */ OS, /* i: waiting for extra flags and operating system (gzip) */ @@ -77,11 +77,14 @@ typedef enum { CHECK -> LENGTH -> DONE */ -/* state maintained between inflate() calls. Approximately 10K bytes. */ +/* State maintained between inflate() calls -- approximately 7K bytes, not + including the allocated sliding window, which is up to 32K bytes. */ struct inflate_state { + z_streamp strm; /* pointer back to this zlib stream */ inflate_mode mode; /* current inflate mode */ int last; /* true if processing last block */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip, + bit 2 true to validate check value */ int havedict; /* true if dictionary provided */ int flags; /* gzip header method and flags (0 if zlib) */ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ diff --git a/Modules/zlib/inftrees.c b/Modules/zlib/inftrees.c index 44d89cf..2ea08fc 100644 --- a/Modules/zlib/inftrees.c +++ b/Modules/zlib/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2013 Mark Adler + * Copyright (C) 1995-2017 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.2.8 Copyright 1995-2013 Mark Adler "; + " inflate 1.2.11 Copyright 1995-2017 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -54,7 +54,7 @@ unsigned short FAR *work; code FAR *next; /* next available space in table */ const unsigned short FAR *base; /* base value table to use */ const unsigned short FAR *extra; /* extra bits table to use */ - int end; /* use base and extra for symbol > end */ + unsigned match; /* use base and extra for symbol >= match */ unsigned short count[MAXBITS+1]; /* number of codes of each length */ unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ static const unsigned short lbase[31] = { /* Length codes 257..285 base */ @@ -62,7 +62,7 @@ unsigned short FAR *work; 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, @@ -181,19 +181,17 @@ unsigned short FAR *work; switch (type) { case CODES: base = extra = work; /* dummy value--not used */ - end = 19; + match = 20; break; case LENS: base = lbase; - base -= 257; extra = lext; - extra -= 257; - end = 256; + match = 257; break; - default: /* DISTS */ + default: /* DISTS */ base = dbase; extra = dext; - end = -1; + match = 0; } /* initialize state for loop */ @@ -216,13 +214,13 @@ unsigned short FAR *work; for (;;) { /* create table entry */ here.bits = (unsigned char)(len - drop); - if ((int)(work[sym]) < end) { + if (work[sym] + 1U < match) { here.op = (unsigned char)0; here.val = work[sym]; } - else if ((int)(work[sym]) > end) { - here.op = (unsigned char)(extra[work[sym]]); - here.val = base[work[sym]]; + else if (work[sym] >= match) { + here.op = (unsigned char)(extra[work[sym] - match]); + here.val = base[work[sym] - match]; } else { here.op = (unsigned char)(32 + 64); /* end of block */ diff --git a/Modules/zlib/trees.c b/Modules/zlib/trees.c index 1fd7759..50cf4b4 100644 --- a/Modules/zlib/trees.c +++ b/Modules/zlib/trees.c @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2012 Jean-loup Gailly + * Copyright (C) 1995-2017 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -36,7 +36,7 @@ #include "deflate.h" -#ifdef DEBUG +#ifdef ZLIB_DEBUG # include #endif @@ -122,13 +122,13 @@ struct static_tree_desc_s { int max_length; /* max bit length for the codes */ }; -local static_tree_desc static_l_desc = +local const static_tree_desc static_l_desc = {static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; -local static_tree_desc static_d_desc = +local const static_tree_desc static_d_desc = {static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; -local static_tree_desc static_bl_desc = +local const static_tree_desc static_bl_desc = {(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; /* =========================================================================== @@ -152,18 +152,16 @@ local int detect_data_type OF((deflate_state *s)); local unsigned bi_reverse OF((unsigned value, int length)); local void bi_windup OF((deflate_state *s)); local void bi_flush OF((deflate_state *s)); -local void copy_block OF((deflate_state *s, charf *buf, unsigned len, - int header)); #ifdef GEN_TREES_H local void gen_trees_header OF((void)); #endif -#ifndef DEBUG +#ifndef ZLIB_DEBUG # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) /* Send a code of the given tree. c and tree must not have side effects */ -#else /* DEBUG */ +#else /* !ZLIB_DEBUG */ # define send_code(s, c, tree) \ { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ send_bits(s, tree[c].Code, tree[c].Len); } @@ -182,7 +180,7 @@ local void gen_trees_header OF((void)); * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ -#ifdef DEBUG +#ifdef ZLIB_DEBUG local void send_bits OF((deflate_state *s, int value, int length)); local void send_bits(s, value, length) @@ -208,12 +206,12 @@ local void send_bits(s, value, length) s->bi_valid += length; } } -#else /* !DEBUG */ +#else /* !ZLIB_DEBUG */ #define send_bits(s, value, length) \ { int len = length;\ if (s->bi_valid > (int)Buf_size - len) {\ - int val = value;\ + int val = (int)value;\ s->bi_buf |= (ush)val << s->bi_valid;\ put_short(s, s->bi_buf);\ s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ @@ -223,7 +221,7 @@ local void send_bits(s, value, length) s->bi_valid += len;\ }\ } -#endif /* DEBUG */ +#endif /* ZLIB_DEBUG */ /* the arguments must not have side effects */ @@ -317,7 +315,7 @@ local void tr_static_init() * Genererate the file trees.h describing the static trees. */ #ifdef GEN_TREES_H -# ifndef DEBUG +# ifndef ZLIB_DEBUG # include # endif @@ -394,7 +392,7 @@ void ZLIB_INTERNAL _tr_init(s) s->bi_buf = 0; s->bi_valid = 0; -#ifdef DEBUG +#ifdef ZLIB_DEBUG s->compressed_len = 0L; s->bits_sent = 0L; #endif @@ -522,12 +520,12 @@ local void gen_bitlen(s, desc) xbits = 0; if (n >= base) xbits = extra[n-base]; f = tree[n].Freq; - s->opt_len += (ulg)f * (bits + xbits); - if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); + s->opt_len += (ulg)f * (unsigned)(bits + xbits); + if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits); } if (overflow == 0) return; - Trace((stderr,"\nbit length overflow\n")); + Tracev((stderr,"\nbit length overflow\n")); /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ @@ -554,9 +552,8 @@ local void gen_bitlen(s, desc) m = s->heap[--h]; if (m > max_code) continue; if ((unsigned) tree[m].Len != (unsigned) bits) { - Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s->opt_len += ((long)bits - (long)tree[m].Len) - *(long)tree[m].Freq; + Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq; tree[m].Len = (ush)bits; } n--; @@ -578,7 +575,7 @@ local void gen_codes (tree, max_code, bl_count) ushf *bl_count; /* number of codes at each bit length */ { ush next_code[MAX_BITS+1]; /* next code value for each bit length */ - ush code = 0; /* running code value */ + unsigned code = 0; /* running code value */ int bits; /* bit index */ int n; /* code index */ @@ -586,7 +583,8 @@ local void gen_codes (tree, max_code, bl_count) * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits-1]) << 1; + code = (code + bl_count[bits-1]) << 1; + next_code[bits] = (ush)code; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. @@ -599,7 +597,7 @@ local void gen_codes (tree, max_code, bl_count) int len = tree[n].Len; if (len == 0) continue; /* Now reverse the bits */ - tree[n].Code = bi_reverse(next_code[len]++, len); + tree[n].Code = (ush)bi_reverse(next_code[len]++, len); Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); @@ -821,7 +819,7 @@ local int build_bl_tree(s) if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; } /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*(max_blindex+1) + 5+5+4; + s->opt_len += 3*((ulg)max_blindex+1) + 5+5+4; Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", s->opt_len, s->static_len)); @@ -869,11 +867,17 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) int last; /* one if this is the last block for a file */ { send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ -#ifdef DEBUG + bi_windup(s); /* align on byte boundary */ + put_short(s, (ush)stored_len); + put_short(s, (ush)~stored_len); + zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); + s->pending += stored_len; +#ifdef ZLIB_DEBUG s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len += (stored_len + 4) << 3; + s->bits_sent += 2*16; + s->bits_sent += stored_len<<3; #endif - copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ } /* =========================================================================== @@ -894,7 +898,7 @@ void ZLIB_INTERNAL _tr_align(s) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG +#ifdef ZLIB_DEBUG s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ #endif bi_flush(s); @@ -902,7 +906,7 @@ void ZLIB_INTERNAL _tr_align(s) /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. + * trees or store, and write out the encoded block. */ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) deflate_state *s; @@ -974,7 +978,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) send_bits(s, (STATIC_TREES<<1)+last, 3); compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree); -#ifdef DEBUG +#ifdef ZLIB_DEBUG s->compressed_len += 3 + s->static_len; #endif } else { @@ -983,7 +987,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) max_blindex+1); compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree); -#ifdef DEBUG +#ifdef ZLIB_DEBUG s->compressed_len += 3 + s->opt_len; #endif } @@ -995,7 +999,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) if (last) { bi_windup(s); -#ifdef DEBUG +#ifdef ZLIB_DEBUG s->compressed_len += 7; /* align on byte boundary */ #endif } @@ -1090,7 +1094,7 @@ local void compress_block(s, ltree, dtree) send_code(s, code, dtree); /* send the distance code */ extra = extra_dbits[code]; if (extra != 0) { - dist -= base_dist[code]; + dist -= (unsigned)base_dist[code]; send_bits(s, dist, extra); /* send the extra distance bits */ } } /* literal or match pair ? */ @@ -1193,34 +1197,7 @@ local void bi_windup(s) } s->bi_buf = 0; s->bi_valid = 0; -#ifdef DEBUG +#ifdef ZLIB_DEBUG s->bits_sent = (s->bits_sent+7) & ~7; #endif } - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -local void copy_block(s, buf, len, header) - deflate_state *s; - charf *buf; /* the input data */ - unsigned len; /* its length */ - int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - - if (header) { - put_short(s, (ush)len); - put_short(s, (ush)~len); -#ifdef DEBUG - s->bits_sent += 2*16; -#endif - } -#ifdef DEBUG - s->bits_sent += (ulg)len<<3; -#endif - while (len--) { - put_byte(s, *buf++); - } -} diff --git a/Modules/zlib/uncompr.c b/Modules/zlib/uncompr.c index 242e949..f03a1a8 100644 --- a/Modules/zlib/uncompr.c +++ b/Modules/zlib/uncompr.c @@ -1,5 +1,5 @@ /* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. + * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,51 +9,85 @@ #include "zlib.h" /* =========================================================================== - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. + Decompresses the source buffer into the destination buffer. *sourceLen is + the byte length of the source buffer. Upon entry, *destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, + *destLen is the size of the decompressed data and *sourceLen is the number + of source bytes consumed. Upon return, source + *sourceLen points to the + first unused input byte. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, or + Z_DATA_ERROR if the input data was corrupted, including if the input data is + an incomplete zlib stream. */ -int ZEXPORT uncompress (dest, destLen, source, sourceLen) +int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; - uLong sourceLen; + uLong *sourceLen; { z_stream stream; int err; + const uInt max = (uInt)-1; + uLong len, left; + Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ - stream.next_in = (z_const Bytef *)source; - stream.avail_in = (uInt)sourceLen; - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; - - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + len = *sourceLen; + if (*destLen) { + left = *destLen; + *destLen = 0; + } + else { + left = 1; + dest = buf; + } + stream.next_in = (z_const Bytef *)source; + stream.avail_in = 0; stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; + stream.opaque = (voidpf)0; err = inflateInit(&stream); if (err != Z_OK) return err; - err = inflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - inflateEnd(&stream); - if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) - return Z_DATA_ERROR; - return err; - } - *destLen = stream.total_out; + stream.next_out = dest; + stream.avail_out = 0; - err = inflateEnd(&stream); - return err; + do { + if (stream.avail_out == 0) { + stream.avail_out = left > (uLong)max ? max : (uInt)left; + left -= stream.avail_out; + } + if (stream.avail_in == 0) { + stream.avail_in = len > (uLong)max ? max : (uInt)len; + len -= stream.avail_in; + } + err = inflate(&stream, Z_NO_FLUSH); + } while (err == Z_OK); + + *sourceLen -= len + stream.avail_in; + if (dest != buf) + *destLen = stream.total_out; + else if (stream.total_out && err == Z_BUF_ERROR) + left = 1; + + inflateEnd(&stream); + return err == Z_STREAM_END ? Z_OK : + err == Z_NEED_DICT ? Z_DATA_ERROR : + err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : + err; +} + +int ZEXPORT uncompress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + return uncompress2(dest, destLen, source, &sourceLen); } diff --git a/Modules/zlib/zconf.h b/Modules/zlib/zconf.h index 9987a77..5e1d68a 100644 --- a/Modules/zlib/zconf.h +++ b/Modules/zlib/zconf.h @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2013 Jean-loup Gailly. + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -17,7 +17,7 @@ #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ # define Z_PREFIX_SET -/* all linked symbols */ +/* all linked symbols and init macros */ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align @@ -29,6 +29,7 @@ # define adler32 z_adler32 # define adler32_combine z_adler32_combine # define adler32_combine64 z_adler32_combine64 +# define adler32_z z_adler32_z # ifndef Z_SOLO # define compress z_compress # define compress2 z_compress2 @@ -37,10 +38,14 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound # define deflateCopy z_deflateCopy # define deflateEnd z_deflateEnd +# define deflateGetDictionary z_deflateGetDictionary +# define deflateInit z_deflateInit +# define deflateInit2 z_deflateInit2 # define deflateInit2_ z_deflateInit2_ # define deflateInit_ z_deflateInit_ # define deflateParams z_deflateParams @@ -67,6 +72,8 @@ # define gzeof z_gzeof # define gzerror z_gzerror # define gzflush z_gzflush +# define gzfread z_gzfread +# define gzfwrite z_gzfwrite # define gzgetc z_gzgetc # define gzgetc_ z_gzgetc_ # define gzgets z_gzgets @@ -78,7 +85,6 @@ # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf -# define gzvprintf z_gzvprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread @@ -89,32 +95,39 @@ # define gztell z_gztell # define gztell64 z_gztell64 # define gzungetc z_gzungetc +# define gzvprintf z_gzvprintf # define gzwrite z_gzwrite # endif # define inflate z_inflate # define inflateBack z_inflateBack # define inflateBackEnd z_inflateBackEnd +# define inflateBackInit z_inflateBackInit # define inflateBackInit_ z_inflateBackInit_ +# define inflateCodesUsed z_inflateCodesUsed # define inflateCopy z_inflateCopy # define inflateEnd z_inflateEnd +# define inflateGetDictionary z_inflateGetDictionary # define inflateGetHeader z_inflateGetHeader +# define inflateInit z_inflateInit +# define inflateInit2 z_inflateInit2 # define inflateInit2_ z_inflateInit2_ # define inflateInit_ z_inflateInit_ # define inflateMark z_inflateMark # define inflatePrime z_inflatePrime # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 +# define inflateResetKeep z_inflateResetKeep # define inflateSetDictionary z_inflateSetDictionary -# define inflateGetDictionary z_inflateGetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine -# define inflateResetKeep z_inflateResetKeep +# define inflateValidate z_inflateValidate # define inflate_copyright z_inflate_copyright # define inflate_fast z_inflate_fast # define inflate_table z_inflate_table # ifndef Z_SOLO # define uncompress z_uncompress +# define uncompress2 z_uncompress2 # endif # define zError z_zError # ifndef Z_SOLO @@ -224,9 +237,19 @@ # define z_const #endif -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL +#ifdef Z_SOLO + typedef unsigned long z_size_t; +#else +# define z_longlong long long +# if defined(NO_SIZE_T) + typedef unsigned NO_SIZE_T z_size_t; +# elif defined(STDC) +# include + typedef size_t z_size_t; +# else + typedef unsigned long z_size_t; +# endif +# undef z_longlong #endif /* Maximum value for memLevel in deflateInit2 */ @@ -256,7 +279,7 @@ Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes for small objects. */ diff --git a/Modules/zlib/zconf.h.cmakein b/Modules/zlib/zconf.h.cmakein index 043019c..a7f24cc 100644 --- a/Modules/zlib/zconf.h.cmakein +++ b/Modules/zlib/zconf.h.cmakein @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2013 Jean-loup Gailly. + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -19,7 +19,7 @@ #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ # define Z_PREFIX_SET -/* all linked symbols */ +/* all linked symbols and init macros */ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align @@ -31,6 +31,7 @@ # define adler32 z_adler32 # define adler32_combine z_adler32_combine # define adler32_combine64 z_adler32_combine64 +# define adler32_z z_adler32_z # ifndef Z_SOLO # define compress z_compress # define compress2 z_compress2 @@ -39,10 +40,14 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound # define deflateCopy z_deflateCopy # define deflateEnd z_deflateEnd +# define deflateGetDictionary z_deflateGetDictionary +# define deflateInit z_deflateInit +# define deflateInit2 z_deflateInit2 # define deflateInit2_ z_deflateInit2_ # define deflateInit_ z_deflateInit_ # define deflateParams z_deflateParams @@ -69,6 +74,8 @@ # define gzeof z_gzeof # define gzerror z_gzerror # define gzflush z_gzflush +# define gzfread z_gzfread +# define gzfwrite z_gzfwrite # define gzgetc z_gzgetc # define gzgetc_ z_gzgetc_ # define gzgets z_gzgets @@ -80,7 +87,6 @@ # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf -# define gzvprintf z_gzvprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread @@ -91,32 +97,39 @@ # define gztell z_gztell # define gztell64 z_gztell64 # define gzungetc z_gzungetc +# define gzvprintf z_gzvprintf # define gzwrite z_gzwrite # endif # define inflate z_inflate # define inflateBack z_inflateBack # define inflateBackEnd z_inflateBackEnd +# define inflateBackInit z_inflateBackInit # define inflateBackInit_ z_inflateBackInit_ +# define inflateCodesUsed z_inflateCodesUsed # define inflateCopy z_inflateCopy # define inflateEnd z_inflateEnd +# define inflateGetDictionary z_inflateGetDictionary # define inflateGetHeader z_inflateGetHeader +# define inflateInit z_inflateInit +# define inflateInit2 z_inflateInit2 # define inflateInit2_ z_inflateInit2_ # define inflateInit_ z_inflateInit_ # define inflateMark z_inflateMark # define inflatePrime z_inflatePrime # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 +# define inflateResetKeep z_inflateResetKeep # define inflateSetDictionary z_inflateSetDictionary -# define inflateGetDictionary z_inflateGetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine -# define inflateResetKeep z_inflateResetKeep +# define inflateValidate z_inflateValidate # define inflate_copyright z_inflate_copyright # define inflate_fast z_inflate_fast # define inflate_table z_inflate_table # ifndef Z_SOLO # define uncompress z_uncompress +# define uncompress2 z_uncompress2 # endif # define zError z_zError # ifndef Z_SOLO @@ -226,9 +239,19 @@ # define z_const #endif -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL +#ifdef Z_SOLO + typedef unsigned long z_size_t; +#else +# define z_longlong long long +# if defined(NO_SIZE_T) + typedef unsigned NO_SIZE_T z_size_t; +# elif defined(STDC) +# include + typedef size_t z_size_t; +# else + typedef unsigned long z_size_t; +# endif +# undef z_longlong #endif /* Maximum value for memLevel in deflateInit2 */ @@ -258,7 +281,7 @@ Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes for small objects. */ diff --git a/Modules/zlib/zconf.h.in b/Modules/zlib/zconf.h.in index 9987a77..5e1d68a 100644 --- a/Modules/zlib/zconf.h.in +++ b/Modules/zlib/zconf.h.in @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2013 Jean-loup Gailly. + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -17,7 +17,7 @@ #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ # define Z_PREFIX_SET -/* all linked symbols */ +/* all linked symbols and init macros */ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align @@ -29,6 +29,7 @@ # define adler32 z_adler32 # define adler32_combine z_adler32_combine # define adler32_combine64 z_adler32_combine64 +# define adler32_z z_adler32_z # ifndef Z_SOLO # define compress z_compress # define compress2 z_compress2 @@ -37,10 +38,14 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound # define deflateCopy z_deflateCopy # define deflateEnd z_deflateEnd +# define deflateGetDictionary z_deflateGetDictionary +# define deflateInit z_deflateInit +# define deflateInit2 z_deflateInit2 # define deflateInit2_ z_deflateInit2_ # define deflateInit_ z_deflateInit_ # define deflateParams z_deflateParams @@ -67,6 +72,8 @@ # define gzeof z_gzeof # define gzerror z_gzerror # define gzflush z_gzflush +# define gzfread z_gzfread +# define gzfwrite z_gzfwrite # define gzgetc z_gzgetc # define gzgetc_ z_gzgetc_ # define gzgets z_gzgets @@ -78,7 +85,6 @@ # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf -# define gzvprintf z_gzvprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread @@ -89,32 +95,39 @@ # define gztell z_gztell # define gztell64 z_gztell64 # define gzungetc z_gzungetc +# define gzvprintf z_gzvprintf # define gzwrite z_gzwrite # endif # define inflate z_inflate # define inflateBack z_inflateBack # define inflateBackEnd z_inflateBackEnd +# define inflateBackInit z_inflateBackInit # define inflateBackInit_ z_inflateBackInit_ +# define inflateCodesUsed z_inflateCodesUsed # define inflateCopy z_inflateCopy # define inflateEnd z_inflateEnd +# define inflateGetDictionary z_inflateGetDictionary # define inflateGetHeader z_inflateGetHeader +# define inflateInit z_inflateInit +# define inflateInit2 z_inflateInit2 # define inflateInit2_ z_inflateInit2_ # define inflateInit_ z_inflateInit_ # define inflateMark z_inflateMark # define inflatePrime z_inflatePrime # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 +# define inflateResetKeep z_inflateResetKeep # define inflateSetDictionary z_inflateSetDictionary -# define inflateGetDictionary z_inflateGetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine -# define inflateResetKeep z_inflateResetKeep +# define inflateValidate z_inflateValidate # define inflate_copyright z_inflate_copyright # define inflate_fast z_inflate_fast # define inflate_table z_inflate_table # ifndef Z_SOLO # define uncompress z_uncompress +# define uncompress2 z_uncompress2 # endif # define zError z_zError # ifndef Z_SOLO @@ -224,9 +237,19 @@ # define z_const #endif -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL +#ifdef Z_SOLO + typedef unsigned long z_size_t; +#else +# define z_longlong long long +# if defined(NO_SIZE_T) + typedef unsigned NO_SIZE_T z_size_t; +# elif defined(STDC) +# include + typedef size_t z_size_t; +# else + typedef unsigned long z_size_t; +# endif +# undef z_longlong #endif /* Maximum value for memLevel in deflateInit2 */ @@ -256,7 +279,7 @@ Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes for small objects. */ diff --git a/Modules/zlib/zlib.3 b/Modules/zlib/zlib.3 index 0160e62..bda4eb0 100644 --- a/Modules/zlib/zlib.3 +++ b/Modules/zlib/zlib.3 @@ -1,4 +1,4 @@ -.TH ZLIB 3 "28 Apr 2013" +.TH ZLIB 3 "15 Jan 2017" .SH NAME zlib \- compression/decompression library .SH SYNOPSIS @@ -48,32 +48,10 @@ Changes to this version are documented in the file that accompanies the source. .LP .I zlib -is available in Java using the java.util.zip package: -.IP -http://java.sun.com/developer/technicalArticles/Programming/compression/ -.LP -A Perl interface to -.IR zlib , -written by Paul Marquess (pmqs@cpan.org), -is available at CPAN (Comprehensive Perl Archive Network) sites, -including: -.IP -http://search.cpan.org/~pmqs/IO-Compress-Zlib/ -.LP -A Python interface to -.IR zlib , -written by A.M. Kuchling (amk@magnet.com), -is available in Python 1.5 and later versions: -.IP -http://docs.python.org/library/zlib.html -.LP -.I zlib -is built into -.IR tcl: -.IP -http://wiki.tcl.tk/4610 +is built in to many languages and operating systems, including but not limited to +Java, Python, .NET, PHP, Perl, Ruby, Swift, and Go. .LP -An experimental package to read and write files in .zip format, +An experimental package to read and write files in the .zip format, written on top of .I zlib by Gilles Vollant (info@winimage.com), @@ -92,7 +70,9 @@ web site can be found at: .IP http://zlib.net/ .LP -The data format used by the zlib library is described by RFC +The data format used by the +.I zlib +library is described by RFC (Request for Comments) 1950 to 1952 in the files: .IP http://tools.ietf.org/html/rfc1950 (for the zlib header and trailer format) @@ -124,17 +104,35 @@ http://zlib.net/zlib_faq.html before asking for help. Send questions and/or comments to zlib@gzip.org, or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). -.SH AUTHORS -Version 1.2.8 -Copyright (C) 1995-2013 Jean-loup Gailly (jloup@gzip.org) -and Mark Adler (madler@alumni.caltech.edu). -.LP -This software is provided "as-is," -without any express or implied warranty. -In no event will the authors be held liable for any damages +.SH AUTHORS AND LICENSE +Version 1.2.11 +.LP +Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler +.LP +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages arising from the use of this software. -See the distribution directory with respect to requirements -governing redistribution. +.LP +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: +.LP +.nr step 1 1 +.IP \n[step]. 3 +The origin of this software must not be misrepresented; you must not +claim that you wrote the original software. If you use this software +in a product, an acknowledgment in the product documentation would be +appreciated but is not required. +.IP \n+[step]. +Altered source versions must be plainly marked as such, and must not be +misrepresented as being the original software. +.IP \n+[step]. +This notice may not be removed or altered from any source distribution. +.LP +Jean-loup Gailly Mark Adler +.br +jloup@gzip.org madler@alumni.caltech.edu +.LP The deflate format used by .I zlib was defined by Phil Katz. diff --git a/Modules/zlib/zlib.h b/Modules/zlib/zlib.h index 3e0c767..f09cdaf 100644 --- a/Modules/zlib/zlib.h +++ b/Modules/zlib/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.8, April 28th, 2013 + version 1.2.11, January 15th, 2017 - Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.8" -#define ZLIB_VERNUM 0x1280 +#define ZLIB_VERSION "1.2.11" +#define ZLIB_VERNUM 0x12b0 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 8 +#define ZLIB_VER_REVISION 11 #define ZLIB_VER_SUBREVISION 0 /* @@ -65,7 +65,8 @@ extern "C" { with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - This library can optionally read and write gzip streams in memory as well. + This library can optionally read and write gzip and raw deflate streams in + memory as well. The zlib format was designed to be compact and fast for use in memory and on communications channels. The gzip format was designed for single- @@ -74,7 +75,7 @@ extern "C" { The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never crash - even in case of corrupted input. + even in the case of corrupted input. */ typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); @@ -87,7 +88,7 @@ typedef struct z_stream_s { uInt avail_in; /* number of bytes available at next_in */ uLong total_in; /* total number of input bytes read so far */ - Bytef *next_out; /* next output byte should be put there */ + Bytef *next_out; /* next output byte will go here */ uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total number of bytes output so far */ @@ -98,8 +99,9 @@ typedef struct z_stream_s { free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ - int data_type; /* best guess about the data type: binary or text */ - uLong adler; /* adler32 value of the uncompressed data */ + int data_type; /* best guess about the data type: binary or text + for deflate, or the decoding state for inflate */ + uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ } z_stream; @@ -142,7 +144,9 @@ typedef gz_header FAR *gz_headerp; zalloc must return Z_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. + thread safe. In that case, zlib is thread-safe. When zalloc and zfree are + Z_NULL on entry to the initialization function, they are set to internal + routines that use the standard library functions malloc() and free(). On 16-bit systems, the functions zalloc and zfree must be able to allocate exactly 65536 bytes, but will not be required to allocate more than this if @@ -155,7 +159,7 @@ typedef gz_header FAR *gz_headerp; The fields total_in and total_out can be used for statistics or progress reports. After compression, total_in holds the total size of the - uncompressed data and may be saved for use in the decompressor (particularly + uncompressed data and may be saved for use by the decompressor (particularly if the decompressor wants to decompress everything in a single step). */ @@ -200,7 +204,7 @@ typedef gz_header FAR *gz_headerp; #define Z_TEXT 1 #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ #define Z_UNKNOWN 2 -/* Possible values of the data_type field (though see inflate()) */ +/* Possible values of the data_type field for deflate() */ #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ @@ -258,11 +262,11 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); enough room in the output buffer), next_in and avail_in are updated and processing will resume at this point for the next call of deflate(). - - Provide more output starting at next_out and update next_out and avail_out + - Generate more output starting at next_out and update next_out and avail_out accordingly. This action is forced if the parameter flush is non zero. Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). Some - output may be provided even if flush is not set. + should be set only when necessary. Some output may be provided even if + flush is zero. Before the call of deflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more @@ -271,7 +275,9 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output - buffer because there might be more output pending. + buffer because there might be more output pending. See deflatePending(), + which can be used if desired to determine whether or not there is more ouput + in that case. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to decide how much data to accumulate before producing output, in order to @@ -292,8 +298,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. This completes the current deflate block and follows it with an empty fixed codes block that is 10 bits long. This assures that enough bytes are output - in order for the decompressor to finish the block before the empty fixed code - block. + in order for the decompressor to finish the block before the empty fixed + codes block. If flush is set to Z_BLOCK, a deflate block is completed and emitted, as for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to @@ -319,34 +325,38 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was - enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the stream - are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least the - value returned by deflateBound (see below). Then deflate is guaranteed to - return Z_STREAM_END. If not enough output space is provided, deflate will - not return Z_STREAM_END, and it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). + enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this + function must be called again with Z_FINISH and more output space (updated + avail_out) but no more input data, until it returns with Z_STREAM_END or an + error. After deflate has returned Z_STREAM_END, the only possible operations + on the stream are deflateReset or deflateEnd. + + Z_FINISH can be used in the first deflate call after deflateInit if all the + compression is to be done in a single step. In order to complete in one + call, avail_out must be at least the value returned by deflateBound (see + below). Then deflate is guaranteed to return Z_STREAM_END. If not enough + output space is provided, deflate will not return Z_STREAM_END, and it must + be called again as described above. + + deflate() sets strm->adler to the Adler-32 checksum of all input read + so far (that is, total_in bytes). If a gzip stream is being generated, then + strm->adler will be the CRC-32 checksum of the input read so far. (See + deflateInit2 below.) deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered - binary. This field is only for information purposes and does not affect the - compression algorithm in any manner. + the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is + considered binary. This field is only for information purposes and does not + affect the compression algorithm in any manner. deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not - fatal, and deflate() can be called again with more input and more output - space to continue compressing. + if next_in or next_out was Z_NULL or the state was inadvertently written over + by the application), or Z_BUF_ERROR if no progress is possible (for example + avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and + deflate() can be called again with more input and more output space to + continue compressing. */ @@ -369,23 +379,21 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the - exact value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. + the caller. In the current version of inflate, the provided input is not + read or consumed. The allocation of a sliding window will be deferred to + the first call of inflate (if the decompression does not complete on the + first call). If zalloc and zfree are set to Z_NULL, inflateInit updates + them to use default allocation functions. inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller, or Z_STREAM_ERROR if the parameters are invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit() does not process any header information -- that is deferred - until inflate() is called. + there is no error message. inflateInit does not perform any decompression. + Actual decompression will be done by inflate(). So next_in, and avail_in, + next_out, and avail_out are unused and unchanged. The current + implementation of inflateInit() does not process any header information -- + that is deferred until inflate() is called. */ @@ -401,17 +409,20 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); - Decompress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing will - resume at this point for the next call of inflate(). + enough room in the output buffer), then next_in and avail_in are updated + accordingly, and processing will resume at this point for the next call of + inflate(). - - Provide more output starting at next_out and update next_out and avail_out + - Generate more output starting at next_out and update next_out and avail_out accordingly. inflate() provides as much output as possible, until there is no more input data or no more space in the output buffer (see below about the flush parameter). Before the call of inflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more - output, and updating the next_* and avail_* values accordingly. The + output, and updating the next_* and avail_* values accordingly. If the + caller of inflate() does not provide both available input and available + output space, it is possible that there will be no progress made. The application can consume the uncompressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of inflate(). If inflate returns Z_OK and with zero avail_out, it must be @@ -428,7 +439,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); gets to the end of that block, or when it runs out of data. The Z_BLOCK option assists in appending to or combining deflate streams. - Also to assist in this, on return inflate() will set strm->data_type to the + To assist in this, on return inflate() always sets strm->data_type to the number of unused bits in the last byte taken from strm->next_in, plus 64 if inflate() is currently decoding the last block in the deflate stream, plus 128 if inflate() returned immediately after decoding an end-of-block code or @@ -454,7 +465,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); this case all pending input is processed and all pending output is flushed; avail_out must be large enough to hold all of the uncompressed data for the operation to complete. (The size of the uncompressed data may have been - saved by the compressor for this purpose.) The use of Z_FINISH is not + saved by the compressor for this purpose.) The use of Z_FINISH is not required to perform an inflation in one step. However it may be used to inform inflate that a faster approach can be used for the single inflate() call. Z_FINISH also informs inflate to not maintain a sliding window if the @@ -476,32 +487,33 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the Adler-32 checksum of all output produced so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed adler32 + below. At the end of the stream, inflate() checks that its computed Adler-32 checksum is equal to that saved by the compressor and returns Z_STREAM_END only if the checksum is correct. inflate() can decompress and check either zlib-wrapped or gzip-wrapped deflate data. The header type is detected automatically, if requested when initializing with inflateInit2(). Any information contained in the gzip - header is not retained, so applications that need that information should - instead use raw inflate, see inflateInit2() below, or inflateBack() and - perform their own processing of the gzip header and trailer. When processing + header is not retained unless inflateGetHeader() is used. When processing gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output - producted so far. The CRC-32 is checked against the gzip trailer. + produced so far. The CRC-32 is checked against the gzip trailer, as is the + uncompressed length, modulo 2^32. inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect check - value), Z_STREAM_ERROR if the stream structure was inconsistent (for example - next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in the - output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + value, in which case strm->msg points to a string with a more specific + error), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL, or the state was inadvertently written over + by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR + if no progress was possible or if there was not enough room in the output + buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and inflate() can be called again with more input and more output space to continue decompressing. If Z_DATA_ERROR is returned, the application may then call inflateSync() to look for a good compression block if a partial - recovery of the data is desired. + recovery of the data is to be attempted. */ @@ -511,9 +523,8 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); This function discards any unprocessed input and does not flush any pending output. - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). + inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state + was inconsistent. */ @@ -544,16 +555,29 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. + For the current implementation of deflate(), a windowBits value of 8 (a + window size of 256 bytes) is not supported. As a result, a request for 8 + will result in 9 (a 512-byte window). In that case, providing 8 to + inflateInit2() will result in an error when the zlib header with 9 is + checked against the initialization of inflate(). The remedy is to not use 8 + with deflateInit2() with this initialization, or at least in that case use 9 + with inflateInit2(). + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute an adler32 check value. + with no zlib header or trailer, and will not compute a check value. windowBits can also be greater than 15 for optional gzip encoding. Add 16 to windowBits to write a simple gzip header and trailer around the compressed data instead of a zlib wrapper. The gzip header will have no file name, no extra data, no comment, no modification time (set to zero), no - header crc, and the operating system will be set to 255 (unknown). If a - gzip stream is being written, strm->adler is a crc32 instead of an adler32. + header crc, and the operating system will be set to the appropriate value, + if the operating system was determined at compile time. If a gzip stream is + being written, strm->adler is a CRC-32 instead of an Adler-32. + + For raw deflate or gzip encoding, a request for a 256-byte window is + rejected as invalid, since only the zlib header provides a means of + transmitting the window size to the decompressor. The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is @@ -614,12 +638,12 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, addition, the current implementation of deflate will use at most the window size minus 262 bytes of the provided dictionary. - Upon return of this function, strm->adler is set to the adler32 value + Upon return of this function, strm->adler is set to the Adler-32 value of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The adler32 value + which dictionary has been used by the compressor. (The Adler-32 value applies to the whole dictionary even if only a subset of the dictionary is actually used by the compressor.) If a raw deflate was requested, then the - adler32 value is not computed and strm->adler is not set. + Adler-32 value is not computed and strm->adler is not set. deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is @@ -628,6 +652,28 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, not perform any compression: this will be done by deflate(). */ +ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); +/* + Returns the sliding dictionary being maintained by deflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If deflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + deflateGetDictionary() may return a length less than the window size, even + when more than the window size in input has been provided. It may return up + to 258 bytes less in that case, due to how zlib's implementation of deflate + manages the sliding window and lookahead for matches, where matches can be + up to 258 bytes long. If the application needs the last window-size bytes of + input, then that would need to be saved by the application outside of zlib. + + deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, z_streamp source)); /* @@ -648,10 +694,10 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); /* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. The - stream will keep the same compression level and any other attributes that - may have been set by deflateInit2. + This function is equivalent to deflateEnd followed by deflateInit, but + does not free and reallocate the internal compression state. The stream + will leave the compression level and any other attributes that may have been + set unchanged. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). @@ -662,20 +708,36 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, int strategy)); /* Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be + interpretation of level and strategy is as in deflateInit2(). This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. - If the compression level is changed, the input available so far is - compressed with the old level (and may be flushed); the new level will take - effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to be - compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if - strm->avail_out was zero. + If the compression approach (which is a function of the level) or the + strategy is changed, and if any input has been consumed in a previous + deflate() call, then the input available so far is compressed with the old + level and strategy using deflate(strm, Z_BLOCK). There are three approaches + for the compression levels 0, 1..3, and 4..9 respectively. The new level + and strategy will take effect at the next call of deflate(). + + If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does + not have enough output space to complete, then the parameter change will not + take effect. In this case, deflateParams() can be called again with the + same parameters and more output space to try again. + + In order to assure a change in the parameters on the first try, the + deflate stream should be flushed using deflate() with Z_BLOCK or other flush + request until strm.avail_out is not zero, before calling deflateParams(). + Then no more input data should be provided before the deflateParams() call. + If this is done, the old level and strategy will be applied to the data + compressed before deflateParams(), and the new level and strategy will be + applied to the the data compressed after deflateParams(). + + deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream + state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if + there was not enough output space to complete the compression of the + available input data before a change in the strategy or approach. Note that + in the case of a Z_BUF_ERROR, the parameters are not changed. A return + value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be + retried with more output space. */ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, @@ -793,7 +855,7 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, is for use with other formats that use the deflate compressed data format such as zip. Those formats provide their own check values. If a custom format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an adler32 or a crc32 be applied to + recommended that a check value such as an Adler-32 or a CRC-32 be applied to the uncompressed data as is done in the zlib, gzip, and zip formats. For most applications, the zlib format should be used as is. Note that comments above on the use in deflateInit2() applies to the magnitude of windowBits. @@ -802,7 +864,10 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a - crc32 instead of an adler32. + CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see + below), inflate() will not automatically decode concatenated gzip streams. + inflate() will return Z_STREAM_END at the end of the gzip stream. The state + would need to be reset to continue decoding a subsequent gzip stream. inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the @@ -823,7 +888,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate, if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the adler32 value returned by that call of inflate. + can be determined from the Adler-32 value returned by that call of inflate. The compressor and decompressor must use exactly the same dictionary (see deflateSetDictionary). For raw inflate, this function can be called at any time to set the dictionary. If the provided dictionary is smaller than the @@ -834,7 +899,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect adler32 value). inflateSetDictionary does not + expected one (incorrect Adler-32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of inflate(). */ @@ -892,7 +957,7 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); /* This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. The + but does not free and reallocate the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source @@ -904,7 +969,9 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, /* This function is the same as inflateReset, but it also permits changing the wrap and window size requests. The windowBits parameter is interpreted - the same as it is for inflateInit2. + the same as it is for inflateInit2. If the window size is changed, then the + memory allocated for the window is freed, and the window will be reallocated + by inflate() if needed. inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL), or if @@ -956,7 +1023,7 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); location in the input stream can be determined from avail_in and data_type as noted in the description for the Z_BLOCK flush parameter for inflate. - inflateMark returns the value noted above or -1 << 16 if the provided + inflateMark returns the value noted above, or -65536 if the provided source stream state was inconsistent. */ @@ -1048,9 +1115,9 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, This routine would normally be used in a utility that reads zip or gzip files and writes out uncompressed files. The utility would decode the header and process the trailer on its own, hence this routine expects only - the raw deflate stream to decompress. This is different from the normal - behavior of inflate(), which expects either a zlib or gzip header and - trailer around the deflate stream. + the raw deflate stream to decompress. This is different from the default + behavior of inflate(), which expects a zlib header and trailer around the + deflate stream. inflateBack() uses two subroutines supplied by the caller that are then called by inflateBack() for input and output. inflateBack() calls those @@ -1059,12 +1126,12 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, parameters and return types are defined above in the in_func and out_func typedefs. inflateBack() will call in(in_desc, &buf) which should return the number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero--buf is ignored in that - case--and inflateBack() will return a buffer error. inflateBack() will call - out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() - should return zero on success, or non-zero on failure. If out() returns - non-zero, inflateBack() will return with an error. Neither in() nor out() - are permitted to change the contents of the window provided to + there is no input available, in() must return zero -- buf is ignored in that + case -- and inflateBack() will return a buffer error. inflateBack() will + call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. + out() should return zero on success, or non-zero on failure. If out() + returns non-zero, inflateBack() will return with an error. Neither in() nor + out() are permitted to change the contents of the window provided to inflateBackInit(), which is also the buffer that out() uses to write from. The length written by out() will be at most the window size. Any non-zero amount of input may be provided by in(). @@ -1092,7 +1159,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, using strm->next_in which will be Z_NULL only if in() returned an error. If strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning non-zero. (in() will always be called before out(), so strm->next_in is - assured to be defined if out() returns non-zero.) Note that inflateBack() + assured to be defined if out() returns non-zero.) Note that inflateBack() cannot return Z_OK. */ @@ -1114,7 +1181,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); 7.6: size of z_off_t Compiler, assembler, and debug options: - 8: DEBUG + 8: ZLIB_DEBUG 9: ASMV or ASMINF -- use ASM code 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention 11: 0 (reserved) @@ -1164,7 +1231,8 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. + compressed data. compress() is equivalent to compress2() with a level + parameter of Z_DEFAULT_COMPRESSION. compress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output @@ -1180,7 +1248,7 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. + compressed data. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, @@ -1203,7 +1271,7 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen - is the actual size of the uncompressed buffer. + is the actual size of the uncompressed data. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output @@ -1212,6 +1280,14 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, buffer with the uncompressed data up to that point. */ +ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong *sourceLen)); +/* + Same as uncompress, except that sourceLen is a pointer, where the + length of the source is *sourceLen. On return, *sourceLen is the number of + source bytes consumed. +*/ + /* gzip file access functions */ /* @@ -1290,10 +1366,9 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); default buffer size is 8192 bytes. This function must be called after gzopen() or gzdopen(), and before any other calls that read or write the file. The buffer memory allocation is always deferred to the first read or - write. Two buffers are allocated, either both of the specified size when - writing, or one of the specified size and the other twice that size when - reading. A larger buffer size of, for example, 64K or 128K bytes will - noticeably increase the speed of decompression (reading). + write. Three times that size in buffer space is allocated. A larger buffer + size of, for example, 64K or 128K bytes will noticeably increase the speed + of decompression (reading). The new buffer size also affects the maximum length for gzprintf(). @@ -1304,10 +1379,12 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. + of deflateInit2 for the meaning of these parameters. Previously provided + data is flushed before the parameter change. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. + gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not + opened for writing, Z_ERRNO if there is an error writing the flushed data, + or Z_MEM_ERROR if there is a memory allocation error. */ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); @@ -1335,7 +1412,35 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); case. gzread returns the number of uncompressed bytes actually read, less than - len for end of file, or -1 for error. + len for end of file, or -1 for error. If len is too large to fit in an int, + then nothing is read, -1 is returned, and the error state is set to + Z_STREAM_ERROR. +*/ + +ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, + gzFile file)); +/* + Read up to nitems items of size size from file to buf, otherwise operating + as gzread() does. This duplicates the interface of stdio's fread(), with + size_t request and return types. If the library defines size_t, then + z_size_t is identical to size_t. If not, then z_size_t is an unsigned + integer type that can contain a pointer. + + gzfread() returns the number of full items read of size size, or zero if + the end of the file was reached and a full item could not be read, or if + there was an error. gzerror() must be consulted if zero is returned in + order to determine if there was an error. If the multiplication of size and + nitems overflows, i.e. the product does not fit in a z_size_t, then nothing + is read, zero is returned, and the error state is set to Z_STREAM_ERROR. + + In the event that the end of file is reached and only a partial item is + available at the end, i.e. the remaining uncompressed data length is not a + multiple of size, then the final partial item is nevetheless read into buf + and the end-of-file flag is set. The length of the partial item read is not + provided, but could be inferred from the result of gztell(). This behavior + is the same as the behavior of fread() implementations in common libraries, + but it prevents the direct use of gzfread() to read a concurrently written + file, reseting and retrying on end-of-file, when size is not 1. */ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, @@ -1346,19 +1451,33 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, error. */ +ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, + z_size_t nitems, gzFile file)); +/* + gzfwrite() writes nitems items of size size from buf to file, duplicating + the interface of stdio's fwrite(), with size_t request and return types. If + the library defines size_t, then z_size_t is identical to size_t. If not, + then z_size_t is an unsigned integer type that can contain a pointer. + + gzfwrite() returns the number of full items written of size size, or zero + if there was an error. If the multiplication of size and nitems overflows, + i.e. the product does not fit in a z_size_t, then nothing is written, zero + is returned, and the error state is set to Z_STREAM_ERROR. +*/ + ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); /* Converts, formats, and writes the arguments to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written, or 0 in case of error. The number of - uncompressed bytes written is limited to 8191, or one less than the buffer - size given to gzbuffer(). The caller should assure that this limit is not - exceeded. If it is exceeded, then gzprintf() will return an error (0) with - nothing written. In this case, there may also be a buffer overflow with - unpredictable consequences, which is possible only if zlib was compiled with - the insecure functions sprintf() or vsprintf() because the secure snprintf() - or vsnprintf() functions were not available. This can be determined using - zlibCompileFlags(). + uncompressed bytes actually written, or a negative zlib error code in case + of error. The number of uncompressed bytes written is limited to 8191, or + one less than the buffer size given to gzbuffer(). The caller should assure + that this limit is not exceeded. If it is exceeded, then gzprintf() will + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. + This can be determined using zlibCompileFlags(). */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); @@ -1418,7 +1537,7 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); If the flush parameter is Z_FINISH, the remaining data is written and the gzip stream is completed in the output. If gzwrite() is called again, a new gzip stream will be started in the output. gzread() is able to read such - concatented gzip streams. + concatenated gzip streams. gzflush should be called only when strictly necessary because it will degrade compression if called too often. @@ -1572,7 +1691,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); return the updated checksum. If buf is Z_NULL, this function returns the required initial value for the checksum. - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed much faster. Usage example: @@ -1585,6 +1704,12 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); if (adler != original_adler) error(); */ +ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf, + z_size_t len)); +/* + Same as adler32(), but with a size_t length. +*/ + /* ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, z_off_t len2)); @@ -1614,6 +1739,12 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); if (crc != original_crc) error(); */ +ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, + z_size_t len)); +/* + Same as crc32(), but with a size_t length. +*/ + /* ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); @@ -1644,19 +1775,35 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, unsigned char FAR *window, const char *version, int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ - (int)sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, (int)sizeof(z_stream)) +#ifdef Z_PREFIX_SET +# define z_deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define z_inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#else +# define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#endif #ifndef Z_SOLO @@ -1676,10 +1823,10 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ #ifdef Z_PREFIX_SET # undef z_gzgetc # define z_gzgetc(g) \ - ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) #else # define gzgetc(g) \ - ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) #endif /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or @@ -1737,19 +1884,16 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ #endif /* !Z_SOLO */ -/* hack for buggy compilers */ -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; -#endif - /* undocumented functions */ ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); +ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); -#if defined(_WIN32) && !defined(Z_SOLO) +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, const char *mode)); #endif diff --git a/Modules/zlib/zlib.map b/Modules/zlib/zlib.map index 55c6647..40fa9db 100644 --- a/Modules/zlib/zlib.map +++ b/Modules/zlib/zlib.map @@ -1,83 +1,94 @@ -ZLIB_1.2.0 { - global: - compressBound; - deflateBound; - inflateBack; - inflateBackEnd; - inflateBackInit_; - inflateCopy; - local: - deflate_copyright; - inflate_copyright; - inflate_fast; - inflate_table; - zcalloc; - zcfree; - z_errmsg; - gz_error; - gz_intmax; - _*; -}; - -ZLIB_1.2.0.2 { - gzclearerr; - gzungetc; - zlibCompileFlags; -} ZLIB_1.2.0; - -ZLIB_1.2.0.8 { - deflatePrime; -} ZLIB_1.2.0.2; - -ZLIB_1.2.2 { - adler32_combine; - crc32_combine; - deflateSetHeader; - inflateGetHeader; -} ZLIB_1.2.0.8; - -ZLIB_1.2.2.3 { - deflateTune; - gzdirect; -} ZLIB_1.2.2; - -ZLIB_1.2.2.4 { - inflatePrime; -} ZLIB_1.2.2.3; - -ZLIB_1.2.3.3 { - adler32_combine64; - crc32_combine64; - gzopen64; - gzseek64; - gztell64; - inflateUndermine; -} ZLIB_1.2.2.4; - -ZLIB_1.2.3.4 { - inflateReset2; - inflateMark; -} ZLIB_1.2.3.3; - -ZLIB_1.2.3.5 { - gzbuffer; - gzoffset; - gzoffset64; - gzclose_r; - gzclose_w; -} ZLIB_1.2.3.4; - -ZLIB_1.2.5.1 { - deflatePending; -} ZLIB_1.2.3.5; - -ZLIB_1.2.5.2 { - deflateResetKeep; - gzgetc_; - inflateResetKeep; -} ZLIB_1.2.5.1; - -ZLIB_1.2.7.1 { - inflateGetDictionary; - gzvprintf; -} ZLIB_1.2.5.2; +ZLIB_1.2.0 { + global: + compressBound; + deflateBound; + inflateBack; + inflateBackEnd; + inflateBackInit_; + inflateCopy; + local: + deflate_copyright; + inflate_copyright; + inflate_fast; + inflate_table; + zcalloc; + zcfree; + z_errmsg; + gz_error; + gz_intmax; + _*; +}; + +ZLIB_1.2.0.2 { + gzclearerr; + gzungetc; + zlibCompileFlags; +} ZLIB_1.2.0; + +ZLIB_1.2.0.8 { + deflatePrime; +} ZLIB_1.2.0.2; + +ZLIB_1.2.2 { + adler32_combine; + crc32_combine; + deflateSetHeader; + inflateGetHeader; +} ZLIB_1.2.0.8; + +ZLIB_1.2.2.3 { + deflateTune; + gzdirect; +} ZLIB_1.2.2; + +ZLIB_1.2.2.4 { + inflatePrime; +} ZLIB_1.2.2.3; + +ZLIB_1.2.3.3 { + adler32_combine64; + crc32_combine64; + gzopen64; + gzseek64; + gztell64; + inflateUndermine; +} ZLIB_1.2.2.4; + +ZLIB_1.2.3.4 { + inflateReset2; + inflateMark; +} ZLIB_1.2.3.3; + +ZLIB_1.2.3.5 { + gzbuffer; + gzoffset; + gzoffset64; + gzclose_r; + gzclose_w; +} ZLIB_1.2.3.4; + +ZLIB_1.2.5.1 { + deflatePending; +} ZLIB_1.2.3.5; + +ZLIB_1.2.5.2 { + deflateResetKeep; + gzgetc_; + inflateResetKeep; +} ZLIB_1.2.5.1; + +ZLIB_1.2.7.1 { + inflateGetDictionary; + gzvprintf; +} ZLIB_1.2.5.2; + +ZLIB_1.2.9 { + inflateCodesUsed; + inflateValidate; + uncompress2; + gzfread; + gzfwrite; + deflateGetDictionary; + adler32_z; + crc32_z; +} ZLIB_1.2.7.1; diff --git a/Modules/zlib/zutil.c b/Modules/zlib/zutil.c index 23d2ebe..a76c6b0 100644 --- a/Modules/zlib/zutil.c +++ b/Modules/zlib/zutil.c @@ -1,5 +1,5 @@ /* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly. + * Copyright (C) 1995-2017 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -10,21 +10,18 @@ # include "gzguts.h" #endif -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - z_const char * const z_errmsg[10] = { -"need dictionary", /* Z_NEED_DICT 2 */ -"stream end", /* Z_STREAM_END 1 */ -"", /* Z_OK 0 */ -"file error", /* Z_ERRNO (-1) */ -"stream error", /* Z_STREAM_ERROR (-2) */ -"data error", /* Z_DATA_ERROR (-3) */ -"insufficient memory", /* Z_MEM_ERROR (-4) */ -"buffer error", /* Z_BUF_ERROR (-5) */ -"incompatible version",/* Z_VERSION_ERROR (-6) */ -""}; + (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */ + (z_const char *)"stream end", /* Z_STREAM_END 1 */ + (z_const char *)"", /* Z_OK 0 */ + (z_const char *)"file error", /* Z_ERRNO (-1) */ + (z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */ + (z_const char *)"data error", /* Z_DATA_ERROR (-3) */ + (z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */ + (z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */ + (z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */ + (z_const char *)"" +}; const char * ZEXPORT zlibVersion() @@ -61,7 +58,7 @@ uLong ZEXPORT zlibCompileFlags() case 8: flags += 2 << 6; break; default: flags += 3 << 6; } -#ifdef DEBUG +#ifdef ZLIB_DEBUG flags += 1 << 8; #endif #if defined(ASMV) || defined(ASMINF) @@ -115,8 +112,8 @@ uLong ZEXPORT zlibCompileFlags() return flags; } -#ifdef DEBUG - +#ifdef ZLIB_DEBUG +#include # ifndef verbose # define verbose 0 # endif @@ -219,9 +216,11 @@ local ptr_table table[MAX_PTR]; voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) { - voidpf buf = opaque; /* just to make some compilers happy */ + voidpf buf; ulg bsize = (ulg)items*size; + (void)opaque; + /* If we allocate less than 65520 bytes, we assume that farmalloc * will return a usable pointer which doesn't have to be normalized. */ @@ -244,6 +243,9 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) { int n; + + (void)opaque; + if (*(ush*)&ptr != 0) { /* object < 64K */ farfree(ptr); return; @@ -259,7 +261,6 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) next_ptr--; return; } - ptr = opaque; /* just to make some compilers happy */ Assert(0, "zcfree: ptr not found"); } @@ -278,13 +279,13 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) { - if (opaque) opaque = 0; /* to make compiler happy */ + (void)opaque; return _halloc((long)items, size); } void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) { - if (opaque) opaque = 0; /* to make compiler happy */ + (void)opaque; _hfree(ptr); } @@ -306,7 +307,7 @@ voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) unsigned items; unsigned size; { - if (opaque) items += size - size; /* make compiler happy */ + (void)opaque; return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : (voidpf)calloc(items, size); } @@ -315,8 +316,8 @@ void ZLIB_INTERNAL zcfree (opaque, ptr) voidpf opaque; voidpf ptr; { + (void)opaque; free(ptr); - if (opaque) return; /* make compiler happy */ } #endif /* MY_ZCALLOC */ diff --git a/Modules/zlib/zutil.h b/Modules/zlib/zutil.h index 24ab06b..b079ea6 100644 --- a/Modules/zlib/zutil.h +++ b/Modules/zlib/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2013 Jean-loup Gailly. + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -36,7 +36,9 @@ #ifndef local # define local static #endif -/* compile with -Dlocal if your debugger can't find static symbols */ +/* since "static" is used to mean two completely different things in C, we + define "local" for the non-static meaning of "static", for readability + (compile with -Dlocal if your debugger can't find static symbols) */ typedef unsigned char uch; typedef uch FAR uchf; @@ -98,28 +100,38 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #endif #ifdef AMIGA -# define OS_CODE 0x01 +# define OS_CODE 1 #endif #if defined(VAXC) || defined(VMS) -# define OS_CODE 0x02 +# define OS_CODE 2 # define F_OPEN(name, mode) \ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") #endif +#ifdef __370__ +# if __TARGET_LIB__ < 0x20000000 +# define OS_CODE 4 +# elif __TARGET_LIB__ < 0x40000000 +# define OS_CODE 11 +# else +# define OS_CODE 8 +# endif +#endif + #if defined(ATARI) || defined(atarist) -# define OS_CODE 0x05 +# define OS_CODE 5 #endif #ifdef OS2 -# define OS_CODE 0x06 +# define OS_CODE 6 # if defined(M_I86) && !defined(Z_SOLO) # include # endif #endif #if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 +# define OS_CODE 7 # ifndef Z_SOLO # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os # include /* for fdopen */ @@ -131,18 +143,24 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # endif #endif -#ifdef TOPS20 -# define OS_CODE 0x0a +#ifdef __acorn +# define OS_CODE 13 #endif -#ifdef WIN32 -# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ -# define OS_CODE 0x0b -# endif +#if defined(WIN32) && !defined(__CYGWIN__) +# define OS_CODE 10 +#endif + +#ifdef _BEOS_ +# define OS_CODE 16 +#endif + +#ifdef __TOS_OS400__ +# define OS_CODE 18 #endif -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0f +#ifdef __APPLE__ +# define OS_CODE 19 #endif #if defined(_BEOS_) || defined(RISCOS) @@ -177,7 +195,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* common defaults */ #ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ +# define OS_CODE 3 /* assume Unix */ #endif #ifndef F_OPEN @@ -216,7 +234,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #endif /* Diagnostic functions */ -#ifdef DEBUG +#ifdef ZLIB_DEBUG # include extern int ZLIB_INTERNAL z_verbose; extern void ZLIB_INTERNAL z_error OF((char *m)); diff --git a/Objects/abstract.c b/Objects/abstract.c index 88205bd..952552e 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2825,8 +2825,8 @@ _PySequence_BytesToCharpArray(PyObject* self) array[i] = NULL; goto fail; } - data = PyBytes_AsString(item); - if (data == NULL) { + /* check for embedded null bytes */ + if (PyBytes_AsStringAndSize(item, &data, NULL) < 0) { /* NULL terminate before freeing. */ array[i] = NULL; goto fail; diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 3fad6d8..85c6d1b 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -254,7 +254,7 @@ PyByteArray_Concat(PyObject *a, PyObject *b) if (PyObject_GetBuffer(a, &va, PyBUF_SIMPLE) != 0 || PyObject_GetBuffer(b, &vb, PyBUF_SIMPLE) != 0) { PyErr_Format(PyExc_TypeError, "can't concat %.100s to %.100s", - Py_TYPE(a)->tp_name, Py_TYPE(b)->tp_name); + Py_TYPE(b)->tp_name, Py_TYPE(a)->tp_name); goto done; } @@ -427,11 +427,11 @@ bytearray_subscript(PyByteArrayObject *self, PyObject *index) } else if (PySlice_Check(index)) { Py_ssize_t start, stop, step, slicelength, cur, i; - if (PySlice_GetIndicesEx(index, - PyByteArray_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { + if (PySlice_Unpack(index, &start, &stop, &step) < 0) { return NULL; } + slicelength = PySlice_AdjustIndices(PyByteArray_GET_SIZE(self), + &start, &stop, step); if (slicelength <= 0) return PyByteArray_FromStringAndSize("", 0); @@ -657,11 +657,11 @@ bytearray_ass_subscript(PyByteArrayObject *self, PyObject *index, PyObject *valu } } else if (PySlice_Check(index)) { - if (PySlice_GetIndicesEx(index, - PyByteArray_GET_SIZE(self), - &start, &stop, &step, &slicelen) < 0) { + if (PySlice_Unpack(index, &start, &stop, &step) < 0) { return -1; } + slicelen = PySlice_AdjustIndices(PyByteArray_GET_SIZE(self), &start, + &stop, step); } else { PyErr_Format(PyExc_TypeError, diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 673bb00..77dd45e 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -1272,7 +1272,7 @@ bytes_concat(PyObject *a, PyObject *b) if (PyObject_GetBuffer(a, &va, PyBUF_SIMPLE) != 0 || PyObject_GetBuffer(b, &vb, PyBUF_SIMPLE) != 0) { PyErr_Format(PyExc_TypeError, "can't concat %.100s to %.100s", - Py_TYPE(a)->tp_name, Py_TYPE(b)->tp_name); + Py_TYPE(b)->tp_name, Py_TYPE(a)->tp_name); goto done; } @@ -1534,11 +1534,11 @@ bytes_subscript(PyBytesObject* self, PyObject* item) char* result_buf; PyObject* result; - if (PySlice_GetIndicesEx(item, - PyBytes_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return NULL; } + slicelength = PySlice_AdjustIndices(PyBytes_GET_SIZE(self), &start, + &stop, step); if (slicelength <= 0) { return PyBytes_FromStringAndSize("", 0); diff --git a/Objects/codeobject.c b/Objects/codeobject.c index c334626..2f1bef2 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -521,7 +521,7 @@ _PyCode_ConstantKey(PyObject *op) PyTuple_SET_ITEM(tuple, i, item_key); } - key = PyTuple_Pack(3, Py_TYPE(op), op, tuple); + key = PyTuple_Pack(2, tuple, op); Py_DECREF(tuple); } else if (PyFrozenSet_CheckExact(op)) { @@ -555,7 +555,7 @@ _PyCode_ConstantKey(PyObject *op) if (set == NULL) return NULL; - key = PyTuple_Pack(3, Py_TYPE(op), op, set); + key = PyTuple_Pack(2, set, op); Py_DECREF(set); return key; } @@ -566,7 +566,7 @@ _PyCode_ConstantKey(PyObject *op) if (obj_id == NULL) return NULL; - key = PyTuple_Pack(3, Py_TYPE(op), op, obj_id); + key = PyTuple_Pack(2, obj_id, op); Py_DECREF(obj_id); } return key; diff --git a/Objects/complexobject.c b/Objects/complexobject.c index d82c5eb..606c101 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -1014,11 +1014,11 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } cr.real = PyFloat_AsDouble(tmp); - cr.imag = 0.0; /* Shut up compiler warning */ + cr.imag = 0.0; Py_DECREF(tmp); } if (i == NULL) { - ci.real = 0.0; + ci.real = cr.imag; } else if (PyComplex_Check(i)) { ci = ((PyComplexObject*)i)->cval; @@ -1040,7 +1040,7 @@ complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds) if (ci_is_complex) { cr.real -= ci.imag; } - if (cr_is_complex) { + if (cr_is_complex && i != NULL) { ci.real += cr.imag; } return complex_subtype_from_doubles(type, cr.real, ci.real); diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 747d218..ff77bee 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -429,7 +429,7 @@ Christian Tismer. lookdict() is general-purpose, and may return NULL if (and only if) a comparison raises an exception (this was new in Python 2.5). lookdict_unicode() below is specialized to string keys, comparison of which can -never raise an exception; that function can never return NULL. +never raise an exception; that function must not return NULL for string key. lookdict_unicode_nodummy is further specialized for string keys that cannot be the value. For both, when the key isn't found a PyDictEntry* is returned @@ -787,56 +787,61 @@ insertdict(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *value) PyDictKeyEntry *ep; assert(key != dummy); + Py_INCREF(key); + Py_INCREF(value); if (mp->ma_values != NULL && !PyUnicode_CheckExact(key)) { if (insertion_resize(mp) < 0) - return -1; + goto Fail; } ep = mp->ma_keys->dk_lookup(mp, key, hash, &value_addr); - if (ep == NULL) { - return -1; - } + if (ep == NULL) + goto Fail; + assert(PyUnicode_CheckExact(key) || mp->ma_keys->dk_lookup == lookdict); - Py_INCREF(value); MAINTAIN_TRACKING(mp, key, value); old_value = *value_addr; if (old_value != NULL) { assert(ep->me_key != NULL && ep->me_key != dummy); *value_addr = value; Py_DECREF(old_value); /* which **CAN** re-enter (see issue #22653) */ + Py_DECREF(key); } else { if (ep->me_key == NULL) { - Py_INCREF(key); if (mp->ma_keys->dk_usable <= 0) { /* Need to resize. */ - if (insertion_resize(mp) < 0) { - Py_DECREF(key); - Py_DECREF(value); - return -1; - } + if (insertion_resize(mp) < 0) + goto Fail; ep = find_empty_slot(mp, key, hash, &value_addr); } + mp->ma_used++; + *value_addr = value; mp->ma_keys->dk_usable--; assert(mp->ma_keys->dk_usable >= 0); ep->me_key = key; ep->me_hash = hash; + assert(ep->me_key != NULL && ep->me_key != dummy); } else { + mp->ma_used++; + *value_addr = value; if (ep->me_key == dummy) { - Py_INCREF(key); ep->me_key = key; ep->me_hash = hash; Py_DECREF(dummy); } else { assert(_PyDict_HasSplitTable(mp)); + Py_DECREF(key); } } - mp->ma_used++; - *value_addr = value; - assert(ep->me_key != NULL && ep->me_key != dummy); } return 0; + +Fail: + Py_DECREF(value); + Py_DECREF(key); + return -1; } /* @@ -1475,9 +1480,8 @@ _PyDict_Next(PyObject *op, Py_ssize_t *ppos, PyObject **pkey, /* Internal version of dict.pop(). */ PyObject * -_PyDict_Pop(PyDictObject *mp, PyObject *key, PyObject *deflt) +_PyDict_Pop_KnownHash(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *deflt) { - Py_hash_t hash; PyObject *old_value, *old_key; PyDictKeyEntry *ep; PyObject **value_addr; @@ -1490,12 +1494,6 @@ _PyDict_Pop(PyDictObject *mp, PyObject *key, PyObject *deflt) _PyErr_SetKeyError(key); return NULL; } - if (!PyUnicode_CheckExact(key) || - (hash = ((PyASCIIObject *) key)->hash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return NULL; - } ep = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr); if (ep == NULL) return NULL; @@ -1520,6 +1518,28 @@ _PyDict_Pop(PyDictObject *mp, PyObject *key, PyObject *deflt) return old_value; } +PyObject * +_PyDict_Pop(PyDictObject *mp, PyObject *key, PyObject *deflt) +{ + Py_hash_t hash; + + if (mp->ma_used == 0) { + if (deflt) { + Py_INCREF(deflt); + return deflt; + } + _PyErr_SetKeyError(key); + return NULL; + } + if (!PyUnicode_CheckExact(key) || + (hash = ((PyASCIIObject *) key)->hash) == -1) { + hash = PyObject_Hash(key); + if (hash == -1) + return NULL; + } + return _PyDict_Pop_KnownHash(mp, key, hash, deflt); +} + /* Internal version of dict.from_keys(). It is subclass-friendly. */ PyObject * _PyDict_FromKeys(PyObject *cls, PyObject *iterable, PyObject *value) @@ -2042,11 +2062,18 @@ PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override) /* Update/merge with this (key, value) pair. */ key = PySequence_Fast_GET_ITEM(fast, 0); value = PySequence_Fast_GET_ITEM(fast, 1); + Py_INCREF(key); + Py_INCREF(value); if (override || PyDict_GetItem(d, key) == NULL) { int status = PyDict_SetItem(d, key, value); - if (status < 0) + if (status < 0) { + Py_DECREF(key); + Py_DECREF(value); goto Fail; + } } + Py_DECREF(key); + Py_DECREF(value); Py_DECREF(fast); Py_DECREF(item); } @@ -2305,14 +2332,15 @@ dict_equal(PyDictObject *a, PyDictObject *b) bval = NULL; else bval = *vaddr; - Py_DECREF(key); if (bval == NULL) { + Py_DECREF(key); Py_DECREF(aval); if (PyErr_Occurred()) return -1; return 0; } cmp = PyObject_RichCompareBool(aval, bval, Py_EQ); + Py_DECREF(key); Py_DECREF(aval); if (cmp <= 0) /* error or not equal */ return cmp; @@ -3137,7 +3165,7 @@ PyTypeObject PyDictIterValue_Type = { static PyObject *dictiter_iternextitem(dictiterobject *di) { - PyObject *key, *value, *result = di->di_result; + PyObject *key, *value, *result; Py_ssize_t i, mask, offset; PyDictObject *d = di->di_dict; PyObject **value_ptr; @@ -3173,22 +3201,27 @@ static PyObject *dictiter_iternextitem(dictiterobject *di) if (i > mask) goto fail; - if (result->ob_refcnt == 1) { + di->len--; + key = d->ma_keys->dk_entries[i].me_key; + value = *value_ptr; + Py_INCREF(key); + Py_INCREF(value); + result = di->di_result; + if (Py_REFCNT(result) == 1) { + PyObject *oldkey = PyTuple_GET_ITEM(result, 0); + PyObject *oldvalue = PyTuple_GET_ITEM(result, 1); + PyTuple_SET_ITEM(result, 0, key); /* steals reference */ + PyTuple_SET_ITEM(result, 1, value); /* steals reference */ Py_INCREF(result); - Py_DECREF(PyTuple_GET_ITEM(result, 0)); - Py_DECREF(PyTuple_GET_ITEM(result, 1)); + Py_DECREF(oldkey); + Py_DECREF(oldvalue); } else { result = PyTuple_New(2); if (result == NULL) return NULL; + PyTuple_SET_ITEM(result, 0, key); /* steals reference */ + PyTuple_SET_ITEM(result, 1, value); /* steals reference */ } - di->len--; - key = d->ma_keys->dk_entries[i].me_key; - value = *value_ptr; - Py_INCREF(key); - Py_INCREF(value); - PyTuple_SET_ITEM(result, 0, key); /* steals reference */ - PyTuple_SET_ITEM(result, 1, value); /* steals reference */ return result; fail: @@ -3681,6 +3714,7 @@ dictitems_iter(_PyDictViewObject *dv) static int dictitems_contains(_PyDictViewObject *dv, PyObject *obj) { + int result; PyObject *key, *value, *found; if (dv->dv_dict == NULL) return 0; @@ -3694,7 +3728,10 @@ dictitems_contains(_PyDictViewObject *dv, PyObject *obj) return -1; return 0; } - return PyObject_RichCompareBool(value, found, Py_EQ); + Py_INCREF(found); + result = PyObject_RichCompareBool(value, found, Py_EQ); + Py_DECREF(found); + return result; } static PySequenceMethods dictitems_as_sequence = { @@ -3878,20 +3915,18 @@ _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, } if (value == NULL) { res = PyDict_DelItem(dict, key); - if (cached != ((PyDictObject *)dict)->ma_keys) { - CACHED_KEYS(tp) = NULL; - DK_DECREF(cached); - } } else { - int was_shared = cached == ((PyDictObject *)dict)->ma_keys; + int was_shared = (cached == ((PyDictObject *)dict)->ma_keys); res = PyDict_SetItem(dict, key, value); /* PyDict_SetItem() may call dictresize() and convert split table * into combined table. In such case, convert it to split * table again and update type's shared key only when this is * the only dict sharing key with the type. */ - if (was_shared && cached != ((PyDictObject *)dict)->ma_keys) { + if (was_shared && + (cached = CACHED_KEYS(tp)) != NULL && + cached != ((PyDictObject *)dict)->ma_keys) { if (cached->dk_refcnt == 1) { CACHED_KEYS(tp) = make_keys_shared(dict); } else { diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 981ead2..345a0fe 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -692,6 +692,53 @@ ImportError_str(PyImportErrorObject *self) } } +static PyObject * +ImportError_getstate(PyImportErrorObject *self) +{ + PyObject *dict = ((PyBaseExceptionObject *)self)->dict; + if (self->name || self->path) { + _Py_IDENTIFIER(name); + _Py_IDENTIFIER(path); + dict = dict ? PyDict_Copy(dict) : PyDict_New(); + if (dict == NULL) + return NULL; + if (self->name && _PyDict_SetItemId(dict, &PyId_name, self->name) < 0) { + Py_DECREF(dict); + return NULL; + } + if (self->path && _PyDict_SetItemId(dict, &PyId_path, self->path) < 0) { + Py_DECREF(dict); + return NULL; + } + return dict; + } + else if (dict) { + Py_INCREF(dict); + return dict; + } + else { + Py_RETURN_NONE; + } +} + +/* Pickling support */ +static PyObject * +ImportError_reduce(PyImportErrorObject *self) +{ + PyObject *res; + PyObject *args; + PyObject *state = ImportError_getstate(self); + if (state == NULL) + return NULL; + args = ((PyBaseExceptionObject *)self)->args; + if (state == Py_None) + res = PyTuple_Pack(2, Py_TYPE(self), args); + else + res = PyTuple_Pack(3, Py_TYPE(self), args, state); + Py_DECREF(state); + return res; +} + static PyMemberDef ImportError_members[] = { {"msg", T_OBJECT, offsetof(PyImportErrorObject, msg), 0, PyDoc_STR("exception message")}, @@ -703,6 +750,7 @@ static PyMemberDef ImportError_members[] = { }; static PyMethodDef ImportError_methods[] = { + {"__reduce__", (PyCFunction)ImportError_reduce, METH_NOARGS}, {NULL} }; diff --git a/Objects/genobject.c b/Objects/genobject.c index d403598..0de5408 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -466,8 +466,7 @@ _PyGen_SetStopIterationValue(PyObject *value) PyObject *e; if (value == NULL || - (!PyTuple_Check(value) && - !PyObject_TypeCheck(value, (PyTypeObject *) PyExc_StopIteration))) + (!PyTuple_Check(value) && !PyExceptionInstance_Check(value))) { /* Delay exception instantiation if we can */ PyErr_SetObject(PyExc_StopIteration, value); diff --git a/Objects/listobject.c b/Objects/listobject.c index 815a1b9..8100048 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2154,8 +2154,8 @@ listindex(PyListObject *self, PyObject *args) PyObject *v; if (!PyArg_ParseTuple(args, "O|O&O&:index", &v, - _PyEval_SliceIndex, &start, - _PyEval_SliceIndex, &stop)) + _PyEval_SliceIndexNotNone, &start, + _PyEval_SliceIndexNotNone, &stop)) return NULL; if (start < 0) { start += Py_SIZE(self); @@ -2421,10 +2421,11 @@ list_subscript(PyListObject* self, PyObject* item) PyObject* it; PyObject **src, **dest; - if (PySlice_GetIndicesEx(item, Py_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return NULL; } + slicelength = PySlice_AdjustIndices(Py_SIZE(self), &start, &stop, + step); if (slicelength <= 0) { return PyList_New(0); @@ -2470,10 +2471,11 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength; - if (PySlice_GetIndicesEx(item, Py_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return -1; } + slicelength = PySlice_AdjustIndices(Py_SIZE(self), &start, &stop, + step); if (step == 1) return list_ass_slice(self, start, stop, value); diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index e261ee0..45849be 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -2311,10 +2311,10 @@ init_slice(Py_buffer *base, PyObject *key, int dim) { Py_ssize_t start, stop, step, slicelength; - if (PySlice_GetIndicesEx(key, base->shape[dim], - &start, &stop, &step, &slicelength) < 0) { + if (PySlice_Unpack(key, &start, &stop, &step) < 0) { return -1; } + slicelength = PySlice_AdjustIndices(base->shape[dim], &start, &stop, step); if (base->suboffsets == NULL || dim == 0) { diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 7cc889f..9dd8421 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1176,7 +1176,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) _Py_AllocatedBlocks++; - assert(nelem <= PY_SSIZE_T_MAX / elsize); + assert(elsize == 0 || nelem <= PY_SSIZE_T_MAX / elsize); nbytes = nelem * elsize; #ifdef WITH_VALGRIND @@ -2233,7 +2233,9 @@ _PyObject_DebugMallocStats(FILE *out) if (p->ref.count == 0) { /* currently unused */ +#ifdef Py_DEBUG assert(pool_is_in_list(p, arenas[i].freepools)); +#endif continue; } ++numpools[sz]; diff --git a/Objects/odictobject.c b/Objects/odictobject.c index a6963d7..73deedf 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -2237,7 +2237,7 @@ odictvalues_new(PyObject *od) /* ---------------------------------------------- - MutableMappping implementations + MutableMapping implementations Mapping: diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index 899697a..f221fde 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -675,6 +675,25 @@ static PyMappingMethods range_as_mapping = { (objobjargproc)0, /* mp_ass_subscript */ }; +static int +range_bool(rangeobject* self) +{ + return PyObject_IsTrue(self->length); +} + +static PyNumberMethods range_as_number = { + 0, /* nb_add */ + 0, /* nb_subtract */ + 0, /* nb_multiply */ + 0, /* nb_remainder */ + 0, /* nb_divmod */ + 0, /* nb_power */ + 0, /* nb_negative */ + 0, /* nb_positive */ + 0, /* nb_absolute */ + (inquiry)range_bool, /* nb_bool */ +}; + static PyObject * range_iter(PyObject *seq); static PyObject * range_reverse(PyObject *seq); @@ -714,7 +733,7 @@ PyTypeObject PyRange_Type = { 0, /* tp_setattr */ 0, /* tp_reserved */ (reprfunc)range_repr, /* tp_repr */ - 0, /* tp_as_number */ + &range_as_number, /* tp_as_number */ &range_as_sequence, /* tp_as_sequence */ &range_as_mapping, /* tp_as_mapping */ (hashfunc)range_hash, /* tp_hash */ diff --git a/Objects/setobject.c b/Objects/setobject.c index 4ef692d..3dbdb4e 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -1498,15 +1498,21 @@ set_difference(PySetObject *so, PyObject *other) { PyObject *result; setentry *entry; - Py_ssize_t pos = 0; + Py_ssize_t pos = 0, other_size; - if (!PyAnySet_Check(other) && !PyDict_CheckExact(other)) { + if (PyAnySet_Check(other)) { + other_size = PySet_GET_SIZE(other); + } + else if (PyDict_CheckExact(other)) { + other_size = PyDict_Size(other); + } + else { return set_copy_and_difference(so, other); } /* If len(so) much more than len(other), it's more efficient to simply copy * so and then iterate other looking for common elements. */ - if ((PySet_GET_SIZE(so) >> 2) > PyObject_Size(other)) { + if ((PySet_GET_SIZE(so) >> 2) > other_size) { return set_copy_and_difference(so, other); } diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c index 2f32355..3259947 100644 --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -191,14 +191,13 @@ PySlice_GetIndices(PyObject *_r, Py_ssize_t length, } int -PySlice_GetIndicesEx(PyObject *_r, Py_ssize_t length, - Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, - Py_ssize_t *slicelength) +PySlice_Unpack(PyObject *_r, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) { PySliceObject *r = (PySliceObject*)_r; /* this is harder to get right than you might think */ - Py_ssize_t defstart, defstop; + assert(PY_SSIZE_T_MIN + 1 <= -PY_SSIZE_T_MAX); if (r->step == Py_None) { *step = 1; @@ -219,42 +218,75 @@ PySlice_GetIndicesEx(PyObject *_r, Py_ssize_t length, *step = -PY_SSIZE_T_MAX; } - defstart = *step < 0 ? length-1 : 0; - defstop = *step < 0 ? -1 : length; - if (r->start == Py_None) { - *start = defstart; + *start = *step < 0 ? PY_SSIZE_T_MAX : 0; } else { if (!_PyEval_SliceIndex(r->start, start)) return -1; - if (*start < 0) *start += length; - if (*start < 0) *start = (*step < 0) ? -1 : 0; - if (*start >= length) - *start = (*step < 0) ? length - 1 : length; } if (r->stop == Py_None) { - *stop = defstop; + *stop = *step < 0 ? PY_SSIZE_T_MIN : PY_SSIZE_T_MAX; } else { if (!_PyEval_SliceIndex(r->stop, stop)) return -1; - if (*stop < 0) *stop += length; - if (*stop < 0) *stop = (*step < 0) ? -1 : 0; - if (*stop >= length) - *stop = (*step < 0) ? length - 1 : length; } - if ((*step < 0 && *stop >= *start) - || (*step > 0 && *start >= *stop)) { - *slicelength = 0; + return 0; +} + +Py_ssize_t +PySlice_AdjustIndices(Py_ssize_t length, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step) +{ + /* this is harder to get right than you might think */ + + assert(step != 0); + assert(step >= -PY_SSIZE_T_MAX); + + if (*start < 0) { + *start += length; + if (*start < 0) { + *start = (step < 0) ? -1 : 0; + } + } + else if (*start >= length) { + *start = (step < 0) ? length - 1 : length; + } + + if (*stop < 0) { + *stop += length; + if (*stop < 0) { + *stop = (step < 0) ? -1 : 0; + } + } + else if (*stop >= length) { + *stop = (step < 0) ? length - 1 : length; } - else if (*step < 0) { - *slicelength = (*stop-*start+1)/(*step)+1; + + if (step < 0) { + if (*stop < *start) { + return (*start - *stop - 1) / (-step) + 1; + } } else { - *slicelength = (*stop-*start-1)/(*step)+1; + if (*start < *stop) { + return (*stop - *start - 1) / step + 1; + } } + return 0; +} + +#undef PySlice_GetIndicesEx +int +PySlice_GetIndicesEx(PyObject *_r, Py_ssize_t length, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, + Py_ssize_t *slicelength) +{ + if (PySlice_Unpack(_r, start, stop, step) < 0) + return -1; + *slicelength = PySlice_AdjustIndices(length, start, stop, *step); return 0; } diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 7920fec..19a6fed 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -515,8 +515,8 @@ tupleindex(PyTupleObject *self, PyObject *args) PyObject *v; if (!PyArg_ParseTuple(args, "O|O&O&:index", &v, - _PyEval_SliceIndex, &start, - _PyEval_SliceIndex, &stop)) + _PyEval_SliceIndexNotNone, &start, + _PyEval_SliceIndexNotNone, &stop)) return NULL; if (start < 0) { start += Py_SIZE(self); @@ -713,11 +713,11 @@ tuplesubscript(PyTupleObject* self, PyObject* item) PyObject* it; PyObject **src, **dest; - if (PySlice_GetIndicesEx(item, - PyTuple_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return NULL; } + slicelength = PySlice_AdjustIndices(PyTuple_GET_SIZE(self), &start, + &stop, step); if (slicelength <= 0) { return PyTuple_New(0); diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 7b76e5c..3f526b4 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3020,6 +3020,7 @@ type_getattro(PyTypeObject *type, PyObject *name) static int type_setattro(PyTypeObject *type, PyObject *name, PyObject *value) { + int res; if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { PyErr_Format( PyExc_TypeError, @@ -3027,9 +3028,35 @@ type_setattro(PyTypeObject *type, PyObject *name, PyObject *value) type->tp_name); return -1; } - if (PyObject_GenericSetAttr((PyObject *)type, name, value) < 0) - return -1; - return update_slot(type, name); + if (PyUnicode_Check(name)) { + if (PyUnicode_CheckExact(name)) { + if (PyUnicode_READY(name) == -1) + return -1; + Py_INCREF(name); + } + else { + name = _PyUnicode_Copy(name); + if (name == NULL) + return -1; + } + PyUnicode_InternInPlace(&name); + if (!PyUnicode_CHECK_INTERNED(name)) { + PyErr_SetString(PyExc_MemoryError, + "Out of memory interning an attribute name"); + Py_DECREF(name); + return -1; + } + } + else { + /* Will fail in _PyObject_GenericSetAttrWithDict. */ + Py_INCREF(name); + } + res = PyObject_GenericSetAttr((PyObject *)type, name, value); + if (res == 0) { + res = update_slot(type, name); + } + Py_DECREF(name); + return res; } extern void @@ -6849,7 +6876,7 @@ init_slotdefs(void) /* Slots must be ordered by their offset in the PyHeapTypeObject. */ assert(!p[1].name || p->offset <= p[1].offset); p->name_strobj = PyUnicode_InternFromString(p->name); - if (!p->name_strobj) + if (!p->name_strobj || !PyUnicode_CHECK_INTERNED(p->name_strobj)) Py_FatalError("Out of memory interning slotdef names"); } slotdefs_initialized = 1; @@ -6874,6 +6901,9 @@ update_slot(PyTypeObject *type, PyObject *name) slotdef **pp; int offset; + assert(PyUnicode_CheckExact(name)); + assert(PyUnicode_CHECK_INTERNED(name)); + /* Clear the VALID_VERSION flag of 'type' and all its subclasses. This could possibly be unified with the update_subclasses() recursion below, but carefully: @@ -6884,7 +6914,6 @@ update_slot(PyTypeObject *type, PyObject *name) init_slotdefs(); pp = ptrs; for (p = slotdefs; p->name; p++) { - /* XXX assume name is interned! */ if (p->name_strobj == name) *pp++ = p; } diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 5787830..571cd77 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -2839,6 +2839,37 @@ PyUnicode_AsWideCharString(PyObject *unicode, return buffer; } +wchar_t* +_PyUnicode_AsWideCharString(PyObject *unicode) +{ + const wchar_t *wstr; + wchar_t *buffer; + Py_ssize_t buflen; + + if (unicode == NULL) { + PyErr_BadInternalCall(); + return NULL; + } + + wstr = PyUnicode_AsUnicodeAndSize(unicode, &buflen); + if (wstr == NULL) { + return NULL; + } + if (wcslen(wstr) != (size_t)buflen) { + PyErr_SetString(PyExc_ValueError, + "embedded null character"); + return NULL; + } + + buffer = PyMem_NEW(wchar_t, buflen + 1); + if (buffer == NULL) { + PyErr_NoMemory(); + return NULL; + } + memcpy(buffer, wstr, (buflen + 1) * sizeof(wchar_t)); + return buffer; +} + #endif /* HAVE_WCHAR_H */ PyObject * @@ -3654,6 +3685,7 @@ PyUnicode_FSDecoder(PyObject* arg, void* addr) PyObject *output = NULL; if (arg == NULL) { Py_DECREF(*(PyObject**)addr); + *(PyObject**)addr = NULL; return 1; } if (PyUnicode_Check(arg)) { @@ -3862,6 +3894,20 @@ PyUnicode_AsUnicode(PyObject *unicode) return PyUnicode_AsUnicodeAndSize(unicode, NULL); } +const Py_UNICODE * +_PyUnicode_AsUnicode(PyObject *unicode) +{ + Py_ssize_t size; + const Py_UNICODE *wstr; + + wstr = PyUnicode_AsUnicodeAndSize(unicode, &size); + if (wstr && wcslen(wstr) != (size_t)size) { + PyErr_SetString(PyExc_ValueError, "embedded null character"); + return NULL; + } + return wstr; +} + Py_ssize_t PyUnicode_GetSize(PyObject *unicode) @@ -5163,13 +5209,12 @@ _PyUnicode_EncodeUTF32(PyObject *str, /* four bytes are reserved for each surrogate */ if (moreunits > 1) { Py_ssize_t outpos = out - (PY_UINT32_T*) PyBytes_AS_STRING(v); - Py_ssize_t morebytes = 4 * (moreunits - 1); - if (PyBytes_GET_SIZE(v) > PY_SSIZE_T_MAX - morebytes) { + if (moreunits >= (PY_SSIZE_T_MAX - PyBytes_GET_SIZE(v)) / 4) { /* integer overflow */ PyErr_NoMemory(); goto error; } - if (_PyBytes_Resize(&v, PyBytes_GET_SIZE(v) + morebytes) < 0) + if (_PyBytes_Resize(&v, PyBytes_GET_SIZE(v) + 4 * (moreunits - 1)) < 0) goto error; out = (PY_UINT32_T*) PyBytes_AS_STRING(v) + outpos; } @@ -5506,13 +5551,12 @@ _PyUnicode_EncodeUTF16(PyObject *str, /* two bytes are reserved for each surrogate */ if (moreunits > 1) { Py_ssize_t outpos = out - (unsigned short*) PyBytes_AS_STRING(v); - Py_ssize_t morebytes = 2 * (moreunits - 1); - if (PyBytes_GET_SIZE(v) > PY_SSIZE_T_MAX - morebytes) { + if (moreunits >= (PY_SSIZE_T_MAX - PyBytes_GET_SIZE(v)) / 2) { /* integer overflow */ PyErr_NoMemory(); goto error; } - if (_PyBytes_Resize(&v, PyBytes_GET_SIZE(v) + morebytes) < 0) + if (_PyBytes_Resize(&v, PyBytes_GET_SIZE(v) + 2 * (moreunits - 1)) < 0) goto error; out = (unsigned short*) PyBytes_AS_STRING(v) + outpos; } @@ -6204,6 +6248,10 @@ _PyUnicode_DecodeUnicodeInternal(const char *s, 1)) return NULL; + if (size < 0) { + PyErr_BadInternalCall(); + return NULL; + } if (size == 0) _Py_RETURN_UNICODE_EMPTY(); @@ -7006,6 +7054,10 @@ decode_code_page_stateful(int code_page, PyErr_SetString(PyExc_ValueError, "invalid code page number"); return NULL; } + if (size < 0) { + PyErr_BadInternalCall(); + return NULL; + } if (consumed) *consumed = 0; @@ -9752,7 +9804,7 @@ PyUnicode_Join(PyObject *separator, PyObject *seq) use_memcpy = 1; #endif for (i = 0; i < seqlen; i++) { - const Py_ssize_t old_sz = sz; + size_t add_sz; item = items[i]; if (!PyUnicode_Check(item)) { PyErr_Format(PyExc_TypeError, @@ -9763,16 +9815,18 @@ PyUnicode_Join(PyObject *separator, PyObject *seq) } if (PyUnicode_READY(item) == -1) goto onError; - sz += PyUnicode_GET_LENGTH(item); + add_sz = PyUnicode_GET_LENGTH(item); item_maxchar = PyUnicode_MAX_CHAR_VALUE(item); maxchar = Py_MAX(maxchar, item_maxchar); - if (i != 0) - sz += seplen; - if (sz < old_sz || sz > PY_SSIZE_T_MAX) { + if (i != 0) { + add_sz += seplen; + } + if (add_sz > (size_t)(PY_SSIZE_T_MAX - sz)) { PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); goto onError; } + sz += add_sz; if (use_memcpy && last_obj != NULL) { if (PyUnicode_KIND(last_obj) != PyUnicode_KIND(item)) use_memcpy = 0; @@ -10418,7 +10472,7 @@ replace(PyObject *self, PyObject *str1, u = unicode_empty; goto done; } - if (new_size > (PY_SSIZE_T_MAX >> (rkind-1))) { + if (new_size > (PY_SSIZE_T_MAX / rkind)) { PyErr_SetString(PyExc_OverflowError, "replace string is too long"); goto error; @@ -13802,10 +13856,11 @@ unicode_subscript(PyObject* self, PyObject* item) int src_kind, dest_kind; Py_UCS4 ch, max_char, kind_limit; - if (PySlice_GetIndicesEx(item, PyUnicode_GET_LENGTH(self), - &start, &stop, &step, &slicelength) < 0) { + if (PySlice_Unpack(item, &start, &stop, &step) < 0) { return NULL; } + slicelength = PySlice_AdjustIndices(PyUnicode_GET_LENGTH(self), + &start, &stop, step); if (slicelength <= 0) { _Py_RETURN_UNICODE_EMPTY(); diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c index 7e6f364..892798a 100644 --- a/Objects/weakrefobject.c +++ b/Objects/weakrefobject.c @@ -24,6 +24,8 @@ init_weakref(PyWeakReference *self, PyObject *ob, PyObject *callback) { self->hash = -1; self->wr_object = ob; + self->wr_prev = NULL; + self->wr_next = NULL; Py_XINCREF(callback); self->wr_callback = callback; } diff --git a/PC/_msi.c b/PC/_msi.c index 9e7e36d..967b7fa 100644 --- a/PC/_msi.c +++ b/PC/_msi.c @@ -600,8 +600,12 @@ summary_setproperty(msiobj* si, PyObject *args) return NULL; if (PyUnicode_Check(data)) { + const WCHAR *value = _PyUnicode_AsUnicode(data); + if (value == NULL) { + return NULL; + } status = MsiSummaryInfoSetPropertyW(si->h, field, VT_LPSTR, - 0, NULL, PyUnicode_AsUnicode(data)); + 0, NULL, value); } else if (PyLong_CheckExact(data)) { long value = PyLong_AsLong(data); if (value == -1 && PyErr_Occurred()) { diff --git a/PC/bdist_wininst/bdist_wininst.vcxproj b/PC/bdist_wininst/bdist_wininst.vcxproj index 4dc5009..16213fb 100644 --- a/PC/bdist_wininst/bdist_wininst.vcxproj +++ b/PC/bdist_wininst/bdist_wininst.vcxproj @@ -1,104 +1,108 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C} - wininst - false - - - - - Application - false - NotSet - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PySourcePath)lib\distutils\command\ - false - wininst-$(VisualStudioVersion) - $(TargetName)-amd64 - .exe - - - - $(OutDir)wininst.tlb - - - MinSpace - $(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDebug - MultiThreaded - - - $(PySourcePath)PC\bdist_wininst;%(AdditionalIncludeDirectories) - - - comctl32.lib;imagehlp.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C} + wininst + false + + + + + Application + false + NotSet + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PySourcePath)lib\distutils\command\ + false + wininst-$(VisualStudioVersion) + wininst-14.0 + wininst-12.0 + wininst-11.0 + wininst-10.0 + $(TargetName)-amd64 + .exe + + + + $(OutDir)wininst.tlb + + + MinSpace + $(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + MultiThreadedDebug + MultiThreaded + + + $(PySourcePath)PC\bdist_wininst;%(AdditionalIncludeDirectories) + + + comctl32.lib;imagehlp.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PC/bdist_wininst/bdist_wininst.vcxproj.filters b/PC/bdist_wininst/bdist_wininst.vcxproj.filters index b4b6a4d..a47ac86 100644 --- a/PC/bdist_wininst/bdist_wininst.vcxproj.filters +++ b/PC/bdist_wininst/bdist_wininst.vcxproj.filters @@ -1,61 +1,61 @@ - - - - - {293b1092-03ad-4b7c-acb9-c4ab62e52f55} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {0edc0406-282f-4dbc-b60e-a867c34a2a31} - - - {ea0c0f0e-3b73-474e-a999-e9689d032ccc} - h;hpp;hxx;hm;inl - - - {0c77c1cf-3f87-4f87-bd86-b425211c2181} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - - - Source Files - - - Source Files - - - Source Files\zlib - - - Source Files\zlib - - - Source Files\zlib - - - Source Files\zlib - - - Source Files\zlib - - - Source Files\zlib - - - - - Header Files - - - - - Resource Files - - - - - Resource Files - - + + + + + {293b1092-03ad-4b7c-acb9-c4ab62e52f55} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {0edc0406-282f-4dbc-b60e-a867c34a2a31} + + + {ea0c0f0e-3b73-474e-a999-e9689d032ccc} + h;hpp;hxx;hm;inl + + + {0c77c1cf-3f87-4f87-bd86-b425211c2181} + ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + + + Source Files + + + Source Files + + + Source Files\zlib + + + Source Files\zlib + + + Source Files\zlib + + + Source Files\zlib + + + Source Files\zlib + + + Source Files\zlib + + + + + Header Files + + + + + Resource Files + + + + + Resource Files + + \ No newline at end of file diff --git a/PC/bdist_wininst/build.bat b/PC/bdist_wininst/build.bat index 25f565c..744267f 100644 --- a/PC/bdist_wininst/build.bat +++ b/PC/bdist_wininst/build.bat @@ -7,16 +7,13 @@ set PCBUILD=%~dp0..\..\PCBuild\ echo Building Lib\distutils\command\wininst-xx.0.exe -call "%PCBUILD%env.bat" x86 -if errorlevel 1 goto :eof +call "%PCBUILD%find_msbuild.bat" %MSBUILD% +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) -msbuild "%D%bdist_wininst.vcxproj" "/p:SolutionDir=%PCBUILD%\" /p:Configuration=Release /p:Platform=Win32 +%MSBUILD% "%D%bdist_wininst.vcxproj" "/p:SolutionDir=%PCBUILD%\" /p:Configuration=Release /p:Platform=Win32 if errorlevel 1 goto :eof echo Building Lib\distutils\command\wininst-xx.0-amd64.exe -call "%PCBUILD%env.bat" x86_amd64 -if errorlevel 1 goto :eof - -msbuild "%D%bdist_wininst.vcxproj" "/p:SolutionDir=%PCBUILD%\" /p:Configuration=Release /p:Platform=x64 +%MSBUILD% "%D%bdist_wininst.vcxproj" "/p:SolutionDir=%PCBUILD%\" /p:Configuration=Release /p:Platform=x64 diff --git a/PC/getpathp.c b/PC/getpathp.c index c7ddf1e..47a571e 100644 --- a/PC/getpathp.c +++ b/PC/getpathp.c @@ -133,7 +133,7 @@ exists(wchar_t *filename) may extend 'filename' by one character. */ static int -ismodule(wchar_t *filename, int update_filename) /* Is module -- check for .pyc/.pyo too */ +ismodule(wchar_t *filename, int update_filename) /* Is module -- check for .pyc too */ { int n; @@ -144,7 +144,7 @@ ismodule(wchar_t *filename, int update_filename) /* Is module -- check for .pyc/ n = wcsnlen_s(filename, MAXPATHLEN+1); if (n < MAXPATHLEN) { int exist = 0; - filename[n] = Py_OptimizeFlag ? L'o' : L'c'; + filename[n] = L'c'; filename[n + 1] = L'\0'; exist = exists(filename); if (!update_filename) diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index b0739d0..423afea 100644 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -111,7 +111,9 @@ msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes) int err; Py_BEGIN_ALLOW_THREADS + _Py_BEGIN_SUPPRESS_IPH err = _locking(fd, mode, nbytes); + _Py_END_SUPPRESS_IPH Py_END_ALLOW_THREADS if (err != 0) return PyErr_SetFromErrno(PyExc_IOError); @@ -138,7 +140,9 @@ static long msvcrt_setmode_impl(PyObject *module, int fd, int flags) /*[clinic end generated code: output=24a9be5ea07ccb9b input=76e7c01f6b137f75]*/ { + _Py_BEGIN_SUPPRESS_IPH flags = _setmode(fd, flags); + _Py_END_SUPPRESS_IPH if (flags == -1) PyErr_SetFromErrno(PyExc_IOError); @@ -165,7 +169,9 @@ msvcrt_open_osfhandle_impl(PyObject *module, Py_intptr_t handle, int flags) { int fd; + _Py_BEGIN_SUPPRESS_IPH fd = _open_osfhandle(handle, flags); + _Py_END_SUPPRESS_IPH if (fd == -1) PyErr_SetFromErrno(PyExc_IOError); @@ -189,16 +195,11 @@ msvcrt_get_osfhandle_impl(PyObject *module, int fd) { Py_intptr_t handle = -1; - if (!_PyVerify_fd(fd)) { - PyErr_SetFromErrno(PyExc_IOError); - } - else { _Py_BEGIN_SUPPRESS_IPH - handle = _get_osfhandle(fd); + handle = _get_osfhandle(fd); _Py_END_SUPPRESS_IPH - if (handle == -1) - PyErr_SetFromErrno(PyExc_IOError); - } + if (handle == -1) + PyErr_SetFromErrno(PyExc_IOError); return handle; } @@ -308,7 +309,9 @@ static PyObject * msvcrt_putch_impl(PyObject *module, char char_value) /*[clinic end generated code: output=92ec9b81012d8f60 input=ec078dd10cb054d6]*/ { + _Py_BEGIN_SUPPRESS_IPH _putch(char_value); + _Py_END_SUPPRESS_IPH Py_RETURN_NONE; } @@ -325,7 +328,9 @@ static PyObject * msvcrt_putwch_impl(PyObject *module, int unicode_char) /*[clinic end generated code: output=a3bd1a8951d28eee input=996ccd0bbcbac4c3]*/ { + _Py_BEGIN_SUPPRESS_IPH _putwch(unicode_char); + _Py_END_SUPPRESS_IPH Py_RETURN_NONE; } @@ -347,7 +352,13 @@ static PyObject * msvcrt_ungetch_impl(PyObject *module, char char_value) /*[clinic end generated code: output=c6942a0efa119000 input=22f07ee9001bbf0f]*/ { - if (_ungetch(char_value) == EOF) + int res; + + _Py_BEGIN_SUPPRESS_IPH + res = _ungetch(char_value); + _Py_END_SUPPRESS_IPH + + if (res == EOF) return PyErr_SetFromErrno(PyExc_IOError); Py_RETURN_NONE; } @@ -365,7 +376,13 @@ static PyObject * msvcrt_ungetwch_impl(PyObject *module, int unicode_char) /*[clinic end generated code: output=e63af05438b8ba3d input=83ec0492be04d564]*/ { - if (_ungetwch(unicode_char) == WEOF) + int res; + + _Py_BEGIN_SUPPRESS_IPH + res = _ungetwch(unicode_char); + _Py_END_SUPPRESS_IPH + + if (res == WEOF) return PyErr_SetFromErrno(PyExc_IOError); Py_RETURN_NONE; } @@ -387,7 +404,13 @@ static long msvcrt_CrtSetReportFile_impl(PyObject *module, int type, int file) /*[clinic end generated code: output=df291c7fe032eb68 input=bb8f721a604fcc45]*/ { - return (long)_CrtSetReportFile(type, (_HFILE)file); + long res; + + _Py_BEGIN_SUPPRESS_IPH + res = (long)_CrtSetReportFile(type, (_HFILE)file); + _Py_END_SUPPRESS_IPH + + return res; } /*[clinic input] @@ -408,7 +431,9 @@ msvcrt_CrtSetReportMode_impl(PyObject *module, int type, int mode) { int res; + _Py_BEGIN_SUPPRESS_IPH res = _CrtSetReportMode(type, mode); + _Py_END_SUPPRESS_IPH if (res == -1) PyErr_SetFromErrno(PyExc_IOError); return res; @@ -429,7 +454,13 @@ static long msvcrt_set_error_mode_impl(PyObject *module, int mode) /*[clinic end generated code: output=ac4a09040d8ac4e3 input=046fca59c0f20872]*/ { - return _set_error_mode(mode); + long res; + + _Py_BEGIN_SUPPRESS_IPH + res = _set_error_mode(mode); + _Py_END_SUPPRESS_IPH + + return res; } #endif /* _DEBUG */ @@ -448,7 +479,10 @@ msvcrt_SetErrorMode_impl(PyObject *module, unsigned int mode) { unsigned int res; + _Py_BEGIN_SUPPRESS_IPH res = SetErrorMode(mode); + _Py_END_SUPPRESS_IPH + return PyLong_FromUnsignedLong(res); } diff --git a/PC/python3.def b/PC/python3.def index d753049..200d6bb 100644 --- a/PC/python3.def +++ b/PC/python3.def @@ -527,10 +527,12 @@ EXPORTS PySet_Pop=python35.PySet_Pop PySet_Size=python35.PySet_Size PySet_Type=python35.PySet_Type DATA + PySlice_AdjustIndices=python35.PySlice_AdjustIndices PySlice_GetIndices=python35.PySlice_GetIndices PySlice_GetIndicesEx=python35.PySlice_GetIndicesEx PySlice_New=python35.PySlice_New PySlice_Type=python35.PySlice_Type DATA + PySlice_Unpack=python35.PySlice_Unpack PySortWrapper_Type=python35.PySortWrapper_Type DATA PyState_AddModule=python35.PyState_AddModule PyState_FindModule=python35.PyState_FindModule diff --git a/PC/readme.txt b/PC/readme.txt index 0a96d26..b796901 100644 --- a/PC/readme.txt +++ b/PC/readme.txt @@ -1,81 +1,81 @@ -Welcome to the "PC" subdirectory of the Python distribution -*********************************************************** - -This "PC" subdirectory contains complete project files to make -several older PC ports of Python, as well as all the PC-specific -Python source files. It should be located in the root of the -Python distribution, and there should be directories "Modules", -"Objects", "Python", etc. in the parent directory of this "PC" -subdirectory. Be sure to read the documentation in the Python -distribution. - -Python requires library files such as string.py to be available in -one or more library directories. The search path of libraries is -set up when Python starts. To see the current Python library search -path, start Python and enter "import sys" and "print sys.path". - -All PC ports use this scheme to try to set up a module search path: - - 1) The script location; the current directory without script. - 2) The PYTHONPATH variable, if set. - 3) For Win32 platforms (NT/95), paths specified in the Registry. - 4) Default directories lib, lib/win, lib/test, lib/tkinter; - these are searched relative to the environment variable - PYTHONHOME, if set, or relative to the executable and its - ancestors, if a landmark file (Lib/string.py) is found , - or the current directory (not useful). - 5) The directory containing the executable. - -The best installation strategy is to put the Python executable (and -DLL, for Win32 platforms) in some convenient directory such as -C:/python, and copy all library files and subdirectories (using XCOPY) -to C:/python/lib. Then you don't need to set PYTHONPATH. Otherwise, -set the environment variable PYTHONPATH to your Python search path. -For example, - set PYTHONPATH=.;d:\python\lib;d:\python\lib\win;d:\python\lib\dos-8x3 - -There are several add-in modules to build Python programs which use -the native Windows operating environment. The ports here just make -"QuickWin" and DOS Python versions which support a character-mode -(console) environment. Look in www.python.org for Tkinter, PythonWin, -WPY and wxPython. - -To make a Python port, start the Integrated Development Environment -(IDE) of your compiler, and read in the native "project file" -(or makefile) provided. This will enable you to change any source -files or build settings so you can make custom builds. - -pyconfig.h An important configuration file specific to PC's. - -config.c The list of C modules to include in the Python PC - version. Manually edit this file to add or - remove Python modules. - -testpy.py A Python test program. Run this to test your - Python port. It should produce copious output, - ending in a report on how many tests were OK, how many - failed, and how many were skipped. Don't worry about - skipped tests (these test unavailable optional features). - - -Additional files and subdirectories for 32-bit Windows -====================================================== - -python_nt.rc Resource compiler input for python15.dll. - -dl_nt.c - Additional sources used for 32-bit Windows features. - -getpathp.c Default sys.path calculations (for all PC platforms). - -dllbase_nt.txt A (manually maintained) list of base addresses for - various DLLs, to avoid run-time relocation. - - -Note for Windows 3.x and DOS users -================================== - -Neither Windows 3.x nor DOS is supported any more. The last Python -version that supported these was Python 1.5.2; the support files were -present in Python 2.0 but weren't updated, and it is not our intention -to support these platforms for Python 2.x. +Welcome to the "PC" subdirectory of the Python distribution +*********************************************************** + +This "PC" subdirectory contains complete project files to make +several older PC ports of Python, as well as all the PC-specific +Python source files. It should be located in the root of the +Python distribution, and there should be directories "Modules", +"Objects", "Python", etc. in the parent directory of this "PC" +subdirectory. Be sure to read the documentation in the Python +distribution. + +Python requires library files such as string.py to be available in +one or more library directories. The search path of libraries is +set up when Python starts. To see the current Python library search +path, start Python and enter "import sys" and "print sys.path". + +All PC ports use this scheme to try to set up a module search path: + + 1) The script location; the current directory without script. + 2) The PYTHONPATH variable, if set. + 3) For Win32 platforms (NT/95), paths specified in the Registry. + 4) Default directories lib, lib/win, lib/test, lib/tkinter; + these are searched relative to the environment variable + PYTHONHOME, if set, or relative to the executable and its + ancestors, if a landmark file (Lib/string.py) is found , + or the current directory (not useful). + 5) The directory containing the executable. + +The best installation strategy is to put the Python executable (and +DLL, for Win32 platforms) in some convenient directory such as +C:/python, and copy all library files and subdirectories (using XCOPY) +to C:/python/lib. Then you don't need to set PYTHONPATH. Otherwise, +set the environment variable PYTHONPATH to your Python search path. +For example, + set PYTHONPATH=.;d:\python\lib;d:\python\lib\win;d:\python\lib\dos-8x3 + +There are several add-in modules to build Python programs which use +the native Windows operating environment. The ports here just make +"QuickWin" and DOS Python versions which support a character-mode +(console) environment. Look in www.python.org for Tkinter, PythonWin, +WPY and wxPython. + +To make a Python port, start the Integrated Development Environment +(IDE) of your compiler, and read in the native "project file" +(or makefile) provided. This will enable you to change any source +files or build settings so you can make custom builds. + +pyconfig.h An important configuration file specific to PC's. + +config.c The list of C modules to include in the Python PC + version. Manually edit this file to add or + remove Python modules. + +testpy.py A Python test program. Run this to test your + Python port. It should produce copious output, + ending in a report on how many tests were OK, how many + failed, and how many were skipped. Don't worry about + skipped tests (these test unavailable optional features). + + +Additional files and subdirectories for 32-bit Windows +====================================================== + +python_nt.rc Resource compiler input for python15.dll. + +dl_nt.c + Additional sources used for 32-bit Windows features. + +getpathp.c Default sys.path calculations (for all PC platforms). + +dllbase_nt.txt A (manually maintained) list of base addresses for + various DLLs, to avoid run-time relocation. + + +Note for Windows 3.x and DOS users +================================== + +Neither Windows 3.x nor DOS is supported any more. The last Python +version that supported these was Python 1.5.2; the support files were +present in Python 2.0 but weren't updated, and it is not our intention +to support these platforms for Python 2.x. diff --git a/PCbuild/_bz2.vcxproj b/PCbuild/_bz2.vcxproj index 9efb0d9..f53634a 100644 --- a/PCbuild/_bz2.vcxproj +++ b/PCbuild/_bz2.vcxproj @@ -1,98 +1,98 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5} - bz2 - Win32Proj - - - - - DynamicLibrary - NotSet - - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(bz2Dir);%(AdditionalIncludeDirectories) - WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - - - 0x1D170000 - - - - - - - - - - - - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5} + bz2 + Win32Proj + + + + + DynamicLibrary + NotSet + + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + $(bz2Dir);%(AdditionalIncludeDirectories) + WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + + + 0x1D170000 + + + + + + + + + + + + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/_bz2.vcxproj.filters b/PCbuild/_bz2.vcxproj.filters index eac64dd..382f6b6 100644 --- a/PCbuild/_bz2.vcxproj.filters +++ b/PCbuild/_bz2.vcxproj.filters @@ -1,48 +1,48 @@ - - - - - {f53a859d-dad2-4d5b-ae41-f28d8b571f5a} - - - {7e0bed05-ae33-43b7-8797-656455bbb7f3} - - - {ed574b89-6983-4cdf-9f98-fe7048d9e89c} - - - - - Source Files - - - bzip2 1.0.6 Source Files - - - bzip2 1.0.6 Source Files - - - bzip2 1.0.6 Source Files - - - bzip2 1.0.6 Source Files - - - bzip2 1.0.6 Source Files - - - bzip2 1.0.6 Source Files - - - bzip2 1.0.6 Source Files - - - - - bzip2 1.0.6 Header Files - - - bzip2 1.0.6 Header Files - - - + + + + + {f53a859d-dad2-4d5b-ae41-f28d8b571f5a} + + + {7e0bed05-ae33-43b7-8797-656455bbb7f3} + + + {ed574b89-6983-4cdf-9f98-fe7048d9e89c} + + + + + Source Files + + + bzip2 1.0.6 Source Files + + + bzip2 1.0.6 Source Files + + + bzip2 1.0.6 Source Files + + + bzip2 1.0.6 Source Files + + + bzip2 1.0.6 Source Files + + + bzip2 1.0.6 Source Files + + + bzip2 1.0.6 Source Files + + + + + bzip2 1.0.6 Header Files + + + bzip2 1.0.6 Header Files + + + diff --git a/PCbuild/_ctypes.vcxproj b/PCbuild/_ctypes.vcxproj index 70bea45..0b2c00e 100644 --- a/PCbuild/_ctypes.vcxproj +++ b/PCbuild/_ctypes.vcxproj @@ -1,110 +1,110 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {0E9791DB-593A-465F-98BC-681011311618} - _ctypes - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - - - - ..\Modules\_ctypes\libffi_msvc;%(AdditionalIncludeDirectories) - - - 0x1D1A0000 - /EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions) - - - - - - - - - - - - - - - - - - - - - true - - - - - true - ml64 /nologo /c /Zi /Fo "$(IntDir)win64.obj" "%(FullPath)" - $(IntDir)win64.obj;%(Outputs) - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {0E9791DB-593A-465F-98BC-681011311618} + _ctypes + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + + + + ..\Modules\_ctypes\libffi_msvc;%(AdditionalIncludeDirectories) + + + 0x1D1A0000 + /EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions) + + + + + + + + + + + + + + + + + + + + + true + + + + + true + ml64 /nologo /c /Zi /Fo "$(IntDir)win64.obj" "%(FullPath)" + $(IntDir)win64.obj;%(Outputs) + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + + + + + \ No newline at end of file diff --git a/PCbuild/_ctypes.vcxproj.filters b/PCbuild/_ctypes.vcxproj.filters index 83d7a7b..0a2c4bf 100644 --- a/PCbuild/_ctypes.vcxproj.filters +++ b/PCbuild/_ctypes.vcxproj.filters @@ -1,65 +1,65 @@ - - - - - {806081ee-2af0-48d0-a83e-ee02a74baa0f} - - - {dbdea1f2-ad8b-44ca-b782-fcf65d91559b} - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - + + + + + {806081ee-2af0-48d0-a83e-ee02a74baa0f} + + + {dbdea1f2-ad8b-44ca-b782-fcf65d91559b} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_ctypes_test.vcxproj b/PCbuild/_ctypes_test.vcxproj index b62407f..06a9301 100644 --- a/PCbuild/_ctypes_test.vcxproj +++ b/PCbuild/_ctypes_test.vcxproj @@ -1,80 +1,80 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {9EC7190A-249F-4180-A900-548FDCF3055F} - _ctypes_test - Win32Proj - false - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {9EC7190A-249F-4180-A900-548FDCF3055F} + _ctypes_test + Win32Proj + false + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + + + + + \ No newline at end of file diff --git a/PCbuild/_ctypes_test.vcxproj.filters b/PCbuild/_ctypes_test.vcxproj.filters index c1e94ce..1a5a82b 100644 --- a/PCbuild/_ctypes_test.vcxproj.filters +++ b/PCbuild/_ctypes_test.vcxproj.filters @@ -1,21 +1,21 @@ - - - - - {8fd70119-5481-4e5d-b187-d0b14eb27e38} - - - {38abc486-e143-49dc-8cf0-8aefab0e0d3d} - - - - - Header Files - - - - - Source Files - - + + + + + {8fd70119-5481-4e5d-b187-d0b14eb27e38} + + + {38abc486-e143-49dc-8cf0-8aefab0e0d3d} + + + + + Header Files + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_decimal.vcxproj b/PCbuild/_decimal.vcxproj index 9c9c19a..d2868c8 100644 --- a/PCbuild/_decimal.vcxproj +++ b/PCbuild/_decimal.vcxproj @@ -1,127 +1,127 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {0E9791DB-593A-465F-98BC-681011311617} - _decimal - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - - - - _CRT_SECURE_NO_WARNINGS;MASM;%(PreprocessorDefinitions) - CONFIG_32;PPRO;%(PreprocessorDefinitions) - CONFIG_64;%(PreprocessorDefinitions) - ..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories) - - - 0x1D1A0000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - ml64 /nologo /c /Zi /Fo "$(IntDir)vcdiv64.obj" "%(FullPath)" - $(IntDir)vcdiv64.obj;%(Outputs) - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {0E9791DB-593A-465F-98BC-681011311617} + _decimal + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + + + + _CRT_SECURE_NO_WARNINGS;MASM;%(PreprocessorDefinitions) + CONFIG_32;PPRO;%(PreprocessorDefinitions) + CONFIG_64;%(PreprocessorDefinitions) + ..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories) + + + 0x1D1A0000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + ml64 /nologo /c /Zi /Fo "$(IntDir)vcdiv64.obj" "%(FullPath)" + $(IntDir)vcdiv64.obj;%(Outputs) + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + + + + + \ No newline at end of file diff --git a/PCbuild/_decimal.vcxproj.filters b/PCbuild/_decimal.vcxproj.filters index 7e19aa2..6f1d520 100644 --- a/PCbuild/_decimal.vcxproj.filters +++ b/PCbuild/_decimal.vcxproj.filters @@ -1,116 +1,116 @@ - - - - - {f35a78a6-3ef0-4e36-bd8b-afaef22fbb7c} - - - {138089f8-faba-494f-b6ed-051f31fbaf2d} - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - + + + + + {f35a78a6-3ef0-4e36-bd8b-afaef22fbb7c} + + + {138089f8-faba-494f-b6ed-051f31fbaf2d} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_elementtree.vcxproj b/PCbuild/_elementtree.vcxproj index 725b5a9..e7cdf57 100644 --- a/PCbuild/_elementtree.vcxproj +++ b/PCbuild/_elementtree.vcxproj @@ -1,106 +1,106 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {17E1E049-C309-4D79-843F-AE483C264AEA} - _elementtree - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - ..\Modules\expat;%(AdditionalIncludeDirectories) - XML_NS;XML_DTD;BYTEORDER=1234;XML_CONTEXT_BYTES=1024;USE_PYEXPAT_CAPI;XML_STATIC;HAVE_MEMMOVE;%(PreprocessorDefinitions) - - - 0x1D100000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - - \ No newline at end of file + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {17E1E049-C309-4D79-843F-AE483C264AEA} + _elementtree + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + ..\Modules\expat;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions) + + + 0x1D100000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + + diff --git a/PCbuild/_elementtree.vcxproj.filters b/PCbuild/_elementtree.vcxproj.filters index ee78295..acb722d 100644 --- a/PCbuild/_elementtree.vcxproj.filters +++ b/PCbuild/_elementtree.vcxproj.filters @@ -1,72 +1,72 @@ - - - - - {643d8607-d024-40fe-8583-1823c96430f0} - - - {7b5335ad-059f-486f-85e4-f4757e26a9bf} - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - + + + + + {643d8607-d024-40fe-8583-1823c96430f0} + + + {7b5335ad-059f-486f-85e4-f4757e26a9bf} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_freeze_importlib.vcxproj b/PCbuild/_freeze_importlib.vcxproj index f7714c0..5affff0 100644 --- a/PCbuild/_freeze_importlib.vcxproj +++ b/PCbuild/_freeze_importlib.vcxproj @@ -1,106 +1,106 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {19C0C13F-47CA-4432-AFF3-799A296A4DDC} - Win32Proj - _freeze_importlib - false - - - - - Application - Unicode - - - - - - - - - - - - _CONSOLE;%(PreprocessorDefinitions) - - - Console - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - true - true - false - true - false - - - - - - - - - - - - - <_OldContent Condition="Exists('$(PySourcePath)Python\importlib.h')">$([System.IO.File]::ReadAllText('$(PySourcePath)Python\importlib.h').Replace(` `, ` `)) - <_NewContent Condition="Exists('$(IntDir)importlib.g.h')">$([System.IO.File]::ReadAllText('$(IntDir)importlib.g.h').Replace(` `, ` `)) - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {19C0C13F-47CA-4432-AFF3-799A296A4DDC} + Win32Proj + _freeze_importlib + false + + + + + Application + Unicode + + + + + + + + + + + + _CONSOLE;%(PreprocessorDefinitions) + + + Console + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + true + true + false + true + false + + + + + + + + + + + + + <_OldContent Condition="Exists('$(PySourcePath)Python\importlib.h')">$([System.IO.File]::ReadAllText('$(PySourcePath)Python\importlib.h').Replace(` `, ` `)) + <_NewContent Condition="Exists('$(IntDir)importlib.g.h')">$([System.IO.File]::ReadAllText('$(IntDir)importlib.g.h').Replace(` `, ` `)) + + + + + + + + + + + + + diff --git a/PCbuild/_freeze_importlib.vcxproj.filters b/PCbuild/_freeze_importlib.vcxproj.filters index ccad053..80b7fa9 100644 --- a/PCbuild/_freeze_importlib.vcxproj.filters +++ b/PCbuild/_freeze_importlib.vcxproj.filters @@ -1,27 +1,27 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - - - Source Files - - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Source Files + + + diff --git a/PCbuild/_hashlib.vcxproj b/PCbuild/_hashlib.vcxproj index b1300cb..76862ea 100644 --- a/PCbuild/_hashlib.vcxproj +++ b/PCbuild/_hashlib.vcxproj @@ -1,93 +1,93 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {447F05A8-F581-4CAC-A466-5AC7936E207E} - _hashlib - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(opensslIncludeDir);%(AdditionalIncludeDirectories) - - - ws2_32.lib;$(OutDir)libeay$(PyDebugExt).lib;$(OutDir)ssleay$(PyDebugExt).lib;%(AdditionalDependencies) - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - {10615b24-73bf-4efa-93aa-236916321317} - false - - - {e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0} - false - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {447F05A8-F581-4CAC-A466-5AC7936E207E} + _hashlib + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + $(opensslIncludeDir);%(AdditionalIncludeDirectories) + + + ws2_32.lib;$(OutDir)libeay$(PyDebugExt).lib;$(OutDir)ssleay$(PyDebugExt).lib;%(AdditionalDependencies) + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + {10615b24-73bf-4efa-93aa-236916321317} + false + + + {e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0} + false + + + + + + diff --git a/PCbuild/_hashlib.vcxproj.filters b/PCbuild/_hashlib.vcxproj.filters index a9d993e..0f26370 100644 --- a/PCbuild/_hashlib.vcxproj.filters +++ b/PCbuild/_hashlib.vcxproj.filters @@ -1,13 +1,13 @@ - - - - - {cc45963d-bd25-4eb8-bdba-a5507090bca4} - - - - - Source Files - - + + + + + {cc45963d-bd25-4eb8-bdba-a5507090bca4} + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_lzma.vcxproj b/PCbuild/_lzma.vcxproj index 1f0696d..88c60df 100644 --- a/PCbuild/_lzma.vcxproj +++ b/PCbuild/_lzma.vcxproj @@ -1,88 +1,88 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {F9D71780-F393-11E0-BE50-0800200C9A66} - lzma - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(lzmaDir)include;%(AdditionalIncludeDirectories) - WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) - - - $(lzmaDir)\bin_i486\liblzma.a;%(AdditionalDependencies) - $(lzmaDir)\bin_x86-64\liblzma.a;%(AdditionalDependencies) - false - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {F9D71780-F393-11E0-BE50-0800200C9A66} + lzma + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + $(lzmaDir)include;%(AdditionalIncludeDirectories) + WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) + + + $(lzmaDir)\bin_i486\liblzma.a;%(AdditionalDependencies) + $(lzmaDir)\bin_x86-64\liblzma.a;%(AdditionalDependencies) + false + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/_lzma.vcxproj.filters b/PCbuild/_lzma.vcxproj.filters index 0c5ed74..bb0ae1f 100644 --- a/PCbuild/_lzma.vcxproj.filters +++ b/PCbuild/_lzma.vcxproj.filters @@ -1,13 +1,13 @@ - - - - - {53e68eda-39fc-4336-a658-dc5f5d598760} - - - - - Source Files - - + + + + + {53e68eda-39fc-4336-a658-dc5f5d598760} + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_msi.vcxproj b/PCbuild/_msi.vcxproj index 3895d45..b61a528 100644 --- a/PCbuild/_msi.vcxproj +++ b/PCbuild/_msi.vcxproj @@ -1,83 +1,83 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {31FFC478-7B4A-43E8-9954-8D03E2187E9C} - _msi - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - cabinet.lib;msi.lib;rpcrt4.lib;%(AdditionalDependencies) - 0x1D160000 - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {31FFC478-7B4A-43E8-9954-8D03E2187E9C} + _msi + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + cabinet.lib;msi.lib;rpcrt4.lib;%(AdditionalDependencies) + 0x1D160000 + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/_msi.vcxproj.filters b/PCbuild/_msi.vcxproj.filters index 7dec52d..a40f405 100644 --- a/PCbuild/_msi.vcxproj.filters +++ b/PCbuild/_msi.vcxproj.filters @@ -1,13 +1,13 @@ - - - - - {bdef7710-e433-4ac0-84e0-14f34454bd3e} - - - - - Source Files - - + + + + + {bdef7710-e433-4ac0-84e0-14f34454bd3e} + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_multiprocessing.vcxproj b/PCbuild/_multiprocessing.vcxproj index bb2bb41..0673f26 100644 --- a/PCbuild/_multiprocessing.vcxproj +++ b/PCbuild/_multiprocessing.vcxproj @@ -1,87 +1,87 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {9E48B300-37D1-11DD-8C41-005056C00008} - _multiprocessing - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - ws2_32.lib;%(AdditionalDependencies) - 0x1e1D0000 - - - - - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {9E48B300-37D1-11DD-8C41-005056C00008} + _multiprocessing + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + ws2_32.lib;%(AdditionalDependencies) + 0x1e1D0000 + + + + + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/_multiprocessing.vcxproj.filters b/PCbuild/_multiprocessing.vcxproj.filters index 78133ec..0b5291d 100644 --- a/PCbuild/_multiprocessing.vcxproj.filters +++ b/PCbuild/_multiprocessing.vcxproj.filters @@ -1,24 +1,24 @@ - - - - - {623c956c-1893-43d9-a7dc-96e4fef20f93} - - - {34615a62-f999-4659-83f5-19d17a644530} - - - - - Header Files - - - - - Source Files - - - Source Files - - + + + + + {623c956c-1893-43d9-a7dc-96e4fef20f93} + + + {34615a62-f999-4659-83f5-19d17a644530} + + + + + Header Files + + + + + Source Files + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_overlapped.vcxproj b/PCbuild/_overlapped.vcxproj index 8cf8a86..ce946a5 100644 --- a/PCbuild/_overlapped.vcxproj +++ b/PCbuild/_overlapped.vcxproj @@ -1,83 +1,83 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {EB6E69DD-04BF-4543-9B92-49FAABCEAC2E} - _overlapped - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - ws2_32.lib;%(AdditionalDependencies) - 0x1D110000 - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {EB6E69DD-04BF-4543-9B92-49FAABCEAC2E} + _overlapped + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + ws2_32.lib;%(AdditionalDependencies) + 0x1D110000 + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/_overlapped.vcxproj.filters b/PCbuild/_overlapped.vcxproj.filters index 78de895..5ed9a09 100644 --- a/PCbuild/_overlapped.vcxproj.filters +++ b/PCbuild/_overlapped.vcxproj.filters @@ -1,13 +1,13 @@ - - - - - {6f67c8db-7de7-4714-a967-2b0d4bc71f2e} - - - - - Source Files - - + + + + + {6f67c8db-7de7-4714-a967-2b0d4bc71f2e} + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_socket.vcxproj b/PCbuild/_socket.vcxproj index d5c4d1b..0c1d05a 100644 --- a/PCbuild/_socket.vcxproj +++ b/PCbuild/_socket.vcxproj @@ -1,86 +1,86 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {86937F53-C189-40EF-8CE8-8759D8E7D480} - _socket - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - ws2_32.lib;%(AdditionalDependencies) - 0x1e1D0000 - - - - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {86937F53-C189-40EF-8CE8-8759D8E7D480} + _socket + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + ws2_32.lib;%(AdditionalDependencies) + 0x1e1D0000 + + + + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/_socket.vcxproj.filters b/PCbuild/_socket.vcxproj.filters index 790ffa8..8fe3e6b 100644 --- a/PCbuild/_socket.vcxproj.filters +++ b/PCbuild/_socket.vcxproj.filters @@ -1,21 +1,21 @@ - - - - - {1452207f-707c-4e84-b532-307193a0fd85} - - - {1edfe0d0-7b9d-4dc8-a335-b21fef7cc77a} - - - - - Header Files - - - - - Source Files - - + + + + + {1452207f-707c-4e84-b532-307193a0fd85} + + + {1edfe0d0-7b9d-4dc8-a335-b21fef7cc77a} + + + + + Header Files + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_sqlite3.vcxproj b/PCbuild/_sqlite3.vcxproj index 5456bb5..39f7de8 100644 --- a/PCbuild/_sqlite3.vcxproj +++ b/PCbuild/_sqlite3.vcxproj @@ -1,109 +1,109 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {13CECB97-4119-4316-9D42-8534019A5A44} - _sqlite3 - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(sqlite3Dir);%(AdditionalIncludeDirectories) - MODULE_NAME="sqlite3";%(PreprocessorDefinitions) - - - 0x1e180000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - {a1a295e5-463c-437f-81ca-1f32367685da} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {13CECB97-4119-4316-9D42-8534019A5A44} + _sqlite3 + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + $(sqlite3Dir);%(AdditionalIncludeDirectories) + MODULE_NAME="sqlite3";%(PreprocessorDefinitions) + + + 0x1e180000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + {a1a295e5-463c-437f-81ca-1f32367685da} + false + + + + + \ No newline at end of file diff --git a/PCbuild/_sqlite3.vcxproj.filters b/PCbuild/_sqlite3.vcxproj.filters index dce77c9..269a798 100644 --- a/PCbuild/_sqlite3.vcxproj.filters +++ b/PCbuild/_sqlite3.vcxproj.filters @@ -1,69 +1,69 @@ - - - - - {dac8ab3b-ce16-4bef-bef9-76463a01f5c4} - - - {814b187d-44ad-4f2b-baa7-18ca8a8a6a77} - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - + + + + + {dac8ab3b-ce16-4bef-bef9-76463a01f5c4} + + + {814b187d-44ad-4f2b-baa7-18ca8a8a6a77} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj index d75ebd6..02f9812 100644 --- a/PCbuild/_ssl.vcxproj +++ b/PCbuild/_ssl.vcxproj @@ -1,97 +1,97 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {C6E20F84-3247-4AD6-B051-B073268F73BA} - _ssl - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(opensslIncludeDir);%(AdditionalIncludeDirectories) - - - ws2_32.lib;crypt32.lib;$(OutDir)libeay$(PyDebugExt).lib;$(OutDir)ssleay$(PyDebugExt).lib;%(AdditionalDependencies) - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - {e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0} - false - - - {10615b24-73bf-4efa-93aa-236916321317} - false - - - {86937f53-c189-40ef-8ce8-8759d8e7d480} - false - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {C6E20F84-3247-4AD6-B051-B073268F73BA} + _ssl + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + $(opensslIncludeDir);%(AdditionalIncludeDirectories) + + + ws2_32.lib;crypt32.lib;$(OutDir)libeay$(PyDebugExt).lib;$(OutDir)ssleay$(PyDebugExt).lib;%(AdditionalDependencies) + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + {e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0} + false + + + {10615b24-73bf-4efa-93aa-236916321317} + false + + + {86937f53-c189-40ef-8ce8-8759d8e7d480} + false + + + + + + diff --git a/PCbuild/_ssl.vcxproj.filters b/PCbuild/_ssl.vcxproj.filters index 78b1459..7cd1b5d 100644 --- a/PCbuild/_ssl.vcxproj.filters +++ b/PCbuild/_ssl.vcxproj.filters @@ -1,13 +1,13 @@ - - - - - {695348f7-e9f6-4fe1-bc03-5f08ffc8095b} - - - - - Source Files - - + + + + + {695348f7-e9f6-4fe1-bc03-5f08ffc8095b} + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_testbuffer.vcxproj b/PCbuild/_testbuffer.vcxproj index 1f45b29..cdc4a9b 100644 --- a/PCbuild/_testbuffer.vcxproj +++ b/PCbuild/_testbuffer.vcxproj @@ -1,82 +1,82 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {A2697BD3-28C1-4AEC-9106-8B748639FD16} - _testbuffer - Win32Proj - false - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - - - - 0x1e1F0000 - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {A2697BD3-28C1-4AEC-9106-8B748639FD16} + _testbuffer + Win32Proj + false + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + + + + 0x1e1F0000 + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + + + + + \ No newline at end of file diff --git a/PCbuild/_testbuffer.vcxproj.filters b/PCbuild/_testbuffer.vcxproj.filters index eadf282..e3ff428 100644 --- a/PCbuild/_testbuffer.vcxproj.filters +++ b/PCbuild/_testbuffer.vcxproj.filters @@ -1,13 +1,13 @@ - - - - - {8d232240-921a-4bc2-87c3-93ffd3462f0a} - - - - - Source Files - - + + + + + {8d232240-921a-4bc2-87c3-93ffd3462f0a} + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_testcapi.vcxproj b/PCbuild/_testcapi.vcxproj index 365b07c..8d3d321 100644 --- a/PCbuild/_testcapi.vcxproj +++ b/PCbuild/_testcapi.vcxproj @@ -1,83 +1,83 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D} - _testcapi - Win32Proj - false - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - 0x1e1F0000 - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D} + _testcapi + Win32Proj + false + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + 0x1e1F0000 + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/_testcapi.vcxproj.filters b/PCbuild/_testcapi.vcxproj.filters index 7a6ad1a..04735f7 100644 --- a/PCbuild/_testcapi.vcxproj.filters +++ b/PCbuild/_testcapi.vcxproj.filters @@ -1,13 +1,13 @@ - - - - - {a76a90d8-8e8b-4c36-8f58-8bd46abe9f5e} - - - - - Source Files - - + + + + + {a76a90d8-8e8b-4c36-8f58-8bd46abe9f5e} + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_testembed.vcxproj b/PCbuild/_testembed.vcxproj index 14a926e..5f6fd6e 100644 --- a/PCbuild/_testembed.vcxproj +++ b/PCbuild/_testembed.vcxproj @@ -1,80 +1,80 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {6DAC66D9-E703-4624-BE03-49112AB5AA62} - Win32Proj - _testembed - false - - - - - Application - Unicode - - - - - - - - - - - - _CONSOLE;%(PreprocessorDefinitions) - - - Console - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {6DAC66D9-E703-4624-BE03-49112AB5AA62} + Win32Proj + _testembed + false + + + + + Application + Unicode + + + + + + + + + + + + _CONSOLE;%(PreprocessorDefinitions) + + + Console + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/_testembed.vcxproj.filters b/PCbuild/_testembed.vcxproj.filters index f7f9abe..5a1b9f4 100644 --- a/PCbuild/_testembed.vcxproj.filters +++ b/PCbuild/_testembed.vcxproj.filters @@ -1,22 +1,22 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_testimportmultiple.vcxproj b/PCbuild/_testimportmultiple.vcxproj index 37c1a64..531868a 100644 --- a/PCbuild/_testimportmultiple.vcxproj +++ b/PCbuild/_testimportmultiple.vcxproj @@ -1,83 +1,83 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {36D0C52C-DF4E-45D0-8BC7-E294C3ABC781} - _testimportmultiple - Win32Proj - false - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - 0x1e1F0000 - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {36D0C52C-DF4E-45D0-8BC7-E294C3ABC781} + _testimportmultiple + Win32Proj + false + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + 0x1e1F0000 + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + + diff --git a/PCbuild/_testimportmultiple.vcxproj.filters b/PCbuild/_testimportmultiple.vcxproj.filters index db0d0a6..42fa8cf 100644 --- a/PCbuild/_testimportmultiple.vcxproj.filters +++ b/PCbuild/_testimportmultiple.vcxproj.filters @@ -1,13 +1,13 @@ - - - - - {1ec38ad9-1abf-4b80-8628-ac43ccba324b} - - - - - Source Files - - - + + + + + {1ec38ad9-1abf-4b80-8628-ac43ccba324b} + + + + + Source Files + + + diff --git a/PCbuild/_testmultiphase.vcxproj b/PCbuild/_testmultiphase.vcxproj index 106927c..0245a72 100644 --- a/PCbuild/_testmultiphase.vcxproj +++ b/PCbuild/_testmultiphase.vcxproj @@ -1,83 +1,83 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {16BFE6F0-22EF-40B5-B831-7E937119EF10} - Win32Proj - _testmultiphase - false - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - - _CONSOLE;%(PreprocessorDefinitions) - - - Console - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {16BFE6F0-22EF-40B5-B831-7E937119EF10} + Win32Proj + _testmultiphase + false + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + + _CONSOLE;%(PreprocessorDefinitions) + + + Console + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/_testmultiphase.vcxproj.filters b/PCbuild/_testmultiphase.vcxproj.filters index 0c25101..f78f3ce 100644 --- a/PCbuild/_testmultiphase.vcxproj.filters +++ b/PCbuild/_testmultiphase.vcxproj.filters @@ -1,22 +1,22 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/_tkinter.vcxproj b/PCbuild/_tkinter.vcxproj index 6793106..9766115 100644 --- a/PCbuild/_tkinter.vcxproj +++ b/PCbuild/_tkinter.vcxproj @@ -1,94 +1,94 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF} - _tkinter - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(tcltkDir)include;%(AdditionalIncludeDirectories) - WITH_APPINIT;%(PreprocessorDefinitions) - Py_TCLTK_DIR="$(tcltkDir.TrimEnd('\').Replace('\', '\\'))";%(PreprocessorDefinitions) - - - $(tcltkLib);%(AdditionalDependencies) - - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - {b5fd6f1d-129e-4bff-9340-03606fac7283} - - - {7e85eccf-a72c-4da4-9e52-884508e80ba1} - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF} + _tkinter + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + $(tcltkDir)include;%(AdditionalIncludeDirectories) + WITH_APPINIT;%(PreprocessorDefinitions) + Py_TCLTK_DIR="$(tcltkDir.TrimEnd('\').Replace('\', '\\'))";%(PreprocessorDefinitions) + + + $(tcltkLib);%(AdditionalDependencies) + + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + {b5fd6f1d-129e-4bff-9340-03606fac7283} + + + {7e85eccf-a72c-4da4-9e52-884508e80ba1} + + + + + \ No newline at end of file diff --git a/PCbuild/_tkinter.vcxproj.filters b/PCbuild/_tkinter.vcxproj.filters index 4e5cd47..c63b5fe 100644 --- a/PCbuild/_tkinter.vcxproj.filters +++ b/PCbuild/_tkinter.vcxproj.filters @@ -1,16 +1,16 @@ - - - - - {b9ce64dd-cb95-472d-bbe8-5583b2cd375b} - - - - - Source Files - - - Source Files - - + + + + + {b9ce64dd-cb95-472d-bbe8-5583b2cd375b} + + + + + Source Files + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 9e63a84..bc3cf6c 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -48,7 +48,6 @@ exit /b 127 :Run setlocal set platf=Win32 -set vs_platf=x86 set conf=Release set target=Build set dir=%~dp0 @@ -57,10 +56,6 @@ set verbose=/nologo /v:m set kill= set do_pgo= set pgo_job=-m test --pgo -set on_64_bit=true - -rem This may not be 100% accurate, but close enough. -if "%ProgramFiles(x86)%"=="" (set on_64_bit=false) :CheckOpts if "%~1"=="-h" goto Usage @@ -90,27 +85,22 @@ if "%IncludeTkinter%"=="" set IncludeTkinter=true if "%IncludeExternals%"=="true" call "%dir%get_externals.bat" -if "%platf%"=="x64" ( - if "%on_64_bit%"=="true" ( - rem This ought to always be correct these days... - set vs_platf=amd64 - ) else ( - if "%do_pgo%"=="true" ( - echo.ERROR: Cannot cross-compile with PGO - echo. 32bit operating system detected, if this is incorrect, - echo. make sure the ProgramFiles(x86^) environment variable is set - exit /b 1 - ) - set vs_platf=x86_amd64 +if "%do_pgo%" EQU "true" if "%platf%" EQU "x64" ( + if "%PROCESSOR_ARCHITEW6432%" NEQ "AMD64" if "%PROCESSOR_ARCHITECTURE%" NEQ "AMD64" ( + echo.ERROR: Cannot cross-compile with PGO + echo. 32bit operating system detected. Ensure your PROCESSOR_ARCHITECTURE + echo. and PROCESSOR_ARCHITEW6432 environment variables are correct. + exit /b 1 ) ) -if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" -if exist "%HG%" set HGProperty=/p:HG="%HG%" -if not exist "%HG%" echo Cannot find Mercurial on PATH & set HGProperty= +if not exist "%GIT%" where git > "%TEMP%\git.loc" 2> nul && set /P GIT= < "%TEMP%\git.loc" & del "%TEMP%\git.loc" +if exist "%GIT%" set GITProperty=/p:GIT="%GIT%" +if not exist "%GIT%" echo Cannot find Git on PATH & set GITProperty= rem Setup the environment -call "%dir%env.bat" %vs_platf% >nul +call "%dir%find_msbuild.bat" %MSBUILD% +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) if "%kill%"=="true" call :Kill @@ -129,7 +119,7 @@ goto Build :Kill echo on -msbuild "%dir%\pythoncore.vcxproj" /t:KillPython %verbose%^ +%MSBUILD% "%dir%\pythoncore.vcxproj" /t:KillPython %verbose%^ /p:Configuration=%conf% /p:Platform=%platf%^ /p:KillPython=true @@ -141,11 +131,11 @@ rem Call on MSBuild to do the work, echo the command. rem Passing %1-9 is not the preferred option, but argument parsing in rem batch is, shall we say, "lackluster" echo on -msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose%^ +%MSBUILD% "%dir%pcbuild.proj" /t:%target% %parallel% %verbose%^ /p:Configuration=%conf% /p:Platform=%platf%^ /p:IncludeExternals=%IncludeExternals%^ /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^ - /p:UseTestMarker=%UseTestMarker% %HGProperty%^ + /p:UseTestMarker=%UseTestMarker% %GITProperty%^ %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off @@ -153,4 +143,4 @@ goto :eof :Version rem Display the current build version information -msbuild "%dir%python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9 +%MSBUILD% "%dir%python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/PCbuild/find_msbuild.bat b/PCbuild/find_msbuild.bat new file mode 100644 index 0000000..1a8bfa8 --- /dev/null +++ b/PCbuild/find_msbuild.bat @@ -0,0 +1,51 @@ +@rem +@rem Searches for MSBuild.exe. This is the only tool we need to initiate +@rem a build, so we no longer search for the full VC toolset. +@rem +@rem This file is supposed to modify the state of the caller (specifically +@rem the MSBUILD variable), so we do not use setlocal or echo, and avoid +@rem changing any other persistent state. +@rem + +@rem No arguments provided means do full search +@if '%1' EQU '' goto :begin_search + +@rem One argument may be the full path. Use a goto so we don't try to +@rem parse the next if statement - incorrect quoting in the multi-arg +@rem case can cause us to break immediately. +@if '%2' EQU '' goto :one_arg + +@rem Entire command line may represent the full path if quoting failed. +@if exist "%*" (set MSBUILD="%*") & (set _Py_MSBuild_Source=environment) & goto :found +@goto :begin_search + +:one_arg +@if exist "%~1" (set MSBUILD="%~1") & (set _Py_MSBuild_Source=environment) & goto :found + +:begin_search +@set MSBUILD= + +@rem If msbuild.exe is on the PATH, assume that the user wants that one. +@where msbuild > "%TEMP%\msbuild.loc" 2> nul && set /P MSBUILD= < "%TEMP%\msbuild.loc" & del "%TEMP%\msbuild.loc" +@if exist "%MSBUILD%" set MSBUILD="%MSBUILD%" & (set _Py_MSBuild_Source=PATH) & goto :found + +@rem VS 2017 sets exactly one install as the "main" install, so we may find MSBuild in there. +@reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32 >nul 2>nul +@if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32') DO @( + @if "%%i"=="15.0" @if exist "%%k\MSBuild\15.0\Bin\msbuild.exe" @(set MSBUILD="%%k\MSBuild\15.0\Bin\msbuild.exe") +) +@if exist %MSBUILD% (set _Py_MSBuild_Source=Visual Studio 2017 registry) & goto :found + +@rem VS 2015 and earlier register MSBuild separately, so we can find it. +@reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath /reg:32 >nul 2>nul +@if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath /reg:32') DO @( + @if "%%i"=="MSBuildToolsPath" @if exist "%%k\msbuild.exe" @(set MSBUILD="%%k\msbuild.exe") +) +@if exist %MSBUILD% (set _Py_MSBuild_Source=registry) & goto :found + + +@exit /b 1 + +:found +@echo Using %MSBUILD% (found in the %_Py_MSBuild_Source%) +@set _Py_MSBuild_Source= diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat index 1c3cdee..9cd1306 100644 --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -54,7 +54,7 @@ echo.Fetching external libraries... set libraries= set libraries=%libraries% bzip2-1.0.6 if NOT "%IncludeSSL%"=="false" set libraries=%libraries% nasm-2.11.06 -if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2j +if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2k set libraries=%libraries% sqlite-3.8.11.0 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-core-8.6.4.2 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.6.4.2 @@ -66,7 +66,7 @@ for %%e in (%libraries%) do ( echo.%%e already exists, skipping. ) else ( echo.Fetching %%e... - svn export %SVNROOT%%%e + svn export -q %SVNROOT%%%e ) ) diff --git a/PCbuild/libeay.vcxproj b/PCbuild/libeay.vcxproj index 9662cd4..cd59401 100644 --- a/PCbuild/libeay.vcxproj +++ b/PCbuild/libeay.vcxproj @@ -1,907 +1,907 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Debug - x64 - - - Release - x64 - - - - {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0} - libeay - - - - - - - StaticLibrary - - - - - - - - <_DATEValue>#define DATE "$([System.DateTime]::Now.ToString(`ddd MMM dd HH':'mm':'ss yyyy`))" - <_CFLAGSValue>#define CFLAGS "cl /MD /Ox -W3 -Gs0 -Gy -nologo @(PreprocessorDefinitions->'-D%(Identity)',' ')" - <_PLATFORMValue Condition="$(Platform)=='Win32'">#define PLATFORM "VC-WIN32" - <_PLATFORMValue Condition="$(Platform)=='x64'">#define PLATFORM "VC-WIN64A" - - - - - - - - - - - - $(IntDir);%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Debug + x64 + + + Release + x64 + + + + {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0} + libeay + + + + + + + StaticLibrary + + + + + + + + <_DATEValue>#define DATE "$([System.DateTime]::Now.ToString(`ddd MMM dd HH':'mm':'ss yyyy`))" + <_CFLAGSValue>#define CFLAGS "cl /MD /Ox -W3 -Gs0 -Gy -nologo @(PreprocessorDefinitions->'-D%(Identity)',' ')" + <_PLATFORMValue Condition="$(Platform)=='Win32'">#define PLATFORM "VC-WIN32" + <_PLATFORMValue Condition="$(Platform)=='x64'">#define PLATFORM "VC-WIN64A" + + + + + + + + + + + + $(IntDir);%(AdditionalIncludeDirectories) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/openssl.props b/PCbuild/openssl.props index e35c0d9..66545ba 100644 --- a/PCbuild/openssl.props +++ b/PCbuild/openssl.props @@ -1,76 +1,76 @@ - - - - $(opensslDir)tmp\ - - - - - - StaticLibrary - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_PreprocessorDefinitionList>@(PreprocessorDefinitions) - - - - - - 4244;4267 - $(opensslDir);$(opensslIncludeDir);$(opensslDir)crypto;$(opensslDir)crypto\asn1;$(opensslDir)crypto\evp;$(opensslDir)crypto\modes - $(_PreprocessorDefinitionList);%(PreprocessorDefinitions) - - - - - - nasm.exe -f win32 - nasm.exe -f win64 -DNEAR -Ox -g - - - - - - - - - - - + + + + $(opensslDir)tmp\ + + + + + + StaticLibrary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_PreprocessorDefinitionList>@(PreprocessorDefinitions) + + + + + + 4244;4267 + $(opensslDir);$(opensslIncludeDir);$(opensslDir)crypto;$(opensslDir)crypto\asn1;$(opensslDir)crypto\evp;$(opensslDir)crypto\modes + $(_PreprocessorDefinitionList);%(PreprocessorDefinitions) + + + + + + nasm.exe -f win32 + nasm.exe -f win64 -DNEAR -Ox -g + + + + + + + + + + + diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj index c320434..2d24d46 100644 --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -1,122 +1,122 @@ - - - - {CC9B93A2-439D-4058-9D29-6DCF43774405} - Win32 - Release - true - true - true - true - true - - - - - $(Platform) - $(Configuration) - - Build - Clean - CleanAll - true - - - $(Platform) - $(Configuration) - - Build - Clean - CleanAll - true - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - false - - - - - false - - - - - - - - - - - - - - - - - - - - + + + + {CC9B93A2-439D-4058-9D29-6DCF43774405} + Win32 + Release + true + true + true + true + true + + + + + $(Platform) + $(Configuration) + + Build + Clean + CleanAll + true + + + $(Platform) + $(Configuration) + + Build + Clean + CleanAll + true + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + false + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/pyexpat.vcxproj b/PCbuild/pyexpat.vcxproj index 99c7286..5e28748 100644 --- a/PCbuild/pyexpat.vcxproj +++ b/PCbuild/pyexpat.vcxproj @@ -1,87 +1,87 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - <_ProjectFileVersion>10.0.30319.1 - {D06B6426-4762-44CC-8BAD-D79052507F2F} - pyexpat - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - - $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories) - PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_NS;XML_DTD;BYTEORDER=1234;XML_CONTEXT_BYTES=1024;XML_STATIC;HAVE_MEMMOVE;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + <_ProjectFileVersion>10.0.30319.1 + {D06B6426-4762-44CC-8BAD-D79052507F2F} + pyexpat + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + + $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/pyexpat.vcxproj.filters b/PCbuild/pyexpat.vcxproj.filters index abf362f..bfa04d5 100644 --- a/PCbuild/pyexpat.vcxproj.filters +++ b/PCbuild/pyexpat.vcxproj.filters @@ -1,33 +1,33 @@ - - - - - {ddae77a6-7ca0-4a1b-b71c-deea5f4025de} - - - {5af9d40c-fc46-4640-ad84-3d1dd34a71d7} - - - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - + + + + + {ddae77a6-7ca0-4a1b-b71c-deea5f4025de} + + + {5af9d40c-fc46-4640-ad84-3d1dd34a71d7} + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/pylauncher.vcxproj b/PCbuild/pylauncher.vcxproj index 2d4b5f6..298be3f 100644 --- a/PCbuild/pylauncher.vcxproj +++ b/PCbuild/pylauncher.vcxproj @@ -1,82 +1,82 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {7B2727B5-5A3F-40EE-A866-43A13CD31446} - pylauncher - py - false - - - - - Application - MultiByte - - - - - - ClCompile - - - - - - - - - _CONSOLE;%(PreprocessorDefinitions) - MultiThreaded - - - version.lib;%(AdditionalDependencies) - Console - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {7B2727B5-5A3F-40EE-A866-43A13CD31446} + pylauncher + py + false + + + + + Application + MultiByte + + + + + + ClCompile + + + + + + + + + _CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + + version.lib;%(AdditionalDependencies) + Console + + + + + + + + + + + + + + + diff --git a/PCbuild/pylauncher.vcxproj.filters b/PCbuild/pylauncher.vcxproj.filters index e4b23d2..05a93d0 100644 --- a/PCbuild/pylauncher.vcxproj.filters +++ b/PCbuild/pylauncher.vcxproj.filters @@ -1,32 +1,32 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - - - Resource Files - - - - - Resource Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Resource Files + + + + + Resource Files + + \ No newline at end of file diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props index d1ac998..3dc6490 100644 --- a/PCbuild/pyproject.props +++ b/PCbuild/pyproject.props @@ -1,162 +1,162 @@ - - - - <_ProjectFileVersion>10.0.30319.1 - 10.0 - $(BuildPath) - $(OutDir)\ - $(MSBuildThisFileDirectory)obj\ - $(Py_IntDir)\$(ArchName)_$(Configuration)\$(ProjectName)\ - $(Py_IntDir)\$(ArchName)_PGO\$(ProjectName)\ - $(ProjectName) - $(TargetName)$(PyDebugExt) - false - false - true - true - false - false - - - - <_DebugPreprocessorDefinition>NDEBUG; - <_DebugPreprocessorDefinition Condition="$(Configuration) == 'Debug'">_DEBUG; - <_PlatformPreprocessorDefinition>_WIN32; - <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64;_M_X64; - <_PydPreprocessorDefinition Condition="$(TargetExt) == '.pyd'">Py_BUILD_CORE_MODULE; - - - - $(PySourcePath)Include;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories) - WIN32;$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions) - - MaxSpeed - true - true - - MultiThreadedDLL - true - Level3 - ProgramDatabase - Default - true - true - NoExtensions - - - Disabled - false - MultiThreadedDebugDLL - - - Strict - - - $(OutDir);%(AdditionalLibraryDirectories) - true - $(OutDir)$(TargetName).pdb - Windows - true - true - true - LIBC;%(IgnoreSpecificDefaultLibraries) - MachineX86 - MachineX64 - $(OutDir)$(TargetName).pgd - UseLinkTimeCodeGeneration - PGInstrument - PGUpdate - - - true - true - true - - - $(PySourcePath)PC;$(PySourcePath)Include;$(IntDir);%(AdditionalIncludeDirectories) - $(_DebugPreprocessorDefinition)%(PreprocessorDefinitions) - 0x0409 - - - $(_DebugPreprocessorDefinition)%(PreprocessorDefinitions) - true - true - Win32 - X64 - $(IntDir) - $(MSBuildProjectName)_i.c - $(MSBuildProjectName)_p.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86\signtool.exe - $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86\signtool.exe - $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\signtool.exe - <_SignCommand Condition="Exists($(SignToolPath))">"$(SignToolPath)" sign /q /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)" - - - - - - + + + + <_ProjectFileVersion>10.0.30319.1 + 10.0 + $(BuildPath) + $(OutDir)\ + $(MSBuildThisFileDirectory)obj\ + $(Py_IntDir)\$(ArchName)_$(Configuration)\$(ProjectName)\ + $(Py_IntDir)\$(ArchName)_PGO\$(ProjectName)\ + $(ProjectName) + $(TargetName)$(PyDebugExt) + false + false + true + true + false + false + + + + <_DebugPreprocessorDefinition>NDEBUG; + <_DebugPreprocessorDefinition Condition="$(Configuration) == 'Debug'">_DEBUG; + <_PlatformPreprocessorDefinition>_WIN32; + <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64;_M_X64; + <_PydPreprocessorDefinition Condition="$(TargetExt) == '.pyd'">Py_BUILD_CORE_MODULE; + + + + $(PySourcePath)Include;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories) + WIN32;$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions) + + MaxSpeed + true + true + + MultiThreadedDLL + true + Level3 + ProgramDatabase + Default + true + true + NoExtensions + + + Disabled + false + MultiThreadedDebugDLL + + + Strict + + + $(OutDir);%(AdditionalLibraryDirectories) + true + $(OutDir)$(TargetName).pdb + Windows + true + true + true + LIBC;%(IgnoreSpecificDefaultLibraries) + MachineX86 + MachineX64 + $(OutDir)$(TargetName).pgd + UseLinkTimeCodeGeneration + PGInstrument + PGUpdate + + + true + true + true + + + $(PySourcePath)PC;$(PySourcePath)Include;$(IntDir);%(AdditionalIncludeDirectories) + $(_DebugPreprocessorDefinition)%(PreprocessorDefinitions) + 0x0409 + + + $(_DebugPreprocessorDefinition)%(PreprocessorDefinitions) + true + true + Win32 + X64 + $(IntDir) + $(MSBuildProjectName)_i.c + $(MSBuildProjectName)_p.c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)\bin\x86\signtool.exe + $(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot)\bin\x86\signtool.exe + $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A@InstallationFolder)\Bin\signtool.exe + <_SignCommand Condition="Exists($(SignToolPath))">"$(SignToolPath)" sign /q /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "Python $(PythonVersion)" + + + + + + \ No newline at end of file diff --git a/PCbuild/pyshellext.vcxproj b/PCbuild/pyshellext.vcxproj index 0293935..b5b0d13 100644 --- a/PCbuild/pyshellext.vcxproj +++ b/PCbuild/pyshellext.vcxproj @@ -1,87 +1,87 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {0F6EE4A4-C75F-4578-B4B3-2D64F4B9B782} - pyshellext - pyshellext - false - - - - - DynamicLibrary - Unicode - - - - - - ClCompile - - - - - - - - - _CONSOLE;%(PreprocessorDefinitions) - - - version.lib;shlwapi.lib;%(AdditionalDependencies) - Console - ..\PC\pyshellext$(PyDebugExt).def - - - true - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {0F6EE4A4-C75F-4578-B4B3-2D64F4B9B782} + pyshellext + pyshellext + false + + + + + DynamicLibrary + Unicode + + + + + + ClCompile + + + + + + + + + _CONSOLE;%(PreprocessorDefinitions) + + + version.lib;shlwapi.lib;%(AdditionalDependencies) + Console + ..\PC\pyshellext$(PyDebugExt).def + + + true + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/pyshellext.vcxproj.filters b/PCbuild/pyshellext.vcxproj.filters index 648e499..d07e249 100644 --- a/PCbuild/pyshellext.vcxproj.filters +++ b/PCbuild/pyshellext.vcxproj.filters @@ -1,40 +1,40 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - - - Source Files - - - - - Resource Files - - - - - Source Files - - - Source Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Source Files + + + + + Resource Files + + + + + Source Files + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/python.props b/PCbuild/python.props index 1553731..1b42ad8 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -1,173 +1,173 @@ - - - - Win32 - Release - - v140 - v120 - v110 - v100 - - $(BasePlatformToolset) - false - true - - - amd64 - win32 - $(ArchName)-pgo - - - $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\)) - $(PySourcePath)\ - - - $(PySourcePath)PCBuild\win32\ - $(Py_OutDir)\win32\ - $(PySourcePath)PCBuild\amd64\ - $(Py_OutDir)\amd64\ - $(BuildPath32) - $(BuildPath64) - $(PySourcePath)PCBuild\$(ArchName)\ - $(BuildPath)\ - - - $([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`)) - $(ExternalsDir)sqlite-3.8.11.0\ - $(ExternalsDir)bzip2-1.0.6\ - $(ExternalsDir)xz-5.0.5\ - $(ExternalsDir)openssl-1.0.2j\ - $(opensslDir)include32 - $(opensslDir)include64 - $(ExternalsDir)\nasm-2.11.06\ - - - _d - - - -test - - - -32 - - - $(BuildPath)python$(PyDebugExt).exe - - - - - <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`)) - $([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value) - $([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value) - $([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value) - <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value) - $([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value) - 15 - 10 - 11 - 12 - a$(ReleaseSerial) - b$(ReleaseSerial) - rc$(ReleaseSerial) - - - - - $([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value) - $([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value) - $([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value) - $([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value) - <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value) - $([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value) - 0 - 15 - 10 - 11 - 12 - - - - $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber) - $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName) - $([msbuild]::BitwiseOr( - $([msbuild]::Multiply($(MajorVersionNumber), 16777216)), - $([msbuild]::BitwiseOr( - $([msbuild]::Multiply($(MinorVersionNumber), 65536)), - $([msbuild]::BitwiseOr( - $([msbuild]::Multiply($(MicroVersionNumber), 256)), - $([msbuild]::BitwiseOr( - $([msbuild]::Multiply($(ReleaseLevelNumber), 16)), - $(ReleaseSerial) - )) - )) - )) - )) - $([msbuild]::Add( - $(ReleaseSerial), - $([msbuild]::Add( - $([msbuild]::Multiply($(ReleaseLevelNumber), 10)), - $([msbuild]::Multiply($(MicroVersionNumber), 1000)) - )) - )) - $([msbuild]::Add($(Field3Value), 9000)) - - - python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt) - - - .cp$(MajorVersionNumber)$(MinorVersionNumber)-win32 - .cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64 - - - $(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt) - - - - - - - - - - - - + + + + Win32 + Release + + v140 + v120 + v110 + v100 + + $(BasePlatformToolset) + false + true + + + amd64 + win32 + $(ArchName)-pgo + + + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\)) + $(PySourcePath)\ + + + $(PySourcePath)PCBuild\win32\ + $(Py_OutDir)\win32\ + $(PySourcePath)PCBuild\amd64\ + $(Py_OutDir)\amd64\ + $(BuildPath32) + $(BuildPath64) + $(PySourcePath)PCBuild\$(ArchName)\ + $(BuildPath)\ + + + $([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`)) + $(ExternalsDir)sqlite-3.8.11.0\ + $(ExternalsDir)bzip2-1.0.6\ + $(ExternalsDir)xz-5.0.5\ + $(ExternalsDir)openssl-1.0.2k\ + $(opensslDir)include32 + $(opensslDir)include64 + $(ExternalsDir)\nasm-2.11.06\ + + + _d + + + -test + + + -32 + + + $(BuildPath)python$(PyDebugExt).exe + + + + + <_PatchLevelContent>$([System.IO.File]::ReadAllText(`$(PySourcePath)Include\patchlevel.h`)) + $([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MAJOR_VERSION\s+(\d+)`).Groups[1].Value) + $([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MINOR_VERSION\s+(\d+)`).Groups[1].Value) + $([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_MICRO_VERSION\s+(\d+)`).Groups[1].Value) + <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_LEVEL\s+PY_RELEASE_LEVEL_(\w+)`).Groups[1].Value) + $([System.Text.RegularExpressions.Regex]::Match($(_PatchLevelContent), `define\s+PY_RELEASE_SERIAL\s+(\d+)`).Groups[1].Value) + 15 + 10 + 11 + 12 + a$(ReleaseSerial) + b$(ReleaseSerial) + rc$(ReleaseSerial) + + + + + $([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[1].Value) + $([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[2].Value) + $([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[3].Value) + $([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[4].Value) + <_ReleaseLevel>$([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[5].Value) + $([System.Text.RegularExpressions.Regex]::Match($(OverrideVersion), `(\d+)\.(\d+)\.(\d+)((a|b|rc)(\d))?`).Groups[6].Value) + 0 + 15 + 10 + 11 + 12 + + + + $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber) + $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName) + $([msbuild]::BitwiseOr( + $([msbuild]::Multiply($(MajorVersionNumber), 16777216)), + $([msbuild]::BitwiseOr( + $([msbuild]::Multiply($(MinorVersionNumber), 65536)), + $([msbuild]::BitwiseOr( + $([msbuild]::Multiply($(MicroVersionNumber), 256)), + $([msbuild]::BitwiseOr( + $([msbuild]::Multiply($(ReleaseLevelNumber), 16)), + $(ReleaseSerial) + )) + )) + )) + )) + $([msbuild]::Add( + $(ReleaseSerial), + $([msbuild]::Add( + $([msbuild]::Multiply($(ReleaseLevelNumber), 10)), + $([msbuild]::Multiply($(MicroVersionNumber), 1000)) + )) + )) + $([msbuild]::Add($(Field3Value), 9000)) + + + python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt) + + + .cp$(MajorVersionNumber)$(MinorVersionNumber)-win32 + .cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64 + + + $(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt) + + + + + + + + + + + + diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj index 807213f..edbc3c5 100644 --- a/PCbuild/python.vcxproj +++ b/PCbuild/python.vcxproj @@ -1,112 +1,115 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} - - - - - Application - false - MultiByte - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - _CONSOLE;%(PreprocessorDefinitions) - - - Console - 2000000 - 0x1d000000 - - - - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - - - - ucrtbase - ucrtbased - - - - - - <_Content>@rem This script invokes the most recently built Python with all arguments -@rem passed through to the interpreter. This file is generated by the -@rem build process and any changes *will* be thrown away by the next -@rem rebuild. -@rem This is only meant as a convenience for developing CPython -@rem and using it outside of that context is ill-advised. -@echo Running $(Configuration)^|$(Platform) interpreter... -@setlocal -@set PYTHONHOME=$(PySourcePath) -@"$(OutDir)python$(PyDebugExt).exe" %* - - <_ExistingContent Condition="Exists('$(PySourcePath)python.bat')">$([System.IO.File]::ReadAllText('$(PySourcePath)python.bat')) - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} + + + + + Application + false + MultiByte + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + _CONSOLE;%(PreprocessorDefinitions) + + + Console + 2000000 + 0x1d000000 + + + + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + + + + ucrtbase + ucrtbased + + + + + + <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'Win32'">@set PATH=%PATH%%3B$(VCInstallDir)bin + <_PGOPath Condition="$(Configuration) == 'PGInstrument' and $(Platform) == 'x64'">@set PATH=%PATH%%3B$(VCInstallDir)bin\amd64 + <_Content>@rem This script invokes the most recently built Python with all arguments +@rem passed through to the interpreter. This file is generated by the +@rem build process and any changes *will* be thrown away by the next +@rem rebuild. +@rem This is only meant as a convenience for developing CPython +@rem and using it outside of that context is ill-advised. +@echo Running $(Configuration)^|$(Platform) interpreter... +@setlocal +@set PYTHONHOME=$(PySourcePath) +$(_PGOPath) +@"$(OutDir)python$(PyDebugExt).exe" %* + + <_ExistingContent Condition="Exists('$(PySourcePath)python.bat')">$([System.IO.File]::ReadAllText('$(PySourcePath)python.bat')) + + + \ No newline at end of file diff --git a/PCbuild/python.vcxproj.filters b/PCbuild/python.vcxproj.filters index 0662a4e..958eee0 100644 --- a/PCbuild/python.vcxproj.filters +++ b/PCbuild/python.vcxproj.filters @@ -1,26 +1,26 @@ - - - - - {2d690795-de83-4a33-8235-3c5dafe45efa} - - - {8b010a19-5b29-45f1-a8a0-f672e2bbb11a} - - - - - Resource Files - - - - - Resource Files - - - - - Source Files - - - + + + + + {2d690795-de83-4a33-8235-3c5dafe45efa} + + + {8b010a19-5b29-45f1-a8a0-f672e2bbb11a} + + + + + Resource Files + + + + + Resource Files + + + + + Source Files + + + diff --git a/PCbuild/python3dll.vcxproj b/PCbuild/python3dll.vcxproj index c66c8ef..125e071 100644 --- a/PCbuild/python3dll.vcxproj +++ b/PCbuild/python3dll.vcxproj @@ -1,137 +1,137 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {885D4898-D08D-4091-9C40-C700CFE3FC5A} - python3dll - Win32Proj - python3 - false - - - - - DynamicLibrary - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - <_Machine>X86 - <_Machine Condition="$(Platform) == 'x64'">X64 - $(ExtensionsToDeleteOnClean);$(IntDir)python3_d.def;$(IntDir)python3stub.def - - - - false - - - $(OutDir)$(TargetName)stub.lib - $(PySourcePath)PC\python3.def - $(IntDir)python3_d.def - DllMain - - - lib /nologo /def:"$(IntDir)python3stub.def" /out:"$(OutDir)$(TargetName)stub.lib" /MACHINE:$(_Machine) - Rebuilding $(TargetName)stub.lib - $(OutDir)$(TargetName)stub.lib - - - - - - - - - - - - - - - - - - <_DefLines Remove="@(_DefLines)" /> - <_Lines Remove="@(_Lines)" /> - - - - - - <_Pattern1>(=python$(MajorVersionNumber)$(MinorVersionNumber))\. - <_Sub1>$1_d. - <_Pattern2>"python3" - <_Sub2>"python3_d" - - - <_Lines Include="@(_DefLines)"> - $([System.Text.RegularExpressions.Regex]::Replace($([System.Text.RegularExpressions.Regex]::Replace(`%(Identity)`, `$(_Pattern1)`, `$(_Sub1)`)), `$(_Pattern2)`, `$(_Sub2)`)) - - - - - - - - - <_DefLines Remove="@(_DefLines)" /> - <_Lines Remove="@(_Lines)" /> - - - - - - <_Pattern>^[\w.]+=.+?\.([^ ]+).*$ - <_Sub>$1 - - - <_Lines Include="EXPORTS" /> - <_Symbols Include="@(_DefLines)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(`%(Identity)`, `$(_Pattern)`))"> - $([System.Text.RegularExpressions.Regex]::Replace(`%(Identity)`, `$(_Pattern)`, `$(_Sub)`)) - - <_Lines Include="@(_Symbols->'%(Symbol)')" /> - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {885D4898-D08D-4091-9C40-C700CFE3FC5A} + python3dll + Win32Proj + python3 + false + + + + + DynamicLibrary + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + <_Machine>X86 + <_Machine Condition="$(Platform) == 'x64'">X64 + $(ExtensionsToDeleteOnClean);$(IntDir)python3_d.def;$(IntDir)python3stub.def + + + + false + + + $(OutDir)$(TargetName)stub.lib + $(PySourcePath)PC\python3.def + $(IntDir)python3_d.def + DllMain + + + lib /nologo /def:"$(IntDir)python3stub.def" /out:"$(OutDir)$(TargetName)stub.lib" /MACHINE:$(_Machine) + Rebuilding $(TargetName)stub.lib + $(OutDir)$(TargetName)stub.lib + + + + + + + + + + + + + + + + + + <_DefLines Remove="@(_DefLines)" /> + <_Lines Remove="@(_Lines)" /> + + + + + + <_Pattern1>(=python$(MajorVersionNumber)$(MinorVersionNumber))\. + <_Sub1>$1_d. + <_Pattern2>"python3" + <_Sub2>"python3_d" + + + <_Lines Include="@(_DefLines)"> + $([System.Text.RegularExpressions.Regex]::Replace($([System.Text.RegularExpressions.Regex]::Replace(`%(Identity)`, `$(_Pattern1)`, `$(_Sub1)`)), `$(_Pattern2)`, `$(_Sub2)`)) + + + + + + + + + <_DefLines Remove="@(_DefLines)" /> + <_Lines Remove="@(_Lines)" /> + + + + + + <_Pattern>^[\w.]+=.+?\.([^ ]+).*$ + <_Sub>$1 + + + <_Lines Include="EXPORTS" /> + <_Symbols Include="@(_DefLines)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch(`%(Identity)`, `$(_Pattern)`))"> + $([System.Text.RegularExpressions.Regex]::Replace(`%(Identity)`, `$(_Pattern)`, `$(_Sub)`)) + + <_Lines Include="@(_Symbols->'%(Symbol)')" /> + + + + \ No newline at end of file diff --git a/PCbuild/python3dll.vcxproj.filters b/PCbuild/python3dll.vcxproj.filters index d250c45..ff48bea 100644 --- a/PCbuild/python3dll.vcxproj.filters +++ b/PCbuild/python3dll.vcxproj.filters @@ -1,32 +1,32 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - - - Source Files - - - - - Resource Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + + + Source Files + + + + + Resource Files + + \ No newline at end of file diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 970344f..ba26076 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -1,426 +1,427 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - pythoncore - - - - - DynamicLibrary - false - - - - - - true - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PyDllName) - - - Link - - - - /Zm200 %(AdditionalOptions) - $(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories) - _USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions) - - - version.lib;ws2_32.lib;%(AdditionalDependencies) - 0x1e000000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - hg - <_HG>$(HG) - <_HG Condition="$(HG.Contains(` `))">"$(HG)" - - - - - - - - $([System.IO.File]::ReadAllText('$(IntDir)hgbranch.txt').Trim()) - $([System.IO.File]::ReadAllText('$(IntDir)hgversion.txt').Trim()) - $([System.IO.File]::ReadAllText('$(IntDir)hgtag.txt').Trim()) - - - - HGVERSION="$(HgVersion)";HGTAG="$(HgTag)";HGBRANCH="$(HgBranch)";%(PreprocessorDefinitions) - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + pythoncore + + + + + DynamicLibrary + false + + + + + + true + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PyDllName) + + + Link + + + + /Zm200 %(AdditionalOptions) + $(PySourcePath)Python;$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories) + _USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions) + + + version.lib;ws2_32.lib;%(AdditionalDependencies) + 0x1e000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + git + <_GIT>$(GIT) + <_GIT Condition="$(GIT.Contains(` `))">"$(GIT)" + + + + + + + + $([System.IO.File]::ReadAllText('$(IntDir)gitbranch.txt').Trim()) + $([System.IO.File]::ReadAllText('$(IntDir)gitversion.txt').Trim()) + $([System.IO.File]::ReadAllText('$(IntDir)gittag.txt').Trim()) + + + + + GITVERSION="$(GitVersion)";GITTAG="$(GitTag)";GITBRANCH="$(GitBranch)";%(PreprocessorDefinitions) + + + + + + \ No newline at end of file diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index 837b736..478e354 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -1,983 +1,983 @@ - - - - - {086b0afb-270c-4603-a02a-63d46f0b2b92} - - - {8e81609f-13ca-4eae-9fdb-f8af20c710c7} - - - {8787c5bb-bab6-4586-a42e-4a27c7b3ffb6} - - - {5d6d2d6c-9e61-4a1d-b0b2-5cc2f446d69e} - - - {9f12c4b1-322e-431e-abf1-e02550f50032} - - - {ab29a558-143d-4fe7-a039-b431fb429856} - - - {97349fee-0abf-48b0-a8f5-771bf39b8aee} - - - {ea21fc98-de89-4746-a979-c5616964329a} - - - {f2696406-14bc-48bd-90c5-e93ab82a21ac} - - - {c3e03a5c-56c7-45fd-8543-e5d2326b907d} - - - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Include - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules\_io - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Parser - - - Parser - - - PC - - - PC - - - Python - - - Python - - - Python - - - Python - - - Include - - - Include - - - Modules - - - Include - - - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules - - - Modules\_io - - - Modules\_io - - - Modules\_io - - - Modules\_io - - - Modules\_io - - - Modules\_io - - - Modules\_io - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\zlib - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Modules\cjkcodecs - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Objects - - - Parser - - - Parser - - - Parser - - - Parser - - - Parser - - - Parser - - - Parser - - - Parser - - - Parser - - - Parser - - - Parser - - - Parser - - - PC - - - PC - - - PC - - - PC - - - PC - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - Python - - - PC - - - Modules - - - Python - - - Objects - - - Modules - - - Modules - - - Modules - - - PC - - - Objects - - - - - Resource Files - - + + + + + {086b0afb-270c-4603-a02a-63d46f0b2b92} + + + {8e81609f-13ca-4eae-9fdb-f8af20c710c7} + + + {8787c5bb-bab6-4586-a42e-4a27c7b3ffb6} + + + {5d6d2d6c-9e61-4a1d-b0b2-5cc2f446d69e} + + + {9f12c4b1-322e-431e-abf1-e02550f50032} + + + {ab29a558-143d-4fe7-a039-b431fb429856} + + + {97349fee-0abf-48b0-a8f5-771bf39b8aee} + + + {ea21fc98-de89-4746-a979-c5616964329a} + + + {f2696406-14bc-48bd-90c5-e93ab82a21ac} + + + {c3e03a5c-56c7-45fd-8543-e5d2326b907d} + + + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules\_io + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Parser + + + Parser + + + PC + + + PC + + + Python + + + Python + + + Python + + + Python + + + Include + + + Include + + + Modules + + + Include + + + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules + + + Modules\_io + + + Modules\_io + + + Modules\_io + + + Modules\_io + + + Modules\_io + + + Modules\_io + + + Modules\_io + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\zlib + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Modules\cjkcodecs + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Objects + + + Parser + + + Parser + + + Parser + + + Parser + + + Parser + + + Parser + + + Parser + + + Parser + + + Parser + + + Parser + + + Parser + + + Parser + + + PC + + + PC + + + PC + + + PC + + + PC + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + Python + + + PC + + + Modules + + + Python + + + Objects + + + Modules + + + Modules + + + Modules + + + PC + + + Objects + + + + + Resource Files + + \ No newline at end of file diff --git a/PCbuild/pythonw.vcxproj b/PCbuild/pythonw.vcxproj index caed1e8..11f7654 100644 --- a/PCbuild/pythonw.vcxproj +++ b/PCbuild/pythonw.vcxproj @@ -1,79 +1,79 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {F4229CC3-873C-49AE-9729-DD308ED4CD4A} - false - - - - - Application - false - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - 2000000 - 0x1d000000 - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {F4229CC3-873C-49AE-9729-DD308ED4CD4A} + false + + + + + Application + false + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + 2000000 + 0x1d000000 + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/pythonw.vcxproj.filters b/PCbuild/pythonw.vcxproj.filters index 259866f..6032117 100644 --- a/PCbuild/pythonw.vcxproj.filters +++ b/PCbuild/pythonw.vcxproj.filters @@ -1,21 +1,21 @@ - - - - - {0434cf11-a311-4a92-8a6c-4164aa79a7f2} - - - {e1d8ea6b-c65d-42f4-9eed-6010846ed378} - - - - - Resource Files - - - - - Source Files - - + + + + + {0434cf11-a311-4a92-8a6c-4164aa79a7f2} + + + {e1d8ea6b-c65d-42f4-9eed-6010846ed378} + + + + + Resource Files + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/pywlauncher.vcxproj b/PCbuild/pywlauncher.vcxproj index eabf883..e836ccc 100644 --- a/PCbuild/pywlauncher.vcxproj +++ b/PCbuild/pywlauncher.vcxproj @@ -1,82 +1,82 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {1D4B18D3-7C12-4ECB-9179-8531FF876CE6} - pywlauncher - pyw - false - - - - - Application - Unicode - - - - - - ClCompile - - - - - - - - - _WINDOWS;%(PreprocessorDefinitions) - MultiThreaded - - - version.lib;%(AdditionalDependencies) - Windows - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {1D4B18D3-7C12-4ECB-9179-8531FF876CE6} + pywlauncher + pyw + false + + + + + Application + Unicode + + + + + + ClCompile + + + + + + + + + _WINDOWS;%(PreprocessorDefinitions) + MultiThreaded + + + version.lib;%(AdditionalDependencies) + Windows + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/pywlauncher.vcxproj.filters b/PCbuild/pywlauncher.vcxproj.filters index e4b23d2..05a93d0 100644 --- a/PCbuild/pywlauncher.vcxproj.filters +++ b/PCbuild/pywlauncher.vcxproj.filters @@ -1,32 +1,32 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - - - Resource Files - - - - - Resource Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Resource Files + + + + + Resource Files + + \ No newline at end of file diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt index 2462012..6857925 100644 --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -169,7 +169,7 @@ _lzma Homepage: http://tukaani.org/xz/ _ssl - Python wrapper for version 1.0.2j of the OpenSSL secure sockets + Python wrapper for version 1.0.2k of the OpenSSL secure sockets library, which is built by ssl.vcxproj Homepage: http://www.openssl.org/ diff --git a/PCbuild/rmpyc.py b/PCbuild/rmpyc.py index a1e75bb..0b58f68 100644 --- a/PCbuild/rmpyc.py +++ b/PCbuild/rmpyc.py @@ -1,25 +1,19 @@ -# Remove all the .pyc and .pyo files under ../Lib. +# Remove all the .pyc files under ../Lib. def deltree(root): import os from os.path import join - npyc = npyo = 0 + npyc = 0 for root, dirs, files in os.walk(root): for name in files: - delete = False - if name.endswith('.pyc'): - delete = True + # to be thorough + if name.endswith(('.pyc', '.pyo')): npyc += 1 - elif name.endswith('.pyo'): - delete = True - npyo += 1 - - if delete: os.remove(join(root, name)) - return npyc, npyo + return npyc -npyc, npyo = deltree("../Lib") -print(npyc, ".pyc deleted,", npyo, ".pyo deleted") +npyc = deltree("../Lib") +print(npyc, ".pyc deleted") diff --git a/PCbuild/rt.bat b/PCbuild/rt.bat index 2d93b80..2056854 100644 --- a/PCbuild/rt.bat +++ b/PCbuild/rt.bat @@ -4,8 +4,8 @@ rem Usage: rt [-d] [-O] [-q] [-x64] regrtest_args rem -d Run Debug build (python_d.exe). Else release build. rem -O Run python.exe or python_d.exe (see -d) with -O. rem -q "quick" -- normally the tests are run twice, the first time -rem after deleting all the .py[co] files reachable from Lib/. -rem -q runs the tests just once, and without deleting .py[co] files. +rem after deleting all the .pyc files reachable from Lib/. +rem -q runs the tests just once, and without deleting .pyc files. rem -x64 Run the 64-bit build of python (or python_d if -d was specified) rem from the 'amd64' dir instead of the 32-bit build in this dir. rem All leading instances of these switches are shifted off, and @@ -45,14 +45,14 @@ set exe=%prefix%python%suffix%.exe set cmd="%exe%" %dashO% -Wd -E -bb "%pcbuild%..\lib\test\regrtest.py" %regrtestargs% if defined qmode goto Qmode -echo Deleting .pyc/.pyo files ... +echo Deleting .pyc files ... "%exe%" "%pcbuild%rmpyc.py" echo on %cmd% @echo off -echo About to run again without deleting .pyc/.pyo first: +echo About to run again without deleting .pyc first: pause :Qmode diff --git a/PCbuild/select.vcxproj b/PCbuild/select.vcxproj index d6112ab..8ac16b7 100644 --- a/PCbuild/select.vcxproj +++ b/PCbuild/select.vcxproj @@ -1,82 +1,82 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {18CAE28C-B454-46C1-87A0-493D91D97F03} - select - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - ws2_32.lib;%(AdditionalDependencies) - 0x1D110000 - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {18CAE28C-B454-46C1-87A0-493D91D97F03} + select + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + ws2_32.lib;%(AdditionalDependencies) + 0x1D110000 + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/select.vcxproj.filters b/PCbuild/select.vcxproj.filters index 55a2fc8..9a994e6 100644 --- a/PCbuild/select.vcxproj.filters +++ b/PCbuild/select.vcxproj.filters @@ -1,13 +1,13 @@ - - - - - {98346077-900c-4c7a-852f-a23470e37b40} - - - - - Source Files - - + + + + + {98346077-900c-4c7a-852f-a23470e37b40} + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/sqlite3.vcxproj b/PCbuild/sqlite3.vcxproj index c841c5a..d251367 100644 --- a/PCbuild/sqlite3.vcxproj +++ b/PCbuild/sqlite3.vcxproj @@ -1,89 +1,89 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {A1A295E5-463C-437F-81CA-1F32367685DA} - sqlite3 - .pyd - false - - - - - DynamicLibrary - NotSet - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - <_SqliteVersion>$([System.Text.RegularExpressions.Regex]::Match(`$(sqlite3Dir)`, `((\d+)\.(\d+)\.(\d+)\.(\d+))\\?$`).Groups) - $(_SqliteVersion.Split(`;`)[1]) - $(_SqliteVersion.Split(`;`)[2]) - $(_SqliteVersion.Split(`;`)[3]) - $(_SqliteVersion.Split(`;`)[4]) - $(_SqliteVersion.Split(`;`)[5]) - - - - $(sqlite3Dir);%(AdditionalIncludeDirectories) - SQLITE_API=__declspec(dllexport);%(PreprocessorDefinitions) - Level1 - - - SQLITE_VERSION=$(SqliteVersion);SQLITE_MAJOR_VERSION=$(SqliteMajorVersion);SQLITE_MINOR_VERSION=$(SqliteMinorVersion);SQLITE_MICRO_VERSION=$(SqliteMicroVersion);SQLITE_PATCH_VERSION=$(SqlitePatchVersion);%(PreprocessorDefinitions) - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {A1A295E5-463C-437F-81CA-1F32367685DA} + sqlite3 + .pyd + false + + + + + DynamicLibrary + NotSet + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + <_SqliteVersion>$([System.Text.RegularExpressions.Regex]::Match(`$(sqlite3Dir)`, `((\d+)\.(\d+)\.(\d+)\.(\d+))\\?$`).Groups) + $(_SqliteVersion.Split(`;`)[1]) + $(_SqliteVersion.Split(`;`)[2]) + $(_SqliteVersion.Split(`;`)[3]) + $(_SqliteVersion.Split(`;`)[4]) + $(_SqliteVersion.Split(`;`)[5]) + + + + $(sqlite3Dir);%(AdditionalIncludeDirectories) + SQLITE_API=__declspec(dllexport);%(PreprocessorDefinitions) + Level1 + + + SQLITE_VERSION=$(SqliteVersion);SQLITE_MAJOR_VERSION=$(SqliteMajorVersion);SQLITE_MINOR_VERSION=$(SqliteMinorVersion);SQLITE_MICRO_VERSION=$(SqliteMicroVersion);SQLITE_PATCH_VERSION=$(SqlitePatchVersion);%(PreprocessorDefinitions) + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/sqlite3.vcxproj.filters b/PCbuild/sqlite3.vcxproj.filters index 86680c1..8d79004 100644 --- a/PCbuild/sqlite3.vcxproj.filters +++ b/PCbuild/sqlite3.vcxproj.filters @@ -1,24 +1,24 @@ - - - - - {ce5b649d-a6f7-4459-9425-c883795d79df} - - - {0e842fe2-176b-4e83-9d1f-0ad13a859efd} - - - - - Header Files - - - Header Files - - - - - Source Files - - + + + + + {ce5b649d-a6f7-4459-9425-c883795d79df} + + + {0e842fe2-176b-4e83-9d1f-0ad13a859efd} + + + + + Header Files + + + Header Files + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/ssleay.vcxproj b/PCbuild/ssleay.vcxproj index 439e3ac..1499fbd 100644 --- a/PCbuild/ssleay.vcxproj +++ b/PCbuild/ssleay.vcxproj @@ -1,119 +1,119 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Debug - x64 - - - Release - x64 - - - - {10615B24-73BF-4EFA-93AA-236916321317} - ssleay - - - - - - - StaticLibrary - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Debug + x64 + + + Release + x64 + + + + {10615B24-73BF-4EFA-93AA-236916321317} + ssleay + + + + + + + StaticLibrary + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/tcl.vcxproj b/PCbuild/tcl.vcxproj index 3dfd155..69d98be 100644 --- a/PCbuild/tcl.vcxproj +++ b/PCbuild/tcl.vcxproj @@ -1,93 +1,93 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Debug - x64 - - - Release - x64 - - - - {B5FD6F1D-129E-4BFF-9340-03606FAC7283} - - - - - - - - Makefile - $(tcltkDir) - $(OutDir)bin\$(tclDLLName) - - - - - - - - - - msvcrt - symbols,msvcrt - INSTALLDIR="$(OutDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))" - DEBUGFLAGS="-wd4456 -wd4457 -wd4458 -wd4459 -wd4996" - setlocal -@(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' -') -goto :eof -:build -set VCINSTALLDIR=$(VCInstallDir) -cd /D "$(tclDir)win" -nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) core shell dlls -nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) install-binaries install-libraries - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Debug + x64 + + + Release + x64 + + + + {B5FD6F1D-129E-4BFF-9340-03606FAC7283} + + + + + + + + Makefile + $(tcltkDir) + $(OutDir)bin\$(tclDLLName) + + + + + + + + + + msvcrt + symbols,msvcrt + INSTALLDIR="$(OutDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))" + DEBUGFLAGS="-wd4456 -wd4457 -wd4458 -wd4459 -wd4996" + setlocal +@(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' +') +goto :eof +:build +set VCINSTALLDIR=$(VCInstallDir) +cd /D "$(tclDir)win" +nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) core shell dlls +nmake -f makefile.vc MACHINE=$(TclMachine) OPTS=$(TclOpts) $(TclDirs) $(DebugFlags) install-binaries install-libraries + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/tcltk.props b/PCbuild/tcltk.props index 11dbffb..960c85a 100644 --- a/PCbuild/tcltk.props +++ b/PCbuild/tcltk.props @@ -1,45 +1,45 @@ - - - - - 8 - 6 - 4 - 2 - $(TclMajorVersion) - $(TclMinorVersion) - $(TclPatchLevel) - $(TclRevision) - 8 - 4 - 3 - 6 - $(ExternalsDir)tcl-core-$(TclMajorVersion).$(TclMinorVersion).$(TclPatchLevel).$(TclRevision)\ - $(ExternalsDir)tk-$(TkMajorVersion).$(TkMinorVersion).$(TkPatchLevel).$(TkRevision)\ - $(ExternalsDir)tix-$(TixMajorVersion).$(TixMinorVersion).$(TixPatchLevel).$(TixRevision)\ - $(ExternalsDir)tcltk\ - $(ExternalsDir)tcltk64\ - g - tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).dll - tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).lib - tclsh$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).exe - tk$(TkMajorVersion)$(TkMinorVersion)t$(TclDebugExt).dll - tk$(TkMajorVersion)$(TkMinorVersion)t$(TclDebugExt).lib - tix$(TixMajorVersion)$(TixMinorVersion)$(TclDebugExt).dll - $(tcltkDir)lib\tix$(TixMajorVersion).$(TixMinorVersion).$(TixPatchLevel)\$(tixDLLName) - $(tcltkDir)lib\tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).lib;$(tcltkDir)lib\tk$(TkMajorVersion)$(TkMinorVersion)t$(TclDebugExt).lib - IX86 - AMD64 - TCL_MAJOR_VERSION=$(TclMajorVersion) TCL_MINOR_VERSION=$(TclMinorVersion) TCL_PATCH_LEVEL=$(TclPatchLevel) - TCL_MAJOR=$(TclMajorVersion) TCL_MINOR=$(TclMinorVersion) TCL_PATCH=$(TclPatchLevel) - TK_MAJOR_VERSION=$(TkMajorVersion) TK_MINOR_VERSION=$(TkMinorVersion) TK_PATCH_LEVEL=$(TkPatchLevel) - - Release - Debug - $(BuildDirTop)_$(TclMachine) - $(BuildDirTop)_VC13 - $(BuildDirTop)_VC12 - $(BuildDirTop)_VC11 - $(BuildDirTop)_VC10 - + + + + + 8 + 6 + 4 + 2 + $(TclMajorVersion) + $(TclMinorVersion) + $(TclPatchLevel) + $(TclRevision) + 8 + 4 + 3 + 6 + $(ExternalsDir)tcl-core-$(TclMajorVersion).$(TclMinorVersion).$(TclPatchLevel).$(TclRevision)\ + $(ExternalsDir)tk-$(TkMajorVersion).$(TkMinorVersion).$(TkPatchLevel).$(TkRevision)\ + $(ExternalsDir)tix-$(TixMajorVersion).$(TixMinorVersion).$(TixPatchLevel).$(TixRevision)\ + $(ExternalsDir)tcltk\ + $(ExternalsDir)tcltk64\ + g + tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).dll + tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).lib + tclsh$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).exe + tk$(TkMajorVersion)$(TkMinorVersion)t$(TclDebugExt).dll + tk$(TkMajorVersion)$(TkMinorVersion)t$(TclDebugExt).lib + tix$(TixMajorVersion)$(TixMinorVersion)$(TclDebugExt).dll + $(tcltkDir)lib\tix$(TixMajorVersion).$(TixMinorVersion).$(TixPatchLevel)\$(tixDLLName) + $(tcltkDir)lib\tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).lib;$(tcltkDir)lib\tk$(TkMajorVersion)$(TkMinorVersion)t$(TclDebugExt).lib + IX86 + AMD64 + TCL_MAJOR_VERSION=$(TclMajorVersion) TCL_MINOR_VERSION=$(TclMinorVersion) TCL_PATCH_LEVEL=$(TclPatchLevel) + TCL_MAJOR=$(TclMajorVersion) TCL_MINOR=$(TclMinorVersion) TCL_PATCH=$(TclPatchLevel) + TK_MAJOR_VERSION=$(TkMajorVersion) TK_MINOR_VERSION=$(TkMinorVersion) TK_PATCH_LEVEL=$(TkPatchLevel) + + Release + Debug + $(BuildDirTop)_$(TclMachine) + $(BuildDirTop)_VC13 + $(BuildDirTop)_VC12 + $(BuildDirTop)_VC11 + $(BuildDirTop)_VC10 + \ No newline at end of file diff --git a/PCbuild/tix.vcxproj b/PCbuild/tix.vcxproj index d1bc0ab..407acdd 100644 --- a/PCbuild/tix.vcxproj +++ b/PCbuild/tix.vcxproj @@ -1,94 +1,94 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Debug - x64 - - - Release - x64 - - - - {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555} - tix - - - - - - - - Makefile - $(tcltkDir) - $(tixDLLPath) - - - - - - - - - - BUILDDIRTOP="$(BuildDirTop)" TCL_DIR="$(tclDir.TrimEnd(`\`))" TK_DIR="$(tkDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))" - DEBUG=1 NODEBUG=0 TCL_DBGX=g TK_DBGX=g - DEBUG=0 NODEBUG=1 - setlocal -@(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' -') -goto :eof -:build -set VCINSTALLDIR=$(VCInstallDir) -cd /D "$(tixDir)win" -nmake /nologo -f makefile.vc MACHINE=$(TclMachine) $(DebugFlags) $(TclShortVersions) $(TixDirs) all install - - rmdir /q/s "$(OutDir.TrimEnd(`\`))" - - - - - {b5fd6f1d-129e-4bff-9340-03606fac7283} - false - - - {7e85eccf-a72c-4da4-9e52-884508e80ba1} - false - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Debug + x64 + + + Release + x64 + + + + {C5A3E7FB-9695-4B2E-960B-1D9F43F1E555} + tix + + + + + + + + Makefile + $(tcltkDir) + $(tixDLLPath) + + + + + + + + + + BUILDDIRTOP="$(BuildDirTop)" TCL_DIR="$(tclDir.TrimEnd(`\`))" TK_DIR="$(tkDir.TrimEnd(`\`))" INSTALL_DIR="$(OutDir.TrimEnd(`\`))" + DEBUG=1 NODEBUG=0 TCL_DBGX=g TK_DBGX=g + DEBUG=0 NODEBUG=1 + setlocal +@(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' +') +goto :eof +:build +set VCINSTALLDIR=$(VCInstallDir) +cd /D "$(tixDir)win" +nmake /nologo -f makefile.vc MACHINE=$(TclMachine) $(DebugFlags) $(TclShortVersions) $(TixDirs) all install + + rmdir /q/s "$(OutDir.TrimEnd(`\`))" + + + + + {b5fd6f1d-129e-4bff-9340-03606fac7283} + false + + + {7e85eccf-a72c-4da4-9e52-884508e80ba1} + false + + + + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/tk.vcxproj b/PCbuild/tk.vcxproj index a26318b..8d1aacb 100644 --- a/PCbuild/tk.vcxproj +++ b/PCbuild/tk.vcxproj @@ -1,97 +1,97 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Debug - x64 - - - Release - x64 - - - - {7E85ECCF-A72C-4DA4-9E52-884508E80BA1} - tk - - - - - - - - Makefile - $(tcltkDir) - $(OutDir)bin\$(tkDLLName) - - - - - - - - - - msvcrt - symbols,msvcrt - TCLDIR="$(tclDir.TrimEnd(`\`))" INSTALLDIR="$(OutDir.TrimEnd(`\`))" - DEBUGFLAGS="-wd4456 -wd4457 -wd4458 -wd4459 -wd4996" - setlocal -@(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' -') -goto :eof -:build -set VCINSTALLDIR=$(VCInstallDir) -cd /D "$(tkDir)win" -nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) all -nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) install-binaries install-libraries - - - - - {b5fd6f1d-129e-4bff-9340-03606fac7283} - false - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Debug + x64 + + + Release + x64 + + + + {7E85ECCF-A72C-4DA4-9E52-884508E80BA1} + tk + + + + + + + + Makefile + $(tcltkDir) + $(OutDir)bin\$(tkDLLName) + + + + + + + + + + msvcrt + symbols,msvcrt + TCLDIR="$(tclDir.TrimEnd(`\`))" INSTALLDIR="$(OutDir.TrimEnd(`\`))" + DEBUGFLAGS="-wd4456 -wd4457 -wd4458 -wd4459 -wd4996" + setlocal +@(ExpectedOutputs->'if not exist "%(FullPath)" goto build',' +') +goto :eof +:build +set VCINSTALLDIR=$(VCInstallDir) +cd /D "$(tkDir)win" +nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) all +nmake /nologo -f makefile.vc RC=rc MACHINE=$(TclMachine) OPTS=$(TkOpts) $(TkDirs) $(DebugFlags) install-binaries install-libraries + + + + + {b5fd6f1d-129e-4bff-9340-03606fac7283} + false + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PCbuild/unicodedata.vcxproj b/PCbuild/unicodedata.vcxproj index 317c1a8..cf99b95 100644 --- a/PCbuild/unicodedata.vcxproj +++ b/PCbuild/unicodedata.vcxproj @@ -1,86 +1,86 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881} - unicodedata - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - 0x1D120000 - - - - - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881} + unicodedata + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + 0x1D120000 + + + + + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/unicodedata.vcxproj.filters b/PCbuild/unicodedata.vcxproj.filters index 20e640e..74f35f6 100644 --- a/PCbuild/unicodedata.vcxproj.filters +++ b/PCbuild/unicodedata.vcxproj.filters @@ -1,24 +1,24 @@ - - - - - {b939a8f1-ccd7-420a-974a-243606dccd74} - - - {e2c055bb-ec62-4bbc-aa1c-d88da4d4ad1c} - - - - - Header Files - - - Header Files - - - - - Source Files - - + + + + + {b939a8f1-ccd7-420a-974a-243606dccd74} + + + {e2c055bb-ec62-4bbc-aa1c-d88da4d4ad1c} + + + + + Header Files + + + Header Files + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/winsound.vcxproj b/PCbuild/winsound.vcxproj index 12913ef..2720cfa 100644 --- a/PCbuild/winsound.vcxproj +++ b/PCbuild/winsound.vcxproj @@ -1,82 +1,82 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {28B5D777-DDF2-4B6B-B34F-31D938813856} - winsound - Win32Proj - - - - - DynamicLibrary - NotSet - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - winmm.lib;%(AdditionalDependencies) - - - - - - - - - - - {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} - false - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {28B5D777-DDF2-4B6B-B34F-31D938813856} + winsound + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + winmm.lib;%(AdditionalDependencies) + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + \ No newline at end of file diff --git a/PCbuild/winsound.vcxproj.filters b/PCbuild/winsound.vcxproj.filters index 7d08931..d91fdbf 100644 --- a/PCbuild/winsound.vcxproj.filters +++ b/PCbuild/winsound.vcxproj.filters @@ -1,14 +1,14 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + \ No newline at end of file diff --git a/PCbuild/xxlimited.vcxproj b/PCbuild/xxlimited.vcxproj index 0144fa9..770bc3e 100644 --- a/PCbuild/xxlimited.vcxproj +++ b/PCbuild/xxlimited.vcxproj @@ -1,83 +1,83 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {F749B822-B489-4CA5-A3AD-CE078F5F338A} - xxlimited - Win32Proj - - - - - DynamicLibrary - NotSet - false - - - - .pyd - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - %(PreprocessorDefinitions);Py_LIMITED_API=0x03050000 - - - wsock32.lib;%(AdditionalDependencies) - 0x1D110000 - - - - - - - - {885d4898-d08d-4091-9c40-c700cfe3fc5a} - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {F749B822-B489-4CA5-A3AD-CE078F5F338A} + xxlimited + Win32Proj + + + + + DynamicLibrary + NotSet + false + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + %(PreprocessorDefinitions);Py_LIMITED_API=0x03050000 + + + wsock32.lib;%(AdditionalDependencies) + 0x1D110000 + + + + + + + + {885d4898-d08d-4091-9c40-c700cfe3fc5a} + + + + + \ No newline at end of file diff --git a/PCbuild/xxlimited.vcxproj.filters b/PCbuild/xxlimited.vcxproj.filters index 21db468..807279a 100644 --- a/PCbuild/xxlimited.vcxproj.filters +++ b/PCbuild/xxlimited.vcxproj.filters @@ -1,13 +1,13 @@ - - - - - {eb5eebc7-3787-4f8f-b282-204db2962cc3} - - - - - Source Files - - + + + + + {eb5eebc7-3787-4f8f-b282-204db2962cc3} + + + + + Source Files + + \ No newline at end of file diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 9f5db2a..17c074a 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1892,12 +1892,15 @@ builtin_input_impl(PyObject *module, PyObject *prompt) PyObject *result; size_t len; + /* stdin is a text stream, so it must have an encoding. */ stdin_encoding = _PyObject_GetAttrId(fin, &PyId_encoding); stdin_errors = _PyObject_GetAttrId(fin, &PyId_errors); - if (!stdin_encoding || !stdin_errors) - /* stdin is a text stream, so it must have an - encoding. */ + if (!stdin_encoding || !stdin_errors || + !PyUnicode_Check(stdin_encoding) || + !PyUnicode_Check(stdin_errors)) { + tty = 0; goto _readline_errors; + } stdin_encoding_str = _PyUnicode_AsString(stdin_encoding); stdin_errors_str = _PyUnicode_AsString(stdin_errors); if (!stdin_encoding_str || !stdin_errors_str) @@ -1913,8 +1916,12 @@ builtin_input_impl(PyObject *module, PyObject *prompt) PyObject *stringpo; stdout_encoding = _PyObject_GetAttrId(fout, &PyId_encoding); stdout_errors = _PyObject_GetAttrId(fout, &PyId_errors); - if (!stdout_encoding || !stdout_errors) + if (!stdout_encoding || !stdout_errors || + !PyUnicode_Check(stdout_encoding) || + !PyUnicode_Check(stdout_errors)) { + tty = 0; goto _readline_errors; + } stdout_encoding_str = _PyUnicode_AsString(stdout_encoding); stdout_errors_str = _PyUnicode_AsString(stdout_errors); if (!stdout_encoding_str || !stdout_errors_str) @@ -1969,13 +1976,17 @@ builtin_input_impl(PyObject *module, PyObject *prompt) Py_XDECREF(po); PyMem_FREE(s); return result; + _readline_errors: Py_XDECREF(stdin_encoding); Py_XDECREF(stdout_encoding); Py_XDECREF(stdin_errors); Py_XDECREF(stdout_errors); Py_XDECREF(po); - return NULL; + if (tty) + return NULL; + + PyErr_Clear(); } /* Fallback if we're not interactive */ @@ -2073,7 +2084,7 @@ reverse flag can be set to request the result in descending order. [end disabled clinic input]*/ PyDoc_STRVAR(builtin_sorted__doc__, -"sorted($module, iterable, key=None, reverse=False)\n" +"sorted($module, iterable, /, *, key=None, reverse=False)\n" "--\n" "\n" "Return a new list containing all items from the iterable in ascending order.\n" diff --git a/Python/ceval.c b/Python/ceval.c index 7b40518..47c5eff 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1545,9 +1545,15 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) TARGET(BINARY_MODULO) { PyObject *divisor = POP(); PyObject *dividend = TOP(); - PyObject *res = PyUnicode_CheckExact(dividend) ? - PyUnicode_Format(dividend, divisor) : - PyNumber_Remainder(dividend, divisor); + PyObject *res; + if (PyUnicode_CheckExact(dividend) && ( + !PyUnicode_Check(divisor) || PyUnicode_CheckExact(divisor))) { + /* fast path; string formatting, but not if the RHS is a str subclass + (see issue28598) */ + res = PyUnicode_Format(dividend, divisor); + } else { + res = PyNumber_Remainder(dividend, divisor); + } Py_DECREF(divisor); Py_DECREF(dividend); SET_TOP(res); @@ -2666,14 +2672,22 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (PyErr_ExceptionMatches(PyExc_AttributeError) || !PyMapping_Check(arg)) { int function_location = (oparg>>8) & 0xff; - PyObject *func = ( - PEEK(function_location + num_maps)); - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after ** " - "must be a mapping, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - arg->ob_type->tp_name); + if (function_location == 1) { + PyObject *func = ( + PEEK(function_location + num_maps)); + PyErr_Format(PyExc_TypeError, + "%.200s%.200s argument after ** " + "must be a mapping, not %.200s", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func), + arg->ob_type->tp_name); + } + else { + PyErr_Format(PyExc_TypeError, + "argument after ** " + "must be a mapping, not %.200s", + arg->ob_type->tp_name); + } } Py_DECREF(sum); goto error; @@ -2683,21 +2697,34 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) Py_ssize_t idx = 0; PyObject *key; int function_location = (oparg>>8) & 0xff; - PyObject *func = PEEK(function_location + num_maps); Py_hash_t hash; _PySet_NextEntry(intersection, &idx, &key, &hash); - if (!PyUnicode_Check(key)) { - PyErr_Format(PyExc_TypeError, - "%.200s%.200s keywords must be strings", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func)); - } else { - PyErr_Format(PyExc_TypeError, - "%.200s%.200s got multiple " - "values for keyword argument '%U'", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - key); + if (function_location == 1) { + PyObject *func = PEEK(function_location + num_maps); + if (!PyUnicode_Check(key)) { + PyErr_Format(PyExc_TypeError, + "%.200s%.200s keywords must be strings", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func)); + } else { + PyErr_Format(PyExc_TypeError, + "%.200s%.200s got multiple " + "values for keyword argument '%U'", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func), + key); + } + } + else { + if (!PyUnicode_Check(key)) { + PyErr_SetString(PyExc_TypeError, + "keywords must be strings"); + } else { + PyErr_Format(PyExc_TypeError, + "function got multiple " + "values for keyword argument '%U'", + key); + } } Py_DECREF(intersection); Py_DECREF(sum); @@ -2710,13 +2737,21 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (PyErr_ExceptionMatches(PyExc_AttributeError)) { if (with_call) { int function_location = (oparg>>8) & 0xff; - PyObject *func = PEEK(function_location + num_maps); - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after ** " - "must be a mapping, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - arg->ob_type->tp_name); + if (function_location == 1) { + PyObject *func = PEEK(function_location + num_maps); + PyErr_Format(PyExc_TypeError, + "%.200s%.200s argument after ** " + "must be a mapping, not %.200s", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func), + arg->ob_type->tp_name); + } + else { + PyErr_Format(PyExc_TypeError, + "argument after ** " + "must be a mapping, not %.200s", + arg->ob_type->tp_name); + } } else { PyErr_Format(PyExc_TypeError, @@ -2826,13 +2861,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) TARGET(IMPORT_STAR) { PyObject *from = POP(), *locals; int err; - if (PyFrame_FastToLocalsWithError(f) < 0) + if (PyFrame_FastToLocalsWithError(f) < 0) { + Py_DECREF(from); goto error; + } locals = f->f_locals; if (locals == NULL) { PyErr_SetString(PyExc_SystemError, "no locals found during 'import *'"); + Py_DECREF(from); goto error; } READ_TIMESTAMP(intr0); @@ -5057,17 +5095,13 @@ ext_call_fail: /* Extract a slice index from a PyLong or an object with the nb_index slot defined, and store in *pi. Silently reduce values larger than PY_SSIZE_T_MAX to PY_SSIZE_T_MAX, - and silently boost values less than -PY_SSIZE_T_MAX-1 to -PY_SSIZE_T_MAX-1. + and silently boost values less than PY_SSIZE_T_MIN to PY_SSIZE_T_MIN. Return 0 on error, 1 on success. */ -/* Note: If v is NULL, return success without storing into *pi. This - is because_PyEval_SliceIndex() is called by apply_slice(), which can be - called by the SLICE opcode with v and/or w equal to NULL. -*/ int _PyEval_SliceIndex(PyObject *v, Py_ssize_t *pi) { - if (v != NULL) { + if (v != Py_None) { Py_ssize_t x; if (PyIndex_Check(v)) { x = PyNumber_AsSsize_t(v, NULL); @@ -5085,6 +5119,26 @@ _PyEval_SliceIndex(PyObject *v, Py_ssize_t *pi) return 1; } +int +_PyEval_SliceIndexNotNone(PyObject *v, Py_ssize_t *pi) +{ + Py_ssize_t x; + if (PyIndex_Check(v)) { + x = PyNumber_AsSsize_t(v, NULL); + if (x == -1 && PyErr_Occurred()) + return 0; + } + else { + PyErr_SetString(PyExc_TypeError, + "slice indices must be integers or " + "have an __index__ method"); + return 0; + } + *pi = x; + return 1; +} + + #define CANNOT_CATCH_MSG "catching classes that do not inherit from "\ "BaseException is not allowed" diff --git a/Python/dynload_win.c b/Python/dynload_win.c index f2c796e..3f533d1 100644 --- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -192,13 +192,13 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix, { dl_funcptr p; char funcname[258], *import_python; - wchar_t *wpathname; + const wchar_t *wpathname; #ifndef _DEBUG _Py_CheckPython3(); #endif - wpathname = PyUnicode_AsUnicode(pathname); + wpathname = _PyUnicode_AsUnicode(pathname); if (wpathname == NULL) return NULL; diff --git a/Python/fileutils.c b/Python/fileutils.c index 23eed71..5072118 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -710,21 +710,32 @@ _Py_stat(PyObject *path, struct stat *statbuf) #ifdef MS_WINDOWS int err; struct _stat wstatbuf; - wchar_t *wpath; + const wchar_t *wpath; - wpath = PyUnicode_AsUnicode(path); + wpath = _PyUnicode_AsUnicode(path); if (wpath == NULL) return -2; + err = _wstat(wpath, &wstatbuf); if (!err) statbuf->st_mode = wstatbuf.st_mode; return err; #else int ret; - PyObject *bytes = PyUnicode_EncodeFSDefault(path); + PyObject *bytes; + char *cpath; + + bytes = PyUnicode_EncodeFSDefault(path); if (bytes == NULL) return -2; - ret = stat(PyBytes_AS_STRING(bytes), statbuf); + + /* check for embedded null bytes */ + if (PyBytes_AsStringAndSize(bytes, &cpath, NULL) == -1) { + Py_DECREF(bytes); + return -2; + } + + ret = stat(cpath, statbuf); Py_DECREF(bytes); return ret; #endif @@ -1083,7 +1094,7 @@ _Py_fopen_obj(PyObject *path, const char *mode) FILE *f; int async_err = 0; #ifdef MS_WINDOWS - wchar_t *wpath; + const wchar_t *wpath; wchar_t wmode[10]; int usize; @@ -1097,7 +1108,7 @@ _Py_fopen_obj(PyObject *path, const char *mode) Py_TYPE(path)); return NULL; } - wpath = PyUnicode_AsUnicode(path); + wpath = _PyUnicode_AsUnicode(path); if (wpath == NULL) return NULL; diff --git a/Python/import.c b/Python/import.c index 3579273..9d54d59 100644 --- a/Python/import.c +++ b/Python/import.c @@ -483,9 +483,17 @@ PyImport_Cleanup(void) #undef STORE_MODULE_WEAKREF } +/* Issue #29537: handle issue27286 bytecode incompatibility + * + * In order to avoid forcing recompilation of all extension modules, we export + * the legacy 3.5.0 magic number here rather than putting it in a header file. + * + * See Lib/importlib/_bootstrap_external.py for general discussion + */ +PY_UINT32_T _Py_BACKCOMPAT_MAGIC_NUMBER = 168627478; +PY_UINT32_T _Py_BACKCOMPAT_HALF_MAGIC = 3350; /* Helper for pythonrun.c -- return magic number and tag. */ - long PyImport_GetMagicNumber(void) { @@ -1453,11 +1461,9 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals, Py_DECREF(partition); } } - - if (PyDict_GetItem(interp->modules, package) == NULL) { - PyErr_Format(PyExc_SystemError, - "Parent module %R not loaded, cannot perform relative " - "import", package); + if (PyUnicode_GET_LENGTH(package) == 0) { + PyErr_SetString(PyExc_ImportError, + "attempted relative import with no known parent package"); goto error; } } @@ -1798,9 +1804,13 @@ PyImport_Import(PyObject *module_name) Py_DECREF(r); modules = PyImport_GetModuleDict(); - r = PyDict_GetItem(modules, module_name); - if (r != NULL) + r = PyDict_GetItemWithError(modules, module_name); + if (r != NULL) { Py_INCREF(r); + } + else if (!PyErr_Occurred()) { + PyErr_SetObject(PyExc_KeyError, module_name); + } err: Py_XDECREF(globals); diff --git a/Python/importlib.h b/Python/importlib.h index a5fc936..aba15fd 100644 --- a/Python/importlib.h +++ b/Python/importlib.h @@ -1610,379 +1610,376 @@ const unsigned char _Py_M__importlib[] = { 1,10,1,3,1,13,1,13,1,18,1,12,1,8,2,25, 1,12,2,22,1,13,1,3,1,13,1,13,4,9,2,12, 1,4,2,7,2,8,2,114,176,0,0,0,99,3,0,0, - 0,0,0,0,0,4,0,0,0,4,0,0,0,67,0,0, - 0,115,185,0,0,0,116,0,0,124,0,0,116,1,0,131, + 0,0,0,0,0,3,0,0,0,4,0,0,0,67,0,0, + 0,115,161,0,0,0,116,0,0,124,0,0,116,1,0,131, 2,0,115,42,0,116,2,0,100,1,0,106,3,0,116,4, 0,124,0,0,131,1,0,131,1,0,131,1,0,130,1,0, 124,2,0,100,2,0,107,0,0,114,66,0,116,5,0,100, 3,0,131,1,0,130,1,0,124,2,0,100,2,0,107,4, - 0,114,150,0,116,0,0,124,1,0,116,1,0,131,2,0, + 0,114,126,0,116,0,0,124,1,0,116,1,0,131,2,0, 115,108,0,116,2,0,100,4,0,131,1,0,130,1,0,110, - 42,0,124,1,0,116,6,0,106,7,0,107,7,0,114,150, - 0,100,5,0,125,3,0,116,8,0,124,3,0,106,3,0, - 124,1,0,131,1,0,131,1,0,130,1,0,124,0,0,12, - 114,181,0,124,2,0,100,2,0,107,2,0,114,181,0,116, - 5,0,100,6,0,131,1,0,130,1,0,100,7,0,83,41, - 8,122,28,86,101,114,105,102,121,32,97,114,103,117,109,101, - 110,116,115,32,97,114,101,32,34,115,97,110,101,34,46,122, - 31,109,111,100,117,108,101,32,110,97,109,101,32,109,117,115, - 116,32,98,101,32,115,116,114,44,32,110,111,116,32,123,125, - 114,33,0,0,0,122,18,108,101,118,101,108,32,109,117,115, - 116,32,98,101,32,62,61,32,48,122,31,95,95,112,97,99, - 107,97,103,101,95,95,32,110,111,116,32,115,101,116,32,116, - 111,32,97,32,115,116,114,105,110,103,122,61,80,97,114,101, - 110,116,32,109,111,100,117,108,101,32,123,33,114,125,32,110, - 111,116,32,108,111,97,100,101,100,44,32,99,97,110,110,111, - 116,32,112,101,114,102,111,114,109,32,114,101,108,97,116,105, - 118,101,32,105,109,112,111,114,116,122,17,69,109,112,116,121, - 32,109,111,100,117,108,101,32,110,97,109,101,78,41,9,218, - 10,105,115,105,110,115,116,97,110,99,101,218,3,115,116,114, - 218,9,84,121,112,101,69,114,114,111,114,114,50,0,0,0, - 114,13,0,0,0,114,168,0,0,0,114,14,0,0,0,114, - 21,0,0,0,218,11,83,121,115,116,101,109,69,114,114,111, - 114,41,4,114,15,0,0,0,114,169,0,0,0,114,170,0, - 0,0,114,147,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,218,13,95,115,97,110,105,116,121,95, - 99,104,101,99,107,151,3,0,0,115,24,0,0,0,0,2, - 15,1,27,1,12,1,12,1,12,1,15,1,15,1,15,1, - 6,2,21,1,19,1,114,181,0,0,0,122,16,78,111,32, - 109,111,100,117,108,101,32,110,97,109,101,100,32,122,4,123, - 33,114,125,99,2,0,0,0,0,0,0,0,8,0,0,0, - 12,0,0,0,67,0,0,0,115,40,1,0,0,100,0,0, - 125,2,0,124,0,0,106,0,0,100,1,0,131,1,0,100, - 2,0,25,125,3,0,124,3,0,114,175,0,124,3,0,116, - 1,0,106,2,0,107,7,0,114,59,0,116,3,0,124,1, - 0,124,3,0,131,2,0,1,124,0,0,116,1,0,106,2, - 0,107,6,0,114,85,0,116,1,0,106,2,0,124,0,0, - 25,83,116,1,0,106,2,0,124,3,0,25,125,4,0,121, - 13,0,124,4,0,106,4,0,125,2,0,87,110,61,0,4, - 116,5,0,107,10,0,114,174,0,1,1,1,116,6,0,100, - 3,0,23,106,7,0,124,0,0,124,3,0,131,2,0,125, - 5,0,116,8,0,124,5,0,100,4,0,124,0,0,131,1, - 1,100,0,0,130,2,0,89,110,1,0,88,116,9,0,124, - 0,0,124,2,0,131,2,0,125,6,0,124,6,0,100,0, - 0,107,8,0,114,232,0,116,8,0,116,6,0,106,7,0, - 124,0,0,131,1,0,100,4,0,124,0,0,131,1,1,130, - 1,0,110,12,0,116,10,0,124,6,0,131,1,0,125,7, - 0,124,3,0,114,36,1,116,1,0,106,2,0,124,3,0, - 25,125,4,0,116,11,0,124,4,0,124,0,0,106,0,0, - 100,1,0,131,1,0,100,5,0,25,124,7,0,131,3,0, - 1,124,7,0,83,41,6,78,114,121,0,0,0,114,33,0, - 0,0,122,23,59,32,123,33,114,125,32,105,115,32,110,111, - 116,32,97,32,112,97,99,107,97,103,101,114,15,0,0,0, - 114,140,0,0,0,41,12,114,122,0,0,0,114,14,0,0, - 0,114,21,0,0,0,114,65,0,0,0,114,131,0,0,0, - 114,96,0,0,0,218,8,95,69,82,82,95,77,83,71,114, - 50,0,0,0,114,77,0,0,0,114,176,0,0,0,114,149, - 0,0,0,114,5,0,0,0,41,8,114,15,0,0,0,218, - 7,105,109,112,111,114,116,95,114,152,0,0,0,114,123,0, - 0,0,90,13,112,97,114,101,110,116,95,109,111,100,117,108, - 101,114,147,0,0,0,114,88,0,0,0,114,89,0,0,0, + 18,0,124,1,0,115,126,0,116,6,0,100,5,0,131,1, + 0,130,1,0,124,0,0,12,114,157,0,124,2,0,100,2, + 0,107,2,0,114,157,0,116,5,0,100,6,0,131,1,0, + 130,1,0,100,7,0,83,41,8,122,28,86,101,114,105,102, + 121,32,97,114,103,117,109,101,110,116,115,32,97,114,101,32, + 34,115,97,110,101,34,46,122,31,109,111,100,117,108,101,32, + 110,97,109,101,32,109,117,115,116,32,98,101,32,115,116,114, + 44,32,110,111,116,32,123,125,114,33,0,0,0,122,18,108, + 101,118,101,108,32,109,117,115,116,32,98,101,32,62,61,32, + 48,122,31,95,95,112,97,99,107,97,103,101,95,95,32,110, + 111,116,32,115,101,116,32,116,111,32,97,32,115,116,114,105, + 110,103,122,54,97,116,116,101,109,112,116,101,100,32,114,101, + 108,97,116,105,118,101,32,105,109,112,111,114,116,32,119,105, + 116,104,32,110,111,32,107,110,111,119,110,32,112,97,114,101, + 110,116,32,112,97,99,107,97,103,101,122,17,69,109,112,116, + 121,32,109,111,100,117,108,101,32,110,97,109,101,78,41,7, + 218,10,105,115,105,110,115,116,97,110,99,101,218,3,115,116, + 114,218,9,84,121,112,101,69,114,114,111,114,114,50,0,0, + 0,114,13,0,0,0,114,168,0,0,0,114,77,0,0,0, + 41,3,114,15,0,0,0,114,169,0,0,0,114,170,0,0, + 0,114,10,0,0,0,114,10,0,0,0,114,11,0,0,0, + 218,13,95,115,97,110,105,116,121,95,99,104,101,99,107,151, + 3,0,0,115,22,0,0,0,0,2,15,1,27,1,12,1, + 12,1,12,1,15,1,15,1,6,1,12,2,19,1,114,180, + 0,0,0,122,16,78,111,32,109,111,100,117,108,101,32,110, + 97,109,101,100,32,122,4,123,33,114,125,99,2,0,0,0, + 0,0,0,0,8,0,0,0,12,0,0,0,67,0,0,0, + 115,40,1,0,0,100,0,0,125,2,0,124,0,0,106,0, + 0,100,1,0,131,1,0,100,2,0,25,125,3,0,124,3, + 0,114,175,0,124,3,0,116,1,0,106,2,0,107,7,0, + 114,59,0,116,3,0,124,1,0,124,3,0,131,2,0,1, + 124,0,0,116,1,0,106,2,0,107,6,0,114,85,0,116, + 1,0,106,2,0,124,0,0,25,83,116,1,0,106,2,0, + 124,3,0,25,125,4,0,121,13,0,124,4,0,106,4,0, + 125,2,0,87,110,61,0,4,116,5,0,107,10,0,114,174, + 0,1,1,1,116,6,0,100,3,0,23,106,7,0,124,0, + 0,124,3,0,131,2,0,125,5,0,116,8,0,124,5,0, + 100,4,0,124,0,0,131,1,1,100,0,0,130,2,0,89, + 110,1,0,88,116,9,0,124,0,0,124,2,0,131,2,0, + 125,6,0,124,6,0,100,0,0,107,8,0,114,232,0,116, + 8,0,116,6,0,106,7,0,124,0,0,131,1,0,100,4, + 0,124,0,0,131,1,1,130,1,0,110,12,0,116,10,0, + 124,6,0,131,1,0,125,7,0,124,3,0,114,36,1,116, + 1,0,106,2,0,124,3,0,25,125,4,0,116,11,0,124, + 4,0,124,0,0,106,0,0,100,1,0,131,1,0,100,5, + 0,25,124,7,0,131,3,0,1,124,7,0,83,41,6,78, + 114,121,0,0,0,114,33,0,0,0,122,23,59,32,123,33, + 114,125,32,105,115,32,110,111,116,32,97,32,112,97,99,107, + 97,103,101,114,15,0,0,0,114,140,0,0,0,41,12,114, + 122,0,0,0,114,14,0,0,0,114,21,0,0,0,114,65, + 0,0,0,114,131,0,0,0,114,96,0,0,0,218,8,95, + 69,82,82,95,77,83,71,114,50,0,0,0,114,77,0,0, + 0,114,176,0,0,0,114,149,0,0,0,114,5,0,0,0, + 41,8,114,15,0,0,0,218,7,105,109,112,111,114,116,95, + 114,152,0,0,0,114,123,0,0,0,90,13,112,97,114,101, + 110,116,95,109,111,100,117,108,101,114,147,0,0,0,114,88, + 0,0,0,114,89,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,218,23,95,102,105,110,100,95,97, + 110,100,95,108,111,97,100,95,117,110,108,111,99,107,101,100, + 170,3,0,0,115,42,0,0,0,0,1,6,1,19,1,6, + 1,15,1,13,2,15,1,11,1,13,1,3,1,13,1,13, + 1,22,1,26,1,15,1,12,1,30,2,12,1,6,2,13, + 1,29,1,114,183,0,0,0,99,2,0,0,0,0,0,0, + 0,2,0,0,0,10,0,0,0,67,0,0,0,115,37,0, + 0,0,116,0,0,124,0,0,131,1,0,143,18,0,1,116, + 1,0,124,0,0,124,1,0,131,2,0,83,87,100,1,0, + 81,82,88,100,1,0,83,41,2,122,54,70,105,110,100,32, + 97,110,100,32,108,111,97,100,32,116,104,101,32,109,111,100, + 117,108,101,44,32,97,110,100,32,114,101,108,101,97,115,101, + 32,116,104,101,32,105,109,112,111,114,116,32,108,111,99,107, + 46,78,41,2,114,54,0,0,0,114,183,0,0,0,41,2, + 114,15,0,0,0,114,182,0,0,0,114,10,0,0,0,114, + 10,0,0,0,114,11,0,0,0,218,14,95,102,105,110,100, + 95,97,110,100,95,108,111,97,100,197,3,0,0,115,4,0, + 0,0,0,2,13,1,114,184,0,0,0,114,33,0,0,0, + 99,3,0,0,0,0,0,0,0,5,0,0,0,4,0,0, + 0,67,0,0,0,115,166,0,0,0,116,0,0,124,0,0, + 124,1,0,124,2,0,131,3,0,1,124,2,0,100,1,0, + 107,4,0,114,46,0,116,1,0,124,0,0,124,1,0,124, + 2,0,131,3,0,125,0,0,116,2,0,106,3,0,131,0, + 0,1,124,0,0,116,4,0,106,5,0,107,7,0,114,84, + 0,116,6,0,124,0,0,116,7,0,131,2,0,83,116,4, + 0,106,5,0,124,0,0,25,125,3,0,124,3,0,100,2, + 0,107,8,0,114,152,0,116,2,0,106,8,0,131,0,0, + 1,100,3,0,106,9,0,124,0,0,131,1,0,125,4,0, + 116,10,0,124,4,0,100,4,0,124,0,0,131,1,1,130, + 1,0,116,11,0,124,0,0,131,1,0,1,124,3,0,83, + 41,5,97,50,1,0,0,73,109,112,111,114,116,32,97,110, + 100,32,114,101,116,117,114,110,32,116,104,101,32,109,111,100, + 117,108,101,32,98,97,115,101,100,32,111,110,32,105,116,115, + 32,110,97,109,101,44,32,116,104,101,32,112,97,99,107,97, + 103,101,32,116,104,101,32,99,97,108,108,32,105,115,10,32, + 32,32,32,98,101,105,110,103,32,109,97,100,101,32,102,114, + 111,109,44,32,97,110,100,32,116,104,101,32,108,101,118,101, + 108,32,97,100,106,117,115,116,109,101,110,116,46,10,10,32, + 32,32,32,84,104,105,115,32,102,117,110,99,116,105,111,110, + 32,114,101,112,114,101,115,101,110,116,115,32,116,104,101,32, + 103,114,101,97,116,101,115,116,32,99,111,109,109,111,110,32, + 100,101,110,111,109,105,110,97,116,111,114,32,111,102,32,102, + 117,110,99,116,105,111,110,97,108,105,116,121,10,32,32,32, + 32,98,101,116,119,101,101,110,32,105,109,112,111,114,116,95, + 109,111,100,117,108,101,32,97,110,100,32,95,95,105,109,112, + 111,114,116,95,95,46,32,84,104,105,115,32,105,110,99,108, + 117,100,101,115,32,115,101,116,116,105,110,103,32,95,95,112, + 97,99,107,97,103,101,95,95,32,105,102,10,32,32,32,32, + 116,104,101,32,108,111,97,100,101,114,32,100,105,100,32,110, + 111,116,46,10,10,32,32,32,32,114,33,0,0,0,78,122, + 40,105,109,112,111,114,116,32,111,102,32,123,125,32,104,97, + 108,116,101,100,59,32,78,111,110,101,32,105,110,32,115,121, + 115,46,109,111,100,117,108,101,115,114,15,0,0,0,41,12, + 114,180,0,0,0,114,171,0,0,0,114,57,0,0,0,114, + 145,0,0,0,114,14,0,0,0,114,21,0,0,0,114,184, + 0,0,0,218,11,95,103,99,100,95,105,109,112,111,114,116, + 114,58,0,0,0,114,50,0,0,0,114,77,0,0,0,114, + 63,0,0,0,41,5,114,15,0,0,0,114,169,0,0,0, + 114,170,0,0,0,114,89,0,0,0,114,74,0,0,0,114, + 10,0,0,0,114,10,0,0,0,114,11,0,0,0,114,185, + 0,0,0,203,3,0,0,115,28,0,0,0,0,9,16,1, + 12,1,18,1,10,1,15,1,13,1,13,1,12,1,10,1, + 6,1,9,1,18,1,10,1,114,185,0,0,0,99,3,0, + 0,0,0,0,0,0,6,0,0,0,17,0,0,0,67,0, + 0,0,115,239,0,0,0,116,0,0,124,0,0,100,1,0, + 131,2,0,114,235,0,100,2,0,124,1,0,107,6,0,114, + 83,0,116,1,0,124,1,0,131,1,0,125,1,0,124,1, + 0,106,2,0,100,2,0,131,1,0,1,116,0,0,124,0, + 0,100,3,0,131,2,0,114,83,0,124,1,0,106,3,0, + 124,0,0,106,4,0,131,1,0,1,120,149,0,124,1,0, + 68,93,141,0,125,3,0,116,0,0,124,0,0,124,3,0, + 131,2,0,115,90,0,100,4,0,106,5,0,124,0,0,106, + 6,0,124,3,0,131,2,0,125,4,0,121,17,0,116,7, + 0,124,2,0,124,4,0,131,2,0,1,87,113,90,0,4, + 116,8,0,107,10,0,114,230,0,1,125,5,0,1,122,47, + 0,116,9,0,124,5,0,131,1,0,106,10,0,116,11,0, + 131,1,0,114,209,0,124,5,0,106,12,0,124,4,0,107, + 2,0,114,209,0,119,90,0,130,0,0,87,89,100,5,0, + 100,5,0,125,5,0,126,5,0,88,113,90,0,88,113,90, + 0,87,124,0,0,83,41,6,122,238,70,105,103,117,114,101, + 32,111,117,116,32,119,104,97,116,32,95,95,105,109,112,111, + 114,116,95,95,32,115,104,111,117,108,100,32,114,101,116,117, + 114,110,46,10,10,32,32,32,32,84,104,101,32,105,109,112, + 111,114,116,95,32,112,97,114,97,109,101,116,101,114,32,105, + 115,32,97,32,99,97,108,108,97,98,108,101,32,119,104,105, + 99,104,32,116,97,107,101,115,32,116,104,101,32,110,97,109, + 101,32,111,102,32,109,111,100,117,108,101,32,116,111,10,32, + 32,32,32,105,109,112,111,114,116,46,32,73,116,32,105,115, + 32,114,101,113,117,105,114,101,100,32,116,111,32,100,101,99, + 111,117,112,108,101,32,116,104,101,32,102,117,110,99,116,105, + 111,110,32,102,114,111,109,32,97,115,115,117,109,105,110,103, + 32,105,109,112,111,114,116,108,105,98,39,115,10,32,32,32, + 32,105,109,112,111,114,116,32,105,109,112,108,101,109,101,110, + 116,97,116,105,111,110,32,105,115,32,100,101,115,105,114,101, + 100,46,10,10,32,32,32,32,114,131,0,0,0,250,1,42, + 218,7,95,95,97,108,108,95,95,122,5,123,125,46,123,125, + 78,41,13,114,4,0,0,0,114,130,0,0,0,218,6,114, + 101,109,111,118,101,218,6,101,120,116,101,110,100,114,187,0, + 0,0,114,50,0,0,0,114,1,0,0,0,114,65,0,0, + 0,114,77,0,0,0,114,178,0,0,0,114,71,0,0,0, + 218,15,95,69,82,82,95,77,83,71,95,80,82,69,70,73, + 88,114,15,0,0,0,41,6,114,89,0,0,0,218,8,102, + 114,111,109,108,105,115,116,114,182,0,0,0,218,1,120,90, + 9,102,114,111,109,95,110,97,109,101,90,3,101,120,99,114, + 10,0,0,0,114,10,0,0,0,114,11,0,0,0,218,16, + 95,104,97,110,100,108,101,95,102,114,111,109,108,105,115,116, + 227,3,0,0,115,34,0,0,0,0,10,15,1,12,1,12, + 1,13,1,15,1,16,1,13,1,15,1,21,1,3,1,17, + 1,18,4,21,1,15,1,3,1,26,1,114,193,0,0,0, + 99,1,0,0,0,0,0,0,0,2,0,0,0,2,0,0, + 0,67,0,0,0,115,72,0,0,0,124,0,0,106,0,0, + 100,1,0,131,1,0,125,1,0,124,1,0,100,2,0,107, + 8,0,114,68,0,124,0,0,100,3,0,25,125,1,0,100, + 4,0,124,0,0,107,7,0,114,68,0,124,1,0,106,1, + 0,100,5,0,131,1,0,100,6,0,25,125,1,0,124,1, + 0,83,41,7,122,167,67,97,108,99,117,108,97,116,101,32, + 119,104,97,116,32,95,95,112,97,99,107,97,103,101,95,95, + 32,115,104,111,117,108,100,32,98,101,46,10,10,32,32,32, + 32,95,95,112,97,99,107,97,103,101,95,95,32,105,115,32, + 110,111,116,32,103,117,97,114,97,110,116,101,101,100,32,116, + 111,32,98,101,32,100,101,102,105,110,101,100,32,111,114,32, + 99,111,117,108,100,32,98,101,32,115,101,116,32,116,111,32, + 78,111,110,101,10,32,32,32,32,116,111,32,114,101,112,114, + 101,115,101,110,116,32,116,104,97,116,32,105,116,115,32,112, + 114,111,112,101,114,32,118,97,108,117,101,32,105,115,32,117, + 110,107,110,111,119,110,46,10,10,32,32,32,32,114,134,0, + 0,0,78,114,1,0,0,0,114,131,0,0,0,114,121,0, + 0,0,114,33,0,0,0,41,2,114,42,0,0,0,114,122, + 0,0,0,41,2,218,7,103,108,111,98,97,108,115,114,169, + 0,0,0,114,10,0,0,0,114,10,0,0,0,114,11,0, + 0,0,218,17,95,99,97,108,99,95,95,95,112,97,99,107, + 97,103,101,95,95,3,4,0,0,115,12,0,0,0,0,7, + 15,1,12,1,10,1,12,1,19,1,114,195,0,0,0,99, + 5,0,0,0,0,0,0,0,9,0,0,0,5,0,0,0, + 67,0,0,0,115,227,0,0,0,124,4,0,100,1,0,107, + 2,0,114,27,0,116,0,0,124,0,0,131,1,0,125,5, + 0,110,54,0,124,1,0,100,2,0,107,9,0,114,45,0, + 124,1,0,110,3,0,105,0,0,125,6,0,116,1,0,124, + 6,0,131,1,0,125,7,0,116,0,0,124,0,0,124,7, + 0,124,4,0,131,3,0,125,5,0,124,3,0,115,207,0, + 124,4,0,100,1,0,107,2,0,114,122,0,116,0,0,124, + 0,0,106,2,0,100,3,0,131,1,0,100,1,0,25,131, + 1,0,83,124,0,0,115,132,0,124,5,0,83,116,3,0, + 124,0,0,131,1,0,116,3,0,124,0,0,106,2,0,100, + 3,0,131,1,0,100,1,0,25,131,1,0,24,125,8,0, + 116,4,0,106,5,0,124,5,0,106,6,0,100,2,0,116, + 3,0,124,5,0,106,6,0,131,1,0,124,8,0,24,133, + 2,0,25,25,83,110,16,0,116,7,0,124,5,0,124,3, + 0,116,0,0,131,3,0,83,100,2,0,83,41,4,97,215, + 1,0,0,73,109,112,111,114,116,32,97,32,109,111,100,117, + 108,101,46,10,10,32,32,32,32,84,104,101,32,39,103,108, + 111,98,97,108,115,39,32,97,114,103,117,109,101,110,116,32, + 105,115,32,117,115,101,100,32,116,111,32,105,110,102,101,114, + 32,119,104,101,114,101,32,116,104,101,32,105,109,112,111,114, + 116,32,105,115,32,111,99,99,117,114,114,105,110,103,32,102, + 114,111,109,10,32,32,32,32,116,111,32,104,97,110,100,108, + 101,32,114,101,108,97,116,105,118,101,32,105,109,112,111,114, + 116,115,46,32,84,104,101,32,39,108,111,99,97,108,115,39, + 32,97,114,103,117,109,101,110,116,32,105,115,32,105,103,110, + 111,114,101,100,46,32,84,104,101,10,32,32,32,32,39,102, + 114,111,109,108,105,115,116,39,32,97,114,103,117,109,101,110, + 116,32,115,112,101,99,105,102,105,101,115,32,119,104,97,116, + 32,115,104,111,117,108,100,32,101,120,105,115,116,32,97,115, + 32,97,116,116,114,105,98,117,116,101,115,32,111,110,32,116, + 104,101,32,109,111,100,117,108,101,10,32,32,32,32,98,101, + 105,110,103,32,105,109,112,111,114,116,101,100,32,40,101,46, + 103,46,32,96,96,102,114,111,109,32,109,111,100,117,108,101, + 32,105,109,112,111,114,116,32,60,102,114,111,109,108,105,115, + 116,62,96,96,41,46,32,32,84,104,101,32,39,108,101,118, + 101,108,39,10,32,32,32,32,97,114,103,117,109,101,110,116, + 32,114,101,112,114,101,115,101,110,116,115,32,116,104,101,32, + 112,97,99,107,97,103,101,32,108,111,99,97,116,105,111,110, + 32,116,111,32,105,109,112,111,114,116,32,102,114,111,109,32, + 105,110,32,97,32,114,101,108,97,116,105,118,101,10,32,32, + 32,32,105,109,112,111,114,116,32,40,101,46,103,46,32,96, + 96,102,114,111,109,32,46,46,112,107,103,32,105,109,112,111, + 114,116,32,109,111,100,96,96,32,119,111,117,108,100,32,104, + 97,118,101,32,97,32,39,108,101,118,101,108,39,32,111,102, + 32,50,41,46,10,10,32,32,32,32,114,33,0,0,0,78, + 114,121,0,0,0,41,8,114,185,0,0,0,114,195,0,0, + 0,218,9,112,97,114,116,105,116,105,111,110,114,167,0,0, + 0,114,14,0,0,0,114,21,0,0,0,114,1,0,0,0, + 114,193,0,0,0,41,9,114,15,0,0,0,114,194,0,0, + 0,218,6,108,111,99,97,108,115,114,191,0,0,0,114,170, + 0,0,0,114,89,0,0,0,90,8,103,108,111,98,97,108, + 115,95,114,169,0,0,0,90,7,99,117,116,95,111,102,102, 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,218, - 23,95,102,105,110,100,95,97,110,100,95,108,111,97,100,95, - 117,110,108,111,99,107,101,100,171,3,0,0,115,42,0,0, - 0,0,1,6,1,19,1,6,1,15,1,13,2,15,1,11, - 1,13,1,3,1,13,1,13,1,22,1,26,1,15,1,12, - 1,30,2,12,1,6,2,13,1,29,1,114,184,0,0,0, - 99,2,0,0,0,0,0,0,0,2,0,0,0,10,0,0, - 0,67,0,0,0,115,37,0,0,0,116,0,0,124,0,0, - 131,1,0,143,18,0,1,116,1,0,124,0,0,124,1,0, - 131,2,0,83,87,100,1,0,81,82,88,100,1,0,83,41, - 2,122,54,70,105,110,100,32,97,110,100,32,108,111,97,100, - 32,116,104,101,32,109,111,100,117,108,101,44,32,97,110,100, - 32,114,101,108,101,97,115,101,32,116,104,101,32,105,109,112, - 111,114,116,32,108,111,99,107,46,78,41,2,114,54,0,0, - 0,114,184,0,0,0,41,2,114,15,0,0,0,114,183,0, + 10,95,95,105,109,112,111,114,116,95,95,18,4,0,0,115, + 26,0,0,0,0,11,12,1,15,2,24,1,12,1,18,1, + 6,3,12,1,23,1,6,1,4,4,35,3,40,2,114,198, + 0,0,0,99,1,0,0,0,0,0,0,0,2,0,0,0, + 3,0,0,0,67,0,0,0,115,53,0,0,0,116,0,0, + 106,1,0,124,0,0,131,1,0,125,1,0,124,1,0,100, + 0,0,107,8,0,114,43,0,116,2,0,100,1,0,124,0, + 0,23,131,1,0,130,1,0,116,3,0,124,1,0,131,1, + 0,83,41,2,78,122,25,110,111,32,98,117,105,108,116,45, + 105,110,32,109,111,100,117,108,101,32,110,97,109,101,100,32, + 41,4,114,150,0,0,0,114,154,0,0,0,114,77,0,0, + 0,114,149,0,0,0,41,2,114,15,0,0,0,114,88,0, 0,0,114,10,0,0,0,114,10,0,0,0,114,11,0,0, - 0,218,14,95,102,105,110,100,95,97,110,100,95,108,111,97, - 100,198,3,0,0,115,4,0,0,0,0,2,13,1,114,185, - 0,0,0,114,33,0,0,0,99,3,0,0,0,0,0,0, - 0,5,0,0,0,4,0,0,0,67,0,0,0,115,166,0, - 0,0,116,0,0,124,0,0,124,1,0,124,2,0,131,3, - 0,1,124,2,0,100,1,0,107,4,0,114,46,0,116,1, - 0,124,0,0,124,1,0,124,2,0,131,3,0,125,0,0, - 116,2,0,106,3,0,131,0,0,1,124,0,0,116,4,0, - 106,5,0,107,7,0,114,84,0,116,6,0,124,0,0,116, - 7,0,131,2,0,83,116,4,0,106,5,0,124,0,0,25, - 125,3,0,124,3,0,100,2,0,107,8,0,114,152,0,116, - 2,0,106,8,0,131,0,0,1,100,3,0,106,9,0,124, - 0,0,131,1,0,125,4,0,116,10,0,124,4,0,100,4, - 0,124,0,0,131,1,1,130,1,0,116,11,0,124,0,0, - 131,1,0,1,124,3,0,83,41,5,97,50,1,0,0,73, - 109,112,111,114,116,32,97,110,100,32,114,101,116,117,114,110, - 32,116,104,101,32,109,111,100,117,108,101,32,98,97,115,101, - 100,32,111,110,32,105,116,115,32,110,97,109,101,44,32,116, - 104,101,32,112,97,99,107,97,103,101,32,116,104,101,32,99, - 97,108,108,32,105,115,10,32,32,32,32,98,101,105,110,103, - 32,109,97,100,101,32,102,114,111,109,44,32,97,110,100,32, - 116,104,101,32,108,101,118,101,108,32,97,100,106,117,115,116, - 109,101,110,116,46,10,10,32,32,32,32,84,104,105,115,32, - 102,117,110,99,116,105,111,110,32,114,101,112,114,101,115,101, - 110,116,115,32,116,104,101,32,103,114,101,97,116,101,115,116, - 32,99,111,109,109,111,110,32,100,101,110,111,109,105,110,97, - 116,111,114,32,111,102,32,102,117,110,99,116,105,111,110,97, - 108,105,116,121,10,32,32,32,32,98,101,116,119,101,101,110, - 32,105,109,112,111,114,116,95,109,111,100,117,108,101,32,97, - 110,100,32,95,95,105,109,112,111,114,116,95,95,46,32,84, - 104,105,115,32,105,110,99,108,117,100,101,115,32,115,101,116, - 116,105,110,103,32,95,95,112,97,99,107,97,103,101,95,95, - 32,105,102,10,32,32,32,32,116,104,101,32,108,111,97,100, - 101,114,32,100,105,100,32,110,111,116,46,10,10,32,32,32, - 32,114,33,0,0,0,78,122,40,105,109,112,111,114,116,32, - 111,102,32,123,125,32,104,97,108,116,101,100,59,32,78,111, - 110,101,32,105,110,32,115,121,115,46,109,111,100,117,108,101, - 115,114,15,0,0,0,41,12,114,181,0,0,0,114,171,0, - 0,0,114,57,0,0,0,114,145,0,0,0,114,14,0,0, - 0,114,21,0,0,0,114,185,0,0,0,218,11,95,103,99, - 100,95,105,109,112,111,114,116,114,58,0,0,0,114,50,0, - 0,0,114,77,0,0,0,114,63,0,0,0,41,5,114,15, - 0,0,0,114,169,0,0,0,114,170,0,0,0,114,89,0, - 0,0,114,74,0,0,0,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,114,186,0,0,0,204,3,0,0,115, - 28,0,0,0,0,9,16,1,12,1,18,1,10,1,15,1, - 13,1,13,1,12,1,10,1,6,1,9,1,18,1,10,1, - 114,186,0,0,0,99,3,0,0,0,0,0,0,0,6,0, - 0,0,17,0,0,0,67,0,0,0,115,239,0,0,0,116, - 0,0,124,0,0,100,1,0,131,2,0,114,235,0,100,2, - 0,124,1,0,107,6,0,114,83,0,116,1,0,124,1,0, - 131,1,0,125,1,0,124,1,0,106,2,0,100,2,0,131, - 1,0,1,116,0,0,124,0,0,100,3,0,131,2,0,114, - 83,0,124,1,0,106,3,0,124,0,0,106,4,0,131,1, - 0,1,120,149,0,124,1,0,68,93,141,0,125,3,0,116, - 0,0,124,0,0,124,3,0,131,2,0,115,90,0,100,4, - 0,106,5,0,124,0,0,106,6,0,124,3,0,131,2,0, - 125,4,0,121,17,0,116,7,0,124,2,0,124,4,0,131, - 2,0,1,87,113,90,0,4,116,8,0,107,10,0,114,230, - 0,1,125,5,0,1,122,47,0,116,9,0,124,5,0,131, - 1,0,106,10,0,116,11,0,131,1,0,114,209,0,124,5, - 0,106,12,0,124,4,0,107,2,0,114,209,0,119,90,0, - 130,0,0,87,89,100,5,0,100,5,0,125,5,0,126,5, - 0,88,113,90,0,88,113,90,0,87,124,0,0,83,41,6, - 122,238,70,105,103,117,114,101,32,111,117,116,32,119,104,97, - 116,32,95,95,105,109,112,111,114,116,95,95,32,115,104,111, - 117,108,100,32,114,101,116,117,114,110,46,10,10,32,32,32, - 32,84,104,101,32,105,109,112,111,114,116,95,32,112,97,114, - 97,109,101,116,101,114,32,105,115,32,97,32,99,97,108,108, - 97,98,108,101,32,119,104,105,99,104,32,116,97,107,101,115, - 32,116,104,101,32,110,97,109,101,32,111,102,32,109,111,100, - 117,108,101,32,116,111,10,32,32,32,32,105,109,112,111,114, - 116,46,32,73,116,32,105,115,32,114,101,113,117,105,114,101, - 100,32,116,111,32,100,101,99,111,117,112,108,101,32,116,104, - 101,32,102,117,110,99,116,105,111,110,32,102,114,111,109,32, - 97,115,115,117,109,105,110,103,32,105,109,112,111,114,116,108, - 105,98,39,115,10,32,32,32,32,105,109,112,111,114,116,32, - 105,109,112,108,101,109,101,110,116,97,116,105,111,110,32,105, - 115,32,100,101,115,105,114,101,100,46,10,10,32,32,32,32, - 114,131,0,0,0,250,1,42,218,7,95,95,97,108,108,95, - 95,122,5,123,125,46,123,125,78,41,13,114,4,0,0,0, - 114,130,0,0,0,218,6,114,101,109,111,118,101,218,6,101, - 120,116,101,110,100,114,188,0,0,0,114,50,0,0,0,114, - 1,0,0,0,114,65,0,0,0,114,77,0,0,0,114,178, - 0,0,0,114,71,0,0,0,218,15,95,69,82,82,95,77, - 83,71,95,80,82,69,70,73,88,114,15,0,0,0,41,6, - 114,89,0,0,0,218,8,102,114,111,109,108,105,115,116,114, - 183,0,0,0,218,1,120,90,9,102,114,111,109,95,110,97, - 109,101,90,3,101,120,99,114,10,0,0,0,114,10,0,0, - 0,114,11,0,0,0,218,16,95,104,97,110,100,108,101,95, - 102,114,111,109,108,105,115,116,228,3,0,0,115,34,0,0, - 0,0,10,15,1,12,1,12,1,13,1,15,1,16,1,13, - 1,15,1,21,1,3,1,17,1,18,4,21,1,15,1,3, - 1,26,1,114,194,0,0,0,99,1,0,0,0,0,0,0, - 0,2,0,0,0,2,0,0,0,67,0,0,0,115,72,0, - 0,0,124,0,0,106,0,0,100,1,0,131,1,0,125,1, - 0,124,1,0,100,2,0,107,8,0,114,68,0,124,0,0, - 100,3,0,25,125,1,0,100,4,0,124,0,0,107,7,0, - 114,68,0,124,1,0,106,1,0,100,5,0,131,1,0,100, - 6,0,25,125,1,0,124,1,0,83,41,7,122,167,67,97, - 108,99,117,108,97,116,101,32,119,104,97,116,32,95,95,112, - 97,99,107,97,103,101,95,95,32,115,104,111,117,108,100,32, - 98,101,46,10,10,32,32,32,32,95,95,112,97,99,107,97, - 103,101,95,95,32,105,115,32,110,111,116,32,103,117,97,114, - 97,110,116,101,101,100,32,116,111,32,98,101,32,100,101,102, - 105,110,101,100,32,111,114,32,99,111,117,108,100,32,98,101, - 32,115,101,116,32,116,111,32,78,111,110,101,10,32,32,32, - 32,116,111,32,114,101,112,114,101,115,101,110,116,32,116,104, - 97,116,32,105,116,115,32,112,114,111,112,101,114,32,118,97, - 108,117,101,32,105,115,32,117,110,107,110,111,119,110,46,10, - 10,32,32,32,32,114,134,0,0,0,78,114,1,0,0,0, - 114,131,0,0,0,114,121,0,0,0,114,33,0,0,0,41, - 2,114,42,0,0,0,114,122,0,0,0,41,2,218,7,103, - 108,111,98,97,108,115,114,169,0,0,0,114,10,0,0,0, - 114,10,0,0,0,114,11,0,0,0,218,17,95,99,97,108, - 99,95,95,95,112,97,99,107,97,103,101,95,95,4,4,0, - 0,115,12,0,0,0,0,7,15,1,12,1,10,1,12,1, - 19,1,114,196,0,0,0,99,5,0,0,0,0,0,0,0, - 9,0,0,0,5,0,0,0,67,0,0,0,115,227,0,0, - 0,124,4,0,100,1,0,107,2,0,114,27,0,116,0,0, - 124,0,0,131,1,0,125,5,0,110,54,0,124,1,0,100, - 2,0,107,9,0,114,45,0,124,1,0,110,3,0,105,0, - 0,125,6,0,116,1,0,124,6,0,131,1,0,125,7,0, - 116,0,0,124,0,0,124,7,0,124,4,0,131,3,0,125, - 5,0,124,3,0,115,207,0,124,4,0,100,1,0,107,2, - 0,114,122,0,116,0,0,124,0,0,106,2,0,100,3,0, - 131,1,0,100,1,0,25,131,1,0,83,124,0,0,115,132, - 0,124,5,0,83,116,3,0,124,0,0,131,1,0,116,3, - 0,124,0,0,106,2,0,100,3,0,131,1,0,100,1,0, - 25,131,1,0,24,125,8,0,116,4,0,106,5,0,124,5, - 0,106,6,0,100,2,0,116,3,0,124,5,0,106,6,0, - 131,1,0,124,8,0,24,133,2,0,25,25,83,110,16,0, - 116,7,0,124,5,0,124,3,0,116,0,0,131,3,0,83, - 100,2,0,83,41,4,97,215,1,0,0,73,109,112,111,114, - 116,32,97,32,109,111,100,117,108,101,46,10,10,32,32,32, - 32,84,104,101,32,39,103,108,111,98,97,108,115,39,32,97, - 114,103,117,109,101,110,116,32,105,115,32,117,115,101,100,32, - 116,111,32,105,110,102,101,114,32,119,104,101,114,101,32,116, - 104,101,32,105,109,112,111,114,116,32,105,115,32,111,99,99, - 117,114,114,105,110,103,32,102,114,111,109,10,32,32,32,32, - 116,111,32,104,97,110,100,108,101,32,114,101,108,97,116,105, - 118,101,32,105,109,112,111,114,116,115,46,32,84,104,101,32, - 39,108,111,99,97,108,115,39,32,97,114,103,117,109,101,110, - 116,32,105,115,32,105,103,110,111,114,101,100,46,32,84,104, - 101,10,32,32,32,32,39,102,114,111,109,108,105,115,116,39, - 32,97,114,103,117,109,101,110,116,32,115,112,101,99,105,102, - 105,101,115,32,119,104,97,116,32,115,104,111,117,108,100,32, - 101,120,105,115,116,32,97,115,32,97,116,116,114,105,98,117, - 116,101,115,32,111,110,32,116,104,101,32,109,111,100,117,108, - 101,10,32,32,32,32,98,101,105,110,103,32,105,109,112,111, - 114,116,101,100,32,40,101,46,103,46,32,96,96,102,114,111, - 109,32,109,111,100,117,108,101,32,105,109,112,111,114,116,32, - 60,102,114,111,109,108,105,115,116,62,96,96,41,46,32,32, - 84,104,101,32,39,108,101,118,101,108,39,10,32,32,32,32, - 97,114,103,117,109,101,110,116,32,114,101,112,114,101,115,101, - 110,116,115,32,116,104,101,32,112,97,99,107,97,103,101,32, - 108,111,99,97,116,105,111,110,32,116,111,32,105,109,112,111, - 114,116,32,102,114,111,109,32,105,110,32,97,32,114,101,108, - 97,116,105,118,101,10,32,32,32,32,105,109,112,111,114,116, - 32,40,101,46,103,46,32,96,96,102,114,111,109,32,46,46, - 112,107,103,32,105,109,112,111,114,116,32,109,111,100,96,96, - 32,119,111,117,108,100,32,104,97,118,101,32,97,32,39,108, - 101,118,101,108,39,32,111,102,32,50,41,46,10,10,32,32, - 32,32,114,33,0,0,0,78,114,121,0,0,0,41,8,114, - 186,0,0,0,114,196,0,0,0,218,9,112,97,114,116,105, - 116,105,111,110,114,167,0,0,0,114,14,0,0,0,114,21, - 0,0,0,114,1,0,0,0,114,194,0,0,0,41,9,114, - 15,0,0,0,114,195,0,0,0,218,6,108,111,99,97,108, - 115,114,192,0,0,0,114,170,0,0,0,114,89,0,0,0, - 90,8,103,108,111,98,97,108,115,95,114,169,0,0,0,90, - 7,99,117,116,95,111,102,102,114,10,0,0,0,114,10,0, - 0,0,114,11,0,0,0,218,10,95,95,105,109,112,111,114, - 116,95,95,19,4,0,0,115,26,0,0,0,0,11,12,1, - 15,2,24,1,12,1,18,1,6,3,12,1,23,1,6,1, - 4,4,35,3,40,2,114,199,0,0,0,99,1,0,0,0, - 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, - 115,53,0,0,0,116,0,0,106,1,0,124,0,0,131,1, - 0,125,1,0,124,1,0,100,0,0,107,8,0,114,43,0, - 116,2,0,100,1,0,124,0,0,23,131,1,0,130,1,0, - 116,3,0,124,1,0,131,1,0,83,41,2,78,122,25,110, - 111,32,98,117,105,108,116,45,105,110,32,109,111,100,117,108, - 101,32,110,97,109,101,100,32,41,4,114,150,0,0,0,114, - 154,0,0,0,114,77,0,0,0,114,149,0,0,0,41,2, - 114,15,0,0,0,114,88,0,0,0,114,10,0,0,0,114, - 10,0,0,0,114,11,0,0,0,218,18,95,98,117,105,108, - 116,105,110,95,102,114,111,109,95,110,97,109,101,54,4,0, - 0,115,8,0,0,0,0,1,15,1,12,1,16,1,114,200, - 0,0,0,99,2,0,0,0,0,0,0,0,12,0,0,0, - 12,0,0,0,67,0,0,0,115,74,1,0,0,124,1,0, - 97,0,0,124,0,0,97,1,0,116,2,0,116,1,0,131, - 1,0,125,2,0,120,123,0,116,1,0,106,3,0,106,4, - 0,131,0,0,68,93,106,0,92,2,0,125,3,0,125,4, - 0,116,5,0,124,4,0,124,2,0,131,2,0,114,40,0, - 124,3,0,116,1,0,106,6,0,107,6,0,114,91,0,116, - 7,0,125,5,0,110,27,0,116,0,0,106,8,0,124,3, - 0,131,1,0,114,40,0,116,9,0,125,5,0,110,3,0, - 113,40,0,116,10,0,124,4,0,124,5,0,131,2,0,125, - 6,0,116,11,0,124,6,0,124,4,0,131,2,0,1,113, - 40,0,87,116,1,0,106,3,0,116,12,0,25,125,7,0, - 120,73,0,100,5,0,68,93,65,0,125,8,0,124,8,0, - 116,1,0,106,3,0,107,7,0,114,206,0,116,13,0,124, - 8,0,131,1,0,125,9,0,110,13,0,116,1,0,106,3, - 0,124,8,0,25,125,9,0,116,14,0,124,7,0,124,8, - 0,124,9,0,131,3,0,1,113,170,0,87,121,16,0,116, - 13,0,100,2,0,131,1,0,125,10,0,87,110,24,0,4, - 116,15,0,107,10,0,114,25,1,1,1,1,100,3,0,125, - 10,0,89,110,1,0,88,116,14,0,124,7,0,100,2,0, - 124,10,0,131,3,0,1,116,13,0,100,4,0,131,1,0, - 125,11,0,116,14,0,124,7,0,100,4,0,124,11,0,131, - 3,0,1,100,3,0,83,41,6,122,250,83,101,116,117,112, - 32,105,109,112,111,114,116,108,105,98,32,98,121,32,105,109, - 112,111,114,116,105,110,103,32,110,101,101,100,101,100,32,98, - 117,105,108,116,45,105,110,32,109,111,100,117,108,101,115,32, - 97,110,100,32,105,110,106,101,99,116,105,110,103,32,116,104, - 101,109,10,32,32,32,32,105,110,116,111,32,116,104,101,32, - 103,108,111,98,97,108,32,110,97,109,101,115,112,97,99,101, - 46,10,10,32,32,32,32,65,115,32,115,121,115,32,105,115, - 32,110,101,101,100,101,100,32,102,111,114,32,115,121,115,46, - 109,111,100,117,108,101,115,32,97,99,99,101,115,115,32,97, - 110,100,32,95,105,109,112,32,105,115,32,110,101,101,100,101, - 100,32,116,111,32,108,111,97,100,32,98,117,105,108,116,45, - 105,110,10,32,32,32,32,109,111,100,117,108,101,115,44,32, - 116,104,111,115,101,32,116,119,111,32,109,111,100,117,108,101, - 115,32,109,117,115,116,32,98,101,32,101,120,112,108,105,99, - 105,116,108,121,32,112,97,115,115,101,100,32,105,110,46,10, - 10,32,32,32,32,114,141,0,0,0,114,34,0,0,0,78, - 114,62,0,0,0,41,1,114,141,0,0,0,41,16,114,57, - 0,0,0,114,14,0,0,0,114,13,0,0,0,114,21,0, - 0,0,218,5,105,116,101,109,115,114,177,0,0,0,114,76, - 0,0,0,114,150,0,0,0,114,82,0,0,0,114,160,0, - 0,0,114,132,0,0,0,114,137,0,0,0,114,1,0,0, - 0,114,200,0,0,0,114,5,0,0,0,114,77,0,0,0, - 41,12,218,10,115,121,115,95,109,111,100,117,108,101,218,11, - 95,105,109,112,95,109,111,100,117,108,101,90,11,109,111,100, - 117,108,101,95,116,121,112,101,114,15,0,0,0,114,89,0, - 0,0,114,99,0,0,0,114,88,0,0,0,90,11,115,101, - 108,102,95,109,111,100,117,108,101,90,12,98,117,105,108,116, - 105,110,95,110,97,109,101,90,14,98,117,105,108,116,105,110, - 95,109,111,100,117,108,101,90,13,116,104,114,101,97,100,95, - 109,111,100,117,108,101,90,14,119,101,97,107,114,101,102,95, - 109,111,100,117,108,101,114,10,0,0,0,114,10,0,0,0, - 114,11,0,0,0,218,6,95,115,101,116,117,112,61,4,0, - 0,115,50,0,0,0,0,9,6,1,6,3,12,1,28,1, - 15,1,15,1,9,1,15,1,9,2,3,1,15,1,17,3, - 13,1,13,1,15,1,15,2,13,1,20,3,3,1,16,1, - 13,2,11,1,16,3,12,1,114,204,0,0,0,99,2,0, - 0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,0, - 0,0,115,87,0,0,0,116,0,0,124,0,0,124,1,0, - 131,2,0,1,116,1,0,106,2,0,106,3,0,116,4,0, - 131,1,0,1,116,1,0,106,2,0,106,3,0,116,5,0, - 131,1,0,1,100,1,0,100,2,0,108,6,0,125,2,0, - 124,2,0,97,7,0,124,2,0,106,8,0,116,1,0,106, - 9,0,116,10,0,25,131,1,0,1,100,2,0,83,41,3, - 122,50,73,110,115,116,97,108,108,32,105,109,112,111,114,116, - 108,105,98,32,97,115,32,116,104,101,32,105,109,112,108,101, - 109,101,110,116,97,116,105,111,110,32,111,102,32,105,109,112, - 111,114,116,46,114,33,0,0,0,78,41,11,114,204,0,0, - 0,114,14,0,0,0,114,174,0,0,0,114,113,0,0,0, - 114,150,0,0,0,114,160,0,0,0,218,26,95,102,114,111, - 122,101,110,95,105,109,112,111,114,116,108,105,98,95,101,120, - 116,101,114,110,97,108,114,119,0,0,0,218,8,95,105,110, - 115,116,97,108,108,114,21,0,0,0,114,1,0,0,0,41, - 3,114,202,0,0,0,114,203,0,0,0,114,205,0,0,0, - 114,10,0,0,0,114,10,0,0,0,114,11,0,0,0,114, - 206,0,0,0,108,4,0,0,115,12,0,0,0,0,2,13, - 2,16,1,16,3,12,1,6,1,114,206,0,0,0,41,51, - 114,3,0,0,0,114,119,0,0,0,114,12,0,0,0,114, - 16,0,0,0,114,17,0,0,0,114,59,0,0,0,114,41, - 0,0,0,114,48,0,0,0,114,31,0,0,0,114,32,0, - 0,0,114,53,0,0,0,114,54,0,0,0,114,56,0,0, - 0,114,63,0,0,0,114,65,0,0,0,114,75,0,0,0, - 114,81,0,0,0,114,84,0,0,0,114,90,0,0,0,114, - 101,0,0,0,114,102,0,0,0,114,106,0,0,0,114,85, - 0,0,0,218,6,111,98,106,101,99,116,90,9,95,80,79, - 80,85,76,65,84,69,114,132,0,0,0,114,137,0,0,0, - 114,144,0,0,0,114,97,0,0,0,114,86,0,0,0,114, - 148,0,0,0,114,149,0,0,0,114,87,0,0,0,114,150, - 0,0,0,114,160,0,0,0,114,165,0,0,0,114,171,0, - 0,0,114,173,0,0,0,114,176,0,0,0,114,181,0,0, - 0,114,191,0,0,0,114,182,0,0,0,114,184,0,0,0, - 114,185,0,0,0,114,186,0,0,0,114,194,0,0,0,114, - 196,0,0,0,114,199,0,0,0,114,200,0,0,0,114,204, - 0,0,0,114,206,0,0,0,114,10,0,0,0,114,10,0, - 0,0,114,10,0,0,0,114,11,0,0,0,218,8,60,109, - 111,100,117,108,101,62,8,0,0,0,115,96,0,0,0,6, - 17,6,2,12,8,12,4,19,20,6,2,6,3,22,4,19, - 68,19,21,19,19,12,19,12,19,12,11,18,8,12,11,12, - 12,12,16,12,36,19,27,19,101,24,26,9,3,18,45,18, - 60,12,18,12,17,12,25,12,29,12,23,12,16,19,73,19, - 77,19,13,12,9,12,9,15,40,12,17,6,1,10,2,12, - 27,12,6,18,24,12,32,12,15,24,35,12,7,12,47, + 0,218,18,95,98,117,105,108,116,105,110,95,102,114,111,109, + 95,110,97,109,101,53,4,0,0,115,8,0,0,0,0,1, + 15,1,12,1,16,1,114,199,0,0,0,99,2,0,0,0, + 0,0,0,0,12,0,0,0,12,0,0,0,67,0,0,0, + 115,74,1,0,0,124,1,0,97,0,0,124,0,0,97,1, + 0,116,2,0,116,1,0,131,1,0,125,2,0,120,123,0, + 116,1,0,106,3,0,106,4,0,131,0,0,68,93,106,0, + 92,2,0,125,3,0,125,4,0,116,5,0,124,4,0,124, + 2,0,131,2,0,114,40,0,124,3,0,116,1,0,106,6, + 0,107,6,0,114,91,0,116,7,0,125,5,0,110,27,0, + 116,0,0,106,8,0,124,3,0,131,1,0,114,40,0,116, + 9,0,125,5,0,110,3,0,113,40,0,116,10,0,124,4, + 0,124,5,0,131,2,0,125,6,0,116,11,0,124,6,0, + 124,4,0,131,2,0,1,113,40,0,87,116,1,0,106,3, + 0,116,12,0,25,125,7,0,120,73,0,100,5,0,68,93, + 65,0,125,8,0,124,8,0,116,1,0,106,3,0,107,7, + 0,114,206,0,116,13,0,124,8,0,131,1,0,125,9,0, + 110,13,0,116,1,0,106,3,0,124,8,0,25,125,9,0, + 116,14,0,124,7,0,124,8,0,124,9,0,131,3,0,1, + 113,170,0,87,121,16,0,116,13,0,100,2,0,131,1,0, + 125,10,0,87,110,24,0,4,116,15,0,107,10,0,114,25, + 1,1,1,1,100,3,0,125,10,0,89,110,1,0,88,116, + 14,0,124,7,0,100,2,0,124,10,0,131,3,0,1,116, + 13,0,100,4,0,131,1,0,125,11,0,116,14,0,124,7, + 0,100,4,0,124,11,0,131,3,0,1,100,3,0,83,41, + 6,122,250,83,101,116,117,112,32,105,109,112,111,114,116,108, + 105,98,32,98,121,32,105,109,112,111,114,116,105,110,103,32, + 110,101,101,100,101,100,32,98,117,105,108,116,45,105,110,32, + 109,111,100,117,108,101,115,32,97,110,100,32,105,110,106,101, + 99,116,105,110,103,32,116,104,101,109,10,32,32,32,32,105, + 110,116,111,32,116,104,101,32,103,108,111,98,97,108,32,110, + 97,109,101,115,112,97,99,101,46,10,10,32,32,32,32,65, + 115,32,115,121,115,32,105,115,32,110,101,101,100,101,100,32, + 102,111,114,32,115,121,115,46,109,111,100,117,108,101,115,32, + 97,99,99,101,115,115,32,97,110,100,32,95,105,109,112,32, + 105,115,32,110,101,101,100,101,100,32,116,111,32,108,111,97, + 100,32,98,117,105,108,116,45,105,110,10,32,32,32,32,109, + 111,100,117,108,101,115,44,32,116,104,111,115,101,32,116,119, + 111,32,109,111,100,117,108,101,115,32,109,117,115,116,32,98, + 101,32,101,120,112,108,105,99,105,116,108,121,32,112,97,115, + 115,101,100,32,105,110,46,10,10,32,32,32,32,114,141,0, + 0,0,114,34,0,0,0,78,114,62,0,0,0,41,1,114, + 141,0,0,0,41,16,114,57,0,0,0,114,14,0,0,0, + 114,13,0,0,0,114,21,0,0,0,218,5,105,116,101,109, + 115,114,177,0,0,0,114,76,0,0,0,114,150,0,0,0, + 114,82,0,0,0,114,160,0,0,0,114,132,0,0,0,114, + 137,0,0,0,114,1,0,0,0,114,199,0,0,0,114,5, + 0,0,0,114,77,0,0,0,41,12,218,10,115,121,115,95, + 109,111,100,117,108,101,218,11,95,105,109,112,95,109,111,100, + 117,108,101,90,11,109,111,100,117,108,101,95,116,121,112,101, + 114,15,0,0,0,114,89,0,0,0,114,99,0,0,0,114, + 88,0,0,0,90,11,115,101,108,102,95,109,111,100,117,108, + 101,90,12,98,117,105,108,116,105,110,95,110,97,109,101,90, + 14,98,117,105,108,116,105,110,95,109,111,100,117,108,101,90, + 13,116,104,114,101,97,100,95,109,111,100,117,108,101,90,14, + 119,101,97,107,114,101,102,95,109,111,100,117,108,101,114,10, + 0,0,0,114,10,0,0,0,114,11,0,0,0,218,6,95, + 115,101,116,117,112,60,4,0,0,115,50,0,0,0,0,9, + 6,1,6,3,12,1,28,1,15,1,15,1,9,1,15,1, + 9,2,3,1,15,1,17,3,13,1,13,1,15,1,15,2, + 13,1,20,3,3,1,16,1,13,2,11,1,16,3,12,1, + 114,203,0,0,0,99,2,0,0,0,0,0,0,0,3,0, + 0,0,3,0,0,0,67,0,0,0,115,87,0,0,0,116, + 0,0,124,0,0,124,1,0,131,2,0,1,116,1,0,106, + 2,0,106,3,0,116,4,0,131,1,0,1,116,1,0,106, + 2,0,106,3,0,116,5,0,131,1,0,1,100,1,0,100, + 2,0,108,6,0,125,2,0,124,2,0,97,7,0,124,2, + 0,106,8,0,116,1,0,106,9,0,116,10,0,25,131,1, + 0,1,100,2,0,83,41,3,122,50,73,110,115,116,97,108, + 108,32,105,109,112,111,114,116,108,105,98,32,97,115,32,116, + 104,101,32,105,109,112,108,101,109,101,110,116,97,116,105,111, + 110,32,111,102,32,105,109,112,111,114,116,46,114,33,0,0, + 0,78,41,11,114,203,0,0,0,114,14,0,0,0,114,174, + 0,0,0,114,113,0,0,0,114,150,0,0,0,114,160,0, + 0,0,218,26,95,102,114,111,122,101,110,95,105,109,112,111, + 114,116,108,105,98,95,101,120,116,101,114,110,97,108,114,119, + 0,0,0,218,8,95,105,110,115,116,97,108,108,114,21,0, + 0,0,114,1,0,0,0,41,3,114,201,0,0,0,114,202, + 0,0,0,114,204,0,0,0,114,10,0,0,0,114,10,0, + 0,0,114,11,0,0,0,114,205,0,0,0,107,4,0,0, + 115,12,0,0,0,0,2,13,2,16,1,16,3,12,1,6, + 1,114,205,0,0,0,41,51,114,3,0,0,0,114,119,0, + 0,0,114,12,0,0,0,114,16,0,0,0,114,17,0,0, + 0,114,59,0,0,0,114,41,0,0,0,114,48,0,0,0, + 114,31,0,0,0,114,32,0,0,0,114,53,0,0,0,114, + 54,0,0,0,114,56,0,0,0,114,63,0,0,0,114,65, + 0,0,0,114,75,0,0,0,114,81,0,0,0,114,84,0, + 0,0,114,90,0,0,0,114,101,0,0,0,114,102,0,0, + 0,114,106,0,0,0,114,85,0,0,0,218,6,111,98,106, + 101,99,116,90,9,95,80,79,80,85,76,65,84,69,114,132, + 0,0,0,114,137,0,0,0,114,144,0,0,0,114,97,0, + 0,0,114,86,0,0,0,114,148,0,0,0,114,149,0,0, + 0,114,87,0,0,0,114,150,0,0,0,114,160,0,0,0, + 114,165,0,0,0,114,171,0,0,0,114,173,0,0,0,114, + 176,0,0,0,114,180,0,0,0,114,190,0,0,0,114,181, + 0,0,0,114,183,0,0,0,114,184,0,0,0,114,185,0, + 0,0,114,193,0,0,0,114,195,0,0,0,114,198,0,0, + 0,114,199,0,0,0,114,203,0,0,0,114,205,0,0,0, + 114,10,0,0,0,114,10,0,0,0,114,10,0,0,0,114, + 11,0,0,0,218,8,60,109,111,100,117,108,101,62,8,0, + 0,0,115,96,0,0,0,6,17,6,2,12,8,12,4,19, + 20,6,2,6,3,22,4,19,68,19,21,19,19,12,19,12, + 19,12,11,18,8,12,11,12,12,12,16,12,36,19,27,19, + 101,24,26,9,3,18,45,18,60,12,18,12,17,12,25,12, + 29,12,23,12,16,19,73,19,77,19,13,12,9,12,9,15, + 40,12,16,6,1,10,2,12,27,12,6,18,24,12,32,12, + 15,24,35,12,7,12,47, }; diff --git a/Python/importlib_external.h b/Python/importlib_external.h index 5ee843a..f337c8b 100644 --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -1,8 +1,8 @@ /* Auto-generated by Programs/_freeze_importlib.c */ const unsigned char _Py_M__importlib_external[] = { 99,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0, - 0,64,0,0,0,115,244,2,0,0,100,0,0,90,0,0, - 100,96,0,90,1,0,100,97,0,90,2,0,101,2,0,101, + 0,64,0,0,0,115,40,3,0,0,100,0,0,90,0,0, + 100,99,0,90,1,0,100,100,0,90,2,0,101,2,0,101, 1,0,23,90,3,0,100,4,0,100,5,0,132,0,0,90, 4,0,100,6,0,100,7,0,132,0,0,90,5,0,100,8, 0,100,9,0,132,0,0,90,6,0,100,10,0,100,11,0, @@ -14,2592 +14,2605 @@ const unsigned char _Py_M__importlib_external[] = { 0,101,14,0,101,13,0,106,15,0,131,1,0,90,16,0, 100,25,0,106,17,0,100,26,0,100,27,0,131,2,0,100, 28,0,23,90,18,0,101,19,0,106,20,0,101,18,0,100, - 27,0,131,2,0,90,21,0,100,29,0,90,22,0,100,30, - 0,90,23,0,100,31,0,103,1,0,90,24,0,100,32,0, - 103,1,0,90,25,0,101,25,0,4,90,26,0,90,27,0, - 100,33,0,100,34,0,100,33,0,100,35,0,100,36,0,132, - 1,1,90,28,0,100,37,0,100,38,0,132,0,0,90,29, - 0,100,39,0,100,40,0,132,0,0,90,30,0,100,41,0, - 100,42,0,132,0,0,90,31,0,100,43,0,100,44,0,132, - 0,0,90,32,0,100,45,0,100,46,0,100,47,0,100,48, - 0,132,0,1,90,33,0,100,49,0,100,50,0,132,0,0, - 90,34,0,100,51,0,100,52,0,132,0,0,90,35,0,100, - 33,0,100,33,0,100,33,0,100,53,0,100,54,0,132,3, - 0,90,36,0,100,33,0,100,33,0,100,33,0,100,55,0, - 100,56,0,132,3,0,90,37,0,100,57,0,100,57,0,100, - 58,0,100,59,0,132,2,0,90,38,0,100,60,0,100,61, - 0,132,0,0,90,39,0,101,40,0,131,0,0,90,41,0, - 100,33,0,100,62,0,100,33,0,100,63,0,101,41,0,100, - 64,0,100,65,0,132,1,2,90,42,0,71,100,66,0,100, - 67,0,132,0,0,100,67,0,131,2,0,90,43,0,71,100, - 68,0,100,69,0,132,0,0,100,69,0,131,2,0,90,44, - 0,71,100,70,0,100,71,0,132,0,0,100,71,0,101,44, - 0,131,3,0,90,45,0,71,100,72,0,100,73,0,132,0, - 0,100,73,0,131,2,0,90,46,0,71,100,74,0,100,75, - 0,132,0,0,100,75,0,101,46,0,101,45,0,131,4,0, - 90,47,0,71,100,76,0,100,77,0,132,0,0,100,77,0, - 101,46,0,101,44,0,131,4,0,90,48,0,103,0,0,90, - 49,0,71,100,78,0,100,79,0,132,0,0,100,79,0,101, - 46,0,101,44,0,131,4,0,90,50,0,71,100,80,0,100, - 81,0,132,0,0,100,81,0,131,2,0,90,51,0,71,100, - 82,0,100,83,0,132,0,0,100,83,0,131,2,0,90,52, - 0,71,100,84,0,100,85,0,132,0,0,100,85,0,131,2, - 0,90,53,0,71,100,86,0,100,87,0,132,0,0,100,87, - 0,131,2,0,90,54,0,100,33,0,100,88,0,100,89,0, - 132,1,0,90,55,0,100,90,0,100,91,0,132,0,0,90, - 56,0,100,92,0,100,93,0,132,0,0,90,57,0,100,94, - 0,100,95,0,132,0,0,90,58,0,100,33,0,83,41,98, - 97,94,1,0,0,67,111,114,101,32,105,109,112,108,101,109, - 101,110,116,97,116,105,111,110,32,111,102,32,112,97,116,104, - 45,98,97,115,101,100,32,105,109,112,111,114,116,46,10,10, - 84,104,105,115,32,109,111,100,117,108,101,32,105,115,32,78, - 79,84,32,109,101,97,110,116,32,116,111,32,98,101,32,100, - 105,114,101,99,116,108,121,32,105,109,112,111,114,116,101,100, - 33,32,73,116,32,104,97,115,32,98,101,101,110,32,100,101, - 115,105,103,110,101,100,32,115,117,99,104,10,116,104,97,116, - 32,105,116,32,99,97,110,32,98,101,32,98,111,111,116,115, - 116,114,97,112,112,101,100,32,105,110,116,111,32,80,121,116, - 104,111,110,32,97,115,32,116,104,101,32,105,109,112,108,101, - 109,101,110,116,97,116,105,111,110,32,111,102,32,105,109,112, - 111,114,116,46,32,65,115,10,115,117,99,104,32,105,116,32, - 114,101,113,117,105,114,101,115,32,116,104,101,32,105,110,106, - 101,99,116,105,111,110,32,111,102,32,115,112,101,99,105,102, - 105,99,32,109,111,100,117,108,101,115,32,97,110,100,32,97, - 116,116,114,105,98,117,116,101,115,32,105,110,32,111,114,100, - 101,114,32,116,111,10,119,111,114,107,46,32,79,110,101,32, - 115,104,111,117,108,100,32,117,115,101,32,105,109,112,111,114, - 116,108,105,98,32,97,115,32,116,104,101,32,112,117,98,108, - 105,99,45,102,97,99,105,110,103,32,118,101,114,115,105,111, - 110,32,111,102,32,116,104,105,115,32,109,111,100,117,108,101, - 46,10,10,218,3,119,105,110,218,6,99,121,103,119,105,110, - 218,6,100,97,114,119,105,110,99,0,0,0,0,0,0,0, - 0,1,0,0,0,3,0,0,0,3,0,0,0,115,88,0, - 0,0,116,0,0,106,1,0,106,2,0,116,3,0,131,1, - 0,114,72,0,116,0,0,106,1,0,106,2,0,116,4,0, - 131,1,0,114,45,0,100,1,0,137,0,0,110,6,0,100, - 2,0,137,0,0,135,0,0,102,1,0,100,3,0,100,4, - 0,134,0,0,125,0,0,110,12,0,100,5,0,100,4,0, - 132,0,0,125,0,0,124,0,0,83,41,6,78,90,12,80, - 89,84,72,79,78,67,65,83,69,79,75,115,12,0,0,0, - 80,89,84,72,79,78,67,65,83,69,79,75,99,0,0,0, - 0,0,0,0,0,0,0,0,0,2,0,0,0,19,0,0, - 0,115,13,0,0,0,136,0,0,116,0,0,106,1,0,107, - 6,0,83,41,1,122,53,84,114,117,101,32,105,102,32,102, + 27,0,131,2,0,90,21,0,101,21,0,100,29,0,107,3, + 0,114,236,0,100,30,0,90,22,0,101,23,0,101,22,0, + 131,1,0,130,1,0,100,31,0,106,17,0,100,26,0,100, + 27,0,131,2,0,100,28,0,23,90,24,0,100,32,0,90, + 25,0,100,33,0,90,26,0,100,34,0,103,1,0,90,27, + 0,100,35,0,103,1,0,90,28,0,101,28,0,4,90,29, + 0,90,30,0,100,36,0,100,37,0,100,36,0,100,38,0, + 100,39,0,132,1,1,90,31,0,100,40,0,100,41,0,132, + 0,0,90,32,0,100,42,0,100,43,0,132,0,0,90,33, + 0,100,44,0,100,45,0,132,0,0,90,34,0,100,46,0, + 100,47,0,132,0,0,90,35,0,100,48,0,100,49,0,100, + 50,0,100,51,0,132,0,1,90,36,0,100,52,0,100,53, + 0,132,0,0,90,37,0,100,54,0,100,55,0,132,0,0, + 90,38,0,100,36,0,100,36,0,100,36,0,100,56,0,100, + 57,0,132,3,0,90,39,0,100,36,0,100,36,0,100,36, + 0,100,58,0,100,59,0,132,3,0,90,40,0,100,60,0, + 100,60,0,100,61,0,100,62,0,132,2,0,90,41,0,100, + 63,0,100,64,0,132,0,0,90,42,0,101,43,0,131,0, + 0,90,44,0,100,36,0,100,65,0,100,36,0,100,66,0, + 101,44,0,100,67,0,100,68,0,132,1,2,90,45,0,71, + 100,69,0,100,70,0,132,0,0,100,70,0,131,2,0,90, + 46,0,71,100,71,0,100,72,0,132,0,0,100,72,0,131, + 2,0,90,47,0,71,100,73,0,100,74,0,132,0,0,100, + 74,0,101,47,0,131,3,0,90,48,0,71,100,75,0,100, + 76,0,132,0,0,100,76,0,131,2,0,90,49,0,71,100, + 77,0,100,78,0,132,0,0,100,78,0,101,49,0,101,48, + 0,131,4,0,90,50,0,71,100,79,0,100,80,0,132,0, + 0,100,80,0,101,49,0,101,47,0,131,4,0,90,51,0, + 103,0,0,90,52,0,71,100,81,0,100,82,0,132,0,0, + 100,82,0,101,49,0,101,47,0,131,4,0,90,53,0,71, + 100,83,0,100,84,0,132,0,0,100,84,0,131,2,0,90, + 54,0,71,100,85,0,100,86,0,132,0,0,100,86,0,131, + 2,0,90,55,0,71,100,87,0,100,88,0,132,0,0,100, + 88,0,131,2,0,90,56,0,71,100,89,0,100,90,0,132, + 0,0,100,90,0,131,2,0,90,57,0,100,36,0,100,91, + 0,100,92,0,132,1,0,90,58,0,100,93,0,100,94,0, + 132,0,0,90,59,0,100,95,0,100,96,0,132,0,0,90, + 60,0,100,97,0,100,98,0,132,0,0,90,61,0,100,36, + 0,83,41,101,97,94,1,0,0,67,111,114,101,32,105,109, + 112,108,101,109,101,110,116,97,116,105,111,110,32,111,102,32, + 112,97,116,104,45,98,97,115,101,100,32,105,109,112,111,114, + 116,46,10,10,84,104,105,115,32,109,111,100,117,108,101,32, + 105,115,32,78,79,84,32,109,101,97,110,116,32,116,111,32, + 98,101,32,100,105,114,101,99,116,108,121,32,105,109,112,111, + 114,116,101,100,33,32,73,116,32,104,97,115,32,98,101,101, + 110,32,100,101,115,105,103,110,101,100,32,115,117,99,104,10, + 116,104,97,116,32,105,116,32,99,97,110,32,98,101,32,98, + 111,111,116,115,116,114,97,112,112,101,100,32,105,110,116,111, + 32,80,121,116,104,111,110,32,97,115,32,116,104,101,32,105, + 109,112,108,101,109,101,110,116,97,116,105,111,110,32,111,102, + 32,105,109,112,111,114,116,46,32,65,115,10,115,117,99,104, + 32,105,116,32,114,101,113,117,105,114,101,115,32,116,104,101, + 32,105,110,106,101,99,116,105,111,110,32,111,102,32,115,112, + 101,99,105,102,105,99,32,109,111,100,117,108,101,115,32,97, + 110,100,32,97,116,116,114,105,98,117,116,101,115,32,105,110, + 32,111,114,100,101,114,32,116,111,10,119,111,114,107,46,32, + 79,110,101,32,115,104,111,117,108,100,32,117,115,101,32,105, + 109,112,111,114,116,108,105,98,32,97,115,32,116,104,101,32, + 112,117,98,108,105,99,45,102,97,99,105,110,103,32,118,101, + 114,115,105,111,110,32,111,102,32,116,104,105,115,32,109,111, + 100,117,108,101,46,10,10,218,3,119,105,110,218,6,99,121, + 103,119,105,110,218,6,100,97,114,119,105,110,99,0,0,0, + 0,0,0,0,0,1,0,0,0,3,0,0,0,3,0,0, + 0,115,88,0,0,0,116,0,0,106,1,0,106,2,0,116, + 3,0,131,1,0,114,72,0,116,0,0,106,1,0,106,2, + 0,116,4,0,131,1,0,114,45,0,100,1,0,137,0,0, + 110,6,0,100,2,0,137,0,0,135,0,0,102,1,0,100, + 3,0,100,4,0,134,0,0,125,0,0,110,12,0,100,5, + 0,100,4,0,132,0,0,125,0,0,124,0,0,83,41,6, + 78,90,12,80,89,84,72,79,78,67,65,83,69,79,75,115, + 12,0,0,0,80,89,84,72,79,78,67,65,83,69,79,75, + 99,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0, + 0,19,0,0,0,115,13,0,0,0,136,0,0,116,0,0, + 106,1,0,107,6,0,83,41,1,122,53,84,114,117,101,32, + 105,102,32,102,105,108,101,110,97,109,101,115,32,109,117,115, + 116,32,98,101,32,99,104,101,99,107,101,100,32,99,97,115, + 101,45,105,110,115,101,110,115,105,116,105,118,101,108,121,46, + 41,2,218,3,95,111,115,90,7,101,110,118,105,114,111,110, + 169,0,41,1,218,3,107,101,121,114,4,0,0,0,250,38, + 60,102,114,111,122,101,110,32,105,109,112,111,114,116,108,105, + 98,46,95,98,111,111,116,115,116,114,97,112,95,101,120,116, + 101,114,110,97,108,62,218,11,95,114,101,108,97,120,95,99, + 97,115,101,37,0,0,0,115,2,0,0,0,0,2,122,37, + 95,109,97,107,101,95,114,101,108,97,120,95,99,97,115,101, + 46,60,108,111,99,97,108,115,62,46,95,114,101,108,97,120, + 95,99,97,115,101,99,0,0,0,0,0,0,0,0,0,0, + 0,0,1,0,0,0,83,0,0,0,115,4,0,0,0,100, + 1,0,83,41,2,122,53,84,114,117,101,32,105,102,32,102, 105,108,101,110,97,109,101,115,32,109,117,115,116,32,98,101, 32,99,104,101,99,107,101,100,32,99,97,115,101,45,105,110, - 115,101,110,115,105,116,105,118,101,108,121,46,41,2,218,3, - 95,111,115,90,7,101,110,118,105,114,111,110,169,0,41,1, - 218,3,107,101,121,114,4,0,0,0,250,38,60,102,114,111, - 122,101,110,32,105,109,112,111,114,116,108,105,98,46,95,98, - 111,111,116,115,116,114,97,112,95,101,120,116,101,114,110,97, - 108,62,218,11,95,114,101,108,97,120,95,99,97,115,101,37, - 0,0,0,115,2,0,0,0,0,2,122,37,95,109,97,107, - 101,95,114,101,108,97,120,95,99,97,115,101,46,60,108,111, - 99,97,108,115,62,46,95,114,101,108,97,120,95,99,97,115, - 101,99,0,0,0,0,0,0,0,0,0,0,0,0,1,0, - 0,0,83,0,0,0,115,4,0,0,0,100,1,0,83,41, - 2,122,53,84,114,117,101,32,105,102,32,102,105,108,101,110, - 97,109,101,115,32,109,117,115,116,32,98,101,32,99,104,101, - 99,107,101,100,32,99,97,115,101,45,105,110,115,101,110,115, - 105,116,105,118,101,108,121,46,70,114,4,0,0,0,114,4, + 115,101,110,115,105,116,105,118,101,108,121,46,70,114,4,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,7,0,0,0,41,0,0,0,115, + 2,0,0,0,0,2,41,5,218,3,115,121,115,218,8,112, + 108,97,116,102,111,114,109,218,10,115,116,97,114,116,115,119, + 105,116,104,218,27,95,67,65,83,69,95,73,78,83,69,78, + 83,73,84,73,86,69,95,80,76,65,84,70,79,82,77,83, + 218,35,95,67,65,83,69,95,73,78,83,69,78,83,73,84, + 73,86,69,95,80,76,65,84,70,79,82,77,83,95,83,84, + 82,95,75,69,89,41,1,114,7,0,0,0,114,4,0,0, + 0,41,1,114,5,0,0,0,114,6,0,0,0,218,16,95, + 109,97,107,101,95,114,101,108,97,120,95,99,97,115,101,30, + 0,0,0,115,14,0,0,0,0,1,18,1,18,1,9,2, + 6,2,21,4,12,3,114,13,0,0,0,99,1,0,0,0, + 0,0,0,0,1,0,0,0,3,0,0,0,67,0,0,0, + 115,26,0,0,0,116,0,0,124,0,0,131,1,0,100,1, + 0,64,106,1,0,100,2,0,100,3,0,131,2,0,83,41, + 4,122,42,67,111,110,118,101,114,116,32,97,32,51,50,45, + 98,105,116,32,105,110,116,101,103,101,114,32,116,111,32,108, + 105,116,116,108,101,45,101,110,100,105,97,110,46,108,3,0, + 0,0,255,127,255,127,3,0,233,4,0,0,0,218,6,108, + 105,116,116,108,101,41,2,218,3,105,110,116,218,8,116,111, + 95,98,121,116,101,115,41,1,218,1,120,114,4,0,0,0, + 114,4,0,0,0,114,6,0,0,0,218,7,95,119,95,108, + 111,110,103,47,0,0,0,115,2,0,0,0,0,2,114,19, + 0,0,0,99,1,0,0,0,0,0,0,0,1,0,0,0, + 3,0,0,0,67,0,0,0,115,16,0,0,0,116,0,0, + 106,1,0,124,0,0,100,1,0,131,2,0,83,41,2,122, + 47,67,111,110,118,101,114,116,32,52,32,98,121,116,101,115, + 32,105,110,32,108,105,116,116,108,101,45,101,110,100,105,97, + 110,32,116,111,32,97,110,32,105,110,116,101,103,101,114,46, + 114,15,0,0,0,41,2,114,16,0,0,0,218,10,102,114, + 111,109,95,98,121,116,101,115,41,1,90,9,105,110,116,95, + 98,121,116,101,115,114,4,0,0,0,114,4,0,0,0,114, + 6,0,0,0,218,7,95,114,95,108,111,110,103,52,0,0, + 0,115,2,0,0,0,0,2,114,21,0,0,0,99,0,0, + 0,0,0,0,0,0,1,0,0,0,3,0,0,0,71,0, + 0,0,115,26,0,0,0,116,0,0,106,1,0,100,1,0, + 100,2,0,132,0,0,124,0,0,68,131,1,0,131,1,0, + 83,41,3,122,31,82,101,112,108,97,99,101,109,101,110,116, + 32,102,111,114,32,111,115,46,112,97,116,104,46,106,111,105, + 110,40,41,46,99,1,0,0,0,0,0,0,0,2,0,0, + 0,4,0,0,0,83,0,0,0,115,37,0,0,0,103,0, + 0,124,0,0,93,27,0,125,1,0,124,1,0,114,6,0, + 124,1,0,106,0,0,116,1,0,131,1,0,145,2,0,113, + 6,0,83,114,4,0,0,0,41,2,218,6,114,115,116,114, + 105,112,218,15,112,97,116,104,95,115,101,112,97,114,97,116, + 111,114,115,41,2,218,2,46,48,218,4,112,97,114,116,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,250,10, + 60,108,105,115,116,99,111,109,112,62,59,0,0,0,115,2, + 0,0,0,9,1,122,30,95,112,97,116,104,95,106,111,105, + 110,46,60,108,111,99,97,108,115,62,46,60,108,105,115,116, + 99,111,109,112,62,41,2,218,8,112,97,116,104,95,115,101, + 112,218,4,106,111,105,110,41,1,218,10,112,97,116,104,95, + 112,97,114,116,115,114,4,0,0,0,114,4,0,0,0,114, + 6,0,0,0,218,10,95,112,97,116,104,95,106,111,105,110, + 57,0,0,0,115,4,0,0,0,0,2,15,1,114,30,0, + 0,0,99,1,0,0,0,0,0,0,0,5,0,0,0,5, + 0,0,0,67,0,0,0,115,134,0,0,0,116,0,0,116, + 1,0,131,1,0,100,1,0,107,2,0,114,52,0,124,0, + 0,106,2,0,116,3,0,131,1,0,92,3,0,125,1,0, + 125,2,0,125,3,0,124,1,0,124,3,0,102,2,0,83, + 120,69,0,116,4,0,124,0,0,131,1,0,68,93,55,0, + 125,4,0,124,4,0,116,1,0,107,6,0,114,65,0,124, + 0,0,106,5,0,124,4,0,100,2,0,100,1,0,131,1, + 1,92,2,0,125,1,0,125,3,0,124,1,0,124,3,0, + 102,2,0,83,113,65,0,87,100,3,0,124,0,0,102,2, + 0,83,41,4,122,32,82,101,112,108,97,99,101,109,101,110, + 116,32,102,111,114,32,111,115,46,112,97,116,104,46,115,112, + 108,105,116,40,41,46,233,1,0,0,0,90,8,109,97,120, + 115,112,108,105,116,218,0,41,6,218,3,108,101,110,114,23, + 0,0,0,218,10,114,112,97,114,116,105,116,105,111,110,114, + 27,0,0,0,218,8,114,101,118,101,114,115,101,100,218,6, + 114,115,112,108,105,116,41,5,218,4,112,97,116,104,90,5, + 102,114,111,110,116,218,1,95,218,4,116,97,105,108,114,18, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,7,0,0,0,41,0,0,0,115,2,0,0,0, - 0,2,41,5,218,3,115,121,115,218,8,112,108,97,116,102, - 111,114,109,218,10,115,116,97,114,116,115,119,105,116,104,218, - 27,95,67,65,83,69,95,73,78,83,69,78,83,73,84,73, - 86,69,95,80,76,65,84,70,79,82,77,83,218,35,95,67, - 65,83,69,95,73,78,83,69,78,83,73,84,73,86,69,95, - 80,76,65,84,70,79,82,77,83,95,83,84,82,95,75,69, - 89,41,1,114,7,0,0,0,114,4,0,0,0,41,1,114, - 5,0,0,0,114,6,0,0,0,218,16,95,109,97,107,101, - 95,114,101,108,97,120,95,99,97,115,101,30,0,0,0,115, - 14,0,0,0,0,1,18,1,18,1,9,2,6,2,21,4, - 12,3,114,13,0,0,0,99,1,0,0,0,0,0,0,0, - 1,0,0,0,3,0,0,0,67,0,0,0,115,26,0,0, - 0,116,0,0,124,0,0,131,1,0,100,1,0,64,106,1, - 0,100,2,0,100,3,0,131,2,0,83,41,4,122,42,67, - 111,110,118,101,114,116,32,97,32,51,50,45,98,105,116,32, - 105,110,116,101,103,101,114,32,116,111,32,108,105,116,116,108, - 101,45,101,110,100,105,97,110,46,108,3,0,0,0,255,127, - 255,127,3,0,233,4,0,0,0,218,6,108,105,116,116,108, - 101,41,2,218,3,105,110,116,218,8,116,111,95,98,121,116, - 101,115,41,1,218,1,120,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,218,7,95,119,95,108,111,110,103,47, - 0,0,0,115,2,0,0,0,0,2,114,19,0,0,0,99, - 1,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0, - 67,0,0,0,115,16,0,0,0,116,0,0,106,1,0,124, - 0,0,100,1,0,131,2,0,83,41,2,122,47,67,111,110, - 118,101,114,116,32,52,32,98,121,116,101,115,32,105,110,32, - 108,105,116,116,108,101,45,101,110,100,105,97,110,32,116,111, - 32,97,110,32,105,110,116,101,103,101,114,46,114,15,0,0, - 0,41,2,114,16,0,0,0,218,10,102,114,111,109,95,98, - 121,116,101,115,41,1,90,9,105,110,116,95,98,121,116,101, - 115,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,7,95,114,95,108,111,110,103,52,0,0,0,115,2,0, - 0,0,0,2,114,21,0,0,0,99,0,0,0,0,0,0, - 0,0,1,0,0,0,3,0,0,0,71,0,0,0,115,26, - 0,0,0,116,0,0,106,1,0,100,1,0,100,2,0,132, - 0,0,124,0,0,68,131,1,0,131,1,0,83,41,3,122, - 31,82,101,112,108,97,99,101,109,101,110,116,32,102,111,114, - 32,111,115,46,112,97,116,104,46,106,111,105,110,40,41,46, - 99,1,0,0,0,0,0,0,0,2,0,0,0,4,0,0, - 0,83,0,0,0,115,37,0,0,0,103,0,0,124,0,0, - 93,27,0,125,1,0,124,1,0,114,6,0,124,1,0,106, - 0,0,116,1,0,131,1,0,145,2,0,113,6,0,83,114, - 4,0,0,0,41,2,218,6,114,115,116,114,105,112,218,15, - 112,97,116,104,95,115,101,112,97,114,97,116,111,114,115,41, - 2,218,2,46,48,218,4,112,97,114,116,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,250,10,60,108,105,115, - 116,99,111,109,112,62,59,0,0,0,115,2,0,0,0,9, - 1,122,30,95,112,97,116,104,95,106,111,105,110,46,60,108, - 111,99,97,108,115,62,46,60,108,105,115,116,99,111,109,112, - 62,41,2,218,8,112,97,116,104,95,115,101,112,218,4,106, - 111,105,110,41,1,218,10,112,97,116,104,95,112,97,114,116, - 115,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,10,95,112,97,116,104,95,106,111,105,110,57,0,0,0, - 115,4,0,0,0,0,2,15,1,114,30,0,0,0,99,1, - 0,0,0,0,0,0,0,5,0,0,0,5,0,0,0,67, - 0,0,0,115,134,0,0,0,116,0,0,116,1,0,131,1, - 0,100,1,0,107,2,0,114,52,0,124,0,0,106,2,0, - 116,3,0,131,1,0,92,3,0,125,1,0,125,2,0,125, - 3,0,124,1,0,124,3,0,102,2,0,83,120,69,0,116, - 4,0,124,0,0,131,1,0,68,93,55,0,125,4,0,124, - 4,0,116,1,0,107,6,0,114,65,0,124,0,0,106,5, - 0,124,4,0,100,2,0,100,1,0,131,1,1,92,2,0, - 125,1,0,125,3,0,124,1,0,124,3,0,102,2,0,83, - 113,65,0,87,100,3,0,124,0,0,102,2,0,83,41,4, - 122,32,82,101,112,108,97,99,101,109,101,110,116,32,102,111, - 114,32,111,115,46,112,97,116,104,46,115,112,108,105,116,40, - 41,46,233,1,0,0,0,90,8,109,97,120,115,112,108,105, - 116,218,0,41,6,218,3,108,101,110,114,23,0,0,0,218, - 10,114,112,97,114,116,105,116,105,111,110,114,27,0,0,0, - 218,8,114,101,118,101,114,115,101,100,218,6,114,115,112,108, - 105,116,41,5,218,4,112,97,116,104,90,5,102,114,111,110, - 116,218,1,95,218,4,116,97,105,108,114,18,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,11, - 95,112,97,116,104,95,115,112,108,105,116,63,0,0,0,115, - 16,0,0,0,0,2,18,1,24,1,10,1,19,1,12,1, - 27,1,14,1,114,40,0,0,0,99,1,0,0,0,0,0, - 0,0,1,0,0,0,2,0,0,0,67,0,0,0,115,13, - 0,0,0,116,0,0,106,1,0,124,0,0,131,1,0,83, - 41,1,122,126,83,116,97,116,32,116,104,101,32,112,97,116, - 104,46,10,10,32,32,32,32,77,97,100,101,32,97,32,115, - 101,112,97,114,97,116,101,32,102,117,110,99,116,105,111,110, - 32,116,111,32,109,97,107,101,32,105,116,32,101,97,115,105, - 101,114,32,116,111,32,111,118,101,114,114,105,100,101,32,105, - 110,32,101,120,112,101,114,105,109,101,110,116,115,10,32,32, - 32,32,40,101,46,103,46,32,99,97,99,104,101,32,115,116, - 97,116,32,114,101,115,117,108,116,115,41,46,10,10,32,32, - 32,32,41,2,114,3,0,0,0,90,4,115,116,97,116,41, - 1,114,37,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,218,10,95,112,97,116,104,95,115,116,97, - 116,75,0,0,0,115,2,0,0,0,0,7,114,41,0,0, - 0,99,2,0,0,0,0,0,0,0,3,0,0,0,11,0, - 0,0,67,0,0,0,115,58,0,0,0,121,16,0,116,0, - 0,124,0,0,131,1,0,125,2,0,87,110,22,0,4,116, - 1,0,107,10,0,114,40,0,1,1,1,100,1,0,83,89, - 110,1,0,88,124,2,0,106,2,0,100,2,0,64,124,1, - 0,107,2,0,83,41,3,122,49,84,101,115,116,32,119,104, - 101,116,104,101,114,32,116,104,101,32,112,97,116,104,32,105, - 115,32,116,104,101,32,115,112,101,99,105,102,105,101,100,32, - 109,111,100,101,32,116,121,112,101,46,70,105,0,240,0,0, - 41,3,114,41,0,0,0,218,7,79,83,69,114,114,111,114, - 218,7,115,116,95,109,111,100,101,41,3,114,37,0,0,0, - 218,4,109,111,100,101,90,9,115,116,97,116,95,105,110,102, - 111,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,18,95,112,97,116,104,95,105,115,95,109,111,100,101,95, - 116,121,112,101,85,0,0,0,115,10,0,0,0,0,2,3, - 1,16,1,13,1,9,1,114,45,0,0,0,99,1,0,0, - 0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,0, - 0,115,13,0,0,0,116,0,0,124,0,0,100,1,0,131, - 2,0,83,41,2,122,31,82,101,112,108,97,99,101,109,101, + 0,0,218,11,95,112,97,116,104,95,115,112,108,105,116,63, + 0,0,0,115,16,0,0,0,0,2,18,1,24,1,10,1, + 19,1,12,1,27,1,14,1,114,40,0,0,0,99,1,0, + 0,0,0,0,0,0,1,0,0,0,2,0,0,0,67,0, + 0,0,115,13,0,0,0,116,0,0,106,1,0,124,0,0, + 131,1,0,83,41,1,122,126,83,116,97,116,32,116,104,101, + 32,112,97,116,104,46,10,10,32,32,32,32,77,97,100,101, + 32,97,32,115,101,112,97,114,97,116,101,32,102,117,110,99, + 116,105,111,110,32,116,111,32,109,97,107,101,32,105,116,32, + 101,97,115,105,101,114,32,116,111,32,111,118,101,114,114,105, + 100,101,32,105,110,32,101,120,112,101,114,105,109,101,110,116, + 115,10,32,32,32,32,40,101,46,103,46,32,99,97,99,104, + 101,32,115,116,97,116,32,114,101,115,117,108,116,115,41,46, + 10,10,32,32,32,32,41,2,114,3,0,0,0,90,4,115, + 116,97,116,41,1,114,37,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,218,10,95,112,97,116,104, + 95,115,116,97,116,75,0,0,0,115,2,0,0,0,0,7, + 114,41,0,0,0,99,2,0,0,0,0,0,0,0,3,0, + 0,0,11,0,0,0,67,0,0,0,115,58,0,0,0,121, + 16,0,116,0,0,124,0,0,131,1,0,125,2,0,87,110, + 22,0,4,116,1,0,107,10,0,114,40,0,1,1,1,100, + 1,0,83,89,110,1,0,88,124,2,0,106,2,0,100,2, + 0,64,124,1,0,107,2,0,83,41,3,122,49,84,101,115, + 116,32,119,104,101,116,104,101,114,32,116,104,101,32,112,97, + 116,104,32,105,115,32,116,104,101,32,115,112,101,99,105,102, + 105,101,100,32,109,111,100,101,32,116,121,112,101,46,70,105, + 0,240,0,0,41,3,114,41,0,0,0,218,7,79,83,69, + 114,114,111,114,218,7,115,116,95,109,111,100,101,41,3,114, + 37,0,0,0,218,4,109,111,100,101,90,9,115,116,97,116, + 95,105,110,102,111,114,4,0,0,0,114,4,0,0,0,114, + 6,0,0,0,218,18,95,112,97,116,104,95,105,115,95,109, + 111,100,101,95,116,121,112,101,85,0,0,0,115,10,0,0, + 0,0,2,3,1,16,1,13,1,9,1,114,45,0,0,0, + 99,1,0,0,0,0,0,0,0,1,0,0,0,3,0,0, + 0,67,0,0,0,115,13,0,0,0,116,0,0,124,0,0, + 100,1,0,131,2,0,83,41,2,122,31,82,101,112,108,97, + 99,101,109,101,110,116,32,102,111,114,32,111,115,46,112,97, + 116,104,46,105,115,102,105,108,101,46,105,0,128,0,0,41, + 1,114,45,0,0,0,41,1,114,37,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,218,12,95,112, + 97,116,104,95,105,115,102,105,108,101,94,0,0,0,115,2, + 0,0,0,0,2,114,46,0,0,0,99,1,0,0,0,0, + 0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,115, + 31,0,0,0,124,0,0,115,18,0,116,0,0,106,1,0, + 131,0,0,125,0,0,116,2,0,124,0,0,100,1,0,131, + 2,0,83,41,2,122,30,82,101,112,108,97,99,101,109,101, 110,116,32,102,111,114,32,111,115,46,112,97,116,104,46,105, - 115,102,105,108,101,46,105,0,128,0,0,41,1,114,45,0, - 0,0,41,1,114,37,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,12,95,112,97,116,104,95, - 105,115,102,105,108,101,94,0,0,0,115,2,0,0,0,0, - 2,114,46,0,0,0,99,1,0,0,0,0,0,0,0,1, - 0,0,0,3,0,0,0,67,0,0,0,115,31,0,0,0, - 124,0,0,115,18,0,116,0,0,106,1,0,131,0,0,125, - 0,0,116,2,0,124,0,0,100,1,0,131,2,0,83,41, - 2,122,30,82,101,112,108,97,99,101,109,101,110,116,32,102, - 111,114,32,111,115,46,112,97,116,104,46,105,115,100,105,114, - 46,105,0,64,0,0,41,3,114,3,0,0,0,218,6,103, - 101,116,99,119,100,114,45,0,0,0,41,1,114,37,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,11,95,112,97,116,104,95,105,115,100,105,114,99,0,0, - 0,115,6,0,0,0,0,2,6,1,12,1,114,48,0,0, - 0,105,182,1,0,0,99,3,0,0,0,0,0,0,0,6, - 0,0,0,17,0,0,0,67,0,0,0,115,193,0,0,0, - 100,1,0,106,0,0,124,0,0,116,1,0,124,0,0,131, - 1,0,131,2,0,125,3,0,116,2,0,106,3,0,124,3, - 0,116,2,0,106,4,0,116,2,0,106,5,0,66,116,2, - 0,106,6,0,66,124,2,0,100,2,0,64,131,3,0,125, - 4,0,121,61,0,116,7,0,106,8,0,124,4,0,100,3, - 0,131,2,0,143,20,0,125,5,0,124,5,0,106,9,0, - 124,1,0,131,1,0,1,87,100,4,0,81,82,88,116,2, - 0,106,10,0,124,3,0,124,0,0,131,2,0,1,87,110, - 59,0,4,116,11,0,107,10,0,114,188,0,1,1,1,121, - 17,0,116,2,0,106,12,0,124,3,0,131,1,0,1,87, - 110,18,0,4,116,11,0,107,10,0,114,180,0,1,1,1, - 89,110,1,0,88,130,0,0,89,110,1,0,88,100,4,0, - 83,41,5,122,162,66,101,115,116,45,101,102,102,111,114,116, - 32,102,117,110,99,116,105,111,110,32,116,111,32,119,114,105, - 116,101,32,100,97,116,97,32,116,111,32,97,32,112,97,116, - 104,32,97,116,111,109,105,99,97,108,108,121,46,10,32,32, - 32,32,66,101,32,112,114,101,112,97,114,101,100,32,116,111, - 32,104,97,110,100,108,101,32,97,32,70,105,108,101,69,120, - 105,115,116,115,69,114,114,111,114,32,105,102,32,99,111,110, - 99,117,114,114,101,110,116,32,119,114,105,116,105,110,103,32, - 111,102,32,116,104,101,10,32,32,32,32,116,101,109,112,111, - 114,97,114,121,32,102,105,108,101,32,105,115,32,97,116,116, - 101,109,112,116,101,100,46,122,5,123,125,46,123,125,105,182, - 1,0,0,90,2,119,98,78,41,13,218,6,102,111,114,109, - 97,116,218,2,105,100,114,3,0,0,0,90,4,111,112,101, - 110,90,6,79,95,69,88,67,76,90,7,79,95,67,82,69, - 65,84,90,8,79,95,87,82,79,78,76,89,218,3,95,105, - 111,218,6,70,105,108,101,73,79,218,5,119,114,105,116,101, - 218,7,114,101,112,108,97,99,101,114,42,0,0,0,90,6, - 117,110,108,105,110,107,41,6,114,37,0,0,0,218,4,100, - 97,116,97,114,44,0,0,0,90,8,112,97,116,104,95,116, - 109,112,90,2,102,100,218,4,102,105,108,101,114,4,0,0, - 0,114,4,0,0,0,114,6,0,0,0,218,13,95,119,114, - 105,116,101,95,97,116,111,109,105,99,106,0,0,0,115,26, - 0,0,0,0,5,24,1,9,1,33,1,3,3,21,1,20, - 1,20,1,13,1,3,1,17,1,13,1,5,1,114,57,0, - 0,0,105,23,13,0,0,233,2,0,0,0,114,15,0,0, - 0,115,2,0,0,0,13,10,90,11,95,95,112,121,99,97, - 99,104,101,95,95,122,4,111,112,116,45,122,3,46,112,121, - 122,4,46,112,121,99,78,218,12,111,112,116,105,109,105,122, - 97,116,105,111,110,99,2,0,0,0,1,0,0,0,11,0, - 0,0,6,0,0,0,67,0,0,0,115,87,1,0,0,124, - 1,0,100,1,0,107,9,0,114,76,0,116,0,0,106,1, - 0,100,2,0,116,2,0,131,2,0,1,124,2,0,100,1, - 0,107,9,0,114,58,0,100,3,0,125,3,0,116,3,0, - 124,3,0,131,1,0,130,1,0,124,1,0,114,70,0,100, - 4,0,110,3,0,100,5,0,125,2,0,116,4,0,124,0, - 0,131,1,0,92,2,0,125,4,0,125,5,0,124,5,0, - 106,5,0,100,6,0,131,1,0,92,3,0,125,6,0,125, - 7,0,125,8,0,116,6,0,106,7,0,106,8,0,125,9, - 0,124,9,0,100,1,0,107,8,0,114,154,0,116,9,0, - 100,7,0,131,1,0,130,1,0,100,4,0,106,10,0,124, - 6,0,114,172,0,124,6,0,110,3,0,124,8,0,124,7, - 0,124,9,0,103,3,0,131,1,0,125,10,0,124,2,0, - 100,1,0,107,8,0,114,241,0,116,6,0,106,11,0,106, - 12,0,100,8,0,107,2,0,114,229,0,100,4,0,125,2, - 0,110,12,0,116,6,0,106,11,0,106,12,0,125,2,0, - 116,13,0,124,2,0,131,1,0,125,2,0,124,2,0,100, - 4,0,107,3,0,114,63,1,124,2,0,106,14,0,131,0, - 0,115,42,1,116,15,0,100,9,0,106,16,0,124,2,0, - 131,1,0,131,1,0,130,1,0,100,10,0,106,16,0,124, - 10,0,116,17,0,124,2,0,131,3,0,125,10,0,116,18, - 0,124,4,0,116,19,0,124,10,0,116,20,0,100,8,0, - 25,23,131,3,0,83,41,11,97,254,2,0,0,71,105,118, - 101,110,32,116,104,101,32,112,97,116,104,32,116,111,32,97, - 32,46,112,121,32,102,105,108,101,44,32,114,101,116,117,114, - 110,32,116,104,101,32,112,97,116,104,32,116,111,32,105,116, - 115,32,46,112,121,99,32,102,105,108,101,46,10,10,32,32, - 32,32,84,104,101,32,46,112,121,32,102,105,108,101,32,100, - 111,101,115,32,110,111,116,32,110,101,101,100,32,116,111,32, - 101,120,105,115,116,59,32,116,104,105,115,32,115,105,109,112, - 108,121,32,114,101,116,117,114,110,115,32,116,104,101,32,112, - 97,116,104,32,116,111,32,116,104,101,10,32,32,32,32,46, - 112,121,99,32,102,105,108,101,32,99,97,108,99,117,108,97, - 116,101,100,32,97,115,32,105,102,32,116,104,101,32,46,112, - 121,32,102,105,108,101,32,119,101,114,101,32,105,109,112,111, - 114,116,101,100,46,10,10,32,32,32,32,84,104,101,32,39, - 111,112,116,105,109,105,122,97,116,105,111,110,39,32,112,97, - 114,97,109,101,116,101,114,32,99,111,110,116,114,111,108,115, - 32,116,104,101,32,112,114,101,115,117,109,101,100,32,111,112, - 116,105,109,105,122,97,116,105,111,110,32,108,101,118,101,108, - 32,111,102,10,32,32,32,32,116,104,101,32,98,121,116,101, - 99,111,100,101,32,102,105,108,101,46,32,73,102,32,39,111, - 112,116,105,109,105,122,97,116,105,111,110,39,32,105,115,32, - 110,111,116,32,78,111,110,101,44,32,116,104,101,32,115,116, - 114,105,110,103,32,114,101,112,114,101,115,101,110,116,97,116, - 105,111,110,10,32,32,32,32,111,102,32,116,104,101,32,97, - 114,103,117,109,101,110,116,32,105,115,32,116,97,107,101,110, - 32,97,110,100,32,118,101,114,105,102,105,101,100,32,116,111, - 32,98,101,32,97,108,112,104,97,110,117,109,101,114,105,99, - 32,40,101,108,115,101,32,86,97,108,117,101,69,114,114,111, - 114,10,32,32,32,32,105,115,32,114,97,105,115,101,100,41, - 46,10,10,32,32,32,32,84,104,101,32,100,101,98,117,103, - 95,111,118,101,114,114,105,100,101,32,112,97,114,97,109,101, - 116,101,114,32,105,115,32,100,101,112,114,101,99,97,116,101, - 100,46,32,73,102,32,100,101,98,117,103,95,111,118,101,114, - 114,105,100,101,32,105,115,32,110,111,116,32,78,111,110,101, - 44,10,32,32,32,32,97,32,84,114,117,101,32,118,97,108, - 117,101,32,105,115,32,116,104,101,32,115,97,109,101,32,97, - 115,32,115,101,116,116,105,110,103,32,39,111,112,116,105,109, - 105,122,97,116,105,111,110,39,32,116,111,32,116,104,101,32, - 101,109,112,116,121,32,115,116,114,105,110,103,10,32,32,32, - 32,119,104,105,108,101,32,97,32,70,97,108,115,101,32,118, - 97,108,117,101,32,105,115,32,101,113,117,105,118,97,108,101, - 110,116,32,116,111,32,115,101,116,116,105,110,103,32,39,111, - 112,116,105,109,105,122,97,116,105,111,110,39,32,116,111,32, - 39,49,39,46,10,10,32,32,32,32,73,102,32,115,121,115, - 46,105,109,112,108,101,109,101,110,116,97,116,105,111,110,46, - 99,97,99,104,101,95,116,97,103,32,105,115,32,78,111,110, - 101,32,116,104,101,110,32,78,111,116,73,109,112,108,101,109, - 101,110,116,101,100,69,114,114,111,114,32,105,115,32,114,97, - 105,115,101,100,46,10,10,32,32,32,32,78,122,70,116,104, - 101,32,100,101,98,117,103,95,111,118,101,114,114,105,100,101, - 32,112,97,114,97,109,101,116,101,114,32,105,115,32,100,101, - 112,114,101,99,97,116,101,100,59,32,117,115,101,32,39,111, - 112,116,105,109,105,122,97,116,105,111,110,39,32,105,110,115, - 116,101,97,100,122,50,100,101,98,117,103,95,111,118,101,114, - 114,105,100,101,32,111,114,32,111,112,116,105,109,105,122,97, - 116,105,111,110,32,109,117,115,116,32,98,101,32,115,101,116, - 32,116,111,32,78,111,110,101,114,32,0,0,0,114,31,0, - 0,0,218,1,46,122,36,115,121,115,46,105,109,112,108,101, - 109,101,110,116,97,116,105,111,110,46,99,97,99,104,101,95, - 116,97,103,32,105,115,32,78,111,110,101,233,0,0,0,0, - 122,24,123,33,114,125,32,105,115,32,110,111,116,32,97,108, - 112,104,97,110,117,109,101,114,105,99,122,7,123,125,46,123, - 125,123,125,41,21,218,9,95,119,97,114,110,105,110,103,115, - 218,4,119,97,114,110,218,18,68,101,112,114,101,99,97,116, - 105,111,110,87,97,114,110,105,110,103,218,9,84,121,112,101, - 69,114,114,111,114,114,40,0,0,0,114,34,0,0,0,114, - 8,0,0,0,218,14,105,109,112,108,101,109,101,110,116,97, - 116,105,111,110,218,9,99,97,99,104,101,95,116,97,103,218, - 19,78,111,116,73,109,112,108,101,109,101,110,116,101,100,69, - 114,114,111,114,114,28,0,0,0,218,5,102,108,97,103,115, - 218,8,111,112,116,105,109,105,122,101,218,3,115,116,114,218, - 7,105,115,97,108,110,117,109,218,10,86,97,108,117,101,69, - 114,114,111,114,114,49,0,0,0,218,4,95,79,80,84,114, - 30,0,0,0,218,8,95,80,89,67,65,67,72,69,218,17, - 66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,69, - 83,41,11,114,37,0,0,0,90,14,100,101,98,117,103,95, - 111,118,101,114,114,105,100,101,114,59,0,0,0,218,7,109, - 101,115,115,97,103,101,218,4,104,101,97,100,114,39,0,0, - 0,90,4,98,97,115,101,218,3,115,101,112,218,4,114,101, - 115,116,90,3,116,97,103,90,15,97,108,109,111,115,116,95, - 102,105,108,101,110,97,109,101,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,218,17,99,97,99,104,101,95,102, - 114,111,109,95,115,111,117,114,99,101,254,0,0,0,115,46, - 0,0,0,0,18,12,1,9,1,7,1,12,1,6,1,12, - 1,18,1,18,1,24,1,12,1,12,1,12,1,36,1,12, - 1,18,1,9,2,12,1,12,1,12,1,12,1,21,1,21, - 1,114,81,0,0,0,99,1,0,0,0,0,0,0,0,8, - 0,0,0,5,0,0,0,67,0,0,0,115,62,1,0,0, - 116,0,0,106,1,0,106,2,0,100,1,0,107,8,0,114, - 30,0,116,3,0,100,2,0,131,1,0,130,1,0,116,4, - 0,124,0,0,131,1,0,92,2,0,125,1,0,125,2,0, - 116,4,0,124,1,0,131,1,0,92,2,0,125,1,0,125, - 3,0,124,3,0,116,5,0,107,3,0,114,102,0,116,6, - 0,100,3,0,106,7,0,116,5,0,124,0,0,131,2,0, - 131,1,0,130,1,0,124,2,0,106,8,0,100,4,0,131, - 1,0,125,4,0,124,4,0,100,11,0,107,7,0,114,153, - 0,116,6,0,100,7,0,106,7,0,124,2,0,131,1,0, - 131,1,0,130,1,0,110,125,0,124,4,0,100,6,0,107, - 2,0,114,22,1,124,2,0,106,9,0,100,4,0,100,5, - 0,131,2,0,100,12,0,25,125,5,0,124,5,0,106,10, - 0,116,11,0,131,1,0,115,223,0,116,6,0,100,8,0, - 106,7,0,116,11,0,131,1,0,131,1,0,130,1,0,124, - 5,0,116,12,0,116,11,0,131,1,0,100,1,0,133,2, - 0,25,125,6,0,124,6,0,106,13,0,131,0,0,115,22, - 1,116,6,0,100,9,0,106,7,0,124,5,0,131,1,0, - 131,1,0,130,1,0,124,2,0,106,14,0,100,4,0,131, - 1,0,100,10,0,25,125,7,0,116,15,0,124,1,0,124, - 7,0,116,16,0,100,10,0,25,23,131,2,0,83,41,13, - 97,110,1,0,0,71,105,118,101,110,32,116,104,101,32,112, - 97,116,104,32,116,111,32,97,32,46,112,121,99,46,32,102, - 105,108,101,44,32,114,101,116,117,114,110,32,116,104,101,32, - 112,97,116,104,32,116,111,32,105,116,115,32,46,112,121,32, - 102,105,108,101,46,10,10,32,32,32,32,84,104,101,32,46, - 112,121,99,32,102,105,108,101,32,100,111,101,115,32,110,111, - 116,32,110,101,101,100,32,116,111,32,101,120,105,115,116,59, - 32,116,104,105,115,32,115,105,109,112,108,121,32,114,101,116, - 117,114,110,115,32,116,104,101,32,112,97,116,104,32,116,111, - 10,32,32,32,32,116,104,101,32,46,112,121,32,102,105,108, - 101,32,99,97,108,99,117,108,97,116,101,100,32,116,111,32, - 99,111,114,114,101,115,112,111,110,100,32,116,111,32,116,104, - 101,32,46,112,121,99,32,102,105,108,101,46,32,32,73,102, - 32,112,97,116,104,32,100,111,101,115,10,32,32,32,32,110, - 111,116,32,99,111,110,102,111,114,109,32,116,111,32,80,69, - 80,32,51,49,52,55,47,52,56,56,32,102,111,114,109,97, - 116,44,32,86,97,108,117,101,69,114,114,111,114,32,119,105, - 108,108,32,98,101,32,114,97,105,115,101,100,46,32,73,102, - 10,32,32,32,32,115,121,115,46,105,109,112,108,101,109,101, - 110,116,97,116,105,111,110,46,99,97,99,104,101,95,116,97, - 103,32,105,115,32,78,111,110,101,32,116,104,101,110,32,78, - 111,116,73,109,112,108,101,109,101,110,116,101,100,69,114,114, - 111,114,32,105,115,32,114,97,105,115,101,100,46,10,10,32, - 32,32,32,78,122,36,115,121,115,46,105,109,112,108,101,109, - 101,110,116,97,116,105,111,110,46,99,97,99,104,101,95,116, - 97,103,32,105,115,32,78,111,110,101,122,37,123,125,32,110, - 111,116,32,98,111,116,116,111,109,45,108,101,118,101,108,32, - 100,105,114,101,99,116,111,114,121,32,105,110,32,123,33,114, - 125,114,60,0,0,0,114,58,0,0,0,233,3,0,0,0, - 122,33,101,120,112,101,99,116,101,100,32,111,110,108,121,32, - 50,32,111,114,32,51,32,100,111,116,115,32,105,110,32,123, - 33,114,125,122,57,111,112,116,105,109,105,122,97,116,105,111, - 110,32,112,111,114,116,105,111,110,32,111,102,32,102,105,108, - 101,110,97,109,101,32,100,111,101,115,32,110,111,116,32,115, - 116,97,114,116,32,119,105,116,104,32,123,33,114,125,122,52, - 111,112,116,105,109,105,122,97,116,105,111,110,32,108,101,118, - 101,108,32,123,33,114,125,32,105,115,32,110,111,116,32,97, - 110,32,97,108,112,104,97,110,117,109,101,114,105,99,32,118, - 97,108,117,101,114,61,0,0,0,62,2,0,0,0,114,58, - 0,0,0,114,82,0,0,0,233,254,255,255,255,41,17,114, - 8,0,0,0,114,66,0,0,0,114,67,0,0,0,114,68, - 0,0,0,114,40,0,0,0,114,75,0,0,0,114,73,0, - 0,0,114,49,0,0,0,218,5,99,111,117,110,116,114,36, - 0,0,0,114,10,0,0,0,114,74,0,0,0,114,33,0, - 0,0,114,72,0,0,0,218,9,112,97,114,116,105,116,105, - 111,110,114,30,0,0,0,218,15,83,79,85,82,67,69,95, - 83,85,70,70,73,88,69,83,41,8,114,37,0,0,0,114, - 78,0,0,0,90,16,112,121,99,97,99,104,101,95,102,105, - 108,101,110,97,109,101,90,7,112,121,99,97,99,104,101,90, - 9,100,111,116,95,99,111,117,110,116,114,59,0,0,0,90, - 9,111,112,116,95,108,101,118,101,108,90,13,98,97,115,101, + 115,100,105,114,46,105,0,64,0,0,41,3,114,3,0,0, + 0,218,6,103,101,116,99,119,100,114,45,0,0,0,41,1, + 114,37,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 6,0,0,0,218,11,95,112,97,116,104,95,105,115,100,105, + 114,99,0,0,0,115,6,0,0,0,0,2,6,1,12,1, + 114,48,0,0,0,105,182,1,0,0,99,3,0,0,0,0, + 0,0,0,6,0,0,0,17,0,0,0,67,0,0,0,115, + 193,0,0,0,100,1,0,106,0,0,124,0,0,116,1,0, + 124,0,0,131,1,0,131,2,0,125,3,0,116,2,0,106, + 3,0,124,3,0,116,2,0,106,4,0,116,2,0,106,5, + 0,66,116,2,0,106,6,0,66,124,2,0,100,2,0,64, + 131,3,0,125,4,0,121,61,0,116,7,0,106,8,0,124, + 4,0,100,3,0,131,2,0,143,20,0,125,5,0,124,5, + 0,106,9,0,124,1,0,131,1,0,1,87,100,4,0,81, + 82,88,116,2,0,106,10,0,124,3,0,124,0,0,131,2, + 0,1,87,110,59,0,4,116,11,0,107,10,0,114,188,0, + 1,1,1,121,17,0,116,2,0,106,12,0,124,3,0,131, + 1,0,1,87,110,18,0,4,116,11,0,107,10,0,114,180, + 0,1,1,1,89,110,1,0,88,130,0,0,89,110,1,0, + 88,100,4,0,83,41,5,122,162,66,101,115,116,45,101,102, + 102,111,114,116,32,102,117,110,99,116,105,111,110,32,116,111, + 32,119,114,105,116,101,32,100,97,116,97,32,116,111,32,97, + 32,112,97,116,104,32,97,116,111,109,105,99,97,108,108,121, + 46,10,32,32,32,32,66,101,32,112,114,101,112,97,114,101, + 100,32,116,111,32,104,97,110,100,108,101,32,97,32,70,105, + 108,101,69,120,105,115,116,115,69,114,114,111,114,32,105,102, + 32,99,111,110,99,117,114,114,101,110,116,32,119,114,105,116, + 105,110,103,32,111,102,32,116,104,101,10,32,32,32,32,116, + 101,109,112,111,114,97,114,121,32,102,105,108,101,32,105,115, + 32,97,116,116,101,109,112,116,101,100,46,122,5,123,125,46, + 123,125,105,182,1,0,0,90,2,119,98,78,41,13,218,6, + 102,111,114,109,97,116,218,2,105,100,114,3,0,0,0,90, + 4,111,112,101,110,90,6,79,95,69,88,67,76,90,7,79, + 95,67,82,69,65,84,90,8,79,95,87,82,79,78,76,89, + 218,3,95,105,111,218,6,70,105,108,101,73,79,218,5,119, + 114,105,116,101,218,7,114,101,112,108,97,99,101,114,42,0, + 0,0,90,6,117,110,108,105,110,107,41,6,114,37,0,0, + 0,218,4,100,97,116,97,114,44,0,0,0,90,8,112,97, + 116,104,95,116,109,112,90,2,102,100,218,4,102,105,108,101, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, + 13,95,119,114,105,116,101,95,97,116,111,109,105,99,106,0, + 0,0,115,26,0,0,0,0,5,24,1,9,1,33,1,3, + 3,21,1,20,1,20,1,13,1,3,1,17,1,13,1,5, + 1,114,57,0,0,0,105,23,13,0,0,233,2,0,0,0, + 114,15,0,0,0,115,2,0,0,0,13,10,105,23,13,13, + 10,122,65,77,97,103,105,99,32,110,117,109,98,101,114,32, + 109,105,115,109,97,116,99,104,32,40,116,104,101,32,105,115, + 115,117,101,50,55,50,56,54,32,119,111,114,107,97,114,111, + 117,110,100,32,105,115,32,102,111,114,32,51,46,53,32,111, + 110,108,121,41,105,22,13,0,0,90,11,95,95,112,121,99, + 97,99,104,101,95,95,122,4,111,112,116,45,122,3,46,112, + 121,122,4,46,112,121,99,78,218,12,111,112,116,105,109,105, + 122,97,116,105,111,110,99,2,0,0,0,1,0,0,0,11, + 0,0,0,6,0,0,0,67,0,0,0,115,87,1,0,0, + 124,1,0,100,1,0,107,9,0,114,76,0,116,0,0,106, + 1,0,100,2,0,116,2,0,131,2,0,1,124,2,0,100, + 1,0,107,9,0,114,58,0,100,3,0,125,3,0,116,3, + 0,124,3,0,131,1,0,130,1,0,124,1,0,114,70,0, + 100,4,0,110,3,0,100,5,0,125,2,0,116,4,0,124, + 0,0,131,1,0,92,2,0,125,4,0,125,5,0,124,5, + 0,106,5,0,100,6,0,131,1,0,92,3,0,125,6,0, + 125,7,0,125,8,0,116,6,0,106,7,0,106,8,0,125, + 9,0,124,9,0,100,1,0,107,8,0,114,154,0,116,9, + 0,100,7,0,131,1,0,130,1,0,100,4,0,106,10,0, + 124,6,0,114,172,0,124,6,0,110,3,0,124,8,0,124, + 7,0,124,9,0,103,3,0,131,1,0,125,10,0,124,2, + 0,100,1,0,107,8,0,114,241,0,116,6,0,106,11,0, + 106,12,0,100,8,0,107,2,0,114,229,0,100,4,0,125, + 2,0,110,12,0,116,6,0,106,11,0,106,12,0,125,2, + 0,116,13,0,124,2,0,131,1,0,125,2,0,124,2,0, + 100,4,0,107,3,0,114,63,1,124,2,0,106,14,0,131, + 0,0,115,42,1,116,15,0,100,9,0,106,16,0,124,2, + 0,131,1,0,131,1,0,130,1,0,100,10,0,106,16,0, + 124,10,0,116,17,0,124,2,0,131,3,0,125,10,0,116, + 18,0,124,4,0,116,19,0,124,10,0,116,20,0,100,8, + 0,25,23,131,3,0,83,41,11,97,254,2,0,0,71,105, + 118,101,110,32,116,104,101,32,112,97,116,104,32,116,111,32, + 97,32,46,112,121,32,102,105,108,101,44,32,114,101,116,117, + 114,110,32,116,104,101,32,112,97,116,104,32,116,111,32,105, + 116,115,32,46,112,121,99,32,102,105,108,101,46,10,10,32, + 32,32,32,84,104,101,32,46,112,121,32,102,105,108,101,32, + 100,111,101,115,32,110,111,116,32,110,101,101,100,32,116,111, + 32,101,120,105,115,116,59,32,116,104,105,115,32,115,105,109, + 112,108,121,32,114,101,116,117,114,110,115,32,116,104,101,32, + 112,97,116,104,32,116,111,32,116,104,101,10,32,32,32,32, + 46,112,121,99,32,102,105,108,101,32,99,97,108,99,117,108, + 97,116,101,100,32,97,115,32,105,102,32,116,104,101,32,46, + 112,121,32,102,105,108,101,32,119,101,114,101,32,105,109,112, + 111,114,116,101,100,46,10,10,32,32,32,32,84,104,101,32, + 39,111,112,116,105,109,105,122,97,116,105,111,110,39,32,112, + 97,114,97,109,101,116,101,114,32,99,111,110,116,114,111,108, + 115,32,116,104,101,32,112,114,101,115,117,109,101,100,32,111, + 112,116,105,109,105,122,97,116,105,111,110,32,108,101,118,101, + 108,32,111,102,10,32,32,32,32,116,104,101,32,98,121,116, + 101,99,111,100,101,32,102,105,108,101,46,32,73,102,32,39, + 111,112,116,105,109,105,122,97,116,105,111,110,39,32,105,115, + 32,110,111,116,32,78,111,110,101,44,32,116,104,101,32,115, + 116,114,105,110,103,32,114,101,112,114,101,115,101,110,116,97, + 116,105,111,110,10,32,32,32,32,111,102,32,116,104,101,32, + 97,114,103,117,109,101,110,116,32,105,115,32,116,97,107,101, + 110,32,97,110,100,32,118,101,114,105,102,105,101,100,32,116, + 111,32,98,101,32,97,108,112,104,97,110,117,109,101,114,105, + 99,32,40,101,108,115,101,32,86,97,108,117,101,69,114,114, + 111,114,10,32,32,32,32,105,115,32,114,97,105,115,101,100, + 41,46,10,10,32,32,32,32,84,104,101,32,100,101,98,117, + 103,95,111,118,101,114,114,105,100,101,32,112,97,114,97,109, + 101,116,101,114,32,105,115,32,100,101,112,114,101,99,97,116, + 101,100,46,32,73,102,32,100,101,98,117,103,95,111,118,101, + 114,114,105,100,101,32,105,115,32,110,111,116,32,78,111,110, + 101,44,10,32,32,32,32,97,32,84,114,117,101,32,118,97, + 108,117,101,32,105,115,32,116,104,101,32,115,97,109,101,32, + 97,115,32,115,101,116,116,105,110,103,32,39,111,112,116,105, + 109,105,122,97,116,105,111,110,39,32,116,111,32,116,104,101, + 32,101,109,112,116,121,32,115,116,114,105,110,103,10,32,32, + 32,32,119,104,105,108,101,32,97,32,70,97,108,115,101,32, + 118,97,108,117,101,32,105,115,32,101,113,117,105,118,97,108, + 101,110,116,32,116,111,32,115,101,116,116,105,110,103,32,39, + 111,112,116,105,109,105,122,97,116,105,111,110,39,32,116,111, + 32,39,49,39,46,10,10,32,32,32,32,73,102,32,115,121, + 115,46,105,109,112,108,101,109,101,110,116,97,116,105,111,110, + 46,99,97,99,104,101,95,116,97,103,32,105,115,32,78,111, + 110,101,32,116,104,101,110,32,78,111,116,73,109,112,108,101, + 109,101,110,116,101,100,69,114,114,111,114,32,105,115,32,114, + 97,105,115,101,100,46,10,10,32,32,32,32,78,122,70,116, + 104,101,32,100,101,98,117,103,95,111,118,101,114,114,105,100, + 101,32,112,97,114,97,109,101,116,101,114,32,105,115,32,100, + 101,112,114,101,99,97,116,101,100,59,32,117,115,101,32,39, + 111,112,116,105,109,105,122,97,116,105,111,110,39,32,105,110, + 115,116,101,97,100,122,50,100,101,98,117,103,95,111,118,101, + 114,114,105,100,101,32,111,114,32,111,112,116,105,109,105,122, + 97,116,105,111,110,32,109,117,115,116,32,98,101,32,115,101, + 116,32,116,111,32,78,111,110,101,114,32,0,0,0,114,31, + 0,0,0,218,1,46,122,36,115,121,115,46,105,109,112,108, + 101,109,101,110,116,97,116,105,111,110,46,99,97,99,104,101, + 95,116,97,103,32,105,115,32,78,111,110,101,233,0,0,0, + 0,122,24,123,33,114,125,32,105,115,32,110,111,116,32,97, + 108,112,104,97,110,117,109,101,114,105,99,122,7,123,125,46, + 123,125,123,125,41,21,218,9,95,119,97,114,110,105,110,103, + 115,218,4,119,97,114,110,218,18,68,101,112,114,101,99,97, + 116,105,111,110,87,97,114,110,105,110,103,218,9,84,121,112, + 101,69,114,114,111,114,114,40,0,0,0,114,34,0,0,0, + 114,8,0,0,0,218,14,105,109,112,108,101,109,101,110,116, + 97,116,105,111,110,218,9,99,97,99,104,101,95,116,97,103, + 218,19,78,111,116,73,109,112,108,101,109,101,110,116,101,100, + 69,114,114,111,114,114,28,0,0,0,218,5,102,108,97,103, + 115,218,8,111,112,116,105,109,105,122,101,218,3,115,116,114, + 218,7,105,115,97,108,110,117,109,218,10,86,97,108,117,101, + 69,114,114,111,114,114,49,0,0,0,218,4,95,79,80,84, + 114,30,0,0,0,218,8,95,80,89,67,65,67,72,69,218, + 17,66,89,84,69,67,79,68,69,95,83,85,70,70,73,88, + 69,83,41,11,114,37,0,0,0,90,14,100,101,98,117,103, + 95,111,118,101,114,114,105,100,101,114,59,0,0,0,218,7, + 109,101,115,115,97,103,101,218,4,104,101,97,100,114,39,0, + 0,0,90,4,98,97,115,101,218,3,115,101,112,218,4,114, + 101,115,116,90,3,116,97,103,90,15,97,108,109,111,115,116, 95,102,105,108,101,110,97,109,101,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,17,115,111,117,114,99,101, - 95,102,114,111,109,95,99,97,99,104,101,42,1,0,0,115, - 44,0,0,0,0,9,18,1,12,1,18,1,18,1,12,1, - 9,1,15,1,15,1,12,1,9,1,15,1,12,1,22,1, - 15,1,9,1,12,1,22,1,12,1,9,1,12,1,19,1, - 114,87,0,0,0,99,1,0,0,0,0,0,0,0,5,0, - 0,0,12,0,0,0,67,0,0,0,115,164,0,0,0,116, - 0,0,124,0,0,131,1,0,100,1,0,107,2,0,114,22, - 0,100,2,0,83,124,0,0,106,1,0,100,3,0,131,1, - 0,92,3,0,125,1,0,125,2,0,125,3,0,124,1,0, - 12,115,81,0,124,3,0,106,2,0,131,0,0,100,7,0, - 100,8,0,133,2,0,25,100,6,0,107,3,0,114,85,0, - 124,0,0,83,121,16,0,116,3,0,124,0,0,131,1,0, - 125,4,0,87,110,40,0,4,116,4,0,116,5,0,102,2, - 0,107,10,0,114,143,0,1,1,1,124,0,0,100,2,0, - 100,9,0,133,2,0,25,125,4,0,89,110,1,0,88,116, - 6,0,124,4,0,131,1,0,114,160,0,124,4,0,83,124, - 0,0,83,41,10,122,188,67,111,110,118,101,114,116,32,97, - 32,98,121,116,101,99,111,100,101,32,102,105,108,101,32,112, - 97,116,104,32,116,111,32,97,32,115,111,117,114,99,101,32, - 112,97,116,104,32,40,105,102,32,112,111,115,115,105,98,108, - 101,41,46,10,10,32,32,32,32,84,104,105,115,32,102,117, - 110,99,116,105,111,110,32,101,120,105,115,116,115,32,112,117, - 114,101,108,121,32,102,111,114,32,98,97,99,107,119,97,114, - 100,115,45,99,111,109,112,97,116,105,98,105,108,105,116,121, - 32,102,111,114,10,32,32,32,32,80,121,73,109,112,111,114, - 116,95,69,120,101,99,67,111,100,101,77,111,100,117,108,101, - 87,105,116,104,70,105,108,101,110,97,109,101,115,40,41,32, - 105,110,32,116,104,101,32,67,32,65,80,73,46,10,10,32, - 32,32,32,114,61,0,0,0,78,114,60,0,0,0,114,82, - 0,0,0,114,31,0,0,0,90,2,112,121,233,253,255,255, - 255,233,255,255,255,255,114,89,0,0,0,41,7,114,33,0, - 0,0,114,34,0,0,0,218,5,108,111,119,101,114,114,87, - 0,0,0,114,68,0,0,0,114,73,0,0,0,114,46,0, - 0,0,41,5,218,13,98,121,116,101,99,111,100,101,95,112, - 97,116,104,114,80,0,0,0,114,38,0,0,0,90,9,101, - 120,116,101,110,115,105,111,110,218,11,115,111,117,114,99,101, - 95,112,97,116,104,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,218,15,95,103,101,116,95,115,111,117,114,99, - 101,102,105,108,101,75,1,0,0,115,20,0,0,0,0,7, - 18,1,4,1,24,1,35,1,4,1,3,1,16,1,19,1, - 21,1,114,93,0,0,0,99,1,0,0,0,0,0,0,0, - 1,0,0,0,11,0,0,0,67,0,0,0,115,92,0,0, - 0,124,0,0,106,0,0,116,1,0,116,2,0,131,1,0, - 131,1,0,114,59,0,121,14,0,116,3,0,124,0,0,131, - 1,0,83,87,113,88,0,4,116,4,0,107,10,0,114,55, - 0,1,1,1,89,113,88,0,88,110,29,0,124,0,0,106, - 0,0,116,1,0,116,5,0,131,1,0,131,1,0,114,84, - 0,124,0,0,83,100,0,0,83,100,0,0,83,41,1,78, - 41,6,218,8,101,110,100,115,119,105,116,104,218,5,116,117, - 112,108,101,114,86,0,0,0,114,81,0,0,0,114,68,0, - 0,0,114,76,0,0,0,41,1,218,8,102,105,108,101,110, - 97,109,101,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,11,95,103,101,116,95,99,97,99,104,101,100,94, - 1,0,0,115,16,0,0,0,0,1,21,1,3,1,14,1, - 13,1,8,1,21,1,4,2,114,97,0,0,0,99,1,0, - 0,0,0,0,0,0,2,0,0,0,11,0,0,0,67,0, - 0,0,115,60,0,0,0,121,19,0,116,0,0,124,0,0, - 131,1,0,106,1,0,125,1,0,87,110,24,0,4,116,2, - 0,107,10,0,114,45,0,1,1,1,100,1,0,125,1,0, - 89,110,1,0,88,124,1,0,100,2,0,79,125,1,0,124, - 1,0,83,41,3,122,51,67,97,108,99,117,108,97,116,101, - 32,116,104,101,32,109,111,100,101,32,112,101,114,109,105,115, - 115,105,111,110,115,32,102,111,114,32,97,32,98,121,116,101, - 99,111,100,101,32,102,105,108,101,46,105,182,1,0,0,233, - 128,0,0,0,41,3,114,41,0,0,0,114,43,0,0,0, - 114,42,0,0,0,41,2,114,37,0,0,0,114,44,0,0, + 0,0,0,114,6,0,0,0,218,17,99,97,99,104,101,95, + 102,114,111,109,95,115,111,117,114,99,101,20,1,0,0,115, + 46,0,0,0,0,18,12,1,9,1,7,1,12,1,6,1, + 12,1,18,1,18,1,24,1,12,1,12,1,12,1,36,1, + 12,1,18,1,9,2,12,1,12,1,12,1,12,1,21,1, + 21,1,114,81,0,0,0,99,1,0,0,0,0,0,0,0, + 8,0,0,0,5,0,0,0,67,0,0,0,115,62,1,0, + 0,116,0,0,106,1,0,106,2,0,100,1,0,107,8,0, + 114,30,0,116,3,0,100,2,0,131,1,0,130,1,0,116, + 4,0,124,0,0,131,1,0,92,2,0,125,1,0,125,2, + 0,116,4,0,124,1,0,131,1,0,92,2,0,125,1,0, + 125,3,0,124,3,0,116,5,0,107,3,0,114,102,0,116, + 6,0,100,3,0,106,7,0,116,5,0,124,0,0,131,2, + 0,131,1,0,130,1,0,124,2,0,106,8,0,100,4,0, + 131,1,0,125,4,0,124,4,0,100,11,0,107,7,0,114, + 153,0,116,6,0,100,7,0,106,7,0,124,2,0,131,1, + 0,131,1,0,130,1,0,110,125,0,124,4,0,100,6,0, + 107,2,0,114,22,1,124,2,0,106,9,0,100,4,0,100, + 5,0,131,2,0,100,12,0,25,125,5,0,124,5,0,106, + 10,0,116,11,0,131,1,0,115,223,0,116,6,0,100,8, + 0,106,7,0,116,11,0,131,1,0,131,1,0,130,1,0, + 124,5,0,116,12,0,116,11,0,131,1,0,100,1,0,133, + 2,0,25,125,6,0,124,6,0,106,13,0,131,0,0,115, + 22,1,116,6,0,100,9,0,106,7,0,124,5,0,131,1, + 0,131,1,0,130,1,0,124,2,0,106,14,0,100,4,0, + 131,1,0,100,10,0,25,125,7,0,116,15,0,124,1,0, + 124,7,0,116,16,0,100,10,0,25,23,131,2,0,83,41, + 13,97,110,1,0,0,71,105,118,101,110,32,116,104,101,32, + 112,97,116,104,32,116,111,32,97,32,46,112,121,99,46,32, + 102,105,108,101,44,32,114,101,116,117,114,110,32,116,104,101, + 32,112,97,116,104,32,116,111,32,105,116,115,32,46,112,121, + 32,102,105,108,101,46,10,10,32,32,32,32,84,104,101,32, + 46,112,121,99,32,102,105,108,101,32,100,111,101,115,32,110, + 111,116,32,110,101,101,100,32,116,111,32,101,120,105,115,116, + 59,32,116,104,105,115,32,115,105,109,112,108,121,32,114,101, + 116,117,114,110,115,32,116,104,101,32,112,97,116,104,32,116, + 111,10,32,32,32,32,116,104,101,32,46,112,121,32,102,105, + 108,101,32,99,97,108,99,117,108,97,116,101,100,32,116,111, + 32,99,111,114,114,101,115,112,111,110,100,32,116,111,32,116, + 104,101,32,46,112,121,99,32,102,105,108,101,46,32,32,73, + 102,32,112,97,116,104,32,100,111,101,115,10,32,32,32,32, + 110,111,116,32,99,111,110,102,111,114,109,32,116,111,32,80, + 69,80,32,51,49,52,55,47,52,56,56,32,102,111,114,109, + 97,116,44,32,86,97,108,117,101,69,114,114,111,114,32,119, + 105,108,108,32,98,101,32,114,97,105,115,101,100,46,32,73, + 102,10,32,32,32,32,115,121,115,46,105,109,112,108,101,109, + 101,110,116,97,116,105,111,110,46,99,97,99,104,101,95,116, + 97,103,32,105,115,32,78,111,110,101,32,116,104,101,110,32, + 78,111,116,73,109,112,108,101,109,101,110,116,101,100,69,114, + 114,111,114,32,105,115,32,114,97,105,115,101,100,46,10,10, + 32,32,32,32,78,122,36,115,121,115,46,105,109,112,108,101, + 109,101,110,116,97,116,105,111,110,46,99,97,99,104,101,95, + 116,97,103,32,105,115,32,78,111,110,101,122,37,123,125,32, + 110,111,116,32,98,111,116,116,111,109,45,108,101,118,101,108, + 32,100,105,114,101,99,116,111,114,121,32,105,110,32,123,33, + 114,125,114,60,0,0,0,114,58,0,0,0,233,3,0,0, + 0,122,33,101,120,112,101,99,116,101,100,32,111,110,108,121, + 32,50,32,111,114,32,51,32,100,111,116,115,32,105,110,32, + 123,33,114,125,122,57,111,112,116,105,109,105,122,97,116,105, + 111,110,32,112,111,114,116,105,111,110,32,111,102,32,102,105, + 108,101,110,97,109,101,32,100,111,101,115,32,110,111,116,32, + 115,116,97,114,116,32,119,105,116,104,32,123,33,114,125,122, + 52,111,112,116,105,109,105,122,97,116,105,111,110,32,108,101, + 118,101,108,32,123,33,114,125,32,105,115,32,110,111,116,32, + 97,110,32,97,108,112,104,97,110,117,109,101,114,105,99,32, + 118,97,108,117,101,114,61,0,0,0,62,2,0,0,0,114, + 58,0,0,0,114,82,0,0,0,233,254,255,255,255,41,17, + 114,8,0,0,0,114,66,0,0,0,114,67,0,0,0,114, + 68,0,0,0,114,40,0,0,0,114,75,0,0,0,114,73, + 0,0,0,114,49,0,0,0,218,5,99,111,117,110,116,114, + 36,0,0,0,114,10,0,0,0,114,74,0,0,0,114,33, + 0,0,0,114,72,0,0,0,218,9,112,97,114,116,105,116, + 105,111,110,114,30,0,0,0,218,15,83,79,85,82,67,69, + 95,83,85,70,70,73,88,69,83,41,8,114,37,0,0,0, + 114,78,0,0,0,90,16,112,121,99,97,99,104,101,95,102, + 105,108,101,110,97,109,101,90,7,112,121,99,97,99,104,101, + 90,9,100,111,116,95,99,111,117,110,116,114,59,0,0,0, + 90,9,111,112,116,95,108,101,118,101,108,90,13,98,97,115, + 101,95,102,105,108,101,110,97,109,101,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,218,17,115,111,117,114,99, + 101,95,102,114,111,109,95,99,97,99,104,101,64,1,0,0, + 115,44,0,0,0,0,9,18,1,12,1,18,1,18,1,12, + 1,9,1,15,1,15,1,12,1,9,1,15,1,12,1,22, + 1,15,1,9,1,12,1,22,1,12,1,9,1,12,1,19, + 1,114,87,0,0,0,99,1,0,0,0,0,0,0,0,5, + 0,0,0,12,0,0,0,67,0,0,0,115,164,0,0,0, + 116,0,0,124,0,0,131,1,0,100,1,0,107,2,0,114, + 22,0,100,2,0,83,124,0,0,106,1,0,100,3,0,131, + 1,0,92,3,0,125,1,0,125,2,0,125,3,0,124,1, + 0,12,115,81,0,124,3,0,106,2,0,131,0,0,100,7, + 0,100,8,0,133,2,0,25,100,6,0,107,3,0,114,85, + 0,124,0,0,83,121,16,0,116,3,0,124,0,0,131,1, + 0,125,4,0,87,110,40,0,4,116,4,0,116,5,0,102, + 2,0,107,10,0,114,143,0,1,1,1,124,0,0,100,2, + 0,100,9,0,133,2,0,25,125,4,0,89,110,1,0,88, + 116,6,0,124,4,0,131,1,0,114,160,0,124,4,0,83, + 124,0,0,83,41,10,122,188,67,111,110,118,101,114,116,32, + 97,32,98,121,116,101,99,111,100,101,32,102,105,108,101,32, + 112,97,116,104,32,116,111,32,97,32,115,111,117,114,99,101, + 32,112,97,116,104,32,40,105,102,32,112,111,115,115,105,98, + 108,101,41,46,10,10,32,32,32,32,84,104,105,115,32,102, + 117,110,99,116,105,111,110,32,101,120,105,115,116,115,32,112, + 117,114,101,108,121,32,102,111,114,32,98,97,99,107,119,97, + 114,100,115,45,99,111,109,112,97,116,105,98,105,108,105,116, + 121,32,102,111,114,10,32,32,32,32,80,121,73,109,112,111, + 114,116,95,69,120,101,99,67,111,100,101,77,111,100,117,108, + 101,87,105,116,104,70,105,108,101,110,97,109,101,115,40,41, + 32,105,110,32,116,104,101,32,67,32,65,80,73,46,10,10, + 32,32,32,32,114,61,0,0,0,78,114,60,0,0,0,114, + 82,0,0,0,114,31,0,0,0,90,2,112,121,233,253,255, + 255,255,233,255,255,255,255,114,89,0,0,0,41,7,114,33, + 0,0,0,114,34,0,0,0,218,5,108,111,119,101,114,114, + 87,0,0,0,114,68,0,0,0,114,73,0,0,0,114,46, + 0,0,0,41,5,218,13,98,121,116,101,99,111,100,101,95, + 112,97,116,104,114,80,0,0,0,114,38,0,0,0,90,9, + 101,120,116,101,110,115,105,111,110,218,11,115,111,117,114,99, + 101,95,112,97,116,104,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,218,15,95,103,101,116,95,115,111,117,114, + 99,101,102,105,108,101,97,1,0,0,115,20,0,0,0,0, + 7,18,1,4,1,24,1,35,1,4,1,3,1,16,1,19, + 1,21,1,114,93,0,0,0,99,1,0,0,0,0,0,0, + 0,1,0,0,0,11,0,0,0,67,0,0,0,115,92,0, + 0,0,124,0,0,106,0,0,116,1,0,116,2,0,131,1, + 0,131,1,0,114,59,0,121,14,0,116,3,0,124,0,0, + 131,1,0,83,87,113,88,0,4,116,4,0,107,10,0,114, + 55,0,1,1,1,89,113,88,0,88,110,29,0,124,0,0, + 106,0,0,116,1,0,116,5,0,131,1,0,131,1,0,114, + 84,0,124,0,0,83,100,0,0,83,100,0,0,83,41,1, + 78,41,6,218,8,101,110,100,115,119,105,116,104,218,5,116, + 117,112,108,101,114,86,0,0,0,114,81,0,0,0,114,68, + 0,0,0,114,76,0,0,0,41,1,218,8,102,105,108,101, + 110,97,109,101,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,218,11,95,103,101,116,95,99,97,99,104,101,100, + 116,1,0,0,115,16,0,0,0,0,1,21,1,3,1,14, + 1,13,1,8,1,21,1,4,2,114,97,0,0,0,99,1, + 0,0,0,0,0,0,0,2,0,0,0,11,0,0,0,67, + 0,0,0,115,60,0,0,0,121,19,0,116,0,0,124,0, + 0,131,1,0,106,1,0,125,1,0,87,110,24,0,4,116, + 2,0,107,10,0,114,45,0,1,1,1,100,1,0,125,1, + 0,89,110,1,0,88,124,1,0,100,2,0,79,125,1,0, + 124,1,0,83,41,3,122,51,67,97,108,99,117,108,97,116, + 101,32,116,104,101,32,109,111,100,101,32,112,101,114,109,105, + 115,115,105,111,110,115,32,102,111,114,32,97,32,98,121,116, + 101,99,111,100,101,32,102,105,108,101,46,105,182,1,0,0, + 233,128,0,0,0,41,3,114,41,0,0,0,114,43,0,0, + 0,114,42,0,0,0,41,2,114,37,0,0,0,114,44,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,10,95,99,97,108,99,95,109,111,100,101,128,1,0, + 0,115,12,0,0,0,0,2,3,1,19,1,13,1,11,3, + 10,1,114,99,0,0,0,218,9,118,101,114,98,111,115,105, + 116,121,114,31,0,0,0,99,1,0,0,0,1,0,0,0, + 3,0,0,0,4,0,0,0,71,0,0,0,115,75,0,0, + 0,116,0,0,106,1,0,106,2,0,124,1,0,107,5,0, + 114,71,0,124,0,0,106,3,0,100,6,0,131,1,0,115, + 43,0,100,3,0,124,0,0,23,125,0,0,116,4,0,124, + 0,0,106,5,0,124,2,0,140,0,0,100,4,0,116,0, + 0,106,6,0,131,1,1,1,100,5,0,83,41,7,122,61, + 80,114,105,110,116,32,116,104,101,32,109,101,115,115,97,103, + 101,32,116,111,32,115,116,100,101,114,114,32,105,102,32,45, + 118,47,80,89,84,72,79,78,86,69,82,66,79,83,69,32, + 105,115,32,116,117,114,110,101,100,32,111,110,46,250,1,35, + 250,7,105,109,112,111,114,116,32,122,2,35,32,114,56,0, + 0,0,78,41,2,114,101,0,0,0,114,102,0,0,0,41, + 7,114,8,0,0,0,114,69,0,0,0,218,7,118,101,114, + 98,111,115,101,114,10,0,0,0,218,5,112,114,105,110,116, + 114,49,0,0,0,218,6,115,116,100,101,114,114,41,3,114, + 77,0,0,0,114,100,0,0,0,218,4,97,114,103,115,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,16, + 95,118,101,114,98,111,115,101,95,109,101,115,115,97,103,101, + 140,1,0,0,115,8,0,0,0,0,2,18,1,15,1,10, + 1,114,107,0,0,0,99,1,0,0,0,0,0,0,0,3, + 0,0,0,11,0,0,0,3,0,0,0,115,84,0,0,0, + 100,1,0,135,0,0,102,1,0,100,2,0,100,3,0,134, + 1,0,125,1,0,121,13,0,116,0,0,106,1,0,125,2, + 0,87,110,30,0,4,116,2,0,107,10,0,114,66,0,1, + 1,1,100,4,0,100,5,0,132,0,0,125,2,0,89,110, + 1,0,88,124,2,0,124,1,0,136,0,0,131,2,0,1, + 124,1,0,83,41,6,122,252,68,101,99,111,114,97,116,111, + 114,32,116,111,32,118,101,114,105,102,121,32,116,104,97,116, + 32,116,104,101,32,109,111,100,117,108,101,32,98,101,105,110, + 103,32,114,101,113,117,101,115,116,101,100,32,109,97,116,99, + 104,101,115,32,116,104,101,32,111,110,101,32,116,104,101,10, + 32,32,32,32,108,111,97,100,101,114,32,99,97,110,32,104, + 97,110,100,108,101,46,10,10,32,32,32,32,84,104,101,32, + 102,105,114,115,116,32,97,114,103,117,109,101,110,116,32,40, + 115,101,108,102,41,32,109,117,115,116,32,100,101,102,105,110, + 101,32,95,110,97,109,101,32,119,104,105,99,104,32,116,104, + 101,32,115,101,99,111,110,100,32,97,114,103,117,109,101,110, + 116,32,105,115,10,32,32,32,32,99,111,109,112,97,114,101, + 100,32,97,103,97,105,110,115,116,46,32,73,102,32,116,104, + 101,32,99,111,109,112,97,114,105,115,111,110,32,102,97,105, + 108,115,32,116,104,101,110,32,73,109,112,111,114,116,69,114, + 114,111,114,32,105,115,32,114,97,105,115,101,100,46,10,10, + 32,32,32,32,78,99,2,0,0,0,0,0,0,0,4,0, + 0,0,5,0,0,0,31,0,0,0,115,89,0,0,0,124, + 1,0,100,0,0,107,8,0,114,24,0,124,0,0,106,0, + 0,125,1,0,110,46,0,124,0,0,106,0,0,124,1,0, + 107,3,0,114,70,0,116,1,0,100,1,0,124,0,0,106, + 0,0,124,1,0,102,2,0,22,100,2,0,124,1,0,131, + 1,1,130,1,0,136,0,0,124,0,0,124,1,0,124,2, + 0,124,3,0,142,2,0,83,41,3,78,122,30,108,111,97, + 100,101,114,32,102,111,114,32,37,115,32,99,97,110,110,111, + 116,32,104,97,110,100,108,101,32,37,115,218,4,110,97,109, + 101,41,2,114,108,0,0,0,218,11,73,109,112,111,114,116, + 69,114,114,111,114,41,4,218,4,115,101,108,102,114,108,0, + 0,0,114,106,0,0,0,90,6,107,119,97,114,103,115,41, + 1,218,6,109,101,116,104,111,100,114,4,0,0,0,114,6, + 0,0,0,218,19,95,99,104,101,99,107,95,110,97,109,101, + 95,119,114,97,112,112,101,114,156,1,0,0,115,12,0,0, + 0,0,1,12,1,12,1,15,1,6,1,25,1,122,40,95, + 99,104,101,99,107,95,110,97,109,101,46,60,108,111,99,97, + 108,115,62,46,95,99,104,101,99,107,95,110,97,109,101,95, + 119,114,97,112,112,101,114,99,2,0,0,0,0,0,0,0, + 3,0,0,0,7,0,0,0,83,0,0,0,115,92,0,0, + 0,120,66,0,100,1,0,100,2,0,100,3,0,100,4,0, + 103,4,0,68,93,46,0,125,2,0,116,0,0,124,1,0, + 124,2,0,131,2,0,114,19,0,116,1,0,124,0,0,124, + 2,0,116,2,0,124,1,0,124,2,0,131,2,0,131,3, + 0,1,113,19,0,87,124,0,0,106,3,0,106,4,0,124, + 1,0,106,3,0,131,1,0,1,100,0,0,83,41,5,78, + 218,10,95,95,109,111,100,117,108,101,95,95,218,8,95,95, + 110,97,109,101,95,95,218,12,95,95,113,117,97,108,110,97, + 109,101,95,95,218,7,95,95,100,111,99,95,95,41,5,218, + 7,104,97,115,97,116,116,114,218,7,115,101,116,97,116,116, + 114,218,7,103,101,116,97,116,116,114,218,8,95,95,100,105, + 99,116,95,95,218,6,117,112,100,97,116,101,41,3,90,3, + 110,101,119,90,3,111,108,100,114,54,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,218,5,95,119, + 114,97,112,167,1,0,0,115,8,0,0,0,0,1,25,1, + 15,1,29,1,122,26,95,99,104,101,99,107,95,110,97,109, + 101,46,60,108,111,99,97,108,115,62,46,95,119,114,97,112, + 41,3,218,10,95,98,111,111,116,115,116,114,97,112,114,122, + 0,0,0,218,9,78,97,109,101,69,114,114,111,114,41,3, + 114,111,0,0,0,114,112,0,0,0,114,122,0,0,0,114, + 4,0,0,0,41,1,114,111,0,0,0,114,6,0,0,0, + 218,11,95,99,104,101,99,107,95,110,97,109,101,148,1,0, + 0,115,14,0,0,0,0,8,21,7,3,1,13,1,13,2, + 17,5,13,1,114,125,0,0,0,99,2,0,0,0,0,0, + 0,0,5,0,0,0,4,0,0,0,67,0,0,0,115,84, + 0,0,0,124,0,0,106,0,0,124,1,0,131,1,0,92, + 2,0,125,2,0,125,3,0,124,2,0,100,1,0,107,8, + 0,114,80,0,116,1,0,124,3,0,131,1,0,114,80,0, + 100,2,0,125,4,0,116,2,0,106,3,0,124,4,0,106, + 4,0,124,3,0,100,3,0,25,131,1,0,116,5,0,131, + 2,0,1,124,2,0,83,41,4,122,155,84,114,121,32,116, + 111,32,102,105,110,100,32,97,32,108,111,97,100,101,114,32, + 102,111,114,32,116,104,101,32,115,112,101,99,105,102,105,101, + 100,32,109,111,100,117,108,101,32,98,121,32,100,101,108,101, + 103,97,116,105,110,103,32,116,111,10,32,32,32,32,115,101, + 108,102,46,102,105,110,100,95,108,111,97,100,101,114,40,41, + 46,10,10,32,32,32,32,84,104,105,115,32,109,101,116,104, + 111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100, + 32,105,110,32,102,97,118,111,114,32,111,102,32,102,105,110, + 100,101,114,46,102,105,110,100,95,115,112,101,99,40,41,46, + 10,10,32,32,32,32,78,122,44,78,111,116,32,105,109,112, + 111,114,116,105,110,103,32,100,105,114,101,99,116,111,114,121, + 32,123,125,58,32,109,105,115,115,105,110,103,32,95,95,105, + 110,105,116,95,95,114,61,0,0,0,41,6,218,11,102,105, + 110,100,95,108,111,97,100,101,114,114,33,0,0,0,114,62, + 0,0,0,114,63,0,0,0,114,49,0,0,0,218,13,73, + 109,112,111,114,116,87,97,114,110,105,110,103,41,5,114,110, + 0,0,0,218,8,102,117,108,108,110,97,109,101,218,6,108, + 111,97,100,101,114,218,8,112,111,114,116,105,111,110,115,218, + 3,109,115,103,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,218,17,95,102,105,110,100,95,109,111,100,117,108, + 101,95,115,104,105,109,176,1,0,0,115,10,0,0,0,0, + 10,21,1,24,1,6,1,29,1,114,132,0,0,0,99,4, + 0,0,0,0,0,0,0,11,0,0,0,19,0,0,0,67, + 0,0,0,115,252,1,0,0,105,0,0,125,4,0,124,2, + 0,100,1,0,107,9,0,114,31,0,124,2,0,124,4,0, + 100,2,0,60,110,6,0,100,3,0,125,2,0,124,3,0, + 100,1,0,107,9,0,114,59,0,124,3,0,124,4,0,100, + 4,0,60,124,0,0,100,1,0,100,5,0,133,2,0,25, + 125,5,0,124,0,0,100,5,0,100,6,0,133,2,0,25, + 125,6,0,124,0,0,100,6,0,100,7,0,133,2,0,25, + 125,7,0,124,5,0,116,0,0,107,3,0,114,180,0,124, + 5,0,116,1,0,107,3,0,114,180,0,100,8,0,106,2, + 0,124,2,0,124,5,0,131,2,0,125,8,0,116,3,0, + 100,9,0,124,8,0,131,2,0,1,116,4,0,124,8,0, + 124,4,0,141,1,0,130,1,0,110,119,0,116,5,0,124, + 6,0,131,1,0,100,5,0,107,3,0,114,241,0,100,10, + 0,106,2,0,124,2,0,131,1,0,125,8,0,116,3,0, + 100,9,0,124,8,0,131,2,0,1,116,6,0,124,8,0, + 131,1,0,130,1,0,110,58,0,116,5,0,124,7,0,131, + 1,0,100,5,0,107,3,0,114,43,1,100,11,0,106,2, + 0,124,2,0,131,1,0,125,8,0,116,3,0,100,9,0, + 124,8,0,131,2,0,1,116,6,0,124,8,0,131,1,0, + 130,1,0,124,1,0,100,1,0,107,9,0,114,238,1,121, + 20,0,116,7,0,124,1,0,100,12,0,25,131,1,0,125, + 9,0,87,110,18,0,4,116,8,0,107,10,0,114,95,1, + 1,1,1,89,110,62,0,88,116,9,0,124,6,0,131,1, + 0,124,9,0,107,3,0,114,157,1,100,13,0,106,2,0, + 124,2,0,131,1,0,125,8,0,116,3,0,100,9,0,124, + 8,0,131,2,0,1,116,4,0,124,8,0,124,4,0,141, + 1,0,130,1,0,121,18,0,124,1,0,100,14,0,25,100, + 15,0,64,125,10,0,87,110,18,0,4,116,8,0,107,10, + 0,114,195,1,1,1,1,89,110,43,0,88,116,9,0,124, + 7,0,131,1,0,124,10,0,107,3,0,114,238,1,116,4, + 0,100,13,0,106,2,0,124,2,0,131,1,0,124,4,0, + 141,1,0,130,1,0,124,0,0,100,7,0,100,1,0,133, + 2,0,25,83,41,16,97,122,1,0,0,86,97,108,105,100, + 97,116,101,32,116,104,101,32,104,101,97,100,101,114,32,111, + 102,32,116,104,101,32,112,97,115,115,101,100,45,105,110,32, + 98,121,116,101,99,111,100,101,32,97,103,97,105,110,115,116, + 32,115,111,117,114,99,101,95,115,116,97,116,115,32,40,105, + 102,10,32,32,32,32,103,105,118,101,110,41,32,97,110,100, + 32,114,101,116,117,114,110,105,110,103,32,116,104,101,32,98, + 121,116,101,99,111,100,101,32,116,104,97,116,32,99,97,110, + 32,98,101,32,99,111,109,112,105,108,101,100,32,98,121,32, + 99,111,109,112,105,108,101,40,41,46,10,10,32,32,32,32, + 65,108,108,32,111,116,104,101,114,32,97,114,103,117,109,101, + 110,116,115,32,97,114,101,32,117,115,101,100,32,116,111,32, + 101,110,104,97,110,99,101,32,101,114,114,111,114,32,114,101, + 112,111,114,116,105,110,103,46,10,10,32,32,32,32,73,109, + 112,111,114,116,69,114,114,111,114,32,105,115,32,114,97,105, + 115,101,100,32,119,104,101,110,32,116,104,101,32,109,97,103, + 105,99,32,110,117,109,98,101,114,32,105,115,32,105,110,99, + 111,114,114,101,99,116,32,111,114,32,116,104,101,32,98,121, + 116,101,99,111,100,101,32,105,115,10,32,32,32,32,102,111, + 117,110,100,32,116,111,32,98,101,32,115,116,97,108,101,46, + 32,69,79,70,69,114,114,111,114,32,105,115,32,114,97,105, + 115,101,100,32,119,104,101,110,32,116,104,101,32,100,97,116, + 97,32,105,115,32,102,111,117,110,100,32,116,111,32,98,101, + 10,32,32,32,32,116,114,117,110,99,97,116,101,100,46,10, + 10,32,32,32,32,78,114,108,0,0,0,122,10,60,98,121, + 116,101,99,111,100,101,62,114,37,0,0,0,114,14,0,0, + 0,233,8,0,0,0,233,12,0,0,0,122,30,98,97,100, + 32,109,97,103,105,99,32,110,117,109,98,101,114,32,105,110, + 32,123,33,114,125,58,32,123,33,114,125,122,2,123,125,122, + 43,114,101,97,99,104,101,100,32,69,79,70,32,119,104,105, + 108,101,32,114,101,97,100,105,110,103,32,116,105,109,101,115, + 116,97,109,112,32,105,110,32,123,33,114,125,122,48,114,101, + 97,99,104,101,100,32,69,79,70,32,119,104,105,108,101,32, + 114,101,97,100,105,110,103,32,115,105,122,101,32,111,102,32, + 115,111,117,114,99,101,32,105,110,32,123,33,114,125,218,5, + 109,116,105,109,101,122,26,98,121,116,101,99,111,100,101,32, + 105,115,32,115,116,97,108,101,32,102,111,114,32,123,33,114, + 125,218,4,115,105,122,101,108,3,0,0,0,255,127,255,127, + 3,0,41,10,218,12,77,65,71,73,67,95,78,85,77,66, + 69,82,218,24,95,66,65,67,75,67,79,77,80,65,84,95, + 77,65,71,73,67,95,78,85,77,66,69,82,114,49,0,0, + 0,114,107,0,0,0,114,109,0,0,0,114,33,0,0,0, + 218,8,69,79,70,69,114,114,111,114,114,16,0,0,0,218, + 8,75,101,121,69,114,114,111,114,114,21,0,0,0,41,11, + 114,55,0,0,0,218,12,115,111,117,114,99,101,95,115,116, + 97,116,115,114,108,0,0,0,114,37,0,0,0,90,11,101, + 120,99,95,100,101,116,97,105,108,115,90,5,109,97,103,105, + 99,90,13,114,97,119,95,116,105,109,101,115,116,97,109,112, + 90,8,114,97,119,95,115,105,122,101,114,77,0,0,0,218, + 12,115,111,117,114,99,101,95,109,116,105,109,101,218,11,115, + 111,117,114,99,101,95,115,105,122,101,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,218,25,95,118,97,108,105, + 100,97,116,101,95,98,121,116,101,99,111,100,101,95,104,101, + 97,100,101,114,193,1,0,0,115,78,0,0,0,0,11,6, + 1,12,1,13,3,6,1,12,1,10,1,16,1,16,1,16, + 1,12,2,12,1,18,1,13,1,18,1,18,1,15,1,13, + 1,15,1,18,1,15,1,13,1,12,1,12,1,3,1,20, + 1,13,1,5,2,18,1,15,1,13,1,15,1,3,1,18, + 1,13,1,5,2,18,1,15,1,9,1,114,144,0,0,0, + 99,4,0,0,0,0,0,0,0,5,0,0,0,6,0,0, + 0,67,0,0,0,115,112,0,0,0,116,0,0,106,1,0, + 124,0,0,131,1,0,125,4,0,116,2,0,124,4,0,116, + 3,0,131,2,0,114,75,0,116,4,0,100,1,0,124,2, + 0,131,2,0,1,124,3,0,100,2,0,107,9,0,114,71, + 0,116,5,0,106,6,0,124,4,0,124,3,0,131,2,0, + 1,124,4,0,83,116,7,0,100,3,0,106,8,0,124,2, + 0,131,1,0,100,4,0,124,1,0,100,5,0,124,2,0, + 131,1,2,130,1,0,100,2,0,83,41,6,122,60,67,111, + 109,112,105,108,101,32,98,121,116,101,99,111,100,101,32,97, + 115,32,114,101,116,117,114,110,101,100,32,98,121,32,95,118, + 97,108,105,100,97,116,101,95,98,121,116,101,99,111,100,101, + 95,104,101,97,100,101,114,40,41,46,122,21,99,111,100,101, + 32,111,98,106,101,99,116,32,102,114,111,109,32,123,33,114, + 125,78,122,23,78,111,110,45,99,111,100,101,32,111,98,106, + 101,99,116,32,105,110,32,123,33,114,125,114,108,0,0,0, + 114,37,0,0,0,41,9,218,7,109,97,114,115,104,97,108, + 90,5,108,111,97,100,115,218,10,105,115,105,110,115,116,97, + 110,99,101,218,10,95,99,111,100,101,95,116,121,112,101,114, + 107,0,0,0,218,4,95,105,109,112,90,16,95,102,105,120, + 95,99,111,95,102,105,108,101,110,97,109,101,114,109,0,0, + 0,114,49,0,0,0,41,5,114,55,0,0,0,114,108,0, + 0,0,114,91,0,0,0,114,92,0,0,0,218,4,99,111, + 100,101,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,17,95,99,111,109,112,105,108,101,95,98,121,116,101, + 99,111,100,101,250,1,0,0,115,16,0,0,0,0,2,15, + 1,15,1,13,1,12,1,16,1,4,2,18,1,114,150,0, + 0,0,114,61,0,0,0,99,3,0,0,0,0,0,0,0, + 4,0,0,0,3,0,0,0,67,0,0,0,115,76,0,0, + 0,116,0,0,116,1,0,131,1,0,125,3,0,124,3,0, + 106,2,0,116,3,0,124,1,0,131,1,0,131,1,0,1, + 124,3,0,106,2,0,116,3,0,124,2,0,131,1,0,131, + 1,0,1,124,3,0,106,2,0,116,4,0,106,5,0,124, + 0,0,131,1,0,131,1,0,1,124,3,0,83,41,1,122, + 80,67,111,109,112,105,108,101,32,97,32,99,111,100,101,32, + 111,98,106,101,99,116,32,105,110,116,111,32,98,121,116,101, + 99,111,100,101,32,102,111,114,32,119,114,105,116,105,110,103, + 32,111,117,116,32,116,111,32,97,32,98,121,116,101,45,99, + 111,109,112,105,108,101,100,10,32,32,32,32,102,105,108,101, + 46,41,6,218,9,98,121,116,101,97,114,114,97,121,114,137, + 0,0,0,218,6,101,120,116,101,110,100,114,19,0,0,0, + 114,145,0,0,0,90,5,100,117,109,112,115,41,4,114,149, + 0,0,0,114,135,0,0,0,114,143,0,0,0,114,55,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,17,95,99,111,100,101,95,116,111,95,98,121,116,101, + 99,111,100,101,6,2,0,0,115,10,0,0,0,0,3,12, + 1,19,1,19,1,22,1,114,153,0,0,0,99,1,0,0, + 0,0,0,0,0,5,0,0,0,4,0,0,0,67,0,0, + 0,115,89,0,0,0,100,1,0,100,2,0,108,0,0,125, + 1,0,116,1,0,106,2,0,124,0,0,131,1,0,106,3, + 0,125,2,0,124,1,0,106,4,0,124,2,0,131,1,0, + 125,3,0,116,1,0,106,5,0,100,2,0,100,3,0,131, + 2,0,125,4,0,124,4,0,106,6,0,124,0,0,106,6, + 0,124,3,0,100,1,0,25,131,1,0,131,1,0,83,41, + 4,122,121,68,101,99,111,100,101,32,98,121,116,101,115,32, + 114,101,112,114,101,115,101,110,116,105,110,103,32,115,111,117, + 114,99,101,32,99,111,100,101,32,97,110,100,32,114,101,116, + 117,114,110,32,116,104,101,32,115,116,114,105,110,103,46,10, + 10,32,32,32,32,85,110,105,118,101,114,115,97,108,32,110, + 101,119,108,105,110,101,32,115,117,112,112,111,114,116,32,105, + 115,32,117,115,101,100,32,105,110,32,116,104,101,32,100,101, + 99,111,100,105,110,103,46,10,32,32,32,32,114,61,0,0, + 0,78,84,41,7,218,8,116,111,107,101,110,105,122,101,114, + 51,0,0,0,90,7,66,121,116,101,115,73,79,90,8,114, + 101,97,100,108,105,110,101,90,15,100,101,116,101,99,116,95, + 101,110,99,111,100,105,110,103,90,25,73,110,99,114,101,109, + 101,110,116,97,108,78,101,119,108,105,110,101,68,101,99,111, + 100,101,114,218,6,100,101,99,111,100,101,41,5,218,12,115, + 111,117,114,99,101,95,98,121,116,101,115,114,154,0,0,0, + 90,21,115,111,117,114,99,101,95,98,121,116,101,115,95,114, + 101,97,100,108,105,110,101,218,8,101,110,99,111,100,105,110, + 103,90,15,110,101,119,108,105,110,101,95,100,101,99,111,100, + 101,114,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,13,100,101,99,111,100,101,95,115,111,117,114,99,101, + 16,2,0,0,115,10,0,0,0,0,5,12,1,18,1,15, + 1,18,1,114,158,0,0,0,114,129,0,0,0,218,26,115, + 117,98,109,111,100,117,108,101,95,115,101,97,114,99,104,95, + 108,111,99,97,116,105,111,110,115,99,2,0,0,0,2,0, + 0,0,9,0,0,0,19,0,0,0,67,0,0,0,115,89, + 1,0,0,124,1,0,100,1,0,107,8,0,114,73,0,100, + 2,0,125,1,0,116,0,0,124,2,0,100,3,0,131,2, + 0,114,73,0,121,19,0,124,2,0,106,1,0,124,0,0, + 131,1,0,125,1,0,87,110,18,0,4,116,2,0,107,10, + 0,114,72,0,1,1,1,89,110,1,0,88,116,3,0,106, + 4,0,124,0,0,124,2,0,100,4,0,124,1,0,131,2, + 1,125,4,0,100,5,0,124,4,0,95,5,0,124,2,0, + 100,1,0,107,8,0,114,194,0,120,73,0,116,6,0,131, + 0,0,68,93,58,0,92,2,0,125,5,0,125,6,0,124, + 1,0,106,7,0,116,8,0,124,6,0,131,1,0,131,1, + 0,114,128,0,124,5,0,124,0,0,124,1,0,131,2,0, + 125,2,0,124,2,0,124,4,0,95,9,0,80,113,128,0, + 87,100,1,0,83,124,3,0,116,10,0,107,8,0,114,23, + 1,116,0,0,124,2,0,100,6,0,131,2,0,114,32,1, + 121,19,0,124,2,0,106,11,0,124,0,0,131,1,0,125, + 7,0,87,110,18,0,4,116,2,0,107,10,0,114,4,1, + 1,1,1,89,113,32,1,88,124,7,0,114,32,1,103,0, + 0,124,4,0,95,12,0,110,9,0,124,3,0,124,4,0, + 95,12,0,124,4,0,106,12,0,103,0,0,107,2,0,114, + 85,1,124,1,0,114,85,1,116,13,0,124,1,0,131,1, + 0,100,7,0,25,125,8,0,124,4,0,106,12,0,106,14, + 0,124,8,0,131,1,0,1,124,4,0,83,41,8,97,61, + 1,0,0,82,101,116,117,114,110,32,97,32,109,111,100,117, + 108,101,32,115,112,101,99,32,98,97,115,101,100,32,111,110, + 32,97,32,102,105,108,101,32,108,111,99,97,116,105,111,110, + 46,10,10,32,32,32,32,84,111,32,105,110,100,105,99,97, + 116,101,32,116,104,97,116,32,116,104,101,32,109,111,100,117, + 108,101,32,105,115,32,97,32,112,97,99,107,97,103,101,44, + 32,115,101,116,10,32,32,32,32,115,117,98,109,111,100,117, + 108,101,95,115,101,97,114,99,104,95,108,111,99,97,116,105, + 111,110,115,32,116,111,32,97,32,108,105,115,116,32,111,102, + 32,100,105,114,101,99,116,111,114,121,32,112,97,116,104,115, + 46,32,32,65,110,10,32,32,32,32,101,109,112,116,121,32, + 108,105,115,116,32,105,115,32,115,117,102,102,105,99,105,101, + 110,116,44,32,116,104,111,117,103,104,32,105,116,115,32,110, + 111,116,32,111,116,104,101,114,119,105,115,101,32,117,115,101, + 102,117,108,32,116,111,32,116,104,101,10,32,32,32,32,105, + 109,112,111,114,116,32,115,121,115,116,101,109,46,10,10,32, + 32,32,32,84,104,101,32,108,111,97,100,101,114,32,109,117, + 115,116,32,116,97,107,101,32,97,32,115,112,101,99,32,97, + 115,32,105,116,115,32,111,110,108,121,32,95,95,105,110,105, + 116,95,95,40,41,32,97,114,103,46,10,10,32,32,32,32, + 78,122,9,60,117,110,107,110,111,119,110,62,218,12,103,101, + 116,95,102,105,108,101,110,97,109,101,218,6,111,114,105,103, + 105,110,84,218,10,105,115,95,112,97,99,107,97,103,101,114, + 61,0,0,0,41,15,114,117,0,0,0,114,160,0,0,0, + 114,109,0,0,0,114,123,0,0,0,218,10,77,111,100,117, + 108,101,83,112,101,99,90,13,95,115,101,116,95,102,105,108, + 101,97,116,116,114,218,27,95,103,101,116,95,115,117,112,112, + 111,114,116,101,100,95,102,105,108,101,95,108,111,97,100,101, + 114,115,114,94,0,0,0,114,95,0,0,0,114,129,0,0, + 0,218,9,95,80,79,80,85,76,65,84,69,114,162,0,0, + 0,114,159,0,0,0,114,40,0,0,0,218,6,97,112,112, + 101,110,100,41,9,114,108,0,0,0,90,8,108,111,99,97, + 116,105,111,110,114,129,0,0,0,114,159,0,0,0,218,4, + 115,112,101,99,218,12,108,111,97,100,101,114,95,99,108,97, + 115,115,218,8,115,117,102,102,105,120,101,115,114,162,0,0, + 0,90,7,100,105,114,110,97,109,101,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,218,23,115,112,101,99,95, + 102,114,111,109,95,102,105,108,101,95,108,111,99,97,116,105, + 111,110,33,2,0,0,115,60,0,0,0,0,12,12,4,6, + 1,15,2,3,1,19,1,13,1,5,8,24,1,9,3,12, + 1,22,1,21,1,15,1,9,1,5,2,4,3,12,2,15, + 1,3,1,19,1,13,1,5,2,6,1,12,2,9,1,15, + 1,6,1,16,1,16,2,114,170,0,0,0,99,0,0,0, + 0,0,0,0,0,0,0,0,0,5,0,0,0,64,0,0, + 0,115,121,0,0,0,101,0,0,90,1,0,100,0,0,90, + 2,0,100,1,0,90,3,0,100,2,0,90,4,0,100,3, + 0,90,5,0,100,4,0,90,6,0,101,7,0,100,5,0, + 100,6,0,132,0,0,131,1,0,90,8,0,101,7,0,100, + 7,0,100,8,0,132,0,0,131,1,0,90,9,0,101,7, + 0,100,9,0,100,9,0,100,10,0,100,11,0,132,2,0, + 131,1,0,90,10,0,101,7,0,100,9,0,100,12,0,100, + 13,0,132,1,0,131,1,0,90,11,0,100,9,0,83,41, + 14,218,21,87,105,110,100,111,119,115,82,101,103,105,115,116, + 114,121,70,105,110,100,101,114,122,62,77,101,116,97,32,112, + 97,116,104,32,102,105,110,100,101,114,32,102,111,114,32,109, + 111,100,117,108,101,115,32,100,101,99,108,97,114,101,100,32, + 105,110,32,116,104,101,32,87,105,110,100,111,119,115,32,114, + 101,103,105,115,116,114,121,46,122,59,83,111,102,116,119,97, + 114,101,92,80,121,116,104,111,110,92,80,121,116,104,111,110, + 67,111,114,101,92,123,115,121,115,95,118,101,114,115,105,111, + 110,125,92,77,111,100,117,108,101,115,92,123,102,117,108,108, + 110,97,109,101,125,122,65,83,111,102,116,119,97,114,101,92, + 80,121,116,104,111,110,92,80,121,116,104,111,110,67,111,114, + 101,92,123,115,121,115,95,118,101,114,115,105,111,110,125,92, + 77,111,100,117,108,101,115,92,123,102,117,108,108,110,97,109, + 101,125,92,68,101,98,117,103,70,99,2,0,0,0,0,0, + 0,0,2,0,0,0,11,0,0,0,67,0,0,0,115,67, + 0,0,0,121,23,0,116,0,0,106,1,0,116,0,0,106, + 2,0,124,1,0,131,2,0,83,87,110,37,0,4,116,3, + 0,107,10,0,114,62,0,1,1,1,116,0,0,106,1,0, + 116,0,0,106,4,0,124,1,0,131,2,0,83,89,110,1, + 0,88,100,0,0,83,41,1,78,41,5,218,7,95,119,105, + 110,114,101,103,90,7,79,112,101,110,75,101,121,90,17,72, + 75,69,89,95,67,85,82,82,69,78,84,95,85,83,69,82, + 114,42,0,0,0,90,18,72,75,69,89,95,76,79,67,65, + 76,95,77,65,67,72,73,78,69,41,2,218,3,99,108,115, + 114,5,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 6,0,0,0,218,14,95,111,112,101,110,95,114,101,103,105, + 115,116,114,121,111,2,0,0,115,8,0,0,0,0,2,3, + 1,23,1,13,1,122,36,87,105,110,100,111,119,115,82,101, + 103,105,115,116,114,121,70,105,110,100,101,114,46,95,111,112, + 101,110,95,114,101,103,105,115,116,114,121,99,2,0,0,0, + 0,0,0,0,6,0,0,0,16,0,0,0,67,0,0,0, + 115,143,0,0,0,124,0,0,106,0,0,114,21,0,124,0, + 0,106,1,0,125,2,0,110,9,0,124,0,0,106,2,0, + 125,2,0,124,2,0,106,3,0,100,1,0,124,1,0,100, + 2,0,116,4,0,106,5,0,100,0,0,100,3,0,133,2, + 0,25,131,0,2,125,3,0,121,47,0,124,0,0,106,6, + 0,124,3,0,131,1,0,143,25,0,125,4,0,116,7,0, + 106,8,0,124,4,0,100,4,0,131,2,0,125,5,0,87, + 100,0,0,81,82,88,87,110,22,0,4,116,9,0,107,10, + 0,114,138,0,1,1,1,100,0,0,83,89,110,1,0,88, + 124,5,0,83,41,5,78,114,128,0,0,0,90,11,115,121, + 115,95,118,101,114,115,105,111,110,114,82,0,0,0,114,32, + 0,0,0,41,10,218,11,68,69,66,85,71,95,66,85,73, + 76,68,218,18,82,69,71,73,83,84,82,89,95,75,69,89, + 95,68,69,66,85,71,218,12,82,69,71,73,83,84,82,89, + 95,75,69,89,114,49,0,0,0,114,8,0,0,0,218,7, + 118,101,114,115,105,111,110,114,174,0,0,0,114,172,0,0, + 0,90,10,81,117,101,114,121,86,97,108,117,101,114,42,0, + 0,0,41,6,114,173,0,0,0,114,128,0,0,0,90,12, + 114,101,103,105,115,116,114,121,95,107,101,121,114,5,0,0, + 0,90,4,104,107,101,121,218,8,102,105,108,101,112,97,116, + 104,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 218,16,95,115,101,97,114,99,104,95,114,101,103,105,115,116, + 114,121,118,2,0,0,115,22,0,0,0,0,2,9,1,12, + 2,9,1,15,1,22,1,3,1,18,1,29,1,13,1,9, + 1,122,38,87,105,110,100,111,119,115,82,101,103,105,115,116, + 114,121,70,105,110,100,101,114,46,95,115,101,97,114,99,104, + 95,114,101,103,105,115,116,114,121,78,99,4,0,0,0,0, + 0,0,0,8,0,0,0,14,0,0,0,67,0,0,0,115, + 158,0,0,0,124,0,0,106,0,0,124,1,0,131,1,0, + 125,4,0,124,4,0,100,0,0,107,8,0,114,31,0,100, + 0,0,83,121,14,0,116,1,0,124,4,0,131,1,0,1, + 87,110,22,0,4,116,2,0,107,10,0,114,69,0,1,1, + 1,100,0,0,83,89,110,1,0,88,120,81,0,116,3,0, + 131,0,0,68,93,70,0,92,2,0,125,5,0,125,6,0, + 124,4,0,106,4,0,116,5,0,124,6,0,131,1,0,131, + 1,0,114,80,0,116,6,0,106,7,0,124,1,0,124,5, + 0,124,1,0,124,4,0,131,2,0,100,1,0,124,4,0, + 131,2,1,125,7,0,124,7,0,83,113,80,0,87,100,0, + 0,83,41,2,78,114,161,0,0,0,41,8,114,180,0,0, + 0,114,41,0,0,0,114,42,0,0,0,114,164,0,0,0, + 114,94,0,0,0,114,95,0,0,0,114,123,0,0,0,218, + 16,115,112,101,99,95,102,114,111,109,95,108,111,97,100,101, + 114,41,8,114,173,0,0,0,114,128,0,0,0,114,37,0, + 0,0,218,6,116,97,114,103,101,116,114,179,0,0,0,114, + 129,0,0,0,114,169,0,0,0,114,167,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,218,9,102, + 105,110,100,95,115,112,101,99,133,2,0,0,115,26,0,0, + 0,0,2,15,1,12,1,4,1,3,1,14,1,13,1,9, + 1,22,1,21,1,9,1,15,1,9,1,122,31,87,105,110, + 100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,100, + 101,114,46,102,105,110,100,95,115,112,101,99,99,3,0,0, + 0,0,0,0,0,4,0,0,0,3,0,0,0,67,0,0, + 0,115,45,0,0,0,124,0,0,106,0,0,124,1,0,124, + 2,0,131,2,0,125,3,0,124,3,0,100,1,0,107,9, + 0,114,37,0,124,3,0,106,1,0,83,100,1,0,83,100, + 1,0,83,41,2,122,108,70,105,110,100,32,109,111,100,117, + 108,101,32,110,97,109,101,100,32,105,110,32,116,104,101,32, + 114,101,103,105,115,116,114,121,46,10,10,32,32,32,32,32, + 32,32,32,84,104,105,115,32,109,101,116,104,111,100,32,105, + 115,32,100,101,112,114,101,99,97,116,101,100,46,32,32,85, + 115,101,32,101,120,101,99,95,109,111,100,117,108,101,40,41, + 32,105,110,115,116,101,97,100,46,10,10,32,32,32,32,32, + 32,32,32,78,41,2,114,183,0,0,0,114,129,0,0,0, + 41,4,114,173,0,0,0,114,128,0,0,0,114,37,0,0, + 0,114,167,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,218,11,102,105,110,100,95,109,111,100,117, + 108,101,149,2,0,0,115,8,0,0,0,0,7,18,1,12, + 1,7,2,122,33,87,105,110,100,111,119,115,82,101,103,105, + 115,116,114,121,70,105,110,100,101,114,46,102,105,110,100,95, + 109,111,100,117,108,101,41,12,114,114,0,0,0,114,113,0, + 0,0,114,115,0,0,0,114,116,0,0,0,114,177,0,0, + 0,114,176,0,0,0,114,175,0,0,0,218,11,99,108,97, + 115,115,109,101,116,104,111,100,114,174,0,0,0,114,180,0, + 0,0,114,183,0,0,0,114,184,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,10,95,99,97,108,99,95,109,111,100,101,106,1,0,0, - 115,12,0,0,0,0,2,3,1,19,1,13,1,11,3,10, - 1,114,99,0,0,0,218,9,118,101,114,98,111,115,105,116, - 121,114,31,0,0,0,99,1,0,0,0,1,0,0,0,3, - 0,0,0,4,0,0,0,71,0,0,0,115,75,0,0,0, - 116,0,0,106,1,0,106,2,0,124,1,0,107,5,0,114, - 71,0,124,0,0,106,3,0,100,6,0,131,1,0,115,43, - 0,100,3,0,124,0,0,23,125,0,0,116,4,0,124,0, - 0,106,5,0,124,2,0,140,0,0,100,4,0,116,0,0, - 106,6,0,131,1,1,1,100,5,0,83,41,7,122,61,80, - 114,105,110,116,32,116,104,101,32,109,101,115,115,97,103,101, - 32,116,111,32,115,116,100,101,114,114,32,105,102,32,45,118, - 47,80,89,84,72,79,78,86,69,82,66,79,83,69,32,105, - 115,32,116,117,114,110,101,100,32,111,110,46,250,1,35,250, - 7,105,109,112,111,114,116,32,122,2,35,32,114,56,0,0, - 0,78,41,2,114,101,0,0,0,114,102,0,0,0,41,7, - 114,8,0,0,0,114,69,0,0,0,218,7,118,101,114,98, - 111,115,101,114,10,0,0,0,218,5,112,114,105,110,116,114, - 49,0,0,0,218,6,115,116,100,101,114,114,41,3,114,77, - 0,0,0,114,100,0,0,0,218,4,97,114,103,115,114,4, - 0,0,0,114,4,0,0,0,114,6,0,0,0,218,16,95, - 118,101,114,98,111,115,101,95,109,101,115,115,97,103,101,118, - 1,0,0,115,8,0,0,0,0,2,18,1,15,1,10,1, - 114,107,0,0,0,99,1,0,0,0,0,0,0,0,3,0, - 0,0,11,0,0,0,3,0,0,0,115,84,0,0,0,100, - 1,0,135,0,0,102,1,0,100,2,0,100,3,0,134,1, - 0,125,1,0,121,13,0,116,0,0,106,1,0,125,2,0, - 87,110,30,0,4,116,2,0,107,10,0,114,66,0,1,1, - 1,100,4,0,100,5,0,132,0,0,125,2,0,89,110,1, - 0,88,124,2,0,124,1,0,136,0,0,131,2,0,1,124, - 1,0,83,41,6,122,252,68,101,99,111,114,97,116,111,114, - 32,116,111,32,118,101,114,105,102,121,32,116,104,97,116,32, - 116,104,101,32,109,111,100,117,108,101,32,98,101,105,110,103, - 32,114,101,113,117,101,115,116,101,100,32,109,97,116,99,104, - 101,115,32,116,104,101,32,111,110,101,32,116,104,101,10,32, - 32,32,32,108,111,97,100,101,114,32,99,97,110,32,104,97, - 110,100,108,101,46,10,10,32,32,32,32,84,104,101,32,102, - 105,114,115,116,32,97,114,103,117,109,101,110,116,32,40,115, - 101,108,102,41,32,109,117,115,116,32,100,101,102,105,110,101, - 32,95,110,97,109,101,32,119,104,105,99,104,32,116,104,101, - 32,115,101,99,111,110,100,32,97,114,103,117,109,101,110,116, - 32,105,115,10,32,32,32,32,99,111,109,112,97,114,101,100, - 32,97,103,97,105,110,115,116,46,32,73,102,32,116,104,101, - 32,99,111,109,112,97,114,105,115,111,110,32,102,97,105,108, - 115,32,116,104,101,110,32,73,109,112,111,114,116,69,114,114, - 111,114,32,105,115,32,114,97,105,115,101,100,46,10,10,32, - 32,32,32,78,99,2,0,0,0,0,0,0,0,4,0,0, - 0,5,0,0,0,31,0,0,0,115,89,0,0,0,124,1, - 0,100,0,0,107,8,0,114,24,0,124,0,0,106,0,0, - 125,1,0,110,46,0,124,0,0,106,0,0,124,1,0,107, - 3,0,114,70,0,116,1,0,100,1,0,124,0,0,106,0, - 0,124,1,0,102,2,0,22,100,2,0,124,1,0,131,1, - 1,130,1,0,136,0,0,124,0,0,124,1,0,124,2,0, - 124,3,0,142,2,0,83,41,3,78,122,30,108,111,97,100, - 101,114,32,102,111,114,32,37,115,32,99,97,110,110,111,116, - 32,104,97,110,100,108,101,32,37,115,218,4,110,97,109,101, - 41,2,114,108,0,0,0,218,11,73,109,112,111,114,116,69, - 114,114,111,114,41,4,218,4,115,101,108,102,114,108,0,0, - 0,114,106,0,0,0,90,6,107,119,97,114,103,115,41,1, - 218,6,109,101,116,104,111,100,114,4,0,0,0,114,6,0, - 0,0,218,19,95,99,104,101,99,107,95,110,97,109,101,95, - 119,114,97,112,112,101,114,134,1,0,0,115,12,0,0,0, - 0,1,12,1,12,1,15,1,6,1,25,1,122,40,95,99, - 104,101,99,107,95,110,97,109,101,46,60,108,111,99,97,108, - 115,62,46,95,99,104,101,99,107,95,110,97,109,101,95,119, - 114,97,112,112,101,114,99,2,0,0,0,0,0,0,0,3, - 0,0,0,7,0,0,0,83,0,0,0,115,92,0,0,0, - 120,66,0,100,1,0,100,2,0,100,3,0,100,4,0,103, - 4,0,68,93,46,0,125,2,0,116,0,0,124,1,0,124, - 2,0,131,2,0,114,19,0,116,1,0,124,0,0,124,2, - 0,116,2,0,124,1,0,124,2,0,131,2,0,131,3,0, - 1,113,19,0,87,124,0,0,106,3,0,106,4,0,124,1, - 0,106,3,0,131,1,0,1,100,0,0,83,41,5,78,218, - 10,95,95,109,111,100,117,108,101,95,95,218,8,95,95,110, - 97,109,101,95,95,218,12,95,95,113,117,97,108,110,97,109, - 101,95,95,218,7,95,95,100,111,99,95,95,41,5,218,7, - 104,97,115,97,116,116,114,218,7,115,101,116,97,116,116,114, - 218,7,103,101,116,97,116,116,114,218,8,95,95,100,105,99, - 116,95,95,218,6,117,112,100,97,116,101,41,3,90,3,110, - 101,119,90,3,111,108,100,114,54,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,6,0,0,0,218,5,95,119,114, - 97,112,145,1,0,0,115,8,0,0,0,0,1,25,1,15, - 1,29,1,122,26,95,99,104,101,99,107,95,110,97,109,101, - 46,60,108,111,99,97,108,115,62,46,95,119,114,97,112,41, - 3,218,10,95,98,111,111,116,115,116,114,97,112,114,122,0, - 0,0,218,9,78,97,109,101,69,114,114,111,114,41,3,114, - 111,0,0,0,114,112,0,0,0,114,122,0,0,0,114,4, - 0,0,0,41,1,114,111,0,0,0,114,6,0,0,0,218, - 11,95,99,104,101,99,107,95,110,97,109,101,126,1,0,0, - 115,14,0,0,0,0,8,21,7,3,1,13,1,13,2,17, - 5,13,1,114,125,0,0,0,99,2,0,0,0,0,0,0, - 0,5,0,0,0,4,0,0,0,67,0,0,0,115,84,0, - 0,0,124,0,0,106,0,0,124,1,0,131,1,0,92,2, - 0,125,2,0,125,3,0,124,2,0,100,1,0,107,8,0, - 114,80,0,116,1,0,124,3,0,131,1,0,114,80,0,100, - 2,0,125,4,0,116,2,0,106,3,0,124,4,0,106,4, - 0,124,3,0,100,3,0,25,131,1,0,116,5,0,131,2, - 0,1,124,2,0,83,41,4,122,155,84,114,121,32,116,111, - 32,102,105,110,100,32,97,32,108,111,97,100,101,114,32,102, - 111,114,32,116,104,101,32,115,112,101,99,105,102,105,101,100, - 32,109,111,100,117,108,101,32,98,121,32,100,101,108,101,103, - 97,116,105,110,103,32,116,111,10,32,32,32,32,115,101,108, - 102,46,102,105,110,100,95,108,111,97,100,101,114,40,41,46, - 10,10,32,32,32,32,84,104,105,115,32,109,101,116,104,111, - 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,32, - 105,110,32,102,97,118,111,114,32,111,102,32,102,105,110,100, - 101,114,46,102,105,110,100,95,115,112,101,99,40,41,46,10, - 10,32,32,32,32,78,122,44,78,111,116,32,105,109,112,111, - 114,116,105,110,103,32,100,105,114,101,99,116,111,114,121,32, - 123,125,58,32,109,105,115,115,105,110,103,32,95,95,105,110, - 105,116,95,95,114,61,0,0,0,41,6,218,11,102,105,110, - 100,95,108,111,97,100,101,114,114,33,0,0,0,114,62,0, - 0,0,114,63,0,0,0,114,49,0,0,0,218,13,73,109, - 112,111,114,116,87,97,114,110,105,110,103,41,5,114,110,0, - 0,0,218,8,102,117,108,108,110,97,109,101,218,6,108,111, - 97,100,101,114,218,8,112,111,114,116,105,111,110,115,218,3, - 109,115,103,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,17,95,102,105,110,100,95,109,111,100,117,108,101, - 95,115,104,105,109,154,1,0,0,115,10,0,0,0,0,10, - 21,1,24,1,6,1,29,1,114,132,0,0,0,99,4,0, - 0,0,0,0,0,0,11,0,0,0,19,0,0,0,67,0, - 0,0,115,240,1,0,0,105,0,0,125,4,0,124,2,0, - 100,1,0,107,9,0,114,31,0,124,2,0,124,4,0,100, - 2,0,60,110,6,0,100,3,0,125,2,0,124,3,0,100, - 1,0,107,9,0,114,59,0,124,3,0,124,4,0,100,4, - 0,60,124,0,0,100,1,0,100,5,0,133,2,0,25,125, - 5,0,124,0,0,100,5,0,100,6,0,133,2,0,25,125, - 6,0,124,0,0,100,6,0,100,7,0,133,2,0,25,125, - 7,0,124,5,0,116,0,0,107,3,0,114,168,0,100,8, - 0,106,1,0,124,2,0,124,5,0,131,2,0,125,8,0, - 116,2,0,100,9,0,124,8,0,131,2,0,1,116,3,0, - 124,8,0,124,4,0,141,1,0,130,1,0,110,119,0,116, - 4,0,124,6,0,131,1,0,100,5,0,107,3,0,114,229, - 0,100,10,0,106,1,0,124,2,0,131,1,0,125,8,0, - 116,2,0,100,9,0,124,8,0,131,2,0,1,116,5,0, - 124,8,0,131,1,0,130,1,0,110,58,0,116,4,0,124, - 7,0,131,1,0,100,5,0,107,3,0,114,31,1,100,11, - 0,106,1,0,124,2,0,131,1,0,125,8,0,116,2,0, - 100,9,0,124,8,0,131,2,0,1,116,5,0,124,8,0, - 131,1,0,130,1,0,124,1,0,100,1,0,107,9,0,114, - 226,1,121,20,0,116,6,0,124,1,0,100,12,0,25,131, - 1,0,125,9,0,87,110,18,0,4,116,7,0,107,10,0, - 114,83,1,1,1,1,89,110,62,0,88,116,8,0,124,6, - 0,131,1,0,124,9,0,107,3,0,114,145,1,100,13,0, - 106,1,0,124,2,0,131,1,0,125,8,0,116,2,0,100, - 9,0,124,8,0,131,2,0,1,116,3,0,124,8,0,124, - 4,0,141,1,0,130,1,0,121,18,0,124,1,0,100,14, - 0,25,100,15,0,64,125,10,0,87,110,18,0,4,116,7, - 0,107,10,0,114,183,1,1,1,1,89,110,43,0,88,116, - 8,0,124,7,0,131,1,0,124,10,0,107,3,0,114,226, - 1,116,3,0,100,13,0,106,1,0,124,2,0,131,1,0, - 124,4,0,141,1,0,130,1,0,124,0,0,100,7,0,100, - 1,0,133,2,0,25,83,41,16,97,122,1,0,0,86,97, - 108,105,100,97,116,101,32,116,104,101,32,104,101,97,100,101, - 114,32,111,102,32,116,104,101,32,112,97,115,115,101,100,45, - 105,110,32,98,121,116,101,99,111,100,101,32,97,103,97,105, - 110,115,116,32,115,111,117,114,99,101,95,115,116,97,116,115, - 32,40,105,102,10,32,32,32,32,103,105,118,101,110,41,32, - 97,110,100,32,114,101,116,117,114,110,105,110,103,32,116,104, - 101,32,98,121,116,101,99,111,100,101,32,116,104,97,116,32, - 99,97,110,32,98,101,32,99,111,109,112,105,108,101,100,32, - 98,121,32,99,111,109,112,105,108,101,40,41,46,10,10,32, - 32,32,32,65,108,108,32,111,116,104,101,114,32,97,114,103, - 117,109,101,110,116,115,32,97,114,101,32,117,115,101,100,32, - 116,111,32,101,110,104,97,110,99,101,32,101,114,114,111,114, - 32,114,101,112,111,114,116,105,110,103,46,10,10,32,32,32, - 32,73,109,112,111,114,116,69,114,114,111,114,32,105,115,32, - 114,97,105,115,101,100,32,119,104,101,110,32,116,104,101,32, - 109,97,103,105,99,32,110,117,109,98,101,114,32,105,115,32, - 105,110,99,111,114,114,101,99,116,32,111,114,32,116,104,101, - 32,98,121,116,101,99,111,100,101,32,105,115,10,32,32,32, - 32,102,111,117,110,100,32,116,111,32,98,101,32,115,116,97, - 108,101,46,32,69,79,70,69,114,114,111,114,32,105,115,32, - 114,97,105,115,101,100,32,119,104,101,110,32,116,104,101,32, - 100,97,116,97,32,105,115,32,102,111,117,110,100,32,116,111, - 32,98,101,10,32,32,32,32,116,114,117,110,99,97,116,101, - 100,46,10,10,32,32,32,32,78,114,108,0,0,0,122,10, - 60,98,121,116,101,99,111,100,101,62,114,37,0,0,0,114, - 14,0,0,0,233,8,0,0,0,233,12,0,0,0,122,30, - 98,97,100,32,109,97,103,105,99,32,110,117,109,98,101,114, - 32,105,110,32,123,33,114,125,58,32,123,33,114,125,122,2, - 123,125,122,43,114,101,97,99,104,101,100,32,69,79,70,32, - 119,104,105,108,101,32,114,101,97,100,105,110,103,32,116,105, - 109,101,115,116,97,109,112,32,105,110,32,123,33,114,125,122, - 48,114,101,97,99,104,101,100,32,69,79,70,32,119,104,105, - 108,101,32,114,101,97,100,105,110,103,32,115,105,122,101,32, - 111,102,32,115,111,117,114,99,101,32,105,110,32,123,33,114, - 125,218,5,109,116,105,109,101,122,26,98,121,116,101,99,111, - 100,101,32,105,115,32,115,116,97,108,101,32,102,111,114,32, - 123,33,114,125,218,4,115,105,122,101,108,3,0,0,0,255, - 127,255,127,3,0,41,9,218,12,77,65,71,73,67,95,78, - 85,77,66,69,82,114,49,0,0,0,114,107,0,0,0,114, - 109,0,0,0,114,33,0,0,0,218,8,69,79,70,69,114, - 114,111,114,114,16,0,0,0,218,8,75,101,121,69,114,114, - 111,114,114,21,0,0,0,41,11,114,55,0,0,0,218,12, - 115,111,117,114,99,101,95,115,116,97,116,115,114,108,0,0, - 0,114,37,0,0,0,90,11,101,120,99,95,100,101,116,97, - 105,108,115,90,5,109,97,103,105,99,90,13,114,97,119,95, - 116,105,109,101,115,116,97,109,112,90,8,114,97,119,95,115, - 105,122,101,114,77,0,0,0,218,12,115,111,117,114,99,101, - 95,109,116,105,109,101,218,11,115,111,117,114,99,101,95,115, - 105,122,101,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,25,95,118,97,108,105,100,97,116,101,95,98,121, - 116,101,99,111,100,101,95,104,101,97,100,101,114,171,1,0, - 0,115,76,0,0,0,0,11,6,1,12,1,13,3,6,1, - 12,1,10,1,16,1,16,1,16,1,12,1,18,1,13,1, - 18,1,18,1,15,1,13,1,15,1,18,1,15,1,13,1, - 12,1,12,1,3,1,20,1,13,1,5,2,18,1,15,1, - 13,1,15,1,3,1,18,1,13,1,5,2,18,1,15,1, - 9,1,114,143,0,0,0,99,4,0,0,0,0,0,0,0, - 5,0,0,0,6,0,0,0,67,0,0,0,115,112,0,0, - 0,116,0,0,106,1,0,124,0,0,131,1,0,125,4,0, - 116,2,0,124,4,0,116,3,0,131,2,0,114,75,0,116, - 4,0,100,1,0,124,2,0,131,2,0,1,124,3,0,100, - 2,0,107,9,0,114,71,0,116,5,0,106,6,0,124,4, - 0,124,3,0,131,2,0,1,124,4,0,83,116,7,0,100, - 3,0,106,8,0,124,2,0,131,1,0,100,4,0,124,1, - 0,100,5,0,124,2,0,131,1,2,130,1,0,100,2,0, - 83,41,6,122,60,67,111,109,112,105,108,101,32,98,121,116, - 101,99,111,100,101,32,97,115,32,114,101,116,117,114,110,101, - 100,32,98,121,32,95,118,97,108,105,100,97,116,101,95,98, - 121,116,101,99,111,100,101,95,104,101,97,100,101,114,40,41, - 46,122,21,99,111,100,101,32,111,98,106,101,99,116,32,102, - 114,111,109,32,123,33,114,125,78,122,23,78,111,110,45,99, - 111,100,101,32,111,98,106,101,99,116,32,105,110,32,123,33, - 114,125,114,108,0,0,0,114,37,0,0,0,41,9,218,7, - 109,97,114,115,104,97,108,90,5,108,111,97,100,115,218,10, - 105,115,105,110,115,116,97,110,99,101,218,10,95,99,111,100, - 101,95,116,121,112,101,114,107,0,0,0,218,4,95,105,109, - 112,90,16,95,102,105,120,95,99,111,95,102,105,108,101,110, - 97,109,101,114,109,0,0,0,114,49,0,0,0,41,5,114, - 55,0,0,0,114,108,0,0,0,114,91,0,0,0,114,92, - 0,0,0,218,4,99,111,100,101,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,17,95,99,111,109,112,105, - 108,101,95,98,121,116,101,99,111,100,101,226,1,0,0,115, - 16,0,0,0,0,2,15,1,15,1,13,1,12,1,16,1, - 4,2,18,1,114,149,0,0,0,114,61,0,0,0,99,3, - 0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,67, - 0,0,0,115,76,0,0,0,116,0,0,116,1,0,131,1, - 0,125,3,0,124,3,0,106,2,0,116,3,0,124,1,0, - 131,1,0,131,1,0,1,124,3,0,106,2,0,116,3,0, - 124,2,0,131,1,0,131,1,0,1,124,3,0,106,2,0, - 116,4,0,106,5,0,124,0,0,131,1,0,131,1,0,1, - 124,3,0,83,41,1,122,80,67,111,109,112,105,108,101,32, - 97,32,99,111,100,101,32,111,98,106,101,99,116,32,105,110, - 116,111,32,98,121,116,101,99,111,100,101,32,102,111,114,32, - 119,114,105,116,105,110,103,32,111,117,116,32,116,111,32,97, - 32,98,121,116,101,45,99,111,109,112,105,108,101,100,10,32, - 32,32,32,102,105,108,101,46,41,6,218,9,98,121,116,101, - 97,114,114,97,121,114,137,0,0,0,218,6,101,120,116,101, - 110,100,114,19,0,0,0,114,144,0,0,0,90,5,100,117, - 109,112,115,41,4,114,148,0,0,0,114,135,0,0,0,114, - 142,0,0,0,114,55,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,17,95,99,111,100,101,95, - 116,111,95,98,121,116,101,99,111,100,101,238,1,0,0,115, - 10,0,0,0,0,3,12,1,19,1,19,1,22,1,114,152, - 0,0,0,99,1,0,0,0,0,0,0,0,5,0,0,0, - 4,0,0,0,67,0,0,0,115,89,0,0,0,100,1,0, - 100,2,0,108,0,0,125,1,0,116,1,0,106,2,0,124, - 0,0,131,1,0,106,3,0,125,2,0,124,1,0,106,4, - 0,124,2,0,131,1,0,125,3,0,116,1,0,106,5,0, - 100,2,0,100,3,0,131,2,0,125,4,0,124,4,0,106, - 6,0,124,0,0,106,6,0,124,3,0,100,1,0,25,131, - 1,0,131,1,0,83,41,4,122,121,68,101,99,111,100,101, - 32,98,121,116,101,115,32,114,101,112,114,101,115,101,110,116, - 105,110,103,32,115,111,117,114,99,101,32,99,111,100,101,32, - 97,110,100,32,114,101,116,117,114,110,32,116,104,101,32,115, - 116,114,105,110,103,46,10,10,32,32,32,32,85,110,105,118, - 101,114,115,97,108,32,110,101,119,108,105,110,101,32,115,117, - 112,112,111,114,116,32,105,115,32,117,115,101,100,32,105,110, - 32,116,104,101,32,100,101,99,111,100,105,110,103,46,10,32, - 32,32,32,114,61,0,0,0,78,84,41,7,218,8,116,111, - 107,101,110,105,122,101,114,51,0,0,0,90,7,66,121,116, - 101,115,73,79,90,8,114,101,97,100,108,105,110,101,90,15, - 100,101,116,101,99,116,95,101,110,99,111,100,105,110,103,90, - 25,73,110,99,114,101,109,101,110,116,97,108,78,101,119,108, - 105,110,101,68,101,99,111,100,101,114,218,6,100,101,99,111, - 100,101,41,5,218,12,115,111,117,114,99,101,95,98,121,116, - 101,115,114,153,0,0,0,90,21,115,111,117,114,99,101,95, - 98,121,116,101,115,95,114,101,97,100,108,105,110,101,218,8, - 101,110,99,111,100,105,110,103,90,15,110,101,119,108,105,110, - 101,95,100,101,99,111,100,101,114,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,13,100,101,99,111,100,101, - 95,115,111,117,114,99,101,248,1,0,0,115,10,0,0,0, - 0,5,12,1,18,1,15,1,18,1,114,157,0,0,0,114, - 129,0,0,0,218,26,115,117,98,109,111,100,117,108,101,95, - 115,101,97,114,99,104,95,108,111,99,97,116,105,111,110,115, - 99,2,0,0,0,2,0,0,0,9,0,0,0,19,0,0, - 0,67,0,0,0,115,89,1,0,0,124,1,0,100,1,0, - 107,8,0,114,73,0,100,2,0,125,1,0,116,0,0,124, - 2,0,100,3,0,131,2,0,114,73,0,121,19,0,124,2, - 0,106,1,0,124,0,0,131,1,0,125,1,0,87,110,18, - 0,4,116,2,0,107,10,0,114,72,0,1,1,1,89,110, - 1,0,88,116,3,0,106,4,0,124,0,0,124,2,0,100, - 4,0,124,1,0,131,2,1,125,4,0,100,5,0,124,4, - 0,95,5,0,124,2,0,100,1,0,107,8,0,114,194,0, - 120,73,0,116,6,0,131,0,0,68,93,58,0,92,2,0, - 125,5,0,125,6,0,124,1,0,106,7,0,116,8,0,124, - 6,0,131,1,0,131,1,0,114,128,0,124,5,0,124,0, - 0,124,1,0,131,2,0,125,2,0,124,2,0,124,4,0, - 95,9,0,80,113,128,0,87,100,1,0,83,124,3,0,116, - 10,0,107,8,0,114,23,1,116,0,0,124,2,0,100,6, - 0,131,2,0,114,32,1,121,19,0,124,2,0,106,11,0, - 124,0,0,131,1,0,125,7,0,87,110,18,0,4,116,2, - 0,107,10,0,114,4,1,1,1,1,89,113,32,1,88,124, - 7,0,114,32,1,103,0,0,124,4,0,95,12,0,110,9, - 0,124,3,0,124,4,0,95,12,0,124,4,0,106,12,0, - 103,0,0,107,2,0,114,85,1,124,1,0,114,85,1,116, - 13,0,124,1,0,131,1,0,100,7,0,25,125,8,0,124, - 4,0,106,12,0,106,14,0,124,8,0,131,1,0,1,124, - 4,0,83,41,8,97,61,1,0,0,82,101,116,117,114,110, - 32,97,32,109,111,100,117,108,101,32,115,112,101,99,32,98, - 97,115,101,100,32,111,110,32,97,32,102,105,108,101,32,108, - 111,99,97,116,105,111,110,46,10,10,32,32,32,32,84,111, - 32,105,110,100,105,99,97,116,101,32,116,104,97,116,32,116, - 104,101,32,109,111,100,117,108,101,32,105,115,32,97,32,112, - 97,99,107,97,103,101,44,32,115,101,116,10,32,32,32,32, - 115,117,98,109,111,100,117,108,101,95,115,101,97,114,99,104, - 95,108,111,99,97,116,105,111,110,115,32,116,111,32,97,32, - 108,105,115,116,32,111,102,32,100,105,114,101,99,116,111,114, - 121,32,112,97,116,104,115,46,32,32,65,110,10,32,32,32, - 32,101,109,112,116,121,32,108,105,115,116,32,105,115,32,115, - 117,102,102,105,99,105,101,110,116,44,32,116,104,111,117,103, - 104,32,105,116,115,32,110,111,116,32,111,116,104,101,114,119, - 105,115,101,32,117,115,101,102,117,108,32,116,111,32,116,104, - 101,10,32,32,32,32,105,109,112,111,114,116,32,115,121,115, - 116,101,109,46,10,10,32,32,32,32,84,104,101,32,108,111, - 97,100,101,114,32,109,117,115,116,32,116,97,107,101,32,97, - 32,115,112,101,99,32,97,115,32,105,116,115,32,111,110,108, - 121,32,95,95,105,110,105,116,95,95,40,41,32,97,114,103, - 46,10,10,32,32,32,32,78,122,9,60,117,110,107,110,111, - 119,110,62,218,12,103,101,116,95,102,105,108,101,110,97,109, - 101,218,6,111,114,105,103,105,110,84,218,10,105,115,95,112, - 97,99,107,97,103,101,114,61,0,0,0,41,15,114,117,0, - 0,0,114,159,0,0,0,114,109,0,0,0,114,123,0,0, - 0,218,10,77,111,100,117,108,101,83,112,101,99,90,13,95, - 115,101,116,95,102,105,108,101,97,116,116,114,218,27,95,103, - 101,116,95,115,117,112,112,111,114,116,101,100,95,102,105,108, - 101,95,108,111,97,100,101,114,115,114,94,0,0,0,114,95, - 0,0,0,114,129,0,0,0,218,9,95,80,79,80,85,76, - 65,84,69,114,161,0,0,0,114,158,0,0,0,114,40,0, - 0,0,218,6,97,112,112,101,110,100,41,9,114,108,0,0, - 0,90,8,108,111,99,97,116,105,111,110,114,129,0,0,0, - 114,158,0,0,0,218,4,115,112,101,99,218,12,108,111,97, - 100,101,114,95,99,108,97,115,115,218,8,115,117,102,102,105, - 120,101,115,114,161,0,0,0,90,7,100,105,114,110,97,109, - 101,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,23,115,112,101,99,95,102,114,111,109,95,102,105,108,101, - 95,108,111,99,97,116,105,111,110,9,2,0,0,115,60,0, - 0,0,0,12,12,4,6,1,15,2,3,1,19,1,13,1, - 5,8,24,1,9,3,12,1,22,1,21,1,15,1,9,1, - 5,2,4,3,12,2,15,1,3,1,19,1,13,1,5,2, - 6,1,12,2,9,1,15,1,6,1,16,1,16,2,114,169, + 114,171,0,0,0,99,2,0,0,115,20,0,0,0,12,2, + 6,3,6,3,6,2,6,2,18,7,18,15,3,1,21,15, + 3,1,114,171,0,0,0,99,0,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,64,0,0,0,115,70,0,0, + 0,101,0,0,90,1,0,100,0,0,90,2,0,100,1,0, + 90,3,0,100,2,0,100,3,0,132,0,0,90,4,0,100, + 4,0,100,5,0,132,0,0,90,5,0,100,6,0,100,7, + 0,132,0,0,90,6,0,100,8,0,100,9,0,132,0,0, + 90,7,0,100,10,0,83,41,11,218,13,95,76,111,97,100, + 101,114,66,97,115,105,99,115,122,83,66,97,115,101,32,99, + 108,97,115,115,32,111,102,32,99,111,109,109,111,110,32,99, + 111,100,101,32,110,101,101,100,101,100,32,98,121,32,98,111, + 116,104,32,83,111,117,114,99,101,76,111,97,100,101,114,32, + 97,110,100,10,32,32,32,32,83,111,117,114,99,101,108,101, + 115,115,70,105,108,101,76,111,97,100,101,114,46,99,2,0, + 0,0,0,0,0,0,5,0,0,0,3,0,0,0,67,0, + 0,0,115,88,0,0,0,116,0,0,124,0,0,106,1,0, + 124,1,0,131,1,0,131,1,0,100,1,0,25,125,2,0, + 124,2,0,106,2,0,100,2,0,100,1,0,131,2,0,100, + 3,0,25,125,3,0,124,1,0,106,3,0,100,2,0,131, + 1,0,100,4,0,25,125,4,0,124,3,0,100,5,0,107, + 2,0,111,87,0,124,4,0,100,5,0,107,3,0,83,41, + 6,122,141,67,111,110,99,114,101,116,101,32,105,109,112,108, + 101,109,101,110,116,97,116,105,111,110,32,111,102,32,73,110, + 115,112,101,99,116,76,111,97,100,101,114,46,105,115,95,112, + 97,99,107,97,103,101,32,98,121,32,99,104,101,99,107,105, + 110,103,32,105,102,10,32,32,32,32,32,32,32,32,116,104, + 101,32,112,97,116,104,32,114,101,116,117,114,110,101,100,32, + 98,121,32,103,101,116,95,102,105,108,101,110,97,109,101,32, + 104,97,115,32,97,32,102,105,108,101,110,97,109,101,32,111, + 102,32,39,95,95,105,110,105,116,95,95,46,112,121,39,46, + 114,31,0,0,0,114,60,0,0,0,114,61,0,0,0,114, + 58,0,0,0,218,8,95,95,105,110,105,116,95,95,41,4, + 114,40,0,0,0,114,160,0,0,0,114,36,0,0,0,114, + 34,0,0,0,41,5,114,110,0,0,0,114,128,0,0,0, + 114,96,0,0,0,90,13,102,105,108,101,110,97,109,101,95, + 98,97,115,101,90,9,116,97,105,108,95,110,97,109,101,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,162, + 0,0,0,168,2,0,0,115,8,0,0,0,0,3,25,1, + 22,1,19,1,122,24,95,76,111,97,100,101,114,66,97,115, + 105,99,115,46,105,115,95,112,97,99,107,97,103,101,99,2, + 0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,67, + 0,0,0,115,4,0,0,0,100,1,0,83,41,2,122,42, + 85,115,101,32,100,101,102,97,117,108,116,32,115,101,109,97, + 110,116,105,99,115,32,102,111,114,32,109,111,100,117,108,101, + 32,99,114,101,97,116,105,111,110,46,78,114,4,0,0,0, + 41,2,114,110,0,0,0,114,167,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,6,0,0,0,218,13,99,114,101, + 97,116,101,95,109,111,100,117,108,101,176,2,0,0,115,0, + 0,0,0,122,27,95,76,111,97,100,101,114,66,97,115,105, + 99,115,46,99,114,101,97,116,101,95,109,111,100,117,108,101, + 99,2,0,0,0,0,0,0,0,3,0,0,0,4,0,0, + 0,67,0,0,0,115,80,0,0,0,124,0,0,106,0,0, + 124,1,0,106,1,0,131,1,0,125,2,0,124,2,0,100, + 1,0,107,8,0,114,54,0,116,2,0,100,2,0,106,3, + 0,124,1,0,106,1,0,131,1,0,131,1,0,130,1,0, + 116,4,0,106,5,0,116,6,0,124,2,0,124,1,0,106, + 7,0,131,3,0,1,100,1,0,83,41,3,122,19,69,120, + 101,99,117,116,101,32,116,104,101,32,109,111,100,117,108,101, + 46,78,122,52,99,97,110,110,111,116,32,108,111,97,100,32, + 109,111,100,117,108,101,32,123,33,114,125,32,119,104,101,110, + 32,103,101,116,95,99,111,100,101,40,41,32,114,101,116,117, + 114,110,115,32,78,111,110,101,41,8,218,8,103,101,116,95, + 99,111,100,101,114,114,0,0,0,114,109,0,0,0,114,49, + 0,0,0,114,123,0,0,0,218,25,95,99,97,108,108,95, + 119,105,116,104,95,102,114,97,109,101,115,95,114,101,109,111, + 118,101,100,218,4,101,120,101,99,114,120,0,0,0,41,3, + 114,110,0,0,0,218,6,109,111,100,117,108,101,114,149,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,11,101,120,101,99,95,109,111,100,117,108,101,179,2, + 0,0,115,10,0,0,0,0,2,18,1,12,1,9,1,15, + 1,122,25,95,76,111,97,100,101,114,66,97,115,105,99,115, + 46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0, + 0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,0, + 0,115,16,0,0,0,116,0,0,106,1,0,124,0,0,124, + 1,0,131,2,0,83,41,1,78,41,2,114,123,0,0,0, + 218,17,95,108,111,97,100,95,109,111,100,117,108,101,95,115, + 104,105,109,41,2,114,110,0,0,0,114,128,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,11, + 108,111,97,100,95,109,111,100,117,108,101,187,2,0,0,115, + 2,0,0,0,0,1,122,25,95,76,111,97,100,101,114,66, + 97,115,105,99,115,46,108,111,97,100,95,109,111,100,117,108, + 101,78,41,8,114,114,0,0,0,114,113,0,0,0,114,115, + 0,0,0,114,116,0,0,0,114,162,0,0,0,114,188,0, + 0,0,114,193,0,0,0,114,195,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 114,186,0,0,0,163,2,0,0,115,10,0,0,0,12,3, + 6,2,12,8,12,3,12,8,114,186,0,0,0,99,0,0, + 0,0,0,0,0,0,0,0,0,0,4,0,0,0,64,0, + 0,0,115,106,0,0,0,101,0,0,90,1,0,100,0,0, + 90,2,0,100,1,0,100,2,0,132,0,0,90,3,0,100, + 3,0,100,4,0,132,0,0,90,4,0,100,5,0,100,6, + 0,132,0,0,90,5,0,100,7,0,100,8,0,132,0,0, + 90,6,0,100,9,0,100,10,0,132,0,0,90,7,0,100, + 11,0,100,18,0,100,13,0,100,14,0,132,0,1,90,8, + 0,100,15,0,100,16,0,132,0,0,90,9,0,100,17,0, + 83,41,19,218,12,83,111,117,114,99,101,76,111,97,100,101, + 114,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, + 0,0,67,0,0,0,115,10,0,0,0,116,0,0,130,1, + 0,100,1,0,83,41,2,122,178,79,112,116,105,111,110,97, + 108,32,109,101,116,104,111,100,32,116,104,97,116,32,114,101, + 116,117,114,110,115,32,116,104,101,32,109,111,100,105,102,105, + 99,97,116,105,111,110,32,116,105,109,101,32,40,97,110,32, + 105,110,116,41,32,102,111,114,32,116,104,101,10,32,32,32, + 32,32,32,32,32,115,112,101,99,105,102,105,101,100,32,112, + 97,116,104,44,32,119,104,101,114,101,32,112,97,116,104,32, + 105,115,32,97,32,115,116,114,46,10,10,32,32,32,32,32, + 32,32,32,82,97,105,115,101,115,32,73,79,69,114,114,111, + 114,32,119,104,101,110,32,116,104,101,32,112,97,116,104,32, + 99,97,110,110,111,116,32,98,101,32,104,97,110,100,108,101, + 100,46,10,32,32,32,32,32,32,32,32,78,41,1,218,7, + 73,79,69,114,114,111,114,41,2,114,110,0,0,0,114,37, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,218,10,112,97,116,104,95,109,116,105,109,101,193,2, + 0,0,115,2,0,0,0,0,6,122,23,83,111,117,114,99, + 101,76,111,97,100,101,114,46,112,97,116,104,95,109,116,105, + 109,101,99,2,0,0,0,0,0,0,0,2,0,0,0,3, + 0,0,0,67,0,0,0,115,19,0,0,0,100,1,0,124, + 0,0,106,0,0,124,1,0,131,1,0,105,1,0,83,41, + 2,97,170,1,0,0,79,112,116,105,111,110,97,108,32,109, + 101,116,104,111,100,32,114,101,116,117,114,110,105,110,103,32, + 97,32,109,101,116,97,100,97,116,97,32,100,105,99,116,32, + 102,111,114,32,116,104,101,32,115,112,101,99,105,102,105,101, + 100,32,112,97,116,104,10,32,32,32,32,32,32,32,32,116, + 111,32,98,121,32,116,104,101,32,112,97,116,104,32,40,115, + 116,114,41,46,10,32,32,32,32,32,32,32,32,80,111,115, + 115,105,98,108,101,32,107,101,121,115,58,10,32,32,32,32, + 32,32,32,32,45,32,39,109,116,105,109,101,39,32,40,109, + 97,110,100,97,116,111,114,121,41,32,105,115,32,116,104,101, + 32,110,117,109,101,114,105,99,32,116,105,109,101,115,116,97, + 109,112,32,111,102,32,108,97,115,116,32,115,111,117,114,99, + 101,10,32,32,32,32,32,32,32,32,32,32,99,111,100,101, + 32,109,111,100,105,102,105,99,97,116,105,111,110,59,10,32, + 32,32,32,32,32,32,32,45,32,39,115,105,122,101,39,32, + 40,111,112,116,105,111,110,97,108,41,32,105,115,32,116,104, + 101,32,115,105,122,101,32,105,110,32,98,121,116,101,115,32, + 111,102,32,116,104,101,32,115,111,117,114,99,101,32,99,111, + 100,101,46,10,10,32,32,32,32,32,32,32,32,73,109,112, + 108,101,109,101,110,116,105,110,103,32,116,104,105,115,32,109, + 101,116,104,111,100,32,97,108,108,111,119,115,32,116,104,101, + 32,108,111,97,100,101,114,32,116,111,32,114,101,97,100,32, + 98,121,116,101,99,111,100,101,32,102,105,108,101,115,46,10, + 32,32,32,32,32,32,32,32,82,97,105,115,101,115,32,73, + 79,69,114,114,111,114,32,119,104,101,110,32,116,104,101,32, + 112,97,116,104,32,99,97,110,110,111,116,32,98,101,32,104, + 97,110,100,108,101,100,46,10,32,32,32,32,32,32,32,32, + 114,135,0,0,0,41,1,114,198,0,0,0,41,2,114,110, + 0,0,0,114,37,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,6,0,0,0,218,10,112,97,116,104,95,115,116, + 97,116,115,201,2,0,0,115,2,0,0,0,0,11,122,23, + 83,111,117,114,99,101,76,111,97,100,101,114,46,112,97,116, + 104,95,115,116,97,116,115,99,4,0,0,0,0,0,0,0, + 4,0,0,0,3,0,0,0,67,0,0,0,115,16,0,0, + 0,124,0,0,106,0,0,124,2,0,124,3,0,131,2,0, + 83,41,1,122,228,79,112,116,105,111,110,97,108,32,109,101, + 116,104,111,100,32,119,104,105,99,104,32,119,114,105,116,101, + 115,32,100,97,116,97,32,40,98,121,116,101,115,41,32,116, + 111,32,97,32,102,105,108,101,32,112,97,116,104,32,40,97, + 32,115,116,114,41,46,10,10,32,32,32,32,32,32,32,32, + 73,109,112,108,101,109,101,110,116,105,110,103,32,116,104,105, + 115,32,109,101,116,104,111,100,32,97,108,108,111,119,115,32, + 102,111,114,32,116,104,101,32,119,114,105,116,105,110,103,32, + 111,102,32,98,121,116,101,99,111,100,101,32,102,105,108,101, + 115,46,10,10,32,32,32,32,32,32,32,32,84,104,101,32, + 115,111,117,114,99,101,32,112,97,116,104,32,105,115,32,110, + 101,101,100,101,100,32,105,110,32,111,114,100,101,114,32,116, + 111,32,99,111,114,114,101,99,116,108,121,32,116,114,97,110, + 115,102,101,114,32,112,101,114,109,105,115,115,105,111,110,115, + 10,32,32,32,32,32,32,32,32,41,1,218,8,115,101,116, + 95,100,97,116,97,41,4,114,110,0,0,0,114,92,0,0, + 0,90,10,99,97,99,104,101,95,112,97,116,104,114,55,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,15,95,99,97,99,104,101,95,98,121,116,101,99,111, + 100,101,214,2,0,0,115,2,0,0,0,0,8,122,28,83, + 111,117,114,99,101,76,111,97,100,101,114,46,95,99,97,99, + 104,101,95,98,121,116,101,99,111,100,101,99,3,0,0,0, + 0,0,0,0,3,0,0,0,1,0,0,0,67,0,0,0, + 115,4,0,0,0,100,1,0,83,41,2,122,150,79,112,116, + 105,111,110,97,108,32,109,101,116,104,111,100,32,119,104,105, + 99,104,32,119,114,105,116,101,115,32,100,97,116,97,32,40, + 98,121,116,101,115,41,32,116,111,32,97,32,102,105,108,101, + 32,112,97,116,104,32,40,97,32,115,116,114,41,46,10,10, + 32,32,32,32,32,32,32,32,73,109,112,108,101,109,101,110, + 116,105,110,103,32,116,104,105,115,32,109,101,116,104,111,100, + 32,97,108,108,111,119,115,32,102,111,114,32,116,104,101,32, + 119,114,105,116,105,110,103,32,111,102,32,98,121,116,101,99, + 111,100,101,32,102,105,108,101,115,46,10,32,32,32,32,32, + 32,32,32,78,114,4,0,0,0,41,3,114,110,0,0,0, + 114,37,0,0,0,114,55,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,200,0,0,0,224,2, + 0,0,115,0,0,0,0,122,21,83,111,117,114,99,101,76, + 111,97,100,101,114,46,115,101,116,95,100,97,116,97,99,2, + 0,0,0,0,0,0,0,5,0,0,0,16,0,0,0,67, + 0,0,0,115,105,0,0,0,124,0,0,106,0,0,124,1, + 0,131,1,0,125,2,0,121,19,0,124,0,0,106,1,0, + 124,2,0,131,1,0,125,3,0,87,110,58,0,4,116,2, + 0,107,10,0,114,94,0,1,125,4,0,1,122,26,0,116, + 3,0,100,1,0,100,2,0,124,1,0,131,1,1,124,4, + 0,130,2,0,87,89,100,3,0,100,3,0,125,4,0,126, + 4,0,88,110,1,0,88,116,4,0,124,3,0,131,1,0, + 83,41,4,122,52,67,111,110,99,114,101,116,101,32,105,109, + 112,108,101,109,101,110,116,97,116,105,111,110,32,111,102,32, + 73,110,115,112,101,99,116,76,111,97,100,101,114,46,103,101, + 116,95,115,111,117,114,99,101,46,122,39,115,111,117,114,99, + 101,32,110,111,116,32,97,118,97,105,108,97,98,108,101,32, + 116,104,114,111,117,103,104,32,103,101,116,95,100,97,116,97, + 40,41,114,108,0,0,0,78,41,5,114,160,0,0,0,218, + 8,103,101,116,95,100,97,116,97,114,42,0,0,0,114,109, + 0,0,0,114,158,0,0,0,41,5,114,110,0,0,0,114, + 128,0,0,0,114,37,0,0,0,114,156,0,0,0,218,3, + 101,120,99,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,218,10,103,101,116,95,115,111,117,114,99,101,231,2, + 0,0,115,14,0,0,0,0,2,15,1,3,1,19,1,18, + 1,9,1,31,1,122,23,83,111,117,114,99,101,76,111,97, + 100,101,114,46,103,101,116,95,115,111,117,114,99,101,218,9, + 95,111,112,116,105,109,105,122,101,114,31,0,0,0,99,3, + 0,0,0,1,0,0,0,4,0,0,0,9,0,0,0,67, + 0,0,0,115,34,0,0,0,116,0,0,106,1,0,116,2, + 0,124,1,0,124,2,0,100,1,0,100,2,0,100,3,0, + 100,4,0,124,3,0,131,4,2,83,41,5,122,130,82,101, + 116,117,114,110,32,116,104,101,32,99,111,100,101,32,111,98, + 106,101,99,116,32,99,111,109,112,105,108,101,100,32,102,114, + 111,109,32,115,111,117,114,99,101,46,10,10,32,32,32,32, + 32,32,32,32,84,104,101,32,39,100,97,116,97,39,32,97, + 114,103,117,109,101,110,116,32,99,97,110,32,98,101,32,97, + 110,121,32,111,98,106,101,99,116,32,116,121,112,101,32,116, + 104,97,116,32,99,111,109,112,105,108,101,40,41,32,115,117, + 112,112,111,114,116,115,46,10,32,32,32,32,32,32,32,32, + 114,191,0,0,0,218,12,100,111,110,116,95,105,110,104,101, + 114,105,116,84,114,70,0,0,0,41,3,114,123,0,0,0, + 114,190,0,0,0,218,7,99,111,109,112,105,108,101,41,4, + 114,110,0,0,0,114,55,0,0,0,114,37,0,0,0,114, + 205,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,218,14,115,111,117,114,99,101,95,116,111,95,99, + 111,100,101,241,2,0,0,115,4,0,0,0,0,5,21,1, + 122,27,83,111,117,114,99,101,76,111,97,100,101,114,46,115, + 111,117,114,99,101,95,116,111,95,99,111,100,101,99,2,0, + 0,0,0,0,0,0,10,0,0,0,43,0,0,0,67,0, + 0,0,115,174,1,0,0,124,0,0,106,0,0,124,1,0, + 131,1,0,125,2,0,100,1,0,125,3,0,121,16,0,116, + 1,0,124,2,0,131,1,0,125,4,0,87,110,24,0,4, + 116,2,0,107,10,0,114,63,0,1,1,1,100,1,0,125, + 4,0,89,110,202,0,88,121,19,0,124,0,0,106,3,0, + 124,2,0,131,1,0,125,5,0,87,110,18,0,4,116,4, + 0,107,10,0,114,103,0,1,1,1,89,110,162,0,88,116, + 5,0,124,5,0,100,2,0,25,131,1,0,125,3,0,121, + 19,0,124,0,0,106,6,0,124,4,0,131,1,0,125,6, + 0,87,110,18,0,4,116,7,0,107,10,0,114,159,0,1, + 1,1,89,110,106,0,88,121,34,0,116,8,0,124,6,0, + 100,3,0,124,5,0,100,4,0,124,1,0,100,5,0,124, + 4,0,131,1,3,125,7,0,87,110,24,0,4,116,9,0, + 116,10,0,102,2,0,107,10,0,114,220,0,1,1,1,89, + 110,45,0,88,116,11,0,100,6,0,124,4,0,124,2,0, + 131,3,0,1,116,12,0,124,7,0,100,4,0,124,1,0, + 100,7,0,124,4,0,100,8,0,124,2,0,131,1,3,83, + 124,0,0,106,6,0,124,2,0,131,1,0,125,8,0,124, + 0,0,106,13,0,124,8,0,124,2,0,131,2,0,125,9, + 0,116,11,0,100,9,0,124,2,0,131,2,0,1,116,14, + 0,106,15,0,12,114,170,1,124,4,0,100,1,0,107,9, + 0,114,170,1,124,3,0,100,1,0,107,9,0,114,170,1, + 116,16,0,124,9,0,124,3,0,116,17,0,124,8,0,131, + 1,0,131,3,0,125,6,0,121,36,0,124,0,0,106,18, + 0,124,2,0,124,4,0,124,6,0,131,3,0,1,116,11, + 0,100,10,0,124,4,0,131,2,0,1,87,110,18,0,4, + 116,2,0,107,10,0,114,169,1,1,1,1,89,110,1,0, + 88,124,9,0,83,41,11,122,190,67,111,110,99,114,101,116, + 101,32,105,109,112,108,101,109,101,110,116,97,116,105,111,110, + 32,111,102,32,73,110,115,112,101,99,116,76,111,97,100,101, + 114,46,103,101,116,95,99,111,100,101,46,10,10,32,32,32, + 32,32,32,32,32,82,101,97,100,105,110,103,32,111,102,32, + 98,121,116,101,99,111,100,101,32,114,101,113,117,105,114,101, + 115,32,112,97,116,104,95,115,116,97,116,115,32,116,111,32, + 98,101,32,105,109,112,108,101,109,101,110,116,101,100,46,32, + 84,111,32,119,114,105,116,101,10,32,32,32,32,32,32,32, + 32,98,121,116,101,99,111,100,101,44,32,115,101,116,95,100, + 97,116,97,32,109,117,115,116,32,97,108,115,111,32,98,101, + 32,105,109,112,108,101,109,101,110,116,101,100,46,10,10,32, + 32,32,32,32,32,32,32,78,114,135,0,0,0,114,141,0, + 0,0,114,108,0,0,0,114,37,0,0,0,122,13,123,125, + 32,109,97,116,99,104,101,115,32,123,125,114,91,0,0,0, + 114,92,0,0,0,122,19,99,111,100,101,32,111,98,106,101, + 99,116,32,102,114,111,109,32,123,125,122,10,119,114,111,116, + 101,32,123,33,114,125,41,19,114,160,0,0,0,114,81,0, + 0,0,114,68,0,0,0,114,199,0,0,0,114,197,0,0, + 0,114,16,0,0,0,114,202,0,0,0,114,42,0,0,0, + 114,144,0,0,0,114,109,0,0,0,114,139,0,0,0,114, + 107,0,0,0,114,150,0,0,0,114,208,0,0,0,114,8, + 0,0,0,218,19,100,111,110,116,95,119,114,105,116,101,95, + 98,121,116,101,99,111,100,101,114,153,0,0,0,114,33,0, + 0,0,114,201,0,0,0,41,10,114,110,0,0,0,114,128, + 0,0,0,114,92,0,0,0,114,142,0,0,0,114,91,0, + 0,0,218,2,115,116,114,55,0,0,0,218,10,98,121,116, + 101,115,95,100,97,116,97,114,156,0,0,0,90,11,99,111, + 100,101,95,111,98,106,101,99,116,114,4,0,0,0,114,4, + 0,0,0,114,6,0,0,0,114,189,0,0,0,249,2,0, + 0,115,78,0,0,0,0,7,15,1,6,1,3,1,16,1, + 13,1,11,2,3,1,19,1,13,1,5,2,16,1,3,1, + 19,1,13,1,5,2,3,1,9,1,12,1,13,1,19,1, + 5,2,9,1,7,1,15,1,6,1,7,1,15,1,18,1, + 13,1,22,1,12,1,9,1,15,1,3,1,19,1,17,1, + 13,1,5,1,122,21,83,111,117,114,99,101,76,111,97,100, + 101,114,46,103,101,116,95,99,111,100,101,78,114,89,0,0, + 0,41,10,114,114,0,0,0,114,113,0,0,0,114,115,0, + 0,0,114,198,0,0,0,114,199,0,0,0,114,201,0,0, + 0,114,200,0,0,0,114,204,0,0,0,114,208,0,0,0, + 114,189,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,196,0,0,0,191,2, + 0,0,115,14,0,0,0,12,2,12,8,12,13,12,10,12, + 7,12,10,18,8,114,196,0,0,0,99,0,0,0,0,0, + 0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,115, + 112,0,0,0,101,0,0,90,1,0,100,0,0,90,2,0, + 100,1,0,90,3,0,100,2,0,100,3,0,132,0,0,90, + 4,0,100,4,0,100,5,0,132,0,0,90,5,0,100,6, + 0,100,7,0,132,0,0,90,6,0,101,7,0,135,0,0, + 102,1,0,100,8,0,100,9,0,134,0,0,131,1,0,90, + 8,0,101,7,0,100,10,0,100,11,0,132,0,0,131,1, + 0,90,9,0,100,12,0,100,13,0,132,0,0,90,10,0, + 135,0,0,83,41,14,218,10,70,105,108,101,76,111,97,100, + 101,114,122,103,66,97,115,101,32,102,105,108,101,32,108,111, + 97,100,101,114,32,99,108,97,115,115,32,119,104,105,99,104, + 32,105,109,112,108,101,109,101,110,116,115,32,116,104,101,32, + 108,111,97,100,101,114,32,112,114,111,116,111,99,111,108,32, + 109,101,116,104,111,100,115,32,116,104,97,116,10,32,32,32, + 32,114,101,113,117,105,114,101,32,102,105,108,101,32,115,121, + 115,116,101,109,32,117,115,97,103,101,46,99,3,0,0,0, + 0,0,0,0,3,0,0,0,2,0,0,0,67,0,0,0, + 115,22,0,0,0,124,1,0,124,0,0,95,0,0,124,2, + 0,124,0,0,95,1,0,100,1,0,83,41,2,122,75,67, + 97,99,104,101,32,116,104,101,32,109,111,100,117,108,101,32, + 110,97,109,101,32,97,110,100,32,116,104,101,32,112,97,116, + 104,32,116,111,32,116,104,101,32,102,105,108,101,32,102,111, + 117,110,100,32,98,121,32,116,104,101,10,32,32,32,32,32, + 32,32,32,102,105,110,100,101,114,46,78,41,2,114,108,0, + 0,0,114,37,0,0,0,41,3,114,110,0,0,0,114,128, + 0,0,0,114,37,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,6,0,0,0,114,187,0,0,0,50,3,0,0, + 115,4,0,0,0,0,3,9,1,122,19,70,105,108,101,76, + 111,97,100,101,114,46,95,95,105,110,105,116,95,95,99,2, + 0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,67, + 0,0,0,115,34,0,0,0,124,0,0,106,0,0,124,1, + 0,106,0,0,107,2,0,111,33,0,124,0,0,106,1,0, + 124,1,0,106,1,0,107,2,0,83,41,1,78,41,2,218, + 9,95,95,99,108,97,115,115,95,95,114,120,0,0,0,41, + 2,114,110,0,0,0,218,5,111,116,104,101,114,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,218,6,95,95, + 101,113,95,95,56,3,0,0,115,4,0,0,0,0,1,18, + 1,122,17,70,105,108,101,76,111,97,100,101,114,46,95,95, + 101,113,95,95,99,1,0,0,0,0,0,0,0,1,0,0, + 0,3,0,0,0,67,0,0,0,115,26,0,0,0,116,0, + 0,124,0,0,106,1,0,131,1,0,116,0,0,124,0,0, + 106,2,0,131,1,0,65,83,41,1,78,41,3,218,4,104, + 97,115,104,114,108,0,0,0,114,37,0,0,0,41,1,114, + 110,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,218,8,95,95,104,97,115,104,95,95,60,3,0, + 0,115,2,0,0,0,0,1,122,19,70,105,108,101,76,111, + 97,100,101,114,46,95,95,104,97,115,104,95,95,99,2,0, + 0,0,0,0,0,0,2,0,0,0,3,0,0,0,3,0, + 0,0,115,22,0,0,0,116,0,0,116,1,0,124,0,0, + 131,2,0,106,2,0,124,1,0,131,1,0,83,41,1,122, + 100,76,111,97,100,32,97,32,109,111,100,117,108,101,32,102, + 114,111,109,32,97,32,102,105,108,101,46,10,10,32,32,32, + 32,32,32,32,32,84,104,105,115,32,109,101,116,104,111,100, + 32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,32, + 32,85,115,101,32,101,120,101,99,95,109,111,100,117,108,101, + 40,41,32,105,110,115,116,101,97,100,46,10,10,32,32,32, + 32,32,32,32,32,41,3,218,5,115,117,112,101,114,114,212, + 0,0,0,114,195,0,0,0,41,2,114,110,0,0,0,114, + 128,0,0,0,41,1,114,213,0,0,0,114,4,0,0,0, + 114,6,0,0,0,114,195,0,0,0,63,3,0,0,115,2, + 0,0,0,0,10,122,22,70,105,108,101,76,111,97,100,101, + 114,46,108,111,97,100,95,109,111,100,117,108,101,99,2,0, + 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, + 0,0,115,7,0,0,0,124,0,0,106,0,0,83,41,1, + 122,58,82,101,116,117,114,110,32,116,104,101,32,112,97,116, + 104,32,116,111,32,116,104,101,32,115,111,117,114,99,101,32, + 102,105,108,101,32,97,115,32,102,111,117,110,100,32,98,121, + 32,116,104,101,32,102,105,110,100,101,114,46,41,1,114,37, + 0,0,0,41,2,114,110,0,0,0,114,128,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,160, + 0,0,0,75,3,0,0,115,2,0,0,0,0,3,122,23, + 70,105,108,101,76,111,97,100,101,114,46,103,101,116,95,102, + 105,108,101,110,97,109,101,99,2,0,0,0,0,0,0,0, + 3,0,0,0,9,0,0,0,67,0,0,0,115,42,0,0, + 0,116,0,0,106,1,0,124,1,0,100,1,0,131,2,0, + 143,17,0,125,2,0,124,2,0,106,2,0,131,0,0,83, + 87,100,2,0,81,82,88,100,2,0,83,41,3,122,39,82, + 101,116,117,114,110,32,116,104,101,32,100,97,116,97,32,102, + 114,111,109,32,112,97,116,104,32,97,115,32,114,97,119,32, + 98,121,116,101,115,46,218,1,114,78,41,3,114,51,0,0, + 0,114,52,0,0,0,90,4,114,101,97,100,41,3,114,110, + 0,0,0,114,37,0,0,0,114,56,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,114,202,0,0, + 0,80,3,0,0,115,4,0,0,0,0,2,21,1,122,19, + 70,105,108,101,76,111,97,100,101,114,46,103,101,116,95,100, + 97,116,97,41,11,114,114,0,0,0,114,113,0,0,0,114, + 115,0,0,0,114,116,0,0,0,114,187,0,0,0,114,215, + 0,0,0,114,217,0,0,0,114,125,0,0,0,114,195,0, + 0,0,114,160,0,0,0,114,202,0,0,0,114,4,0,0, + 0,114,4,0,0,0,41,1,114,213,0,0,0,114,6,0, + 0,0,114,212,0,0,0,45,3,0,0,115,14,0,0,0, + 12,3,6,2,12,6,12,4,12,3,24,12,18,5,114,212, 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, - 5,0,0,0,64,0,0,0,115,121,0,0,0,101,0,0, + 4,0,0,0,64,0,0,0,115,64,0,0,0,101,0,0, 90,1,0,100,0,0,90,2,0,100,1,0,90,3,0,100, - 2,0,90,4,0,100,3,0,90,5,0,100,4,0,90,6, - 0,101,7,0,100,5,0,100,6,0,132,0,0,131,1,0, - 90,8,0,101,7,0,100,7,0,100,8,0,132,0,0,131, - 1,0,90,9,0,101,7,0,100,9,0,100,9,0,100,10, - 0,100,11,0,132,2,0,131,1,0,90,10,0,101,7,0, - 100,9,0,100,12,0,100,13,0,132,1,0,131,1,0,90, - 11,0,100,9,0,83,41,14,218,21,87,105,110,100,111,119, - 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,122, - 62,77,101,116,97,32,112,97,116,104,32,102,105,110,100,101, - 114,32,102,111,114,32,109,111,100,117,108,101,115,32,100,101, - 99,108,97,114,101,100,32,105,110,32,116,104,101,32,87,105, - 110,100,111,119,115,32,114,101,103,105,115,116,114,121,46,122, - 59,83,111,102,116,119,97,114,101,92,80,121,116,104,111,110, - 92,80,121,116,104,111,110,67,111,114,101,92,123,115,121,115, - 95,118,101,114,115,105,111,110,125,92,77,111,100,117,108,101, - 115,92,123,102,117,108,108,110,97,109,101,125,122,65,83,111, - 102,116,119,97,114,101,92,80,121,116,104,111,110,92,80,121, - 116,104,111,110,67,111,114,101,92,123,115,121,115,95,118,101, - 114,115,105,111,110,125,92,77,111,100,117,108,101,115,92,123, - 102,117,108,108,110,97,109,101,125,92,68,101,98,117,103,70, - 99,2,0,0,0,0,0,0,0,2,0,0,0,11,0,0, - 0,67,0,0,0,115,67,0,0,0,121,23,0,116,0,0, - 106,1,0,116,0,0,106,2,0,124,1,0,131,2,0,83, - 87,110,37,0,4,116,3,0,107,10,0,114,62,0,1,1, - 1,116,0,0,106,1,0,116,0,0,106,4,0,124,1,0, - 131,2,0,83,89,110,1,0,88,100,0,0,83,41,1,78, - 41,5,218,7,95,119,105,110,114,101,103,90,7,79,112,101, - 110,75,101,121,90,17,72,75,69,89,95,67,85,82,82,69, - 78,84,95,85,83,69,82,114,42,0,0,0,90,18,72,75, - 69,89,95,76,79,67,65,76,95,77,65,67,72,73,78,69, - 41,2,218,3,99,108,115,114,5,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,6,0,0,0,218,14,95,111,112, - 101,110,95,114,101,103,105,115,116,114,121,87,2,0,0,115, - 8,0,0,0,0,2,3,1,23,1,13,1,122,36,87,105, - 110,100,111,119,115,82,101,103,105,115,116,114,121,70,105,110, - 100,101,114,46,95,111,112,101,110,95,114,101,103,105,115,116, - 114,121,99,2,0,0,0,0,0,0,0,6,0,0,0,16, - 0,0,0,67,0,0,0,115,143,0,0,0,124,0,0,106, - 0,0,114,21,0,124,0,0,106,1,0,125,2,0,110,9, - 0,124,0,0,106,2,0,125,2,0,124,2,0,106,3,0, - 100,1,0,124,1,0,100,2,0,116,4,0,106,5,0,100, - 0,0,100,3,0,133,2,0,25,131,0,2,125,3,0,121, - 47,0,124,0,0,106,6,0,124,3,0,131,1,0,143,25, - 0,125,4,0,116,7,0,106,8,0,124,4,0,100,4,0, - 131,2,0,125,5,0,87,100,0,0,81,82,88,87,110,22, - 0,4,116,9,0,107,10,0,114,138,0,1,1,1,100,0, - 0,83,89,110,1,0,88,124,5,0,83,41,5,78,114,128, - 0,0,0,90,11,115,121,115,95,118,101,114,115,105,111,110, - 114,82,0,0,0,114,32,0,0,0,41,10,218,11,68,69, - 66,85,71,95,66,85,73,76,68,218,18,82,69,71,73,83, - 84,82,89,95,75,69,89,95,68,69,66,85,71,218,12,82, - 69,71,73,83,84,82,89,95,75,69,89,114,49,0,0,0, - 114,8,0,0,0,218,7,118,101,114,115,105,111,110,114,173, - 0,0,0,114,171,0,0,0,90,10,81,117,101,114,121,86, - 97,108,117,101,114,42,0,0,0,41,6,114,172,0,0,0, - 114,128,0,0,0,90,12,114,101,103,105,115,116,114,121,95, - 107,101,121,114,5,0,0,0,90,4,104,107,101,121,218,8, - 102,105,108,101,112,97,116,104,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,218,16,95,115,101,97,114,99,104, - 95,114,101,103,105,115,116,114,121,94,2,0,0,115,22,0, - 0,0,0,2,9,1,12,2,9,1,15,1,22,1,3,1, - 18,1,29,1,13,1,9,1,122,38,87,105,110,100,111,119, - 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,46, - 95,115,101,97,114,99,104,95,114,101,103,105,115,116,114,121, - 78,99,4,0,0,0,0,0,0,0,8,0,0,0,14,0, - 0,0,67,0,0,0,115,158,0,0,0,124,0,0,106,0, - 0,124,1,0,131,1,0,125,4,0,124,4,0,100,0,0, - 107,8,0,114,31,0,100,0,0,83,121,14,0,116,1,0, - 124,4,0,131,1,0,1,87,110,22,0,4,116,2,0,107, - 10,0,114,69,0,1,1,1,100,0,0,83,89,110,1,0, - 88,120,81,0,116,3,0,131,0,0,68,93,70,0,92,2, - 0,125,5,0,125,6,0,124,4,0,106,4,0,116,5,0, - 124,6,0,131,1,0,131,1,0,114,80,0,116,6,0,106, - 7,0,124,1,0,124,5,0,124,1,0,124,4,0,131,2, - 0,100,1,0,124,4,0,131,2,1,125,7,0,124,7,0, - 83,113,80,0,87,100,0,0,83,41,2,78,114,160,0,0, - 0,41,8,114,179,0,0,0,114,41,0,0,0,114,42,0, - 0,0,114,163,0,0,0,114,94,0,0,0,114,95,0,0, - 0,114,123,0,0,0,218,16,115,112,101,99,95,102,114,111, - 109,95,108,111,97,100,101,114,41,8,114,172,0,0,0,114, - 128,0,0,0,114,37,0,0,0,218,6,116,97,114,103,101, - 116,114,178,0,0,0,114,129,0,0,0,114,168,0,0,0, - 114,166,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,218,9,102,105,110,100,95,115,112,101,99,109, - 2,0,0,115,26,0,0,0,0,2,15,1,12,1,4,1, - 3,1,14,1,13,1,9,1,22,1,21,1,9,1,15,1, - 9,1,122,31,87,105,110,100,111,119,115,82,101,103,105,115, - 116,114,121,70,105,110,100,101,114,46,102,105,110,100,95,115, - 112,101,99,99,3,0,0,0,0,0,0,0,4,0,0,0, - 3,0,0,0,67,0,0,0,115,45,0,0,0,124,0,0, - 106,0,0,124,1,0,124,2,0,131,2,0,125,3,0,124, - 3,0,100,1,0,107,9,0,114,37,0,124,3,0,106,1, - 0,83,100,1,0,83,100,1,0,83,41,2,122,108,70,105, - 110,100,32,109,111,100,117,108,101,32,110,97,109,101,100,32, - 105,110,32,116,104,101,32,114,101,103,105,115,116,114,121,46, - 10,10,32,32,32,32,32,32,32,32,84,104,105,115,32,109, - 101,116,104,111,100,32,105,115,32,100,101,112,114,101,99,97, - 116,101,100,46,32,32,85,115,101,32,101,120,101,99,95,109, - 111,100,117,108,101,40,41,32,105,110,115,116,101,97,100,46, - 10,10,32,32,32,32,32,32,32,32,78,41,2,114,182,0, - 0,0,114,129,0,0,0,41,4,114,172,0,0,0,114,128, - 0,0,0,114,37,0,0,0,114,166,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,6,0,0,0,218,11,102,105, - 110,100,95,109,111,100,117,108,101,125,2,0,0,115,8,0, - 0,0,0,7,18,1,12,1,7,2,122,33,87,105,110,100, - 111,119,115,82,101,103,105,115,116,114,121,70,105,110,100,101, - 114,46,102,105,110,100,95,109,111,100,117,108,101,41,12,114, + 2,0,100,3,0,132,0,0,90,4,0,100,4,0,100,5, + 0,132,0,0,90,5,0,100,6,0,100,7,0,100,8,0, + 100,9,0,132,0,1,90,6,0,100,10,0,83,41,11,218, + 16,83,111,117,114,99,101,70,105,108,101,76,111,97,100,101, + 114,122,62,67,111,110,99,114,101,116,101,32,105,109,112,108, + 101,109,101,110,116,97,116,105,111,110,32,111,102,32,83,111, + 117,114,99,101,76,111,97,100,101,114,32,117,115,105,110,103, + 32,116,104,101,32,102,105,108,101,32,115,121,115,116,101,109, + 46,99,2,0,0,0,0,0,0,0,3,0,0,0,4,0, + 0,0,67,0,0,0,115,34,0,0,0,116,0,0,124,1, + 0,131,1,0,125,2,0,100,1,0,124,2,0,106,1,0, + 100,2,0,124,2,0,106,2,0,105,2,0,83,41,3,122, + 33,82,101,116,117,114,110,32,116,104,101,32,109,101,116,97, + 100,97,116,97,32,102,111,114,32,116,104,101,32,112,97,116, + 104,46,114,135,0,0,0,114,136,0,0,0,41,3,114,41, + 0,0,0,218,8,115,116,95,109,116,105,109,101,90,7,115, + 116,95,115,105,122,101,41,3,114,110,0,0,0,114,37,0, + 0,0,114,210,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,199,0,0,0,90,3,0,0,115, + 4,0,0,0,0,2,12,1,122,27,83,111,117,114,99,101, + 70,105,108,101,76,111,97,100,101,114,46,112,97,116,104,95, + 115,116,97,116,115,99,4,0,0,0,0,0,0,0,5,0, + 0,0,5,0,0,0,67,0,0,0,115,34,0,0,0,116, + 0,0,124,1,0,131,1,0,125,4,0,124,0,0,106,1, + 0,124,2,0,124,3,0,100,1,0,124,4,0,131,2,1, + 83,41,2,78,218,5,95,109,111,100,101,41,2,114,99,0, + 0,0,114,200,0,0,0,41,5,114,110,0,0,0,114,92, + 0,0,0,114,91,0,0,0,114,55,0,0,0,114,44,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,114,201,0,0,0,95,3,0,0,115,4,0,0,0,0, + 2,12,1,122,32,83,111,117,114,99,101,70,105,108,101,76, + 111,97,100,101,114,46,95,99,97,99,104,101,95,98,121,116, + 101,99,111,100,101,114,222,0,0,0,105,182,1,0,0,99, + 3,0,0,0,1,0,0,0,9,0,0,0,17,0,0,0, + 67,0,0,0,115,53,1,0,0,116,0,0,124,1,0,131, + 1,0,92,2,0,125,4,0,125,5,0,103,0,0,125,6, + 0,120,54,0,124,4,0,114,80,0,116,1,0,124,4,0, + 131,1,0,12,114,80,0,116,0,0,124,4,0,131,1,0, + 92,2,0,125,4,0,125,7,0,124,6,0,106,2,0,124, + 7,0,131,1,0,1,113,27,0,87,120,132,0,116,3,0, + 124,6,0,131,1,0,68,93,118,0,125,7,0,116,4,0, + 124,4,0,124,7,0,131,2,0,125,4,0,121,17,0,116, + 5,0,106,6,0,124,4,0,131,1,0,1,87,113,94,0, + 4,116,7,0,107,10,0,114,155,0,1,1,1,119,94,0, + 89,113,94,0,4,116,8,0,107,10,0,114,211,0,1,125, + 8,0,1,122,25,0,116,9,0,100,1,0,124,4,0,124, + 8,0,131,3,0,1,100,2,0,83,87,89,100,2,0,100, + 2,0,125,8,0,126,8,0,88,113,94,0,88,113,94,0, + 87,121,33,0,116,10,0,124,1,0,124,2,0,124,3,0, + 131,3,0,1,116,9,0,100,3,0,124,1,0,131,2,0, + 1,87,110,53,0,4,116,8,0,107,10,0,114,48,1,1, + 125,8,0,1,122,21,0,116,9,0,100,1,0,124,1,0, + 124,8,0,131,3,0,1,87,89,100,2,0,100,2,0,125, + 8,0,126,8,0,88,110,1,0,88,100,2,0,83,41,4, + 122,27,87,114,105,116,101,32,98,121,116,101,115,32,100,97, + 116,97,32,116,111,32,97,32,102,105,108,101,46,122,27,99, + 111,117,108,100,32,110,111,116,32,99,114,101,97,116,101,32, + 123,33,114,125,58,32,123,33,114,125,78,122,12,99,114,101, + 97,116,101,100,32,123,33,114,125,41,11,114,40,0,0,0, + 114,48,0,0,0,114,166,0,0,0,114,35,0,0,0,114, + 30,0,0,0,114,3,0,0,0,90,5,109,107,100,105,114, + 218,15,70,105,108,101,69,120,105,115,116,115,69,114,114,111, + 114,114,42,0,0,0,114,107,0,0,0,114,57,0,0,0, + 41,9,114,110,0,0,0,114,37,0,0,0,114,55,0,0, + 0,114,222,0,0,0,218,6,112,97,114,101,110,116,114,96, + 0,0,0,114,29,0,0,0,114,25,0,0,0,114,203,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,114,200,0,0,0,100,3,0,0,115,38,0,0,0,0, + 2,18,1,6,2,22,1,18,1,17,2,19,1,15,1,3, + 1,17,1,13,2,7,1,18,3,16,1,27,1,3,1,16, + 1,17,1,18,2,122,25,83,111,117,114,99,101,70,105,108, + 101,76,111,97,100,101,114,46,115,101,116,95,100,97,116,97, + 78,41,7,114,114,0,0,0,114,113,0,0,0,114,115,0, + 0,0,114,116,0,0,0,114,199,0,0,0,114,201,0,0, + 0,114,200,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,6,0,0,0,114,220,0,0,0,86, + 3,0,0,115,8,0,0,0,12,2,6,2,12,5,12,5, + 114,220,0,0,0,99,0,0,0,0,0,0,0,0,0,0, + 0,0,2,0,0,0,64,0,0,0,115,46,0,0,0,101, + 0,0,90,1,0,100,0,0,90,2,0,100,1,0,90,3, + 0,100,2,0,100,3,0,132,0,0,90,4,0,100,4,0, + 100,5,0,132,0,0,90,5,0,100,6,0,83,41,7,218, + 20,83,111,117,114,99,101,108,101,115,115,70,105,108,101,76, + 111,97,100,101,114,122,45,76,111,97,100,101,114,32,119,104, + 105,99,104,32,104,97,110,100,108,101,115,32,115,111,117,114, + 99,101,108,101,115,115,32,102,105,108,101,32,105,109,112,111, + 114,116,115,46,99,2,0,0,0,0,0,0,0,5,0,0, + 0,6,0,0,0,67,0,0,0,115,76,0,0,0,124,0, + 0,106,0,0,124,1,0,131,1,0,125,2,0,124,0,0, + 106,1,0,124,2,0,131,1,0,125,3,0,116,2,0,124, + 3,0,100,1,0,124,1,0,100,2,0,124,2,0,131,1, + 2,125,4,0,116,3,0,124,4,0,100,1,0,124,1,0, + 100,3,0,124,2,0,131,1,2,83,41,4,78,114,108,0, + 0,0,114,37,0,0,0,114,91,0,0,0,41,4,114,160, + 0,0,0,114,202,0,0,0,114,144,0,0,0,114,150,0, + 0,0,41,5,114,110,0,0,0,114,128,0,0,0,114,37, + 0,0,0,114,55,0,0,0,114,211,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,114,189,0,0, + 0,133,3,0,0,115,8,0,0,0,0,1,15,1,15,1, + 24,1,122,29,83,111,117,114,99,101,108,101,115,115,70,105, + 108,101,76,111,97,100,101,114,46,103,101,116,95,99,111,100, + 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, + 0,0,67,0,0,0,115,4,0,0,0,100,1,0,83,41, + 2,122,39,82,101,116,117,114,110,32,78,111,110,101,32,97, + 115,32,116,104,101,114,101,32,105,115,32,110,111,32,115,111, + 117,114,99,101,32,99,111,100,101,46,78,114,4,0,0,0, + 41,2,114,110,0,0,0,114,128,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,6,0,0,0,114,204,0,0,0, + 139,3,0,0,115,2,0,0,0,0,2,122,31,83,111,117, + 114,99,101,108,101,115,115,70,105,108,101,76,111,97,100,101, + 114,46,103,101,116,95,115,111,117,114,99,101,78,41,6,114, 114,0,0,0,114,113,0,0,0,114,115,0,0,0,114,116, - 0,0,0,114,176,0,0,0,114,175,0,0,0,114,174,0, - 0,0,218,11,99,108,97,115,115,109,101,116,104,111,100,114, - 173,0,0,0,114,179,0,0,0,114,182,0,0,0,114,183, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,170,0,0,0,75,2,0,0, - 115,20,0,0,0,12,2,6,3,6,3,6,2,6,2,18, - 7,18,15,3,1,21,15,3,1,114,170,0,0,0,99,0, - 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, - 0,0,0,115,70,0,0,0,101,0,0,90,1,0,100,0, - 0,90,2,0,100,1,0,90,3,0,100,2,0,100,3,0, - 132,0,0,90,4,0,100,4,0,100,5,0,132,0,0,90, - 5,0,100,6,0,100,7,0,132,0,0,90,6,0,100,8, - 0,100,9,0,132,0,0,90,7,0,100,10,0,83,41,11, - 218,13,95,76,111,97,100,101,114,66,97,115,105,99,115,122, - 83,66,97,115,101,32,99,108,97,115,115,32,111,102,32,99, - 111,109,109,111,110,32,99,111,100,101,32,110,101,101,100,101, - 100,32,98,121,32,98,111,116,104,32,83,111,117,114,99,101, - 76,111,97,100,101,114,32,97,110,100,10,32,32,32,32,83, - 111,117,114,99,101,108,101,115,115,70,105,108,101,76,111,97, - 100,101,114,46,99,2,0,0,0,0,0,0,0,5,0,0, - 0,3,0,0,0,67,0,0,0,115,88,0,0,0,116,0, - 0,124,0,0,106,1,0,124,1,0,131,1,0,131,1,0, - 100,1,0,25,125,2,0,124,2,0,106,2,0,100,2,0, - 100,1,0,131,2,0,100,3,0,25,125,3,0,124,1,0, - 106,3,0,100,2,0,131,1,0,100,4,0,25,125,4,0, - 124,3,0,100,5,0,107,2,0,111,87,0,124,4,0,100, - 5,0,107,3,0,83,41,6,122,141,67,111,110,99,114,101, - 116,101,32,105,109,112,108,101,109,101,110,116,97,116,105,111, - 110,32,111,102,32,73,110,115,112,101,99,116,76,111,97,100, - 101,114,46,105,115,95,112,97,99,107,97,103,101,32,98,121, - 32,99,104,101,99,107,105,110,103,32,105,102,10,32,32,32, - 32,32,32,32,32,116,104,101,32,112,97,116,104,32,114,101, - 116,117,114,110,101,100,32,98,121,32,103,101,116,95,102,105, - 108,101,110,97,109,101,32,104,97,115,32,97,32,102,105,108, - 101,110,97,109,101,32,111,102,32,39,95,95,105,110,105,116, - 95,95,46,112,121,39,46,114,31,0,0,0,114,60,0,0, - 0,114,61,0,0,0,114,58,0,0,0,218,8,95,95,105, - 110,105,116,95,95,41,4,114,40,0,0,0,114,159,0,0, - 0,114,36,0,0,0,114,34,0,0,0,41,5,114,110,0, - 0,0,114,128,0,0,0,114,96,0,0,0,90,13,102,105, - 108,101,110,97,109,101,95,98,97,115,101,90,9,116,97,105, - 108,95,110,97,109,101,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,161,0,0,0,144,2,0,0,115,8, - 0,0,0,0,3,25,1,22,1,19,1,122,24,95,76,111, - 97,100,101,114,66,97,115,105,99,115,46,105,115,95,112,97, - 99,107,97,103,101,99,2,0,0,0,0,0,0,0,2,0, - 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, - 1,0,83,41,2,122,42,85,115,101,32,100,101,102,97,117, - 108,116,32,115,101,109,97,110,116,105,99,115,32,102,111,114, - 32,109,111,100,117,108,101,32,99,114,101,97,116,105,111,110, - 46,78,114,4,0,0,0,41,2,114,110,0,0,0,114,166, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,13,99,114,101,97,116,101,95,109,111,100,117,108, - 101,152,2,0,0,115,0,0,0,0,122,27,95,76,111,97, - 100,101,114,66,97,115,105,99,115,46,99,114,101,97,116,101, - 95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0, - 3,0,0,0,4,0,0,0,67,0,0,0,115,80,0,0, - 0,124,0,0,106,0,0,124,1,0,106,1,0,131,1,0, - 125,2,0,124,2,0,100,1,0,107,8,0,114,54,0,116, - 2,0,100,2,0,106,3,0,124,1,0,106,1,0,131,1, - 0,131,1,0,130,1,0,116,4,0,106,5,0,116,6,0, - 124,2,0,124,1,0,106,7,0,131,3,0,1,100,1,0, - 83,41,3,122,19,69,120,101,99,117,116,101,32,116,104,101, - 32,109,111,100,117,108,101,46,78,122,52,99,97,110,110,111, - 116,32,108,111,97,100,32,109,111,100,117,108,101,32,123,33, - 114,125,32,119,104,101,110,32,103,101,116,95,99,111,100,101, - 40,41,32,114,101,116,117,114,110,115,32,78,111,110,101,41, - 8,218,8,103,101,116,95,99,111,100,101,114,114,0,0,0, - 114,109,0,0,0,114,49,0,0,0,114,123,0,0,0,218, - 25,95,99,97,108,108,95,119,105,116,104,95,102,114,97,109, - 101,115,95,114,101,109,111,118,101,100,218,4,101,120,101,99, - 114,120,0,0,0,41,3,114,110,0,0,0,218,6,109,111, - 100,117,108,101,114,148,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,11,101,120,101,99,95,109, - 111,100,117,108,101,155,2,0,0,115,10,0,0,0,0,2, - 18,1,12,1,9,1,15,1,122,25,95,76,111,97,100,101, - 114,66,97,115,105,99,115,46,101,120,101,99,95,109,111,100, - 117,108,101,99,2,0,0,0,0,0,0,0,2,0,0,0, - 3,0,0,0,67,0,0,0,115,16,0,0,0,116,0,0, - 106,1,0,124,0,0,124,1,0,131,2,0,83,41,1,78, - 41,2,114,123,0,0,0,218,17,95,108,111,97,100,95,109, - 111,100,117,108,101,95,115,104,105,109,41,2,114,110,0,0, - 0,114,128,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,218,11,108,111,97,100,95,109,111,100,117, - 108,101,163,2,0,0,115,2,0,0,0,0,1,122,25,95, - 76,111,97,100,101,114,66,97,115,105,99,115,46,108,111,97, - 100,95,109,111,100,117,108,101,78,41,8,114,114,0,0,0, - 114,113,0,0,0,114,115,0,0,0,114,116,0,0,0,114, - 161,0,0,0,114,187,0,0,0,114,192,0,0,0,114,194, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,185,0,0,0,139,2,0,0, - 115,10,0,0,0,12,3,6,2,12,8,12,3,12,8,114, - 185,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0, - 0,4,0,0,0,64,0,0,0,115,106,0,0,0,101,0, - 0,90,1,0,100,0,0,90,2,0,100,1,0,100,2,0, - 132,0,0,90,3,0,100,3,0,100,4,0,132,0,0,90, - 4,0,100,5,0,100,6,0,132,0,0,90,5,0,100,7, - 0,100,8,0,132,0,0,90,6,0,100,9,0,100,10,0, - 132,0,0,90,7,0,100,11,0,100,18,0,100,13,0,100, - 14,0,132,0,1,90,8,0,100,15,0,100,16,0,132,0, - 0,90,9,0,100,17,0,83,41,19,218,12,83,111,117,114, - 99,101,76,111,97,100,101,114,99,2,0,0,0,0,0,0, - 0,2,0,0,0,1,0,0,0,67,0,0,0,115,10,0, - 0,0,116,0,0,130,1,0,100,1,0,83,41,2,122,178, - 79,112,116,105,111,110,97,108,32,109,101,116,104,111,100,32, - 116,104,97,116,32,114,101,116,117,114,110,115,32,116,104,101, - 32,109,111,100,105,102,105,99,97,116,105,111,110,32,116,105, - 109,101,32,40,97,110,32,105,110,116,41,32,102,111,114,32, - 116,104,101,10,32,32,32,32,32,32,32,32,115,112,101,99, - 105,102,105,101,100,32,112,97,116,104,44,32,119,104,101,114, - 101,32,112,97,116,104,32,105,115,32,97,32,115,116,114,46, - 10,10,32,32,32,32,32,32,32,32,82,97,105,115,101,115, - 32,73,79,69,114,114,111,114,32,119,104,101,110,32,116,104, - 101,32,112,97,116,104,32,99,97,110,110,111,116,32,98,101, - 32,104,97,110,100,108,101,100,46,10,32,32,32,32,32,32, - 32,32,78,41,1,218,7,73,79,69,114,114,111,114,41,2, - 114,110,0,0,0,114,37,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,218,10,112,97,116,104,95, - 109,116,105,109,101,169,2,0,0,115,2,0,0,0,0,6, - 122,23,83,111,117,114,99,101,76,111,97,100,101,114,46,112, - 97,116,104,95,109,116,105,109,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,3,0,0,0,67,0,0,0,115,19, - 0,0,0,100,1,0,124,0,0,106,0,0,124,1,0,131, - 1,0,105,1,0,83,41,2,97,170,1,0,0,79,112,116, - 105,111,110,97,108,32,109,101,116,104,111,100,32,114,101,116, - 117,114,110,105,110,103,32,97,32,109,101,116,97,100,97,116, - 97,32,100,105,99,116,32,102,111,114,32,116,104,101,32,115, - 112,101,99,105,102,105,101,100,32,112,97,116,104,10,32,32, - 32,32,32,32,32,32,116,111,32,98,121,32,116,104,101,32, - 112,97,116,104,32,40,115,116,114,41,46,10,32,32,32,32, - 32,32,32,32,80,111,115,115,105,98,108,101,32,107,101,121, - 115,58,10,32,32,32,32,32,32,32,32,45,32,39,109,116, - 105,109,101,39,32,40,109,97,110,100,97,116,111,114,121,41, - 32,105,115,32,116,104,101,32,110,117,109,101,114,105,99,32, - 116,105,109,101,115,116,97,109,112,32,111,102,32,108,97,115, - 116,32,115,111,117,114,99,101,10,32,32,32,32,32,32,32, - 32,32,32,99,111,100,101,32,109,111,100,105,102,105,99,97, - 116,105,111,110,59,10,32,32,32,32,32,32,32,32,45,32, - 39,115,105,122,101,39,32,40,111,112,116,105,111,110,97,108, - 41,32,105,115,32,116,104,101,32,115,105,122,101,32,105,110, - 32,98,121,116,101,115,32,111,102,32,116,104,101,32,115,111, - 117,114,99,101,32,99,111,100,101,46,10,10,32,32,32,32, - 32,32,32,32,73,109,112,108,101,109,101,110,116,105,110,103, - 32,116,104,105,115,32,109,101,116,104,111,100,32,97,108,108, - 111,119,115,32,116,104,101,32,108,111,97,100,101,114,32,116, - 111,32,114,101,97,100,32,98,121,116,101,99,111,100,101,32, - 102,105,108,101,115,46,10,32,32,32,32,32,32,32,32,82, - 97,105,115,101,115,32,73,79,69,114,114,111,114,32,119,104, - 101,110,32,116,104,101,32,112,97,116,104,32,99,97,110,110, - 111,116,32,98,101,32,104,97,110,100,108,101,100,46,10,32, - 32,32,32,32,32,32,32,114,135,0,0,0,41,1,114,197, - 0,0,0,41,2,114,110,0,0,0,114,37,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,10, - 112,97,116,104,95,115,116,97,116,115,177,2,0,0,115,2, - 0,0,0,0,11,122,23,83,111,117,114,99,101,76,111,97, - 100,101,114,46,112,97,116,104,95,115,116,97,116,115,99,4, - 0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,67, - 0,0,0,115,16,0,0,0,124,0,0,106,0,0,124,2, - 0,124,3,0,131,2,0,83,41,1,122,228,79,112,116,105, - 111,110,97,108,32,109,101,116,104,111,100,32,119,104,105,99, - 104,32,119,114,105,116,101,115,32,100,97,116,97,32,40,98, - 121,116,101,115,41,32,116,111,32,97,32,102,105,108,101,32, - 112,97,116,104,32,40,97,32,115,116,114,41,46,10,10,32, - 32,32,32,32,32,32,32,73,109,112,108,101,109,101,110,116, - 105,110,103,32,116,104,105,115,32,109,101,116,104,111,100,32, - 97,108,108,111,119,115,32,102,111,114,32,116,104,101,32,119, - 114,105,116,105,110,103,32,111,102,32,98,121,116,101,99,111, - 100,101,32,102,105,108,101,115,46,10,10,32,32,32,32,32, - 32,32,32,84,104,101,32,115,111,117,114,99,101,32,112,97, - 116,104,32,105,115,32,110,101,101,100,101,100,32,105,110,32, - 111,114,100,101,114,32,116,111,32,99,111,114,114,101,99,116, - 108,121,32,116,114,97,110,115,102,101,114,32,112,101,114,109, - 105,115,115,105,111,110,115,10,32,32,32,32,32,32,32,32, - 41,1,218,8,115,101,116,95,100,97,116,97,41,4,114,110, - 0,0,0,114,92,0,0,0,90,10,99,97,99,104,101,95, - 112,97,116,104,114,55,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,15,95,99,97,99,104,101, - 95,98,121,116,101,99,111,100,101,190,2,0,0,115,2,0, - 0,0,0,8,122,28,83,111,117,114,99,101,76,111,97,100, - 101,114,46,95,99,97,99,104,101,95,98,121,116,101,99,111, - 100,101,99,3,0,0,0,0,0,0,0,3,0,0,0,1, - 0,0,0,67,0,0,0,115,4,0,0,0,100,1,0,83, - 41,2,122,150,79,112,116,105,111,110,97,108,32,109,101,116, - 104,111,100,32,119,104,105,99,104,32,119,114,105,116,101,115, - 32,100,97,116,97,32,40,98,121,116,101,115,41,32,116,111, - 32,97,32,102,105,108,101,32,112,97,116,104,32,40,97,32, - 115,116,114,41,46,10,10,32,32,32,32,32,32,32,32,73, - 109,112,108,101,109,101,110,116,105,110,103,32,116,104,105,115, - 32,109,101,116,104,111,100,32,97,108,108,111,119,115,32,102, - 111,114,32,116,104,101,32,119,114,105,116,105,110,103,32,111, - 102,32,98,121,116,101,99,111,100,101,32,102,105,108,101,115, - 46,10,32,32,32,32,32,32,32,32,78,114,4,0,0,0, - 41,3,114,110,0,0,0,114,37,0,0,0,114,55,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,199,0,0,0,200,2,0,0,115,0,0,0,0,122,21, - 83,111,117,114,99,101,76,111,97,100,101,114,46,115,101,116, - 95,100,97,116,97,99,2,0,0,0,0,0,0,0,5,0, - 0,0,16,0,0,0,67,0,0,0,115,105,0,0,0,124, - 0,0,106,0,0,124,1,0,131,1,0,125,2,0,121,19, - 0,124,0,0,106,1,0,124,2,0,131,1,0,125,3,0, - 87,110,58,0,4,116,2,0,107,10,0,114,94,0,1,125, - 4,0,1,122,26,0,116,3,0,100,1,0,100,2,0,124, - 1,0,131,1,1,124,4,0,130,2,0,87,89,100,3,0, - 100,3,0,125,4,0,126,4,0,88,110,1,0,88,116,4, - 0,124,3,0,131,1,0,83,41,4,122,52,67,111,110,99, - 114,101,116,101,32,105,109,112,108,101,109,101,110,116,97,116, - 105,111,110,32,111,102,32,73,110,115,112,101,99,116,76,111, - 97,100,101,114,46,103,101,116,95,115,111,117,114,99,101,46, - 122,39,115,111,117,114,99,101,32,110,111,116,32,97,118,97, - 105,108,97,98,108,101,32,116,104,114,111,117,103,104,32,103, - 101,116,95,100,97,116,97,40,41,114,108,0,0,0,78,41, - 5,114,159,0,0,0,218,8,103,101,116,95,100,97,116,97, - 114,42,0,0,0,114,109,0,0,0,114,157,0,0,0,41, - 5,114,110,0,0,0,114,128,0,0,0,114,37,0,0,0, - 114,155,0,0,0,218,3,101,120,99,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,218,10,103,101,116,95,115, - 111,117,114,99,101,207,2,0,0,115,14,0,0,0,0,2, - 15,1,3,1,19,1,18,1,9,1,31,1,122,23,83,111, - 117,114,99,101,76,111,97,100,101,114,46,103,101,116,95,115, - 111,117,114,99,101,218,9,95,111,112,116,105,109,105,122,101, - 114,31,0,0,0,99,3,0,0,0,1,0,0,0,4,0, - 0,0,9,0,0,0,67,0,0,0,115,34,0,0,0,116, - 0,0,106,1,0,116,2,0,124,1,0,124,2,0,100,1, - 0,100,2,0,100,3,0,100,4,0,124,3,0,131,4,2, - 83,41,5,122,130,82,101,116,117,114,110,32,116,104,101,32, - 99,111,100,101,32,111,98,106,101,99,116,32,99,111,109,112, - 105,108,101,100,32,102,114,111,109,32,115,111,117,114,99,101, - 46,10,10,32,32,32,32,32,32,32,32,84,104,101,32,39, - 100,97,116,97,39,32,97,114,103,117,109,101,110,116,32,99, - 97,110,32,98,101,32,97,110,121,32,111,98,106,101,99,116, - 32,116,121,112,101,32,116,104,97,116,32,99,111,109,112,105, - 108,101,40,41,32,115,117,112,112,111,114,116,115,46,10,32, - 32,32,32,32,32,32,32,114,190,0,0,0,218,12,100,111, - 110,116,95,105,110,104,101,114,105,116,84,114,70,0,0,0, - 41,3,114,123,0,0,0,114,189,0,0,0,218,7,99,111, - 109,112,105,108,101,41,4,114,110,0,0,0,114,55,0,0, - 0,114,37,0,0,0,114,204,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,218,14,115,111,117,114, - 99,101,95,116,111,95,99,111,100,101,217,2,0,0,115,4, - 0,0,0,0,5,21,1,122,27,83,111,117,114,99,101,76, - 111,97,100,101,114,46,115,111,117,114,99,101,95,116,111,95, - 99,111,100,101,99,2,0,0,0,0,0,0,0,10,0,0, - 0,43,0,0,0,67,0,0,0,115,174,1,0,0,124,0, - 0,106,0,0,124,1,0,131,1,0,125,2,0,100,1,0, - 125,3,0,121,16,0,116,1,0,124,2,0,131,1,0,125, - 4,0,87,110,24,0,4,116,2,0,107,10,0,114,63,0, - 1,1,1,100,1,0,125,4,0,89,110,202,0,88,121,19, - 0,124,0,0,106,3,0,124,2,0,131,1,0,125,5,0, - 87,110,18,0,4,116,4,0,107,10,0,114,103,0,1,1, - 1,89,110,162,0,88,116,5,0,124,5,0,100,2,0,25, - 131,1,0,125,3,0,121,19,0,124,0,0,106,6,0,124, - 4,0,131,1,0,125,6,0,87,110,18,0,4,116,7,0, - 107,10,0,114,159,0,1,1,1,89,110,106,0,88,121,34, - 0,116,8,0,124,6,0,100,3,0,124,5,0,100,4,0, - 124,1,0,100,5,0,124,4,0,131,1,3,125,7,0,87, - 110,24,0,4,116,9,0,116,10,0,102,2,0,107,10,0, - 114,220,0,1,1,1,89,110,45,0,88,116,11,0,100,6, - 0,124,4,0,124,2,0,131,3,0,1,116,12,0,124,7, - 0,100,4,0,124,1,0,100,7,0,124,4,0,100,8,0, - 124,2,0,131,1,3,83,124,0,0,106,6,0,124,2,0, - 131,1,0,125,8,0,124,0,0,106,13,0,124,8,0,124, - 2,0,131,2,0,125,9,0,116,11,0,100,9,0,124,2, - 0,131,2,0,1,116,14,0,106,15,0,12,114,170,1,124, - 4,0,100,1,0,107,9,0,114,170,1,124,3,0,100,1, - 0,107,9,0,114,170,1,116,16,0,124,9,0,124,3,0, - 116,17,0,124,8,0,131,1,0,131,3,0,125,6,0,121, - 36,0,124,0,0,106,18,0,124,2,0,124,4,0,124,6, - 0,131,3,0,1,116,11,0,100,10,0,124,4,0,131,2, - 0,1,87,110,18,0,4,116,2,0,107,10,0,114,169,1, - 1,1,1,89,110,1,0,88,124,9,0,83,41,11,122,190, - 67,111,110,99,114,101,116,101,32,105,109,112,108,101,109,101, - 110,116,97,116,105,111,110,32,111,102,32,73,110,115,112,101, - 99,116,76,111,97,100,101,114,46,103,101,116,95,99,111,100, - 101,46,10,10,32,32,32,32,32,32,32,32,82,101,97,100, - 105,110,103,32,111,102,32,98,121,116,101,99,111,100,101,32, - 114,101,113,117,105,114,101,115,32,112,97,116,104,95,115,116, - 97,116,115,32,116,111,32,98,101,32,105,109,112,108,101,109, - 101,110,116,101,100,46,32,84,111,32,119,114,105,116,101,10, - 32,32,32,32,32,32,32,32,98,121,116,101,99,111,100,101, - 44,32,115,101,116,95,100,97,116,97,32,109,117,115,116,32, - 97,108,115,111,32,98,101,32,105,109,112,108,101,109,101,110, - 116,101,100,46,10,10,32,32,32,32,32,32,32,32,78,114, - 135,0,0,0,114,140,0,0,0,114,108,0,0,0,114,37, - 0,0,0,122,13,123,125,32,109,97,116,99,104,101,115,32, - 123,125,114,91,0,0,0,114,92,0,0,0,122,19,99,111, - 100,101,32,111,98,106,101,99,116,32,102,114,111,109,32,123, - 125,122,10,119,114,111,116,101,32,123,33,114,125,41,19,114, - 159,0,0,0,114,81,0,0,0,114,68,0,0,0,114,198, - 0,0,0,114,196,0,0,0,114,16,0,0,0,114,201,0, - 0,0,114,42,0,0,0,114,143,0,0,0,114,109,0,0, - 0,114,138,0,0,0,114,107,0,0,0,114,149,0,0,0, - 114,207,0,0,0,114,8,0,0,0,218,19,100,111,110,116, - 95,119,114,105,116,101,95,98,121,116,101,99,111,100,101,114, - 152,0,0,0,114,33,0,0,0,114,200,0,0,0,41,10, - 114,110,0,0,0,114,128,0,0,0,114,92,0,0,0,114, - 141,0,0,0,114,91,0,0,0,218,2,115,116,114,55,0, - 0,0,218,10,98,121,116,101,115,95,100,97,116,97,114,155, - 0,0,0,90,11,99,111,100,101,95,111,98,106,101,99,116, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, - 188,0,0,0,225,2,0,0,115,78,0,0,0,0,7,15, - 1,6,1,3,1,16,1,13,1,11,2,3,1,19,1,13, - 1,5,2,16,1,3,1,19,1,13,1,5,2,3,1,9, - 1,12,1,13,1,19,1,5,2,9,1,7,1,15,1,6, - 1,7,1,15,1,18,1,13,1,22,1,12,1,9,1,15, - 1,3,1,19,1,17,1,13,1,5,1,122,21,83,111,117, - 114,99,101,76,111,97,100,101,114,46,103,101,116,95,99,111, - 100,101,78,114,89,0,0,0,41,10,114,114,0,0,0,114, - 113,0,0,0,114,115,0,0,0,114,197,0,0,0,114,198, - 0,0,0,114,200,0,0,0,114,199,0,0,0,114,203,0, - 0,0,114,207,0,0,0,114,188,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,195,0,0,0,167,2,0,0,115,14,0,0,0,12,2, - 12,8,12,13,12,10,12,7,12,10,18,8,114,195,0,0, - 0,99,0,0,0,0,0,0,0,0,0,0,0,0,4,0, - 0,0,0,0,0,0,115,112,0,0,0,101,0,0,90,1, - 0,100,0,0,90,2,0,100,1,0,90,3,0,100,2,0, - 100,3,0,132,0,0,90,4,0,100,4,0,100,5,0,132, - 0,0,90,5,0,100,6,0,100,7,0,132,0,0,90,6, - 0,101,7,0,135,0,0,102,1,0,100,8,0,100,9,0, - 134,0,0,131,1,0,90,8,0,101,7,0,100,10,0,100, - 11,0,132,0,0,131,1,0,90,9,0,100,12,0,100,13, - 0,132,0,0,90,10,0,135,0,0,83,41,14,218,10,70, - 105,108,101,76,111,97,100,101,114,122,103,66,97,115,101,32, - 102,105,108,101,32,108,111,97,100,101,114,32,99,108,97,115, - 115,32,119,104,105,99,104,32,105,109,112,108,101,109,101,110, - 116,115,32,116,104,101,32,108,111,97,100,101,114,32,112,114, - 111,116,111,99,111,108,32,109,101,116,104,111,100,115,32,116, - 104,97,116,10,32,32,32,32,114,101,113,117,105,114,101,32, - 102,105,108,101,32,115,121,115,116,101,109,32,117,115,97,103, - 101,46,99,3,0,0,0,0,0,0,0,3,0,0,0,2, - 0,0,0,67,0,0,0,115,22,0,0,0,124,1,0,124, - 0,0,95,0,0,124,2,0,124,0,0,95,1,0,100,1, - 0,83,41,2,122,75,67,97,99,104,101,32,116,104,101,32, - 109,111,100,117,108,101,32,110,97,109,101,32,97,110,100,32, - 116,104,101,32,112,97,116,104,32,116,111,32,116,104,101,32, - 102,105,108,101,32,102,111,117,110,100,32,98,121,32,116,104, - 101,10,32,32,32,32,32,32,32,32,102,105,110,100,101,114, - 46,78,41,2,114,108,0,0,0,114,37,0,0,0,41,3, - 114,110,0,0,0,114,128,0,0,0,114,37,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,186, - 0,0,0,26,3,0,0,115,4,0,0,0,0,3,9,1, - 122,19,70,105,108,101,76,111,97,100,101,114,46,95,95,105, - 110,105,116,95,95,99,2,0,0,0,0,0,0,0,2,0, - 0,0,2,0,0,0,67,0,0,0,115,34,0,0,0,124, - 0,0,106,0,0,124,1,0,106,0,0,107,2,0,111,33, - 0,124,0,0,106,1,0,124,1,0,106,1,0,107,2,0, - 83,41,1,78,41,2,218,9,95,95,99,108,97,115,115,95, - 95,114,120,0,0,0,41,2,114,110,0,0,0,218,5,111, - 116,104,101,114,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,218,6,95,95,101,113,95,95,32,3,0,0,115, - 4,0,0,0,0,1,18,1,122,17,70,105,108,101,76,111, - 97,100,101,114,46,95,95,101,113,95,95,99,1,0,0,0, - 0,0,0,0,1,0,0,0,3,0,0,0,67,0,0,0, - 115,26,0,0,0,116,0,0,124,0,0,106,1,0,131,1, - 0,116,0,0,124,0,0,106,2,0,131,1,0,65,83,41, - 1,78,41,3,218,4,104,97,115,104,114,108,0,0,0,114, - 37,0,0,0,41,1,114,110,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,218,8,95,95,104,97, - 115,104,95,95,36,3,0,0,115,2,0,0,0,0,1,122, - 19,70,105,108,101,76,111,97,100,101,114,46,95,95,104,97, - 115,104,95,95,99,2,0,0,0,0,0,0,0,2,0,0, - 0,3,0,0,0,3,0,0,0,115,22,0,0,0,116,0, - 0,116,1,0,124,0,0,131,2,0,106,2,0,124,1,0, - 131,1,0,83,41,1,122,100,76,111,97,100,32,97,32,109, - 111,100,117,108,101,32,102,114,111,109,32,97,32,102,105,108, - 101,46,10,10,32,32,32,32,32,32,32,32,84,104,105,115, - 32,109,101,116,104,111,100,32,105,115,32,100,101,112,114,101, - 99,97,116,101,100,46,32,32,85,115,101,32,101,120,101,99, - 95,109,111,100,117,108,101,40,41,32,105,110,115,116,101,97, - 100,46,10,10,32,32,32,32,32,32,32,32,41,3,218,5, - 115,117,112,101,114,114,211,0,0,0,114,194,0,0,0,41, - 2,114,110,0,0,0,114,128,0,0,0,41,1,114,212,0, - 0,0,114,4,0,0,0,114,6,0,0,0,114,194,0,0, - 0,39,3,0,0,115,2,0,0,0,0,10,122,22,70,105, - 108,101,76,111,97,100,101,114,46,108,111,97,100,95,109,111, - 100,117,108,101,99,2,0,0,0,0,0,0,0,2,0,0, - 0,1,0,0,0,67,0,0,0,115,7,0,0,0,124,0, - 0,106,0,0,83,41,1,122,58,82,101,116,117,114,110,32, - 116,104,101,32,112,97,116,104,32,116,111,32,116,104,101,32, - 115,111,117,114,99,101,32,102,105,108,101,32,97,115,32,102, - 111,117,110,100,32,98,121,32,116,104,101,32,102,105,110,100, - 101,114,46,41,1,114,37,0,0,0,41,2,114,110,0,0, - 0,114,128,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,159,0,0,0,51,3,0,0,115,2, - 0,0,0,0,3,122,23,70,105,108,101,76,111,97,100,101, - 114,46,103,101,116,95,102,105,108,101,110,97,109,101,99,2, - 0,0,0,0,0,0,0,3,0,0,0,9,0,0,0,67, - 0,0,0,115,42,0,0,0,116,0,0,106,1,0,124,1, - 0,100,1,0,131,2,0,143,17,0,125,2,0,124,2,0, - 106,2,0,131,0,0,83,87,100,2,0,81,82,88,100,2, - 0,83,41,3,122,39,82,101,116,117,114,110,32,116,104,101, - 32,100,97,116,97,32,102,114,111,109,32,112,97,116,104,32, - 97,115,32,114,97,119,32,98,121,116,101,115,46,218,1,114, - 78,41,3,114,51,0,0,0,114,52,0,0,0,90,4,114, - 101,97,100,41,3,114,110,0,0,0,114,37,0,0,0,114, - 56,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,201,0,0,0,56,3,0,0,115,4,0,0, - 0,0,2,21,1,122,19,70,105,108,101,76,111,97,100,101, - 114,46,103,101,116,95,100,97,116,97,41,11,114,114,0,0, - 0,114,113,0,0,0,114,115,0,0,0,114,116,0,0,0, - 114,186,0,0,0,114,214,0,0,0,114,216,0,0,0,114, - 125,0,0,0,114,194,0,0,0,114,159,0,0,0,114,201, - 0,0,0,114,4,0,0,0,114,4,0,0,0,41,1,114, - 212,0,0,0,114,6,0,0,0,114,211,0,0,0,21,3, - 0,0,115,14,0,0,0,12,3,6,2,12,6,12,4,12, - 3,24,12,18,5,114,211,0,0,0,99,0,0,0,0,0, - 0,0,0,0,0,0,0,4,0,0,0,64,0,0,0,115, - 64,0,0,0,101,0,0,90,1,0,100,0,0,90,2,0, + 0,0,0,114,189,0,0,0,114,204,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,114,225,0,0,0,129,3,0,0,115,6,0,0,0,12, + 2,6,2,12,6,114,225,0,0,0,99,0,0,0,0,0, + 0,0,0,0,0,0,0,3,0,0,0,64,0,0,0,115, + 136,0,0,0,101,0,0,90,1,0,100,0,0,90,2,0, 100,1,0,90,3,0,100,2,0,100,3,0,132,0,0,90, 4,0,100,4,0,100,5,0,132,0,0,90,5,0,100,6, - 0,100,7,0,100,8,0,100,9,0,132,0,1,90,6,0, - 100,10,0,83,41,11,218,16,83,111,117,114,99,101,70,105, - 108,101,76,111,97,100,101,114,122,62,67,111,110,99,114,101, - 116,101,32,105,109,112,108,101,109,101,110,116,97,116,105,111, - 110,32,111,102,32,83,111,117,114,99,101,76,111,97,100,101, - 114,32,117,115,105,110,103,32,116,104,101,32,102,105,108,101, - 32,115,121,115,116,101,109,46,99,2,0,0,0,0,0,0, - 0,3,0,0,0,4,0,0,0,67,0,0,0,115,34,0, - 0,0,116,0,0,124,1,0,131,1,0,125,2,0,100,1, - 0,124,2,0,106,1,0,100,2,0,124,2,0,106,2,0, - 105,2,0,83,41,3,122,33,82,101,116,117,114,110,32,116, - 104,101,32,109,101,116,97,100,97,116,97,32,102,111,114,32, - 116,104,101,32,112,97,116,104,46,114,135,0,0,0,114,136, - 0,0,0,41,3,114,41,0,0,0,218,8,115,116,95,109, - 116,105,109,101,90,7,115,116,95,115,105,122,101,41,3,114, - 110,0,0,0,114,37,0,0,0,114,209,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,6,0,0,0,114,198,0, - 0,0,66,3,0,0,115,4,0,0,0,0,2,12,1,122, - 27,83,111,117,114,99,101,70,105,108,101,76,111,97,100,101, - 114,46,112,97,116,104,95,115,116,97,116,115,99,4,0,0, - 0,0,0,0,0,5,0,0,0,5,0,0,0,67,0,0, - 0,115,34,0,0,0,116,0,0,124,1,0,131,1,0,125, - 4,0,124,0,0,106,1,0,124,2,0,124,3,0,100,1, - 0,124,4,0,131,2,1,83,41,2,78,218,5,95,109,111, - 100,101,41,2,114,99,0,0,0,114,199,0,0,0,41,5, - 114,110,0,0,0,114,92,0,0,0,114,91,0,0,0,114, - 55,0,0,0,114,44,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,114,200,0,0,0,71,3,0, - 0,115,4,0,0,0,0,2,12,1,122,32,83,111,117,114, - 99,101,70,105,108,101,76,111,97,100,101,114,46,95,99,97, - 99,104,101,95,98,121,116,101,99,111,100,101,114,221,0,0, - 0,105,182,1,0,0,99,3,0,0,0,1,0,0,0,9, - 0,0,0,17,0,0,0,67,0,0,0,115,53,1,0,0, - 116,0,0,124,1,0,131,1,0,92,2,0,125,4,0,125, - 5,0,103,0,0,125,6,0,120,54,0,124,4,0,114,80, - 0,116,1,0,124,4,0,131,1,0,12,114,80,0,116,0, - 0,124,4,0,131,1,0,92,2,0,125,4,0,125,7,0, - 124,6,0,106,2,0,124,7,0,131,1,0,1,113,27,0, - 87,120,132,0,116,3,0,124,6,0,131,1,0,68,93,118, - 0,125,7,0,116,4,0,124,4,0,124,7,0,131,2,0, - 125,4,0,121,17,0,116,5,0,106,6,0,124,4,0,131, - 1,0,1,87,113,94,0,4,116,7,0,107,10,0,114,155, - 0,1,1,1,119,94,0,89,113,94,0,4,116,8,0,107, - 10,0,114,211,0,1,125,8,0,1,122,25,0,116,9,0, - 100,1,0,124,4,0,124,8,0,131,3,0,1,100,2,0, - 83,87,89,100,2,0,100,2,0,125,8,0,126,8,0,88, - 113,94,0,88,113,94,0,87,121,33,0,116,10,0,124,1, - 0,124,2,0,124,3,0,131,3,0,1,116,9,0,100,3, - 0,124,1,0,131,2,0,1,87,110,53,0,4,116,8,0, - 107,10,0,114,48,1,1,125,8,0,1,122,21,0,116,9, - 0,100,1,0,124,1,0,124,8,0,131,3,0,1,87,89, - 100,2,0,100,2,0,125,8,0,126,8,0,88,110,1,0, - 88,100,2,0,83,41,4,122,27,87,114,105,116,101,32,98, - 121,116,101,115,32,100,97,116,97,32,116,111,32,97,32,102, - 105,108,101,46,122,27,99,111,117,108,100,32,110,111,116,32, - 99,114,101,97,116,101,32,123,33,114,125,58,32,123,33,114, - 125,78,122,12,99,114,101,97,116,101,100,32,123,33,114,125, - 41,11,114,40,0,0,0,114,48,0,0,0,114,165,0,0, - 0,114,35,0,0,0,114,30,0,0,0,114,3,0,0,0, - 90,5,109,107,100,105,114,218,15,70,105,108,101,69,120,105, - 115,116,115,69,114,114,111,114,114,42,0,0,0,114,107,0, - 0,0,114,57,0,0,0,41,9,114,110,0,0,0,114,37, - 0,0,0,114,55,0,0,0,114,221,0,0,0,218,6,112, - 97,114,101,110,116,114,96,0,0,0,114,29,0,0,0,114, - 25,0,0,0,114,202,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,114,199,0,0,0,76,3,0, - 0,115,38,0,0,0,0,2,18,1,6,2,22,1,18,1, - 17,2,19,1,15,1,3,1,17,1,13,2,7,1,18,3, - 16,1,27,1,3,1,16,1,17,1,18,2,122,25,83,111, - 117,114,99,101,70,105,108,101,76,111,97,100,101,114,46,115, - 101,116,95,100,97,116,97,78,41,7,114,114,0,0,0,114, - 113,0,0,0,114,115,0,0,0,114,116,0,0,0,114,198, - 0,0,0,114,200,0,0,0,114,199,0,0,0,114,4,0, + 0,100,7,0,132,0,0,90,6,0,100,8,0,100,9,0, + 132,0,0,90,7,0,100,10,0,100,11,0,132,0,0,90, + 8,0,100,12,0,100,13,0,132,0,0,90,9,0,100,14, + 0,100,15,0,132,0,0,90,10,0,100,16,0,100,17,0, + 132,0,0,90,11,0,101,12,0,100,18,0,100,19,0,132, + 0,0,131,1,0,90,13,0,100,20,0,83,41,21,218,19, + 69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,97, + 100,101,114,122,93,76,111,97,100,101,114,32,102,111,114,32, + 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, + 115,46,10,10,32,32,32,32,84,104,101,32,99,111,110,115, + 116,114,117,99,116,111,114,32,105,115,32,100,101,115,105,103, + 110,101,100,32,116,111,32,119,111,114,107,32,119,105,116,104, + 32,70,105,108,101,70,105,110,100,101,114,46,10,10,32,32, + 32,32,99,3,0,0,0,0,0,0,0,3,0,0,0,2, + 0,0,0,67,0,0,0,115,22,0,0,0,124,1,0,124, + 0,0,95,0,0,124,2,0,124,0,0,95,1,0,100,0, + 0,83,41,1,78,41,2,114,108,0,0,0,114,37,0,0, + 0,41,3,114,110,0,0,0,114,108,0,0,0,114,37,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,219,0,0,0,62,3,0,0,115,8,0,0,0,12, - 2,6,2,12,5,12,5,114,219,0,0,0,99,0,0,0, - 0,0,0,0,0,0,0,0,0,2,0,0,0,64,0,0, - 0,115,46,0,0,0,101,0,0,90,1,0,100,0,0,90, - 2,0,100,1,0,90,3,0,100,2,0,100,3,0,132,0, - 0,90,4,0,100,4,0,100,5,0,132,0,0,90,5,0, - 100,6,0,83,41,7,218,20,83,111,117,114,99,101,108,101, - 115,115,70,105,108,101,76,111,97,100,101,114,122,45,76,111, - 97,100,101,114,32,119,104,105,99,104,32,104,97,110,100,108, - 101,115,32,115,111,117,114,99,101,108,101,115,115,32,102,105, - 108,101,32,105,109,112,111,114,116,115,46,99,2,0,0,0, - 0,0,0,0,5,0,0,0,6,0,0,0,67,0,0,0, - 115,76,0,0,0,124,0,0,106,0,0,124,1,0,131,1, - 0,125,2,0,124,0,0,106,1,0,124,2,0,131,1,0, - 125,3,0,116,2,0,124,3,0,100,1,0,124,1,0,100, - 2,0,124,2,0,131,1,2,125,4,0,116,3,0,124,4, - 0,100,1,0,124,1,0,100,3,0,124,2,0,131,1,2, - 83,41,4,78,114,108,0,0,0,114,37,0,0,0,114,91, - 0,0,0,41,4,114,159,0,0,0,114,201,0,0,0,114, - 143,0,0,0,114,149,0,0,0,41,5,114,110,0,0,0, - 114,128,0,0,0,114,37,0,0,0,114,55,0,0,0,114, - 210,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,188,0,0,0,109,3,0,0,115,8,0,0, - 0,0,1,15,1,15,1,24,1,122,29,83,111,117,114,99, - 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,46, - 103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0, + 0,114,187,0,0,0,156,3,0,0,115,4,0,0,0,0, + 1,9,1,122,28,69,120,116,101,110,115,105,111,110,70,105, + 108,101,76,111,97,100,101,114,46,95,95,105,110,105,116,95, + 95,99,2,0,0,0,0,0,0,0,2,0,0,0,2,0, + 0,0,67,0,0,0,115,34,0,0,0,124,0,0,106,0, + 0,124,1,0,106,0,0,107,2,0,111,33,0,124,0,0, + 106,1,0,124,1,0,106,1,0,107,2,0,83,41,1,78, + 41,2,114,213,0,0,0,114,120,0,0,0,41,2,114,110, + 0,0,0,114,214,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,6,0,0,0,114,215,0,0,0,160,3,0,0, + 115,4,0,0,0,0,1,18,1,122,26,69,120,116,101,110, + 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,95, + 95,101,113,95,95,99,1,0,0,0,0,0,0,0,1,0, + 0,0,3,0,0,0,67,0,0,0,115,26,0,0,0,116, + 0,0,124,0,0,106,1,0,131,1,0,116,0,0,124,0, + 0,106,2,0,131,1,0,65,83,41,1,78,41,3,114,216, + 0,0,0,114,108,0,0,0,114,37,0,0,0,41,1,114, + 110,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,114,217,0,0,0,164,3,0,0,115,2,0,0, + 0,0,1,122,28,69,120,116,101,110,115,105,111,110,70,105, + 108,101,76,111,97,100,101,114,46,95,95,104,97,115,104,95, + 95,99,2,0,0,0,0,0,0,0,3,0,0,0,4,0, + 0,0,67,0,0,0,115,47,0,0,0,116,0,0,106,1, + 0,116,2,0,106,3,0,124,1,0,131,2,0,125,2,0, + 116,4,0,100,1,0,124,1,0,106,5,0,124,0,0,106, + 6,0,131,3,0,1,124,2,0,83,41,2,122,38,67,114, + 101,97,116,101,32,97,110,32,117,110,105,116,105,97,108,105, + 122,101,100,32,101,120,116,101,110,115,105,111,110,32,109,111, + 100,117,108,101,122,38,101,120,116,101,110,115,105,111,110,32, + 109,111,100,117,108,101,32,123,33,114,125,32,108,111,97,100, + 101,100,32,102,114,111,109,32,123,33,114,125,41,7,114,123, + 0,0,0,114,190,0,0,0,114,148,0,0,0,90,14,99, + 114,101,97,116,101,95,100,121,110,97,109,105,99,114,107,0, + 0,0,114,108,0,0,0,114,37,0,0,0,41,3,114,110, + 0,0,0,114,167,0,0,0,114,192,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,114,188,0,0, + 0,167,3,0,0,115,10,0,0,0,0,2,6,1,15,1, + 6,1,16,1,122,33,69,120,116,101,110,115,105,111,110,70, + 105,108,101,76,111,97,100,101,114,46,99,114,101,97,116,101, + 95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0, + 2,0,0,0,4,0,0,0,67,0,0,0,115,45,0,0, + 0,116,0,0,106,1,0,116,2,0,106,3,0,124,1,0, + 131,2,0,1,116,4,0,100,1,0,124,0,0,106,5,0, + 124,0,0,106,6,0,131,3,0,1,100,2,0,83,41,3, + 122,30,73,110,105,116,105,97,108,105,122,101,32,97,110,32, + 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, + 122,40,101,120,116,101,110,115,105,111,110,32,109,111,100,117, + 108,101,32,123,33,114,125,32,101,120,101,99,117,116,101,100, + 32,102,114,111,109,32,123,33,114,125,78,41,7,114,123,0, + 0,0,114,190,0,0,0,114,148,0,0,0,90,12,101,120, + 101,99,95,100,121,110,97,109,105,99,114,107,0,0,0,114, + 108,0,0,0,114,37,0,0,0,41,2,114,110,0,0,0, + 114,192,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 6,0,0,0,114,193,0,0,0,175,3,0,0,115,6,0, + 0,0,0,2,19,1,6,1,122,31,69,120,116,101,110,115, + 105,111,110,70,105,108,101,76,111,97,100,101,114,46,101,120, + 101,99,95,109,111,100,117,108,101,99,2,0,0,0,0,0, + 0,0,2,0,0,0,4,0,0,0,3,0,0,0,115,48, + 0,0,0,116,0,0,124,0,0,106,1,0,131,1,0,100, + 1,0,25,137,0,0,116,2,0,135,0,0,102,1,0,100, + 2,0,100,3,0,134,0,0,116,3,0,68,131,1,0,131, + 1,0,83,41,4,122,49,82,101,116,117,114,110,32,84,114, + 117,101,32,105,102,32,116,104,101,32,101,120,116,101,110,115, + 105,111,110,32,109,111,100,117,108,101,32,105,115,32,97,32, + 112,97,99,107,97,103,101,46,114,31,0,0,0,99,1,0, + 0,0,0,0,0,0,2,0,0,0,4,0,0,0,51,0, + 0,0,115,31,0,0,0,124,0,0,93,21,0,125,1,0, + 136,0,0,100,0,0,124,1,0,23,107,2,0,86,1,113, + 3,0,100,1,0,83,41,2,114,187,0,0,0,78,114,4, + 0,0,0,41,2,114,24,0,0,0,218,6,115,117,102,102, + 105,120,41,1,218,9,102,105,108,101,95,110,97,109,101,114, + 4,0,0,0,114,6,0,0,0,250,9,60,103,101,110,101, + 120,112,114,62,184,3,0,0,115,2,0,0,0,6,1,122, + 49,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111, + 97,100,101,114,46,105,115,95,112,97,99,107,97,103,101,46, + 60,108,111,99,97,108,115,62,46,60,103,101,110,101,120,112, + 114,62,41,4,114,40,0,0,0,114,37,0,0,0,218,3, + 97,110,121,218,18,69,88,84,69,78,83,73,79,78,95,83, + 85,70,70,73,88,69,83,41,2,114,110,0,0,0,114,128, + 0,0,0,114,4,0,0,0,41,1,114,228,0,0,0,114, + 6,0,0,0,114,162,0,0,0,181,3,0,0,115,6,0, + 0,0,0,2,19,1,18,1,122,30,69,120,116,101,110,115, + 105,111,110,70,105,108,101,76,111,97,100,101,114,46,105,115, + 95,112,97,99,107,97,103,101,99,2,0,0,0,0,0,0, 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, - 0,0,100,1,0,83,41,2,122,39,82,101,116,117,114,110, - 32,78,111,110,101,32,97,115,32,116,104,101,114,101,32,105, - 115,32,110,111,32,115,111,117,114,99,101,32,99,111,100,101, - 46,78,114,4,0,0,0,41,2,114,110,0,0,0,114,128, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,203,0,0,0,115,3,0,0,115,2,0,0,0, - 0,2,122,31,83,111,117,114,99,101,108,101,115,115,70,105, - 108,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, - 114,99,101,78,41,6,114,114,0,0,0,114,113,0,0,0, - 114,115,0,0,0,114,116,0,0,0,114,188,0,0,0,114, - 203,0,0,0,114,4,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,114,224,0,0,0,105,3,0, - 0,115,6,0,0,0,12,2,6,2,12,6,114,224,0,0, - 0,99,0,0,0,0,0,0,0,0,0,0,0,0,3,0, - 0,0,64,0,0,0,115,136,0,0,0,101,0,0,90,1, - 0,100,0,0,90,2,0,100,1,0,90,3,0,100,2,0, - 100,3,0,132,0,0,90,4,0,100,4,0,100,5,0,132, - 0,0,90,5,0,100,6,0,100,7,0,132,0,0,90,6, - 0,100,8,0,100,9,0,132,0,0,90,7,0,100,10,0, - 100,11,0,132,0,0,90,8,0,100,12,0,100,13,0,132, - 0,0,90,9,0,100,14,0,100,15,0,132,0,0,90,10, - 0,100,16,0,100,17,0,132,0,0,90,11,0,101,12,0, - 100,18,0,100,19,0,132,0,0,131,1,0,90,13,0,100, - 20,0,83,41,21,218,19,69,120,116,101,110,115,105,111,110, - 70,105,108,101,76,111,97,100,101,114,122,93,76,111,97,100, - 101,114,32,102,111,114,32,101,120,116,101,110,115,105,111,110, - 32,109,111,100,117,108,101,115,46,10,10,32,32,32,32,84, - 104,101,32,99,111,110,115,116,114,117,99,116,111,114,32,105, - 115,32,100,101,115,105,103,110,101,100,32,116,111,32,119,111, - 114,107,32,119,105,116,104,32,70,105,108,101,70,105,110,100, - 101,114,46,10,10,32,32,32,32,99,3,0,0,0,0,0, - 0,0,3,0,0,0,2,0,0,0,67,0,0,0,115,22, - 0,0,0,124,1,0,124,0,0,95,0,0,124,2,0,124, - 0,0,95,1,0,100,0,0,83,41,1,78,41,2,114,108, - 0,0,0,114,37,0,0,0,41,3,114,110,0,0,0,114, - 108,0,0,0,114,37,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,114,186,0,0,0,132,3,0, - 0,115,4,0,0,0,0,1,9,1,122,28,69,120,116,101, - 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, - 95,95,105,110,105,116,95,95,99,2,0,0,0,0,0,0, - 0,2,0,0,0,2,0,0,0,67,0,0,0,115,34,0, - 0,0,124,0,0,106,0,0,124,1,0,106,0,0,107,2, - 0,111,33,0,124,0,0,106,1,0,124,1,0,106,1,0, - 107,2,0,83,41,1,78,41,2,114,212,0,0,0,114,120, - 0,0,0,41,2,114,110,0,0,0,114,213,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,214, - 0,0,0,136,3,0,0,115,4,0,0,0,0,1,18,1, - 122,26,69,120,116,101,110,115,105,111,110,70,105,108,101,76, - 111,97,100,101,114,46,95,95,101,113,95,95,99,1,0,0, - 0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,0, - 0,115,26,0,0,0,116,0,0,124,0,0,106,1,0,131, - 1,0,116,0,0,124,0,0,106,2,0,131,1,0,65,83, - 41,1,78,41,3,114,215,0,0,0,114,108,0,0,0,114, - 37,0,0,0,41,1,114,110,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,216,0,0,0,140, - 3,0,0,115,2,0,0,0,0,1,122,28,69,120,116,101, + 0,0,100,1,0,83,41,2,122,63,82,101,116,117,114,110, + 32,78,111,110,101,32,97,115,32,97,110,32,101,120,116,101, + 110,115,105,111,110,32,109,111,100,117,108,101,32,99,97,110, + 110,111,116,32,99,114,101,97,116,101,32,97,32,99,111,100, + 101,32,111,98,106,101,99,116,46,78,114,4,0,0,0,41, + 2,114,110,0,0,0,114,128,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,6,0,0,0,114,189,0,0,0,187, + 3,0,0,115,2,0,0,0,0,2,122,28,69,120,116,101, 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, - 95,95,104,97,115,104,95,95,99,2,0,0,0,0,0,0, - 0,3,0,0,0,4,0,0,0,67,0,0,0,115,47,0, - 0,0,116,0,0,106,1,0,116,2,0,106,3,0,124,1, - 0,131,2,0,125,2,0,116,4,0,100,1,0,124,1,0, - 106,5,0,124,0,0,106,6,0,131,3,0,1,124,2,0, - 83,41,2,122,38,67,114,101,97,116,101,32,97,110,32,117, - 110,105,116,105,97,108,105,122,101,100,32,101,120,116,101,110, - 115,105,111,110,32,109,111,100,117,108,101,122,38,101,120,116, - 101,110,115,105,111,110,32,109,111,100,117,108,101,32,123,33, - 114,125,32,108,111,97,100,101,100,32,102,114,111,109,32,123, - 33,114,125,41,7,114,123,0,0,0,114,189,0,0,0,114, - 147,0,0,0,90,14,99,114,101,97,116,101,95,100,121,110, - 97,109,105,99,114,107,0,0,0,114,108,0,0,0,114,37, - 0,0,0,41,3,114,110,0,0,0,114,166,0,0,0,114, - 191,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,187,0,0,0,143,3,0,0,115,10,0,0, - 0,0,2,6,1,15,1,6,1,16,1,122,33,69,120,116, - 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, - 46,99,114,101,97,116,101,95,109,111,100,117,108,101,99,2, - 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, - 0,0,0,115,45,0,0,0,116,0,0,106,1,0,116,2, - 0,106,3,0,124,1,0,131,2,0,1,116,4,0,100,1, - 0,124,0,0,106,5,0,124,0,0,106,6,0,131,3,0, - 1,100,2,0,83,41,3,122,30,73,110,105,116,105,97,108, - 105,122,101,32,97,110,32,101,120,116,101,110,115,105,111,110, - 32,109,111,100,117,108,101,122,40,101,120,116,101,110,115,105, - 111,110,32,109,111,100,117,108,101,32,123,33,114,125,32,101, - 120,101,99,117,116,101,100,32,102,114,111,109,32,123,33,114, - 125,78,41,7,114,123,0,0,0,114,189,0,0,0,114,147, - 0,0,0,90,12,101,120,101,99,95,100,121,110,97,109,105, - 99,114,107,0,0,0,114,108,0,0,0,114,37,0,0,0, - 41,2,114,110,0,0,0,114,191,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,6,0,0,0,114,192,0,0,0, - 151,3,0,0,115,6,0,0,0,0,2,19,1,6,1,122, - 31,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111, - 97,100,101,114,46,101,120,101,99,95,109,111,100,117,108,101, - 99,2,0,0,0,0,0,0,0,2,0,0,0,4,0,0, - 0,3,0,0,0,115,48,0,0,0,116,0,0,124,0,0, - 106,1,0,131,1,0,100,1,0,25,137,0,0,116,2,0, - 135,0,0,102,1,0,100,2,0,100,3,0,134,0,0,116, - 3,0,68,131,1,0,131,1,0,83,41,4,122,49,82,101, - 116,117,114,110,32,84,114,117,101,32,105,102,32,116,104,101, - 32,101,120,116,101,110,115,105,111,110,32,109,111,100,117,108, - 101,32,105,115,32,97,32,112,97,99,107,97,103,101,46,114, - 31,0,0,0,99,1,0,0,0,0,0,0,0,2,0,0, - 0,4,0,0,0,51,0,0,0,115,31,0,0,0,124,0, - 0,93,21,0,125,1,0,136,0,0,100,0,0,124,1,0, - 23,107,2,0,86,1,113,3,0,100,1,0,83,41,2,114, - 186,0,0,0,78,114,4,0,0,0,41,2,114,24,0,0, - 0,218,6,115,117,102,102,105,120,41,1,218,9,102,105,108, - 101,95,110,97,109,101,114,4,0,0,0,114,6,0,0,0, - 250,9,60,103,101,110,101,120,112,114,62,160,3,0,0,115, - 2,0,0,0,6,1,122,49,69,120,116,101,110,115,105,111, - 110,70,105,108,101,76,111,97,100,101,114,46,105,115,95,112, - 97,99,107,97,103,101,46,60,108,111,99,97,108,115,62,46, - 60,103,101,110,101,120,112,114,62,41,4,114,40,0,0,0, - 114,37,0,0,0,218,3,97,110,121,218,18,69,88,84,69, - 78,83,73,79,78,95,83,85,70,70,73,88,69,83,41,2, - 114,110,0,0,0,114,128,0,0,0,114,4,0,0,0,41, - 1,114,227,0,0,0,114,6,0,0,0,114,161,0,0,0, - 157,3,0,0,115,6,0,0,0,0,2,19,1,18,1,122, - 30,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111, - 97,100,101,114,46,105,115,95,112,97,99,107,97,103,101,99, - 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, - 67,0,0,0,115,4,0,0,0,100,1,0,83,41,2,122, - 63,82,101,116,117,114,110,32,78,111,110,101,32,97,115,32, - 97,110,32,101,120,116,101,110,115,105,111,110,32,109,111,100, - 117,108,101,32,99,97,110,110,111,116,32,99,114,101,97,116, - 101,32,97,32,99,111,100,101,32,111,98,106,101,99,116,46, - 78,114,4,0,0,0,41,2,114,110,0,0,0,114,128,0, + 103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0, + 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, + 0,0,100,1,0,83,41,2,122,53,82,101,116,117,114,110, + 32,78,111,110,101,32,97,115,32,101,120,116,101,110,115,105, + 111,110,32,109,111,100,117,108,101,115,32,104,97,118,101,32, + 110,111,32,115,111,117,114,99,101,32,99,111,100,101,46,78, + 114,4,0,0,0,41,2,114,110,0,0,0,114,128,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 114,204,0,0,0,191,3,0,0,115,2,0,0,0,0,2, + 122,30,69,120,116,101,110,115,105,111,110,70,105,108,101,76, + 111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,101, + 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, + 0,67,0,0,0,115,7,0,0,0,124,0,0,106,0,0, + 83,41,1,122,58,82,101,116,117,114,110,32,116,104,101,32, + 112,97,116,104,32,116,111,32,116,104,101,32,115,111,117,114, + 99,101,32,102,105,108,101,32,97,115,32,102,111,117,110,100, + 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41, + 1,114,37,0,0,0,41,2,114,110,0,0,0,114,128,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,188,0,0,0,163,3,0,0,115,2,0,0,0,0, - 2,122,28,69,120,116,101,110,115,105,111,110,70,105,108,101, - 76,111,97,100,101,114,46,103,101,116,95,99,111,100,101,99, - 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, - 67,0,0,0,115,4,0,0,0,100,1,0,83,41,2,122, - 53,82,101,116,117,114,110,32,78,111,110,101,32,97,115,32, - 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, - 115,32,104,97,118,101,32,110,111,32,115,111,117,114,99,101, - 32,99,111,100,101,46,78,114,4,0,0,0,41,2,114,110, - 0,0,0,114,128,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,203,0,0,0,167,3,0,0, - 115,2,0,0,0,0,2,122,30,69,120,116,101,110,115,105, - 111,110,70,105,108,101,76,111,97,100,101,114,46,103,101,116, - 95,115,111,117,114,99,101,99,2,0,0,0,0,0,0,0, - 2,0,0,0,1,0,0,0,67,0,0,0,115,7,0,0, - 0,124,0,0,106,0,0,83,41,1,122,58,82,101,116,117, - 114,110,32,116,104,101,32,112,97,116,104,32,116,111,32,116, - 104,101,32,115,111,117,114,99,101,32,102,105,108,101,32,97, - 115,32,102,111,117,110,100,32,98,121,32,116,104,101,32,102, - 105,110,100,101,114,46,41,1,114,37,0,0,0,41,2,114, - 110,0,0,0,114,128,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,114,159,0,0,0,171,3,0, - 0,115,2,0,0,0,0,3,122,32,69,120,116,101,110,115, - 105,111,110,70,105,108,101,76,111,97,100,101,114,46,103,101, - 116,95,102,105,108,101,110,97,109,101,78,41,14,114,114,0, - 0,0,114,113,0,0,0,114,115,0,0,0,114,116,0,0, - 0,114,186,0,0,0,114,214,0,0,0,114,216,0,0,0, - 114,187,0,0,0,114,192,0,0,0,114,161,0,0,0,114, - 188,0,0,0,114,203,0,0,0,114,125,0,0,0,114,159, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,225,0,0,0,124,3,0,0, - 115,20,0,0,0,12,6,6,2,12,4,12,4,12,3,12, - 8,12,6,12,6,12,4,12,4,114,225,0,0,0,99,0, - 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, - 0,0,0,115,130,0,0,0,101,0,0,90,1,0,100,0, - 0,90,2,0,100,1,0,90,3,0,100,2,0,100,3,0, - 132,0,0,90,4,0,100,4,0,100,5,0,132,0,0,90, - 5,0,100,6,0,100,7,0,132,0,0,90,6,0,100,8, - 0,100,9,0,132,0,0,90,7,0,100,10,0,100,11,0, - 132,0,0,90,8,0,100,12,0,100,13,0,132,0,0,90, - 9,0,100,14,0,100,15,0,132,0,0,90,10,0,100,16, - 0,100,17,0,132,0,0,90,11,0,100,18,0,100,19,0, - 132,0,0,90,12,0,100,20,0,83,41,21,218,14,95,78, - 97,109,101,115,112,97,99,101,80,97,116,104,97,38,1,0, - 0,82,101,112,114,101,115,101,110,116,115,32,97,32,110,97, - 109,101,115,112,97,99,101,32,112,97,99,107,97,103,101,39, - 115,32,112,97,116,104,46,32,32,73,116,32,117,115,101,115, - 32,116,104,101,32,109,111,100,117,108,101,32,110,97,109,101, - 10,32,32,32,32,116,111,32,102,105,110,100,32,105,116,115, - 32,112,97,114,101,110,116,32,109,111,100,117,108,101,44,32, - 97,110,100,32,102,114,111,109,32,116,104,101,114,101,32,105, - 116,32,108,111,111,107,115,32,117,112,32,116,104,101,32,112, - 97,114,101,110,116,39,115,10,32,32,32,32,95,95,112,97, - 116,104,95,95,46,32,32,87,104,101,110,32,116,104,105,115, - 32,99,104,97,110,103,101,115,44,32,116,104,101,32,109,111, - 100,117,108,101,39,115,32,111,119,110,32,112,97,116,104,32, - 105,115,32,114,101,99,111,109,112,117,116,101,100,44,10,32, - 32,32,32,117,115,105,110,103,32,112,97,116,104,95,102,105, - 110,100,101,114,46,32,32,70,111,114,32,116,111,112,45,108, - 101,118,101,108,32,109,111,100,117,108,101,115,44,32,116,104, - 101,32,112,97,114,101,110,116,32,109,111,100,117,108,101,39, - 115,32,112,97,116,104,10,32,32,32,32,105,115,32,115,121, - 115,46,112,97,116,104,46,99,4,0,0,0,0,0,0,0, - 4,0,0,0,2,0,0,0,67,0,0,0,115,52,0,0, - 0,124,1,0,124,0,0,95,0,0,124,2,0,124,0,0, - 95,1,0,116,2,0,124,0,0,106,3,0,131,0,0,131, - 1,0,124,0,0,95,4,0,124,3,0,124,0,0,95,5, - 0,100,0,0,83,41,1,78,41,6,218,5,95,110,97,109, - 101,218,5,95,112,97,116,104,114,95,0,0,0,218,16,95, - 103,101,116,95,112,97,114,101,110,116,95,112,97,116,104,218, - 17,95,108,97,115,116,95,112,97,114,101,110,116,95,112,97, - 116,104,218,12,95,112,97,116,104,95,102,105,110,100,101,114, - 41,4,114,110,0,0,0,114,108,0,0,0,114,37,0,0, - 0,218,11,112,97,116,104,95,102,105,110,100,101,114,114,4, - 0,0,0,114,4,0,0,0,114,6,0,0,0,114,186,0, - 0,0,184,3,0,0,115,8,0,0,0,0,1,9,1,9, - 1,21,1,122,23,95,78,97,109,101,115,112,97,99,101,80, - 97,116,104,46,95,95,105,110,105,116,95,95,99,1,0,0, - 0,0,0,0,0,4,0,0,0,3,0,0,0,67,0,0, - 0,115,53,0,0,0,124,0,0,106,0,0,106,1,0,100, - 1,0,131,1,0,92,3,0,125,1,0,125,2,0,125,3, - 0,124,2,0,100,2,0,107,2,0,114,43,0,100,6,0, - 83,124,1,0,100,5,0,102,2,0,83,41,7,122,62,82, - 101,116,117,114,110,115,32,97,32,116,117,112,108,101,32,111, - 102,32,40,112,97,114,101,110,116,45,109,111,100,117,108,101, - 45,110,97,109,101,44,32,112,97,114,101,110,116,45,112,97, - 116,104,45,97,116,116,114,45,110,97,109,101,41,114,60,0, - 0,0,114,32,0,0,0,114,8,0,0,0,114,37,0,0, - 0,90,8,95,95,112,97,116,104,95,95,41,2,114,8,0, - 0,0,114,37,0,0,0,41,2,114,232,0,0,0,114,34, - 0,0,0,41,4,114,110,0,0,0,114,223,0,0,0,218, - 3,100,111,116,90,2,109,101,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,218,23,95,102,105,110,100,95,112, - 97,114,101,110,116,95,112,97,116,104,95,110,97,109,101,115, - 190,3,0,0,115,8,0,0,0,0,2,27,1,12,2,4, - 3,122,38,95,78,97,109,101,115,112,97,99,101,80,97,116, - 104,46,95,102,105,110,100,95,112,97,114,101,110,116,95,112, - 97,116,104,95,110,97,109,101,115,99,1,0,0,0,0,0, - 0,0,3,0,0,0,3,0,0,0,67,0,0,0,115,38, - 0,0,0,124,0,0,106,0,0,131,0,0,92,2,0,125, - 1,0,125,2,0,116,1,0,116,2,0,106,3,0,124,1, - 0,25,124,2,0,131,2,0,83,41,1,78,41,4,114,239, - 0,0,0,114,119,0,0,0,114,8,0,0,0,218,7,109, - 111,100,117,108,101,115,41,3,114,110,0,0,0,90,18,112, - 97,114,101,110,116,95,109,111,100,117,108,101,95,110,97,109, - 101,90,14,112,97,116,104,95,97,116,116,114,95,110,97,109, + 0,114,160,0,0,0,195,3,0,0,115,2,0,0,0,0, + 3,122,32,69,120,116,101,110,115,105,111,110,70,105,108,101, + 76,111,97,100,101,114,46,103,101,116,95,102,105,108,101,110, + 97,109,101,78,41,14,114,114,0,0,0,114,113,0,0,0, + 114,115,0,0,0,114,116,0,0,0,114,187,0,0,0,114, + 215,0,0,0,114,217,0,0,0,114,188,0,0,0,114,193, + 0,0,0,114,162,0,0,0,114,189,0,0,0,114,204,0, + 0,0,114,125,0,0,0,114,160,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 114,226,0,0,0,148,3,0,0,115,20,0,0,0,12,6, + 6,2,12,4,12,4,12,3,12,8,12,6,12,6,12,4, + 12,4,114,226,0,0,0,99,0,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,64,0,0,0,115,130,0,0, + 0,101,0,0,90,1,0,100,0,0,90,2,0,100,1,0, + 90,3,0,100,2,0,100,3,0,132,0,0,90,4,0,100, + 4,0,100,5,0,132,0,0,90,5,0,100,6,0,100,7, + 0,132,0,0,90,6,0,100,8,0,100,9,0,132,0,0, + 90,7,0,100,10,0,100,11,0,132,0,0,90,8,0,100, + 12,0,100,13,0,132,0,0,90,9,0,100,14,0,100,15, + 0,132,0,0,90,10,0,100,16,0,100,17,0,132,0,0, + 90,11,0,100,18,0,100,19,0,132,0,0,90,12,0,100, + 20,0,83,41,21,218,14,95,78,97,109,101,115,112,97,99, + 101,80,97,116,104,97,38,1,0,0,82,101,112,114,101,115, + 101,110,116,115,32,97,32,110,97,109,101,115,112,97,99,101, + 32,112,97,99,107,97,103,101,39,115,32,112,97,116,104,46, + 32,32,73,116,32,117,115,101,115,32,116,104,101,32,109,111, + 100,117,108,101,32,110,97,109,101,10,32,32,32,32,116,111, + 32,102,105,110,100,32,105,116,115,32,112,97,114,101,110,116, + 32,109,111,100,117,108,101,44,32,97,110,100,32,102,114,111, + 109,32,116,104,101,114,101,32,105,116,32,108,111,111,107,115, + 32,117,112,32,116,104,101,32,112,97,114,101,110,116,39,115, + 10,32,32,32,32,95,95,112,97,116,104,95,95,46,32,32, + 87,104,101,110,32,116,104,105,115,32,99,104,97,110,103,101, + 115,44,32,116,104,101,32,109,111,100,117,108,101,39,115,32, + 111,119,110,32,112,97,116,104,32,105,115,32,114,101,99,111, + 109,112,117,116,101,100,44,10,32,32,32,32,117,115,105,110, + 103,32,112,97,116,104,95,102,105,110,100,101,114,46,32,32, + 70,111,114,32,116,111,112,45,108,101,118,101,108,32,109,111, + 100,117,108,101,115,44,32,116,104,101,32,112,97,114,101,110, + 116,32,109,111,100,117,108,101,39,115,32,112,97,116,104,10, + 32,32,32,32,105,115,32,115,121,115,46,112,97,116,104,46, + 99,4,0,0,0,0,0,0,0,4,0,0,0,2,0,0, + 0,67,0,0,0,115,52,0,0,0,124,1,0,124,0,0, + 95,0,0,124,2,0,124,0,0,95,1,0,116,2,0,124, + 0,0,106,3,0,131,0,0,131,1,0,124,0,0,95,4, + 0,124,3,0,124,0,0,95,5,0,100,0,0,83,41,1, + 78,41,6,218,5,95,110,97,109,101,218,5,95,112,97,116, + 104,114,95,0,0,0,218,16,95,103,101,116,95,112,97,114, + 101,110,116,95,112,97,116,104,218,17,95,108,97,115,116,95, + 112,97,114,101,110,116,95,112,97,116,104,218,12,95,112,97, + 116,104,95,102,105,110,100,101,114,41,4,114,110,0,0,0, + 114,108,0,0,0,114,37,0,0,0,218,11,112,97,116,104, + 95,102,105,110,100,101,114,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,187,0,0,0,208,3,0,0,115, + 8,0,0,0,0,1,9,1,9,1,21,1,122,23,95,78, + 97,109,101,115,112,97,99,101,80,97,116,104,46,95,95,105, + 110,105,116,95,95,99,1,0,0,0,0,0,0,0,4,0, + 0,0,3,0,0,0,67,0,0,0,115,53,0,0,0,124, + 0,0,106,0,0,106,1,0,100,1,0,131,1,0,92,3, + 0,125,1,0,125,2,0,125,3,0,124,2,0,100,2,0, + 107,2,0,114,43,0,100,6,0,83,124,1,0,100,5,0, + 102,2,0,83,41,7,122,62,82,101,116,117,114,110,115,32, + 97,32,116,117,112,108,101,32,111,102,32,40,112,97,114,101, + 110,116,45,109,111,100,117,108,101,45,110,97,109,101,44,32, + 112,97,114,101,110,116,45,112,97,116,104,45,97,116,116,114, + 45,110,97,109,101,41,114,60,0,0,0,114,32,0,0,0, + 114,8,0,0,0,114,37,0,0,0,90,8,95,95,112,97, + 116,104,95,95,41,2,114,8,0,0,0,114,37,0,0,0, + 41,2,114,233,0,0,0,114,34,0,0,0,41,4,114,110, + 0,0,0,114,224,0,0,0,218,3,100,111,116,90,2,109, 101,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,234,0,0,0,200,3,0,0,115,4,0,0,0,0,1, - 18,1,122,31,95,78,97,109,101,115,112,97,99,101,80,97, - 116,104,46,95,103,101,116,95,112,97,114,101,110,116,95,112, - 97,116,104,99,1,0,0,0,0,0,0,0,3,0,0,0, - 3,0,0,0,67,0,0,0,115,118,0,0,0,116,0,0, - 124,0,0,106,1,0,131,0,0,131,1,0,125,1,0,124, - 1,0,124,0,0,106,2,0,107,3,0,114,111,0,124,0, - 0,106,3,0,124,0,0,106,4,0,124,1,0,131,2,0, - 125,2,0,124,2,0,100,0,0,107,9,0,114,102,0,124, - 2,0,106,5,0,100,0,0,107,8,0,114,102,0,124,2, - 0,106,6,0,114,102,0,124,2,0,106,6,0,124,0,0, - 95,7,0,124,1,0,124,0,0,95,2,0,124,0,0,106, - 7,0,83,41,1,78,41,8,114,95,0,0,0,114,234,0, - 0,0,114,235,0,0,0,114,236,0,0,0,114,232,0,0, - 0,114,129,0,0,0,114,158,0,0,0,114,233,0,0,0, - 41,3,114,110,0,0,0,90,11,112,97,114,101,110,116,95, - 112,97,116,104,114,166,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,12,95,114,101,99,97,108, - 99,117,108,97,116,101,204,3,0,0,115,16,0,0,0,0, - 2,18,1,15,1,21,3,27,1,9,1,12,1,9,1,122, - 27,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, - 95,114,101,99,97,108,99,117,108,97,116,101,99,1,0,0, - 0,0,0,0,0,1,0,0,0,2,0,0,0,67,0,0, - 0,115,16,0,0,0,116,0,0,124,0,0,106,1,0,131, - 0,0,131,1,0,83,41,1,78,41,2,218,4,105,116,101, - 114,114,241,0,0,0,41,1,114,110,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,6,0,0,0,218,8,95,95, - 105,116,101,114,95,95,217,3,0,0,115,2,0,0,0,0, - 1,122,23,95,78,97,109,101,115,112,97,99,101,80,97,116, - 104,46,95,95,105,116,101,114,95,95,99,1,0,0,0,0, - 0,0,0,1,0,0,0,2,0,0,0,67,0,0,0,115, - 16,0,0,0,116,0,0,124,0,0,106,1,0,131,0,0, - 131,1,0,83,41,1,78,41,2,114,33,0,0,0,114,241, - 0,0,0,41,1,114,110,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,218,7,95,95,108,101,110, - 95,95,220,3,0,0,115,2,0,0,0,0,1,122,22,95, - 78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,95, - 108,101,110,95,95,99,1,0,0,0,0,0,0,0,1,0, - 0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,100, - 1,0,106,0,0,124,0,0,106,1,0,131,1,0,83,41, - 2,78,122,20,95,78,97,109,101,115,112,97,99,101,80,97, - 116,104,40,123,33,114,125,41,41,2,114,49,0,0,0,114, - 233,0,0,0,41,1,114,110,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,218,8,95,95,114,101, - 112,114,95,95,223,3,0,0,115,2,0,0,0,0,1,122, - 23,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, - 95,95,114,101,112,114,95,95,99,2,0,0,0,0,0,0, - 0,2,0,0,0,2,0,0,0,67,0,0,0,115,16,0, - 0,0,124,1,0,124,0,0,106,0,0,131,0,0,107,6, - 0,83,41,1,78,41,1,114,241,0,0,0,41,2,114,110, - 0,0,0,218,4,105,116,101,109,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,12,95,95,99,111,110,116, - 97,105,110,115,95,95,226,3,0,0,115,2,0,0,0,0, - 1,122,27,95,78,97,109,101,115,112,97,99,101,80,97,116, - 104,46,95,95,99,111,110,116,97,105,110,115,95,95,99,2, - 0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,67, - 0,0,0,115,20,0,0,0,124,0,0,106,0,0,106,1, - 0,124,1,0,131,1,0,1,100,0,0,83,41,1,78,41, - 2,114,233,0,0,0,114,165,0,0,0,41,2,114,110,0, - 0,0,114,246,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,165,0,0,0,229,3,0,0,115, - 2,0,0,0,0,1,122,21,95,78,97,109,101,115,112,97, - 99,101,80,97,116,104,46,97,112,112,101,110,100,78,41,13, - 114,114,0,0,0,114,113,0,0,0,114,115,0,0,0,114, - 116,0,0,0,114,186,0,0,0,114,239,0,0,0,114,234, - 0,0,0,114,241,0,0,0,114,243,0,0,0,114,244,0, - 0,0,114,245,0,0,0,114,247,0,0,0,114,165,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,231,0,0,0,177,3,0,0,115,20, - 0,0,0,12,5,6,2,12,6,12,10,12,4,12,13,12, - 3,12,3,12,3,12,3,114,231,0,0,0,99,0,0,0, - 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, - 0,115,118,0,0,0,101,0,0,90,1,0,100,0,0,90, - 2,0,100,1,0,100,2,0,132,0,0,90,3,0,101,4, - 0,100,3,0,100,4,0,132,0,0,131,1,0,90,5,0, - 100,5,0,100,6,0,132,0,0,90,6,0,100,7,0,100, - 8,0,132,0,0,90,7,0,100,9,0,100,10,0,132,0, - 0,90,8,0,100,11,0,100,12,0,132,0,0,90,9,0, - 100,13,0,100,14,0,132,0,0,90,10,0,100,15,0,100, - 16,0,132,0,0,90,11,0,100,17,0,83,41,18,218,16, - 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, - 99,4,0,0,0,0,0,0,0,4,0,0,0,4,0,0, - 0,67,0,0,0,115,25,0,0,0,116,0,0,124,1,0, - 124,2,0,124,3,0,131,3,0,124,0,0,95,1,0,100, - 0,0,83,41,1,78,41,2,114,231,0,0,0,114,233,0, - 0,0,41,4,114,110,0,0,0,114,108,0,0,0,114,37, - 0,0,0,114,237,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,186,0,0,0,235,3,0,0, - 115,2,0,0,0,0,1,122,25,95,78,97,109,101,115,112, - 97,99,101,76,111,97,100,101,114,46,95,95,105,110,105,116, - 95,95,99,2,0,0,0,0,0,0,0,2,0,0,0,2, - 0,0,0,67,0,0,0,115,16,0,0,0,100,1,0,106, - 0,0,124,1,0,106,1,0,131,1,0,83,41,2,122,115, - 82,101,116,117,114,110,32,114,101,112,114,32,102,111,114,32, - 116,104,101,32,109,111,100,117,108,101,46,10,10,32,32,32, - 32,32,32,32,32,84,104,101,32,109,101,116,104,111,100,32, - 105,115,32,100,101,112,114,101,99,97,116,101,100,46,32,32, - 84,104,101,32,105,109,112,111,114,116,32,109,97,99,104,105, - 110,101,114,121,32,100,111,101,115,32,116,104,101,32,106,111, - 98,32,105,116,115,101,108,102,46,10,10,32,32,32,32,32, - 32,32,32,122,25,60,109,111,100,117,108,101,32,123,33,114, - 125,32,40,110,97,109,101,115,112,97,99,101,41,62,41,2, - 114,49,0,0,0,114,114,0,0,0,41,2,114,172,0,0, - 0,114,191,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,218,11,109,111,100,117,108,101,95,114,101, - 112,114,238,3,0,0,115,2,0,0,0,0,7,122,28,95, - 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, - 109,111,100,117,108,101,95,114,101,112,114,99,2,0,0,0, - 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, - 115,4,0,0,0,100,1,0,83,41,2,78,84,114,4,0, - 0,0,41,2,114,110,0,0,0,114,128,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,6,0,0,0,114,161,0, - 0,0,247,3,0,0,115,2,0,0,0,0,1,122,27,95, - 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, - 105,115,95,112,97,99,107,97,103,101,99,2,0,0,0,0, - 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, - 4,0,0,0,100,1,0,83,41,2,78,114,32,0,0,0, - 114,4,0,0,0,41,2,114,110,0,0,0,114,128,0,0, + 218,23,95,102,105,110,100,95,112,97,114,101,110,116,95,112, + 97,116,104,95,110,97,109,101,115,214,3,0,0,115,8,0, + 0,0,0,2,27,1,12,2,4,3,122,38,95,78,97,109, + 101,115,112,97,99,101,80,97,116,104,46,95,102,105,110,100, + 95,112,97,114,101,110,116,95,112,97,116,104,95,110,97,109, + 101,115,99,1,0,0,0,0,0,0,0,3,0,0,0,3, + 0,0,0,67,0,0,0,115,38,0,0,0,124,0,0,106, + 0,0,131,0,0,92,2,0,125,1,0,125,2,0,116,1, + 0,116,2,0,106,3,0,124,1,0,25,124,2,0,131,2, + 0,83,41,1,78,41,4,114,240,0,0,0,114,119,0,0, + 0,114,8,0,0,0,218,7,109,111,100,117,108,101,115,41, + 3,114,110,0,0,0,90,18,112,97,114,101,110,116,95,109, + 111,100,117,108,101,95,110,97,109,101,90,14,112,97,116,104, + 95,97,116,116,114,95,110,97,109,101,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,235,0,0,0,224,3, + 0,0,115,4,0,0,0,0,1,18,1,122,31,95,78,97, + 109,101,115,112,97,99,101,80,97,116,104,46,95,103,101,116, + 95,112,97,114,101,110,116,95,112,97,116,104,99,1,0,0, + 0,0,0,0,0,3,0,0,0,3,0,0,0,67,0,0, + 0,115,118,0,0,0,116,0,0,124,0,0,106,1,0,131, + 0,0,131,1,0,125,1,0,124,1,0,124,0,0,106,2, + 0,107,3,0,114,111,0,124,0,0,106,3,0,124,0,0, + 106,4,0,124,1,0,131,2,0,125,2,0,124,2,0,100, + 0,0,107,9,0,114,102,0,124,2,0,106,5,0,100,0, + 0,107,8,0,114,102,0,124,2,0,106,6,0,114,102,0, + 124,2,0,106,6,0,124,0,0,95,7,0,124,1,0,124, + 0,0,95,2,0,124,0,0,106,7,0,83,41,1,78,41, + 8,114,95,0,0,0,114,235,0,0,0,114,236,0,0,0, + 114,237,0,0,0,114,233,0,0,0,114,129,0,0,0,114, + 159,0,0,0,114,234,0,0,0,41,3,114,110,0,0,0, + 90,11,112,97,114,101,110,116,95,112,97,116,104,114,167,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,12,95,114,101,99,97,108,99,117,108,97,116,101,228, + 3,0,0,115,16,0,0,0,0,2,18,1,15,1,21,3, + 27,1,9,1,12,1,9,1,122,27,95,78,97,109,101,115, + 112,97,99,101,80,97,116,104,46,95,114,101,99,97,108,99, + 117,108,97,116,101,99,1,0,0,0,0,0,0,0,1,0, + 0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,116, + 0,0,124,0,0,106,1,0,131,0,0,131,1,0,83,41, + 1,78,41,2,218,4,105,116,101,114,114,242,0,0,0,41, + 1,114,110,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,218,8,95,95,105,116,101,114,95,95,241, + 3,0,0,115,2,0,0,0,0,1,122,23,95,78,97,109, + 101,115,112,97,99,101,80,97,116,104,46,95,95,105,116,101, + 114,95,95,99,1,0,0,0,0,0,0,0,1,0,0,0, + 2,0,0,0,67,0,0,0,115,16,0,0,0,116,0,0, + 124,0,0,106,1,0,131,0,0,131,1,0,83,41,1,78, + 41,2,114,33,0,0,0,114,242,0,0,0,41,1,114,110, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,218,7,95,95,108,101,110,95,95,244,3,0,0,115, + 2,0,0,0,0,1,122,22,95,78,97,109,101,115,112,97, + 99,101,80,97,116,104,46,95,95,108,101,110,95,95,99,1, + 0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,67, + 0,0,0,115,16,0,0,0,100,1,0,106,0,0,124,0, + 0,106,1,0,131,1,0,83,41,2,78,122,20,95,78,97, + 109,101,115,112,97,99,101,80,97,116,104,40,123,33,114,125, + 41,41,2,114,49,0,0,0,114,234,0,0,0,41,1,114, + 110,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,218,8,95,95,114,101,112,114,95,95,247,3,0, + 0,115,2,0,0,0,0,1,122,23,95,78,97,109,101,115, + 112,97,99,101,80,97,116,104,46,95,95,114,101,112,114,95, + 95,99,2,0,0,0,0,0,0,0,2,0,0,0,2,0, + 0,0,67,0,0,0,115,16,0,0,0,124,1,0,124,0, + 0,106,0,0,131,0,0,107,6,0,83,41,1,78,41,1, + 114,242,0,0,0,41,2,114,110,0,0,0,218,4,105,116, + 101,109,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,12,95,95,99,111,110,116,97,105,110,115,95,95,250, + 3,0,0,115,2,0,0,0,0,1,122,27,95,78,97,109, + 101,115,112,97,99,101,80,97,116,104,46,95,95,99,111,110, + 116,97,105,110,115,95,95,99,2,0,0,0,0,0,0,0, + 2,0,0,0,2,0,0,0,67,0,0,0,115,20,0,0, + 0,124,0,0,106,0,0,106,1,0,124,1,0,131,1,0, + 1,100,0,0,83,41,1,78,41,2,114,234,0,0,0,114, + 166,0,0,0,41,2,114,110,0,0,0,114,247,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, + 166,0,0,0,253,3,0,0,115,2,0,0,0,0,1,122, + 21,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, + 97,112,112,101,110,100,78,41,13,114,114,0,0,0,114,113, + 0,0,0,114,115,0,0,0,114,116,0,0,0,114,187,0, + 0,0,114,240,0,0,0,114,235,0,0,0,114,242,0,0, + 0,114,244,0,0,0,114,245,0,0,0,114,246,0,0,0, + 114,248,0,0,0,114,166,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,232, + 0,0,0,201,3,0,0,115,20,0,0,0,12,5,6,2, + 12,6,12,10,12,4,12,13,12,3,12,3,12,3,12,3, + 114,232,0,0,0,99,0,0,0,0,0,0,0,0,0,0, + 0,0,3,0,0,0,64,0,0,0,115,118,0,0,0,101, + 0,0,90,1,0,100,0,0,90,2,0,100,1,0,100,2, + 0,132,0,0,90,3,0,101,4,0,100,3,0,100,4,0, + 132,0,0,131,1,0,90,5,0,100,5,0,100,6,0,132, + 0,0,90,6,0,100,7,0,100,8,0,132,0,0,90,7, + 0,100,9,0,100,10,0,132,0,0,90,8,0,100,11,0, + 100,12,0,132,0,0,90,9,0,100,13,0,100,14,0,132, + 0,0,90,10,0,100,15,0,100,16,0,132,0,0,90,11, + 0,100,17,0,83,41,18,218,16,95,78,97,109,101,115,112, + 97,99,101,76,111,97,100,101,114,99,4,0,0,0,0,0, + 0,0,4,0,0,0,4,0,0,0,67,0,0,0,115,25, + 0,0,0,116,0,0,124,1,0,124,2,0,124,3,0,131, + 3,0,124,0,0,95,1,0,100,0,0,83,41,1,78,41, + 2,114,232,0,0,0,114,234,0,0,0,41,4,114,110,0, + 0,0,114,108,0,0,0,114,37,0,0,0,114,238,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,203,0,0,0,250,3,0,0,115,2,0,0,0,0,1, - 122,27,95,78,97,109,101,115,112,97,99,101,76,111,97,100, - 101,114,46,103,101,116,95,115,111,117,114,99,101,99,2,0, - 0,0,0,0,0,0,2,0,0,0,6,0,0,0,67,0, - 0,0,115,22,0,0,0,116,0,0,100,1,0,100,2,0, - 100,3,0,100,4,0,100,5,0,131,3,1,83,41,6,78, - 114,32,0,0,0,122,8,60,115,116,114,105,110,103,62,114, - 190,0,0,0,114,205,0,0,0,84,41,1,114,206,0,0, - 0,41,2,114,110,0,0,0,114,128,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,6,0,0,0,114,188,0,0, - 0,253,3,0,0,115,2,0,0,0,0,1,122,25,95,78, - 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,103, - 101,116,95,99,111,100,101,99,2,0,0,0,0,0,0,0, - 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0, - 0,100,1,0,83,41,2,122,42,85,115,101,32,100,101,102, - 97,117,108,116,32,115,101,109,97,110,116,105,99,115,32,102, - 111,114,32,109,111,100,117,108,101,32,99,114,101,97,116,105, - 111,110,46,78,114,4,0,0,0,41,2,114,110,0,0,0, - 114,166,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,114,187,0,0,0,0,4,0,0,115,0,0, - 0,0,122,30,95,78,97,109,101,115,112,97,99,101,76,111, - 97,100,101,114,46,99,114,101,97,116,101,95,109,111,100,117, - 108,101,99,2,0,0,0,0,0,0,0,2,0,0,0,1, - 0,0,0,67,0,0,0,115,4,0,0,0,100,0,0,83, - 41,1,78,114,4,0,0,0,41,2,114,110,0,0,0,114, - 191,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,192,0,0,0,3,4,0,0,115,2,0,0, - 0,0,1,122,28,95,78,97,109,101,115,112,97,99,101,76, - 111,97,100,101,114,46,101,120,101,99,95,109,111,100,117,108, - 101,99,2,0,0,0,0,0,0,0,2,0,0,0,3,0, - 0,0,67,0,0,0,115,32,0,0,0,116,0,0,100,1, - 0,124,0,0,106,1,0,131,2,0,1,116,2,0,106,3, - 0,124,0,0,124,1,0,131,2,0,83,41,2,122,98,76, - 111,97,100,32,97,32,110,97,109,101,115,112,97,99,101,32, - 109,111,100,117,108,101,46,10,10,32,32,32,32,32,32,32, - 32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,32, - 100,101,112,114,101,99,97,116,101,100,46,32,32,85,115,101, - 32,101,120,101,99,95,109,111,100,117,108,101,40,41,32,105, - 110,115,116,101,97,100,46,10,10,32,32,32,32,32,32,32, - 32,122,38,110,97,109,101,115,112,97,99,101,32,109,111,100, - 117,108,101,32,108,111,97,100,101,100,32,119,105,116,104,32, - 112,97,116,104,32,123,33,114,125,41,4,114,107,0,0,0, - 114,233,0,0,0,114,123,0,0,0,114,193,0,0,0,41, - 2,114,110,0,0,0,114,128,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,194,0,0,0,6, - 4,0,0,115,4,0,0,0,0,7,16,1,122,28,95,78, - 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,108, - 111,97,100,95,109,111,100,117,108,101,78,41,12,114,114,0, - 0,0,114,113,0,0,0,114,115,0,0,0,114,186,0,0, - 0,114,184,0,0,0,114,249,0,0,0,114,161,0,0,0, - 114,203,0,0,0,114,188,0,0,0,114,187,0,0,0,114, - 192,0,0,0,114,194,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,6,0,0,0,114,248,0, - 0,0,234,3,0,0,115,16,0,0,0,12,1,12,3,18, - 9,12,3,12,3,12,3,12,3,12,3,114,248,0,0,0, - 99,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0, - 0,64,0,0,0,115,160,0,0,0,101,0,0,90,1,0, - 100,0,0,90,2,0,100,1,0,90,3,0,101,4,0,100, - 2,0,100,3,0,132,0,0,131,1,0,90,5,0,101,4, - 0,100,4,0,100,5,0,132,0,0,131,1,0,90,6,0, - 101,4,0,100,6,0,100,7,0,132,0,0,131,1,0,90, - 7,0,101,4,0,100,8,0,100,9,0,132,0,0,131,1, - 0,90,8,0,101,4,0,100,10,0,100,11,0,100,12,0, - 132,1,0,131,1,0,90,9,0,101,4,0,100,10,0,100, - 10,0,100,13,0,100,14,0,132,2,0,131,1,0,90,10, - 0,101,4,0,100,10,0,100,15,0,100,16,0,132,1,0, - 131,1,0,90,11,0,100,10,0,83,41,17,218,10,80,97, - 116,104,70,105,110,100,101,114,122,62,77,101,116,97,32,112, - 97,116,104,32,102,105,110,100,101,114,32,102,111,114,32,115, - 121,115,46,112,97,116,104,32,97,110,100,32,112,97,99,107, - 97,103,101,32,95,95,112,97,116,104,95,95,32,97,116,116, - 114,105,98,117,116,101,115,46,99,1,0,0,0,0,0,0, - 0,2,0,0,0,4,0,0,0,67,0,0,0,115,55,0, - 0,0,120,48,0,116,0,0,106,1,0,106,2,0,131,0, - 0,68,93,31,0,125,1,0,116,3,0,124,1,0,100,1, - 0,131,2,0,114,16,0,124,1,0,106,4,0,131,0,0, - 1,113,16,0,87,100,2,0,83,41,3,122,125,67,97,108, - 108,32,116,104,101,32,105,110,118,97,108,105,100,97,116,101, - 95,99,97,99,104,101,115,40,41,32,109,101,116,104,111,100, - 32,111,110,32,97,108,108,32,112,97,116,104,32,101,110,116, - 114,121,32,102,105,110,100,101,114,115,10,32,32,32,32,32, - 32,32,32,115,116,111,114,101,100,32,105,110,32,115,121,115, - 46,112,97,116,104,95,105,109,112,111,114,116,101,114,95,99, - 97,99,104,101,115,32,40,119,104,101,114,101,32,105,109,112, - 108,101,109,101,110,116,101,100,41,46,218,17,105,110,118,97, - 108,105,100,97,116,101,95,99,97,99,104,101,115,78,41,5, - 114,8,0,0,0,218,19,112,97,116,104,95,105,109,112,111, - 114,116,101,114,95,99,97,99,104,101,218,6,118,97,108,117, - 101,115,114,117,0,0,0,114,251,0,0,0,41,2,114,172, - 0,0,0,218,6,102,105,110,100,101,114,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,251,0,0,0,23, - 4,0,0,115,6,0,0,0,0,4,22,1,15,1,122,28, - 80,97,116,104,70,105,110,100,101,114,46,105,110,118,97,108, - 105,100,97,116,101,95,99,97,99,104,101,115,99,2,0,0, - 0,0,0,0,0,3,0,0,0,12,0,0,0,67,0,0, - 0,115,107,0,0,0,116,0,0,106,1,0,100,1,0,107, - 9,0,114,41,0,116,0,0,106,1,0,12,114,41,0,116, - 2,0,106,3,0,100,2,0,116,4,0,131,2,0,1,120, - 59,0,116,0,0,106,1,0,68,93,44,0,125,2,0,121, - 14,0,124,2,0,124,1,0,131,1,0,83,87,113,51,0, - 4,116,5,0,107,10,0,114,94,0,1,1,1,119,51,0, - 89,113,51,0,88,113,51,0,87,100,1,0,83,100,1,0, - 83,41,3,122,113,83,101,97,114,99,104,32,115,101,113,117, - 101,110,99,101,32,111,102,32,104,111,111,107,115,32,102,111, - 114,32,97,32,102,105,110,100,101,114,32,102,111,114,32,39, - 112,97,116,104,39,46,10,10,32,32,32,32,32,32,32,32, - 73,102,32,39,104,111,111,107,115,39,32,105,115,32,102,97, - 108,115,101,32,116,104,101,110,32,117,115,101,32,115,121,115, - 46,112,97,116,104,95,104,111,111,107,115,46,10,10,32,32, - 32,32,32,32,32,32,78,122,23,115,121,115,46,112,97,116, - 104,95,104,111,111,107,115,32,105,115,32,101,109,112,116,121, - 41,6,114,8,0,0,0,218,10,112,97,116,104,95,104,111, - 111,107,115,114,62,0,0,0,114,63,0,0,0,114,127,0, - 0,0,114,109,0,0,0,41,3,114,172,0,0,0,114,37, - 0,0,0,90,4,104,111,111,107,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,11,95,112,97,116,104,95, - 104,111,111,107,115,31,4,0,0,115,16,0,0,0,0,7, - 25,1,16,1,16,1,3,1,14,1,13,1,12,2,122,22, - 80,97,116,104,70,105,110,100,101,114,46,95,112,97,116,104, - 95,104,111,111,107,115,99,2,0,0,0,0,0,0,0,3, - 0,0,0,19,0,0,0,67,0,0,0,115,123,0,0,0, - 124,1,0,100,1,0,107,2,0,114,53,0,121,16,0,116, - 0,0,106,1,0,131,0,0,125,1,0,87,110,22,0,4, - 116,2,0,107,10,0,114,52,0,1,1,1,100,2,0,83, - 89,110,1,0,88,121,17,0,116,3,0,106,4,0,124,1, - 0,25,125,2,0,87,110,46,0,4,116,5,0,107,10,0, - 114,118,0,1,1,1,124,0,0,106,6,0,124,1,0,131, - 1,0,125,2,0,124,2,0,116,3,0,106,4,0,124,1, - 0,60,89,110,1,0,88,124,2,0,83,41,3,122,210,71, - 101,116,32,116,104,101,32,102,105,110,100,101,114,32,102,111, - 114,32,116,104,101,32,112,97,116,104,32,101,110,116,114,121, - 32,102,114,111,109,32,115,121,115,46,112,97,116,104,95,105, - 109,112,111,114,116,101,114,95,99,97,99,104,101,46,10,10, - 32,32,32,32,32,32,32,32,73,102,32,116,104,101,32,112, - 97,116,104,32,101,110,116,114,121,32,105,115,32,110,111,116, - 32,105,110,32,116,104,101,32,99,97,99,104,101,44,32,102, - 105,110,100,32,116,104,101,32,97,112,112,114,111,112,114,105, - 97,116,101,32,102,105,110,100,101,114,10,32,32,32,32,32, - 32,32,32,97,110,100,32,99,97,99,104,101,32,105,116,46, - 32,73,102,32,110,111,32,102,105,110,100,101,114,32,105,115, - 32,97,118,97,105,108,97,98,108,101,44,32,115,116,111,114, - 101,32,78,111,110,101,46,10,10,32,32,32,32,32,32,32, - 32,114,32,0,0,0,78,41,7,114,3,0,0,0,114,47, - 0,0,0,218,17,70,105,108,101,78,111,116,70,111,117,110, - 100,69,114,114,111,114,114,8,0,0,0,114,252,0,0,0, - 114,139,0,0,0,114,0,1,0,0,41,3,114,172,0,0, - 0,114,37,0,0,0,114,254,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,218,20,95,112,97,116, - 104,95,105,109,112,111,114,116,101,114,95,99,97,99,104,101, - 48,4,0,0,115,22,0,0,0,0,8,12,1,3,1,16, - 1,13,3,9,1,3,1,17,1,13,1,15,1,18,1,122, - 31,80,97,116,104,70,105,110,100,101,114,46,95,112,97,116, - 104,95,105,109,112,111,114,116,101,114,95,99,97,99,104,101, - 99,3,0,0,0,0,0,0,0,6,0,0,0,3,0,0, - 0,67,0,0,0,115,119,0,0,0,116,0,0,124,2,0, - 100,1,0,131,2,0,114,39,0,124,2,0,106,1,0,124, - 1,0,131,1,0,92,2,0,125,3,0,125,4,0,110,21, - 0,124,2,0,106,2,0,124,1,0,131,1,0,125,3,0, - 103,0,0,125,4,0,124,3,0,100,0,0,107,9,0,114, - 88,0,116,3,0,106,4,0,124,1,0,124,3,0,131,2, - 0,83,116,3,0,106,5,0,124,1,0,100,0,0,131,2, - 0,125,5,0,124,4,0,124,5,0,95,6,0,124,5,0, - 83,41,2,78,114,126,0,0,0,41,7,114,117,0,0,0, - 114,126,0,0,0,114,183,0,0,0,114,123,0,0,0,114, - 180,0,0,0,114,162,0,0,0,114,158,0,0,0,41,6, - 114,172,0,0,0,114,128,0,0,0,114,254,0,0,0,114, - 129,0,0,0,114,130,0,0,0,114,166,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,6,0,0,0,218,16,95, - 108,101,103,97,99,121,95,103,101,116,95,115,112,101,99,70, - 4,0,0,115,18,0,0,0,0,4,15,1,24,2,15,1, - 6,1,12,1,16,1,18,1,9,1,122,27,80,97,116,104, - 70,105,110,100,101,114,46,95,108,101,103,97,99,121,95,103, - 101,116,95,115,112,101,99,78,99,4,0,0,0,0,0,0, - 0,9,0,0,0,5,0,0,0,67,0,0,0,115,243,0, - 0,0,103,0,0,125,4,0,120,230,0,124,2,0,68,93, - 191,0,125,5,0,116,0,0,124,5,0,116,1,0,116,2, - 0,102,2,0,131,2,0,115,43,0,113,13,0,124,0,0, - 106,3,0,124,5,0,131,1,0,125,6,0,124,6,0,100, - 1,0,107,9,0,114,13,0,116,4,0,124,6,0,100,2, - 0,131,2,0,114,106,0,124,6,0,106,5,0,124,1,0, - 124,3,0,131,2,0,125,7,0,110,18,0,124,0,0,106, - 6,0,124,1,0,124,6,0,131,2,0,125,7,0,124,7, - 0,100,1,0,107,8,0,114,139,0,113,13,0,124,7,0, - 106,7,0,100,1,0,107,9,0,114,158,0,124,7,0,83, - 124,7,0,106,8,0,125,8,0,124,8,0,100,1,0,107, - 8,0,114,191,0,116,9,0,100,3,0,131,1,0,130,1, - 0,124,4,0,106,10,0,124,8,0,131,1,0,1,113,13, - 0,87,116,11,0,106,12,0,124,1,0,100,1,0,131,2, - 0,125,7,0,124,4,0,124,7,0,95,8,0,124,7,0, - 83,100,1,0,83,41,4,122,63,70,105,110,100,32,116,104, - 101,32,108,111,97,100,101,114,32,111,114,32,110,97,109,101, - 115,112,97,99,101,95,112,97,116,104,32,102,111,114,32,116, - 104,105,115,32,109,111,100,117,108,101,47,112,97,99,107,97, - 103,101,32,110,97,109,101,46,78,114,182,0,0,0,122,19, - 115,112,101,99,32,109,105,115,115,105,110,103,32,108,111,97, - 100,101,114,41,13,114,145,0,0,0,114,71,0,0,0,218, - 5,98,121,116,101,115,114,2,1,0,0,114,117,0,0,0, - 114,182,0,0,0,114,3,1,0,0,114,129,0,0,0,114, - 158,0,0,0,114,109,0,0,0,114,151,0,0,0,114,123, - 0,0,0,114,162,0,0,0,41,9,114,172,0,0,0,114, - 128,0,0,0,114,37,0,0,0,114,181,0,0,0,218,14, - 110,97,109,101,115,112,97,99,101,95,112,97,116,104,90,5, - 101,110,116,114,121,114,254,0,0,0,114,166,0,0,0,114, - 130,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,218,9,95,103,101,116,95,115,112,101,99,85,4, - 0,0,115,40,0,0,0,0,5,6,1,13,1,21,1,3, - 1,15,1,12,1,15,1,21,2,18,1,12,1,3,1,15, - 1,4,1,9,1,12,1,12,5,17,2,18,1,9,1,122, - 20,80,97,116,104,70,105,110,100,101,114,46,95,103,101,116, - 95,115,112,101,99,99,4,0,0,0,0,0,0,0,6,0, - 0,0,4,0,0,0,67,0,0,0,115,140,0,0,0,124, - 2,0,100,1,0,107,8,0,114,21,0,116,0,0,106,1, - 0,125,2,0,124,0,0,106,2,0,124,1,0,124,2,0, - 124,3,0,131,3,0,125,4,0,124,4,0,100,1,0,107, - 8,0,114,58,0,100,1,0,83,124,4,0,106,3,0,100, - 1,0,107,8,0,114,132,0,124,4,0,106,4,0,125,5, - 0,124,5,0,114,125,0,100,2,0,124,4,0,95,5,0, - 116,6,0,124,1,0,124,5,0,124,0,0,106,2,0,131, - 3,0,124,4,0,95,4,0,124,4,0,83,100,1,0,83, - 110,4,0,124,4,0,83,100,1,0,83,41,3,122,98,102, + 114,187,0,0,0,3,4,0,0,115,2,0,0,0,0,1, + 122,25,95,78,97,109,101,115,112,97,99,101,76,111,97,100, + 101,114,46,95,95,105,110,105,116,95,95,99,2,0,0,0, + 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, + 115,16,0,0,0,100,1,0,106,0,0,124,1,0,106,1, + 0,131,1,0,83,41,2,122,115,82,101,116,117,114,110,32, + 114,101,112,114,32,102,111,114,32,116,104,101,32,109,111,100, + 117,108,101,46,10,10,32,32,32,32,32,32,32,32,84,104, + 101,32,109,101,116,104,111,100,32,105,115,32,100,101,112,114, + 101,99,97,116,101,100,46,32,32,84,104,101,32,105,109,112, + 111,114,116,32,109,97,99,104,105,110,101,114,121,32,100,111, + 101,115,32,116,104,101,32,106,111,98,32,105,116,115,101,108, + 102,46,10,10,32,32,32,32,32,32,32,32,122,25,60,109, + 111,100,117,108,101,32,123,33,114,125,32,40,110,97,109,101, + 115,112,97,99,101,41,62,41,2,114,49,0,0,0,114,114, + 0,0,0,41,2,114,173,0,0,0,114,192,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,11, + 109,111,100,117,108,101,95,114,101,112,114,6,4,0,0,115, + 2,0,0,0,0,7,122,28,95,78,97,109,101,115,112,97, + 99,101,76,111,97,100,101,114,46,109,111,100,117,108,101,95, + 114,101,112,114,99,2,0,0,0,0,0,0,0,2,0,0, + 0,1,0,0,0,67,0,0,0,115,4,0,0,0,100,1, + 0,83,41,2,78,84,114,4,0,0,0,41,2,114,110,0, + 0,0,114,128,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,162,0,0,0,15,4,0,0,115, + 2,0,0,0,0,1,122,27,95,78,97,109,101,115,112,97, + 99,101,76,111,97,100,101,114,46,105,115,95,112,97,99,107, + 97,103,101,99,2,0,0,0,0,0,0,0,2,0,0,0, + 1,0,0,0,67,0,0,0,115,4,0,0,0,100,1,0, + 83,41,2,78,114,32,0,0,0,114,4,0,0,0,41,2, + 114,110,0,0,0,114,128,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,204,0,0,0,18,4, + 0,0,115,2,0,0,0,0,1,122,27,95,78,97,109,101, + 115,112,97,99,101,76,111,97,100,101,114,46,103,101,116,95, + 115,111,117,114,99,101,99,2,0,0,0,0,0,0,0,2, + 0,0,0,6,0,0,0,67,0,0,0,115,22,0,0,0, + 116,0,0,100,1,0,100,2,0,100,3,0,100,4,0,100, + 5,0,131,3,1,83,41,6,78,114,32,0,0,0,122,8, + 60,115,116,114,105,110,103,62,114,191,0,0,0,114,206,0, + 0,0,84,41,1,114,207,0,0,0,41,2,114,110,0,0, + 0,114,128,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,114,189,0,0,0,21,4,0,0,115,2, + 0,0,0,0,1,122,25,95,78,97,109,101,115,112,97,99, + 101,76,111,97,100,101,114,46,103,101,116,95,99,111,100,101, + 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, + 0,67,0,0,0,115,4,0,0,0,100,1,0,83,41,2, + 122,42,85,115,101,32,100,101,102,97,117,108,116,32,115,101, + 109,97,110,116,105,99,115,32,102,111,114,32,109,111,100,117, + 108,101,32,99,114,101,97,116,105,111,110,46,78,114,4,0, + 0,0,41,2,114,110,0,0,0,114,167,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,114,188,0, + 0,0,24,4,0,0,115,0,0,0,0,122,30,95,78,97, + 109,101,115,112,97,99,101,76,111,97,100,101,114,46,99,114, + 101,97,116,101,95,109,111,100,117,108,101,99,2,0,0,0, + 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, + 115,4,0,0,0,100,0,0,83,41,1,78,114,4,0,0, + 0,41,2,114,110,0,0,0,114,192,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,114,193,0,0, + 0,27,4,0,0,115,2,0,0,0,0,1,122,28,95,78, + 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,101, + 120,101,99,95,109,111,100,117,108,101,99,2,0,0,0,0, + 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, + 32,0,0,0,116,0,0,100,1,0,124,0,0,106,1,0, + 131,2,0,1,116,2,0,106,3,0,124,0,0,124,1,0, + 131,2,0,83,41,2,122,98,76,111,97,100,32,97,32,110, + 97,109,101,115,112,97,99,101,32,109,111,100,117,108,101,46, + 10,10,32,32,32,32,32,32,32,32,84,104,105,115,32,109, + 101,116,104,111,100,32,105,115,32,100,101,112,114,101,99,97, + 116,101,100,46,32,32,85,115,101,32,101,120,101,99,95,109, + 111,100,117,108,101,40,41,32,105,110,115,116,101,97,100,46, + 10,10,32,32,32,32,32,32,32,32,122,38,110,97,109,101, + 115,112,97,99,101,32,109,111,100,117,108,101,32,108,111,97, + 100,101,100,32,119,105,116,104,32,112,97,116,104,32,123,33, + 114,125,41,4,114,107,0,0,0,114,234,0,0,0,114,123, + 0,0,0,114,194,0,0,0,41,2,114,110,0,0,0,114, + 128,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,114,195,0,0,0,30,4,0,0,115,4,0,0, + 0,0,7,16,1,122,28,95,78,97,109,101,115,112,97,99, + 101,76,111,97,100,101,114,46,108,111,97,100,95,109,111,100, + 117,108,101,78,41,12,114,114,0,0,0,114,113,0,0,0, + 114,115,0,0,0,114,187,0,0,0,114,185,0,0,0,114, + 250,0,0,0,114,162,0,0,0,114,204,0,0,0,114,189, + 0,0,0,114,188,0,0,0,114,193,0,0,0,114,195,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,249,0,0,0,2,4,0,0,115, + 16,0,0,0,12,1,12,3,18,9,12,3,12,3,12,3, + 12,3,12,3,114,249,0,0,0,99,0,0,0,0,0,0, + 0,0,0,0,0,0,5,0,0,0,64,0,0,0,115,160, + 0,0,0,101,0,0,90,1,0,100,0,0,90,2,0,100, + 1,0,90,3,0,101,4,0,100,2,0,100,3,0,132,0, + 0,131,1,0,90,5,0,101,4,0,100,4,0,100,5,0, + 132,0,0,131,1,0,90,6,0,101,4,0,100,6,0,100, + 7,0,132,0,0,131,1,0,90,7,0,101,4,0,100,8, + 0,100,9,0,132,0,0,131,1,0,90,8,0,101,4,0, + 100,10,0,100,11,0,100,12,0,132,1,0,131,1,0,90, + 9,0,101,4,0,100,10,0,100,10,0,100,13,0,100,14, + 0,132,2,0,131,1,0,90,10,0,101,4,0,100,10,0, + 100,15,0,100,16,0,132,1,0,131,1,0,90,11,0,100, + 10,0,83,41,17,218,10,80,97,116,104,70,105,110,100,101, + 114,122,62,77,101,116,97,32,112,97,116,104,32,102,105,110, + 100,101,114,32,102,111,114,32,115,121,115,46,112,97,116,104, + 32,97,110,100,32,112,97,99,107,97,103,101,32,95,95,112, + 97,116,104,95,95,32,97,116,116,114,105,98,117,116,101,115, + 46,99,1,0,0,0,0,0,0,0,2,0,0,0,4,0, + 0,0,67,0,0,0,115,55,0,0,0,120,48,0,116,0, + 0,106,1,0,106,2,0,131,0,0,68,93,31,0,125,1, + 0,116,3,0,124,1,0,100,1,0,131,2,0,114,16,0, + 124,1,0,106,4,0,131,0,0,1,113,16,0,87,100,2, + 0,83,41,3,122,125,67,97,108,108,32,116,104,101,32,105, + 110,118,97,108,105,100,97,116,101,95,99,97,99,104,101,115, + 40,41,32,109,101,116,104,111,100,32,111,110,32,97,108,108, + 32,112,97,116,104,32,101,110,116,114,121,32,102,105,110,100, + 101,114,115,10,32,32,32,32,32,32,32,32,115,116,111,114, + 101,100,32,105,110,32,115,121,115,46,112,97,116,104,95,105, + 109,112,111,114,116,101,114,95,99,97,99,104,101,115,32,40, + 119,104,101,114,101,32,105,109,112,108,101,109,101,110,116,101, + 100,41,46,218,17,105,110,118,97,108,105,100,97,116,101,95, + 99,97,99,104,101,115,78,41,5,114,8,0,0,0,218,19, + 112,97,116,104,95,105,109,112,111,114,116,101,114,95,99,97, + 99,104,101,218,6,118,97,108,117,101,115,114,117,0,0,0, + 114,252,0,0,0,41,2,114,173,0,0,0,218,6,102,105, + 110,100,101,114,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,114,252,0,0,0,47,4,0,0,115,6,0,0, + 0,0,4,22,1,15,1,122,28,80,97,116,104,70,105,110, + 100,101,114,46,105,110,118,97,108,105,100,97,116,101,95,99, + 97,99,104,101,115,99,2,0,0,0,0,0,0,0,3,0, + 0,0,12,0,0,0,67,0,0,0,115,107,0,0,0,116, + 0,0,106,1,0,100,1,0,107,9,0,114,41,0,116,0, + 0,106,1,0,12,114,41,0,116,2,0,106,3,0,100,2, + 0,116,4,0,131,2,0,1,120,59,0,116,0,0,106,1, + 0,68,93,44,0,125,2,0,121,14,0,124,2,0,124,1, + 0,131,1,0,83,87,113,51,0,4,116,5,0,107,10,0, + 114,94,0,1,1,1,119,51,0,89,113,51,0,88,113,51, + 0,87,100,1,0,83,100,1,0,83,41,3,122,113,83,101, + 97,114,99,104,32,115,101,113,117,101,110,99,101,32,111,102, + 32,104,111,111,107,115,32,102,111,114,32,97,32,102,105,110, + 100,101,114,32,102,111,114,32,39,112,97,116,104,39,46,10, + 10,32,32,32,32,32,32,32,32,73,102,32,39,104,111,111, + 107,115,39,32,105,115,32,102,97,108,115,101,32,116,104,101, + 110,32,117,115,101,32,115,121,115,46,112,97,116,104,95,104, + 111,111,107,115,46,10,10,32,32,32,32,32,32,32,32,78, + 122,23,115,121,115,46,112,97,116,104,95,104,111,111,107,115, + 32,105,115,32,101,109,112,116,121,41,6,114,8,0,0,0, + 218,10,112,97,116,104,95,104,111,111,107,115,114,62,0,0, + 0,114,63,0,0,0,114,127,0,0,0,114,109,0,0,0, + 41,3,114,173,0,0,0,114,37,0,0,0,90,4,104,111, + 111,107,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,11,95,112,97,116,104,95,104,111,111,107,115,55,4, + 0,0,115,16,0,0,0,0,7,25,1,16,1,16,1,3, + 1,14,1,13,1,12,2,122,22,80,97,116,104,70,105,110, + 100,101,114,46,95,112,97,116,104,95,104,111,111,107,115,99, + 2,0,0,0,0,0,0,0,3,0,0,0,19,0,0,0, + 67,0,0,0,115,123,0,0,0,124,1,0,100,1,0,107, + 2,0,114,53,0,121,16,0,116,0,0,106,1,0,131,0, + 0,125,1,0,87,110,22,0,4,116,2,0,107,10,0,114, + 52,0,1,1,1,100,2,0,83,89,110,1,0,88,121,17, + 0,116,3,0,106,4,0,124,1,0,25,125,2,0,87,110, + 46,0,4,116,5,0,107,10,0,114,118,0,1,1,1,124, + 0,0,106,6,0,124,1,0,131,1,0,125,2,0,124,2, + 0,116,3,0,106,4,0,124,1,0,60,89,110,1,0,88, + 124,2,0,83,41,3,122,210,71,101,116,32,116,104,101,32, + 102,105,110,100,101,114,32,102,111,114,32,116,104,101,32,112, + 97,116,104,32,101,110,116,114,121,32,102,114,111,109,32,115, + 121,115,46,112,97,116,104,95,105,109,112,111,114,116,101,114, + 95,99,97,99,104,101,46,10,10,32,32,32,32,32,32,32, + 32,73,102,32,116,104,101,32,112,97,116,104,32,101,110,116, + 114,121,32,105,115,32,110,111,116,32,105,110,32,116,104,101, + 32,99,97,99,104,101,44,32,102,105,110,100,32,116,104,101, + 32,97,112,112,114,111,112,114,105,97,116,101,32,102,105,110, + 100,101,114,10,32,32,32,32,32,32,32,32,97,110,100,32, + 99,97,99,104,101,32,105,116,46,32,73,102,32,110,111,32, + 102,105,110,100,101,114,32,105,115,32,97,118,97,105,108,97, + 98,108,101,44,32,115,116,111,114,101,32,78,111,110,101,46, + 10,10,32,32,32,32,32,32,32,32,114,32,0,0,0,78, + 41,7,114,3,0,0,0,114,47,0,0,0,218,17,70,105, + 108,101,78,111,116,70,111,117,110,100,69,114,114,111,114,114, + 8,0,0,0,114,253,0,0,0,114,140,0,0,0,114,1, + 1,0,0,41,3,114,173,0,0,0,114,37,0,0,0,114, + 255,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,218,20,95,112,97,116,104,95,105,109,112,111,114, + 116,101,114,95,99,97,99,104,101,72,4,0,0,115,22,0, + 0,0,0,8,12,1,3,1,16,1,13,3,9,1,3,1, + 17,1,13,1,15,1,18,1,122,31,80,97,116,104,70,105, + 110,100,101,114,46,95,112,97,116,104,95,105,109,112,111,114, + 116,101,114,95,99,97,99,104,101,99,3,0,0,0,0,0, + 0,0,6,0,0,0,3,0,0,0,67,0,0,0,115,119, + 0,0,0,116,0,0,124,2,0,100,1,0,131,2,0,114, + 39,0,124,2,0,106,1,0,124,1,0,131,1,0,92,2, + 0,125,3,0,125,4,0,110,21,0,124,2,0,106,2,0, + 124,1,0,131,1,0,125,3,0,103,0,0,125,4,0,124, + 3,0,100,0,0,107,9,0,114,88,0,116,3,0,106,4, + 0,124,1,0,124,3,0,131,2,0,83,116,3,0,106,5, + 0,124,1,0,100,0,0,131,2,0,125,5,0,124,4,0, + 124,5,0,95,6,0,124,5,0,83,41,2,78,114,126,0, + 0,0,41,7,114,117,0,0,0,114,126,0,0,0,114,184, + 0,0,0,114,123,0,0,0,114,181,0,0,0,114,163,0, + 0,0,114,159,0,0,0,41,6,114,173,0,0,0,114,128, + 0,0,0,114,255,0,0,0,114,129,0,0,0,114,130,0, + 0,0,114,167,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,218,16,95,108,101,103,97,99,121,95, + 103,101,116,95,115,112,101,99,94,4,0,0,115,18,0,0, + 0,0,4,15,1,24,2,15,1,6,1,12,1,16,1,18, + 1,9,1,122,27,80,97,116,104,70,105,110,100,101,114,46, + 95,108,101,103,97,99,121,95,103,101,116,95,115,112,101,99, + 78,99,4,0,0,0,0,0,0,0,9,0,0,0,5,0, + 0,0,67,0,0,0,115,243,0,0,0,103,0,0,125,4, + 0,120,230,0,124,2,0,68,93,191,0,125,5,0,116,0, + 0,124,5,0,116,1,0,116,2,0,102,2,0,131,2,0, + 115,43,0,113,13,0,124,0,0,106,3,0,124,5,0,131, + 1,0,125,6,0,124,6,0,100,1,0,107,9,0,114,13, + 0,116,4,0,124,6,0,100,2,0,131,2,0,114,106,0, + 124,6,0,106,5,0,124,1,0,124,3,0,131,2,0,125, + 7,0,110,18,0,124,0,0,106,6,0,124,1,0,124,6, + 0,131,2,0,125,7,0,124,7,0,100,1,0,107,8,0, + 114,139,0,113,13,0,124,7,0,106,7,0,100,1,0,107, + 9,0,114,158,0,124,7,0,83,124,7,0,106,8,0,125, + 8,0,124,8,0,100,1,0,107,8,0,114,191,0,116,9, + 0,100,3,0,131,1,0,130,1,0,124,4,0,106,10,0, + 124,8,0,131,1,0,1,113,13,0,87,116,11,0,106,12, + 0,124,1,0,100,1,0,131,2,0,125,7,0,124,4,0, + 124,7,0,95,8,0,124,7,0,83,100,1,0,83,41,4, + 122,63,70,105,110,100,32,116,104,101,32,108,111,97,100,101, + 114,32,111,114,32,110,97,109,101,115,112,97,99,101,95,112, + 97,116,104,32,102,111,114,32,116,104,105,115,32,109,111,100, + 117,108,101,47,112,97,99,107,97,103,101,32,110,97,109,101, + 46,78,114,183,0,0,0,122,19,115,112,101,99,32,109,105, + 115,115,105,110,103,32,108,111,97,100,101,114,41,13,114,146, + 0,0,0,114,71,0,0,0,218,5,98,121,116,101,115,114, + 3,1,0,0,114,117,0,0,0,114,183,0,0,0,114,4, + 1,0,0,114,129,0,0,0,114,159,0,0,0,114,109,0, + 0,0,114,152,0,0,0,114,123,0,0,0,114,163,0,0, + 0,41,9,114,173,0,0,0,114,128,0,0,0,114,37,0, + 0,0,114,182,0,0,0,218,14,110,97,109,101,115,112,97, + 99,101,95,112,97,116,104,90,5,101,110,116,114,121,114,255, + 0,0,0,114,167,0,0,0,114,130,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,218,9,95,103, + 101,116,95,115,112,101,99,109,4,0,0,115,40,0,0,0, + 0,5,6,1,13,1,21,1,3,1,15,1,12,1,15,1, + 21,2,18,1,12,1,3,1,15,1,4,1,9,1,12,1, + 12,5,17,2,18,1,9,1,122,20,80,97,116,104,70,105, + 110,100,101,114,46,95,103,101,116,95,115,112,101,99,99,4, + 0,0,0,0,0,0,0,6,0,0,0,4,0,0,0,67, + 0,0,0,115,140,0,0,0,124,2,0,100,1,0,107,8, + 0,114,21,0,116,0,0,106,1,0,125,2,0,124,0,0, + 106,2,0,124,1,0,124,2,0,124,3,0,131,3,0,125, + 4,0,124,4,0,100,1,0,107,8,0,114,58,0,100,1, + 0,83,124,4,0,106,3,0,100,1,0,107,8,0,114,132, + 0,124,4,0,106,4,0,125,5,0,124,5,0,114,125,0, + 100,2,0,124,4,0,95,5,0,116,6,0,124,1,0,124, + 5,0,124,0,0,106,2,0,131,3,0,124,4,0,95,4, + 0,124,4,0,83,100,1,0,83,110,4,0,124,4,0,83, + 100,1,0,83,41,3,122,98,102,105,110,100,32,116,104,101, + 32,109,111,100,117,108,101,32,111,110,32,115,121,115,46,112, + 97,116,104,32,111,114,32,39,112,97,116,104,39,32,98,97, + 115,101,100,32,111,110,32,115,121,115,46,112,97,116,104,95, + 104,111,111,107,115,32,97,110,100,10,32,32,32,32,32,32, + 32,32,115,121,115,46,112,97,116,104,95,105,109,112,111,114, + 116,101,114,95,99,97,99,104,101,46,78,90,9,110,97,109, + 101,115,112,97,99,101,41,7,114,8,0,0,0,114,37,0, + 0,0,114,7,1,0,0,114,129,0,0,0,114,159,0,0, + 0,114,161,0,0,0,114,232,0,0,0,41,6,114,173,0, + 0,0,114,128,0,0,0,114,37,0,0,0,114,182,0,0, + 0,114,167,0,0,0,114,6,1,0,0,114,4,0,0,0, + 114,4,0,0,0,114,6,0,0,0,114,183,0,0,0,141, + 4,0,0,115,26,0,0,0,0,4,12,1,9,1,21,1, + 12,1,4,1,15,1,9,1,6,3,9,1,24,1,4,2, + 7,2,122,20,80,97,116,104,70,105,110,100,101,114,46,102, + 105,110,100,95,115,112,101,99,99,3,0,0,0,0,0,0, + 0,4,0,0,0,3,0,0,0,67,0,0,0,115,41,0, + 0,0,124,0,0,106,0,0,124,1,0,124,2,0,131,2, + 0,125,3,0,124,3,0,100,1,0,107,8,0,114,34,0, + 100,1,0,83,124,3,0,106,1,0,83,41,2,122,170,102, 105,110,100,32,116,104,101,32,109,111,100,117,108,101,32,111, 110,32,115,121,115,46,112,97,116,104,32,111,114,32,39,112, 97,116,104,39,32,98,97,115,101,100,32,111,110,32,115,121, 115,46,112,97,116,104,95,104,111,111,107,115,32,97,110,100, 10,32,32,32,32,32,32,32,32,115,121,115,46,112,97,116, 104,95,105,109,112,111,114,116,101,114,95,99,97,99,104,101, - 46,78,90,9,110,97,109,101,115,112,97,99,101,41,7,114, - 8,0,0,0,114,37,0,0,0,114,6,1,0,0,114,129, - 0,0,0,114,158,0,0,0,114,160,0,0,0,114,231,0, - 0,0,41,6,114,172,0,0,0,114,128,0,0,0,114,37, - 0,0,0,114,181,0,0,0,114,166,0,0,0,114,5,1, - 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,182,0,0,0,117,4,0,0,115,26,0,0,0,0, - 4,12,1,9,1,21,1,12,1,4,1,15,1,9,1,6, - 3,9,1,24,1,4,2,7,2,122,20,80,97,116,104,70, - 105,110,100,101,114,46,102,105,110,100,95,115,112,101,99,99, - 3,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0, - 67,0,0,0,115,41,0,0,0,124,0,0,106,0,0,124, - 1,0,124,2,0,131,2,0,125,3,0,124,3,0,100,1, - 0,107,8,0,114,34,0,100,1,0,83,124,3,0,106,1, - 0,83,41,2,122,170,102,105,110,100,32,116,104,101,32,109, - 111,100,117,108,101,32,111,110,32,115,121,115,46,112,97,116, - 104,32,111,114,32,39,112,97,116,104,39,32,98,97,115,101, - 100,32,111,110,32,115,121,115,46,112,97,116,104,95,104,111, - 111,107,115,32,97,110,100,10,32,32,32,32,32,32,32,32, - 115,121,115,46,112,97,116,104,95,105,109,112,111,114,116,101, - 114,95,99,97,99,104,101,46,10,10,32,32,32,32,32,32, - 32,32,84,104,105,115,32,109,101,116,104,111,100,32,105,115, - 32,100,101,112,114,101,99,97,116,101,100,46,32,32,85,115, - 101,32,102,105,110,100,95,115,112,101,99,40,41,32,105,110, - 115,116,101,97,100,46,10,10,32,32,32,32,32,32,32,32, - 78,41,2,114,182,0,0,0,114,129,0,0,0,41,4,114, - 172,0,0,0,114,128,0,0,0,114,37,0,0,0,114,166, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,183,0,0,0,139,4,0,0,115,8,0,0,0, - 0,8,18,1,12,1,4,1,122,22,80,97,116,104,70,105, - 110,100,101,114,46,102,105,110,100,95,109,111,100,117,108,101, - 41,12,114,114,0,0,0,114,113,0,0,0,114,115,0,0, - 0,114,116,0,0,0,114,184,0,0,0,114,251,0,0,0, - 114,0,1,0,0,114,2,1,0,0,114,3,1,0,0,114, - 6,1,0,0,114,182,0,0,0,114,183,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,250,0,0,0,19,4,0,0,115,22,0,0,0, - 12,2,6,2,18,8,18,17,18,22,18,15,3,1,18,31, - 3,1,21,21,3,1,114,250,0,0,0,99,0,0,0,0, - 0,0,0,0,0,0,0,0,3,0,0,0,64,0,0,0, - 115,133,0,0,0,101,0,0,90,1,0,100,0,0,90,2, - 0,100,1,0,90,3,0,100,2,0,100,3,0,132,0,0, - 90,4,0,100,4,0,100,5,0,132,0,0,90,5,0,101, - 6,0,90,7,0,100,6,0,100,7,0,132,0,0,90,8, - 0,100,8,0,100,9,0,132,0,0,90,9,0,100,10,0, - 100,11,0,100,12,0,132,1,0,90,10,0,100,13,0,100, - 14,0,132,0,0,90,11,0,101,12,0,100,15,0,100,16, - 0,132,0,0,131,1,0,90,13,0,100,17,0,100,18,0, - 132,0,0,90,14,0,100,10,0,83,41,19,218,10,70,105, - 108,101,70,105,110,100,101,114,122,172,70,105,108,101,45,98, - 97,115,101,100,32,102,105,110,100,101,114,46,10,10,32,32, - 32,32,73,110,116,101,114,97,99,116,105,111,110,115,32,119, - 105,116,104,32,116,104,101,32,102,105,108,101,32,115,121,115, - 116,101,109,32,97,114,101,32,99,97,99,104,101,100,32,102, - 111,114,32,112,101,114,102,111,114,109,97,110,99,101,44,32, - 98,101,105,110,103,10,32,32,32,32,114,101,102,114,101,115, - 104,101,100,32,119,104,101,110,32,116,104,101,32,100,105,114, - 101,99,116,111,114,121,32,116,104,101,32,102,105,110,100,101, - 114,32,105,115,32,104,97,110,100,108,105,110,103,32,104,97, - 115,32,98,101,101,110,32,109,111,100,105,102,105,101,100,46, - 10,10,32,32,32,32,99,2,0,0,0,0,0,0,0,5, - 0,0,0,5,0,0,0,7,0,0,0,115,122,0,0,0, - 103,0,0,125,3,0,120,52,0,124,2,0,68,93,44,0, - 92,2,0,137,0,0,125,4,0,124,3,0,106,0,0,135, - 0,0,102,1,0,100,1,0,100,2,0,134,0,0,124,4, - 0,68,131,1,0,131,1,0,1,113,13,0,87,124,3,0, - 124,0,0,95,1,0,124,1,0,112,79,0,100,3,0,124, - 0,0,95,2,0,100,6,0,124,0,0,95,3,0,116,4, - 0,131,0,0,124,0,0,95,5,0,116,4,0,131,0,0, - 124,0,0,95,6,0,100,5,0,83,41,7,122,154,73,110, - 105,116,105,97,108,105,122,101,32,119,105,116,104,32,116,104, - 101,32,112,97,116,104,32,116,111,32,115,101,97,114,99,104, - 32,111,110,32,97,110,100,32,97,32,118,97,114,105,97,98, - 108,101,32,110,117,109,98,101,114,32,111,102,10,32,32,32, - 32,32,32,32,32,50,45,116,117,112,108,101,115,32,99,111, - 110,116,97,105,110,105,110,103,32,116,104,101,32,108,111,97, - 100,101,114,32,97,110,100,32,116,104,101,32,102,105,108,101, - 32,115,117,102,102,105,120,101,115,32,116,104,101,32,108,111, - 97,100,101,114,10,32,32,32,32,32,32,32,32,114,101,99, - 111,103,110,105,122,101,115,46,99,1,0,0,0,0,0,0, - 0,2,0,0,0,3,0,0,0,51,0,0,0,115,27,0, - 0,0,124,0,0,93,17,0,125,1,0,124,1,0,136,0, - 0,102,2,0,86,1,113,3,0,100,0,0,83,41,1,78, - 114,4,0,0,0,41,2,114,24,0,0,0,114,226,0,0, - 0,41,1,114,129,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,228,0,0,0,168,4,0,0,115,2,0,0,0, - 6,0,122,38,70,105,108,101,70,105,110,100,101,114,46,95, - 95,105,110,105,116,95,95,46,60,108,111,99,97,108,115,62, - 46,60,103,101,110,101,120,112,114,62,114,60,0,0,0,114, - 31,0,0,0,78,114,89,0,0,0,41,7,114,151,0,0, - 0,218,8,95,108,111,97,100,101,114,115,114,37,0,0,0, - 218,11,95,112,97,116,104,95,109,116,105,109,101,218,3,115, - 101,116,218,11,95,112,97,116,104,95,99,97,99,104,101,218, - 19,95,114,101,108,97,120,101,100,95,112,97,116,104,95,99, - 97,99,104,101,41,5,114,110,0,0,0,114,37,0,0,0, - 218,14,108,111,97,100,101,114,95,100,101,116,97,105,108,115, - 90,7,108,111,97,100,101,114,115,114,168,0,0,0,114,4, - 0,0,0,41,1,114,129,0,0,0,114,6,0,0,0,114, - 186,0,0,0,162,4,0,0,115,16,0,0,0,0,4,6, - 1,19,1,36,1,9,2,15,1,9,1,12,1,122,19,70, - 105,108,101,70,105,110,100,101,114,46,95,95,105,110,105,116, - 95,95,99,1,0,0,0,0,0,0,0,1,0,0,0,2, - 0,0,0,67,0,0,0,115,13,0,0,0,100,3,0,124, - 0,0,95,0,0,100,2,0,83,41,4,122,31,73,110,118, - 97,108,105,100,97,116,101,32,116,104,101,32,100,105,114,101, - 99,116,111,114,121,32,109,116,105,109,101,46,114,31,0,0, - 0,78,114,89,0,0,0,41,1,114,9,1,0,0,41,1, - 114,110,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,114,251,0,0,0,176,4,0,0,115,2,0, - 0,0,0,2,122,28,70,105,108,101,70,105,110,100,101,114, - 46,105,110,118,97,108,105,100,97,116,101,95,99,97,99,104, - 101,115,99,2,0,0,0,0,0,0,0,3,0,0,0,2, - 0,0,0,67,0,0,0,115,59,0,0,0,124,0,0,106, - 0,0,124,1,0,131,1,0,125,2,0,124,2,0,100,1, - 0,107,8,0,114,37,0,100,1,0,103,0,0,102,2,0, - 83,124,2,0,106,1,0,124,2,0,106,2,0,112,55,0, - 103,0,0,102,2,0,83,41,2,122,197,84,114,121,32,116, - 111,32,102,105,110,100,32,97,32,108,111,97,100,101,114,32, - 102,111,114,32,116,104,101,32,115,112,101,99,105,102,105,101, - 100,32,109,111,100,117,108,101,44,32,111,114,32,116,104,101, - 32,110,97,109,101,115,112,97,99,101,10,32,32,32,32,32, - 32,32,32,112,97,99,107,97,103,101,32,112,111,114,116,105, - 111,110,115,46,32,82,101,116,117,114,110,115,32,40,108,111, - 97,100,101,114,44,32,108,105,115,116,45,111,102,45,112,111, - 114,116,105,111,110,115,41,46,10,10,32,32,32,32,32,32, - 32,32,84,104,105,115,32,109,101,116,104,111,100,32,105,115, - 32,100,101,112,114,101,99,97,116,101,100,46,32,32,85,115, - 101,32,102,105,110,100,95,115,112,101,99,40,41,32,105,110, - 115,116,101,97,100,46,10,10,32,32,32,32,32,32,32,32, - 78,41,3,114,182,0,0,0,114,129,0,0,0,114,158,0, - 0,0,41,3,114,110,0,0,0,114,128,0,0,0,114,166, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,126,0,0,0,182,4,0,0,115,8,0,0,0, - 0,7,15,1,12,1,10,1,122,22,70,105,108,101,70,105, - 110,100,101,114,46,102,105,110,100,95,108,111,97,100,101,114, - 99,6,0,0,0,0,0,0,0,7,0,0,0,7,0,0, - 0,67,0,0,0,115,40,0,0,0,124,1,0,124,2,0, - 124,3,0,131,2,0,125,6,0,116,0,0,124,2,0,124, - 3,0,100,1,0,124,6,0,100,2,0,124,4,0,131,2, - 2,83,41,3,78,114,129,0,0,0,114,158,0,0,0,41, - 1,114,169,0,0,0,41,7,114,110,0,0,0,114,167,0, - 0,0,114,128,0,0,0,114,37,0,0,0,90,4,115,109, - 115,108,114,181,0,0,0,114,129,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,6,0,0,0,114,6,1,0,0, - 194,4,0,0,115,6,0,0,0,0,1,15,1,18,1,122, - 20,70,105,108,101,70,105,110,100,101,114,46,95,103,101,116, - 95,115,112,101,99,78,99,3,0,0,0,0,0,0,0,14, - 0,0,0,15,0,0,0,67,0,0,0,115,234,1,0,0, - 100,1,0,125,3,0,124,1,0,106,0,0,100,2,0,131, - 1,0,100,3,0,25,125,4,0,121,34,0,116,1,0,124, - 0,0,106,2,0,112,49,0,116,3,0,106,4,0,131,0, - 0,131,1,0,106,5,0,125,5,0,87,110,24,0,4,116, - 6,0,107,10,0,114,85,0,1,1,1,100,10,0,125,5, - 0,89,110,1,0,88,124,5,0,124,0,0,106,7,0,107, - 3,0,114,120,0,124,0,0,106,8,0,131,0,0,1,124, - 5,0,124,0,0,95,7,0,116,9,0,131,0,0,114,153, - 0,124,0,0,106,10,0,125,6,0,124,4,0,106,11,0, - 131,0,0,125,7,0,110,15,0,124,0,0,106,12,0,125, - 6,0,124,4,0,125,7,0,124,7,0,124,6,0,107,6, - 0,114,45,1,116,13,0,124,0,0,106,2,0,124,4,0, - 131,2,0,125,8,0,120,100,0,124,0,0,106,14,0,68, - 93,77,0,92,2,0,125,9,0,125,10,0,100,5,0,124, - 9,0,23,125,11,0,116,13,0,124,8,0,124,11,0,131, - 2,0,125,12,0,116,15,0,124,12,0,131,1,0,114,208, - 0,124,0,0,106,16,0,124,10,0,124,1,0,124,12,0, - 124,8,0,103,1,0,124,2,0,131,5,0,83,113,208,0, - 87,116,17,0,124,8,0,131,1,0,125,3,0,120,123,0, - 124,0,0,106,14,0,68,93,112,0,92,2,0,125,9,0, - 125,10,0,116,13,0,124,0,0,106,2,0,124,4,0,124, - 9,0,23,131,2,0,125,12,0,116,18,0,100,6,0,106, - 19,0,124,12,0,131,1,0,100,7,0,100,3,0,131,1, - 1,1,124,7,0,124,9,0,23,124,6,0,107,6,0,114, - 55,1,116,15,0,124,12,0,131,1,0,114,55,1,124,0, - 0,106,16,0,124,10,0,124,1,0,124,12,0,100,8,0, - 124,2,0,131,5,0,83,113,55,1,87,124,3,0,114,230, - 1,116,18,0,100,9,0,106,19,0,124,8,0,131,1,0, - 131,1,0,1,116,20,0,106,21,0,124,1,0,100,8,0, - 131,2,0,125,13,0,124,8,0,103,1,0,124,13,0,95, - 22,0,124,13,0,83,100,8,0,83,41,11,122,102,84,114, - 121,32,116,111,32,102,105,110,100,32,97,32,115,112,101,99, - 32,102,111,114,32,116,104,101,32,115,112,101,99,105,102,105, - 101,100,32,109,111,100,117,108,101,46,32,32,82,101,116,117, - 114,110,115,32,116,104,101,10,32,32,32,32,32,32,32,32, - 109,97,116,99,104,105,110,103,32,115,112,101,99,44,32,111, - 114,32,78,111,110,101,32,105,102,32,110,111,116,32,102,111, - 117,110,100,46,70,114,60,0,0,0,114,58,0,0,0,114, - 31,0,0,0,114,186,0,0,0,122,9,116,114,121,105,110, - 103,32,123,125,114,100,0,0,0,78,122,25,112,111,115,115, - 105,98,108,101,32,110,97,109,101,115,112,97,99,101,32,102, - 111,114,32,123,125,114,89,0,0,0,41,23,114,34,0,0, - 0,114,41,0,0,0,114,37,0,0,0,114,3,0,0,0, - 114,47,0,0,0,114,220,0,0,0,114,42,0,0,0,114, - 9,1,0,0,218,11,95,102,105,108,108,95,99,97,99,104, - 101,114,7,0,0,0,114,12,1,0,0,114,90,0,0,0, - 114,11,1,0,0,114,30,0,0,0,114,8,1,0,0,114, - 46,0,0,0,114,6,1,0,0,114,48,0,0,0,114,107, - 0,0,0,114,49,0,0,0,114,123,0,0,0,114,162,0, - 0,0,114,158,0,0,0,41,14,114,110,0,0,0,114,128, - 0,0,0,114,181,0,0,0,90,12,105,115,95,110,97,109, - 101,115,112,97,99,101,90,11,116,97,105,108,95,109,111,100, - 117,108,101,114,135,0,0,0,90,5,99,97,99,104,101,90, - 12,99,97,99,104,101,95,109,111,100,117,108,101,90,9,98, - 97,115,101,95,112,97,116,104,114,226,0,0,0,114,167,0, - 0,0,90,13,105,110,105,116,95,102,105,108,101,110,97,109, - 101,90,9,102,117,108,108,95,112,97,116,104,114,166,0,0, + 46,10,10,32,32,32,32,32,32,32,32,84,104,105,115,32, + 109,101,116,104,111,100,32,105,115,32,100,101,112,114,101,99, + 97,116,101,100,46,32,32,85,115,101,32,102,105,110,100,95, + 115,112,101,99,40,41,32,105,110,115,116,101,97,100,46,10, + 10,32,32,32,32,32,32,32,32,78,41,2,114,183,0,0, + 0,114,129,0,0,0,41,4,114,173,0,0,0,114,128,0, + 0,0,114,37,0,0,0,114,167,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,6,0,0,0,114,184,0,0,0, + 163,4,0,0,115,8,0,0,0,0,8,18,1,12,1,4, + 1,122,22,80,97,116,104,70,105,110,100,101,114,46,102,105, + 110,100,95,109,111,100,117,108,101,41,12,114,114,0,0,0, + 114,113,0,0,0,114,115,0,0,0,114,116,0,0,0,114, + 185,0,0,0,114,252,0,0,0,114,1,1,0,0,114,3, + 1,0,0,114,4,1,0,0,114,7,1,0,0,114,183,0, + 0,0,114,184,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,6,0,0,0,114,251,0,0,0, + 43,4,0,0,115,22,0,0,0,12,2,6,2,18,8,18, + 17,18,22,18,15,3,1,18,31,3,1,21,21,3,1,114, + 251,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0, + 0,3,0,0,0,64,0,0,0,115,133,0,0,0,101,0, + 0,90,1,0,100,0,0,90,2,0,100,1,0,90,3,0, + 100,2,0,100,3,0,132,0,0,90,4,0,100,4,0,100, + 5,0,132,0,0,90,5,0,101,6,0,90,7,0,100,6, + 0,100,7,0,132,0,0,90,8,0,100,8,0,100,9,0, + 132,0,0,90,9,0,100,10,0,100,11,0,100,12,0,132, + 1,0,90,10,0,100,13,0,100,14,0,132,0,0,90,11, + 0,101,12,0,100,15,0,100,16,0,132,0,0,131,1,0, + 90,13,0,100,17,0,100,18,0,132,0,0,90,14,0,100, + 10,0,83,41,19,218,10,70,105,108,101,70,105,110,100,101, + 114,122,172,70,105,108,101,45,98,97,115,101,100,32,102,105, + 110,100,101,114,46,10,10,32,32,32,32,73,110,116,101,114, + 97,99,116,105,111,110,115,32,119,105,116,104,32,116,104,101, + 32,102,105,108,101,32,115,121,115,116,101,109,32,97,114,101, + 32,99,97,99,104,101,100,32,102,111,114,32,112,101,114,102, + 111,114,109,97,110,99,101,44,32,98,101,105,110,103,10,32, + 32,32,32,114,101,102,114,101,115,104,101,100,32,119,104,101, + 110,32,116,104,101,32,100,105,114,101,99,116,111,114,121,32, + 116,104,101,32,102,105,110,100,101,114,32,105,115,32,104,97, + 110,100,108,105,110,103,32,104,97,115,32,98,101,101,110,32, + 109,111,100,105,102,105,101,100,46,10,10,32,32,32,32,99, + 2,0,0,0,0,0,0,0,5,0,0,0,5,0,0,0, + 7,0,0,0,115,122,0,0,0,103,0,0,125,3,0,120, + 52,0,124,2,0,68,93,44,0,92,2,0,137,0,0,125, + 4,0,124,3,0,106,0,0,135,0,0,102,1,0,100,1, + 0,100,2,0,134,0,0,124,4,0,68,131,1,0,131,1, + 0,1,113,13,0,87,124,3,0,124,0,0,95,1,0,124, + 1,0,112,79,0,100,3,0,124,0,0,95,2,0,100,6, + 0,124,0,0,95,3,0,116,4,0,131,0,0,124,0,0, + 95,5,0,116,4,0,131,0,0,124,0,0,95,6,0,100, + 5,0,83,41,7,122,154,73,110,105,116,105,97,108,105,122, + 101,32,119,105,116,104,32,116,104,101,32,112,97,116,104,32, + 116,111,32,115,101,97,114,99,104,32,111,110,32,97,110,100, + 32,97,32,118,97,114,105,97,98,108,101,32,110,117,109,98, + 101,114,32,111,102,10,32,32,32,32,32,32,32,32,50,45, + 116,117,112,108,101,115,32,99,111,110,116,97,105,110,105,110, + 103,32,116,104,101,32,108,111,97,100,101,114,32,97,110,100, + 32,116,104,101,32,102,105,108,101,32,115,117,102,102,105,120, + 101,115,32,116,104,101,32,108,111,97,100,101,114,10,32,32, + 32,32,32,32,32,32,114,101,99,111,103,110,105,122,101,115, + 46,99,1,0,0,0,0,0,0,0,2,0,0,0,3,0, + 0,0,51,0,0,0,115,27,0,0,0,124,0,0,93,17, + 0,125,1,0,124,1,0,136,0,0,102,2,0,86,1,113, + 3,0,100,0,0,83,41,1,78,114,4,0,0,0,41,2, + 114,24,0,0,0,114,227,0,0,0,41,1,114,129,0,0, + 0,114,4,0,0,0,114,6,0,0,0,114,229,0,0,0, + 192,4,0,0,115,2,0,0,0,6,0,122,38,70,105,108, + 101,70,105,110,100,101,114,46,95,95,105,110,105,116,95,95, + 46,60,108,111,99,97,108,115,62,46,60,103,101,110,101,120, + 112,114,62,114,60,0,0,0,114,31,0,0,0,78,114,89, + 0,0,0,41,7,114,152,0,0,0,218,8,95,108,111,97, + 100,101,114,115,114,37,0,0,0,218,11,95,112,97,116,104, + 95,109,116,105,109,101,218,3,115,101,116,218,11,95,112,97, + 116,104,95,99,97,99,104,101,218,19,95,114,101,108,97,120, + 101,100,95,112,97,116,104,95,99,97,99,104,101,41,5,114, + 110,0,0,0,114,37,0,0,0,218,14,108,111,97,100,101, + 114,95,100,101,116,97,105,108,115,90,7,108,111,97,100,101, + 114,115,114,169,0,0,0,114,4,0,0,0,41,1,114,129, + 0,0,0,114,6,0,0,0,114,187,0,0,0,186,4,0, + 0,115,16,0,0,0,0,4,6,1,19,1,36,1,9,2, + 15,1,9,1,12,1,122,19,70,105,108,101,70,105,110,100, + 101,114,46,95,95,105,110,105,116,95,95,99,1,0,0,0, + 0,0,0,0,1,0,0,0,2,0,0,0,67,0,0,0, + 115,13,0,0,0,100,3,0,124,0,0,95,0,0,100,2, + 0,83,41,4,122,31,73,110,118,97,108,105,100,97,116,101, + 32,116,104,101,32,100,105,114,101,99,116,111,114,121,32,109, + 116,105,109,101,46,114,31,0,0,0,78,114,89,0,0,0, + 41,1,114,10,1,0,0,41,1,114,110,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,114,252,0, + 0,0,200,4,0,0,115,2,0,0,0,0,2,122,28,70, + 105,108,101,70,105,110,100,101,114,46,105,110,118,97,108,105, + 100,97,116,101,95,99,97,99,104,101,115,99,2,0,0,0, + 0,0,0,0,3,0,0,0,2,0,0,0,67,0,0,0, + 115,59,0,0,0,124,0,0,106,0,0,124,1,0,131,1, + 0,125,2,0,124,2,0,100,1,0,107,8,0,114,37,0, + 100,1,0,103,0,0,102,2,0,83,124,2,0,106,1,0, + 124,2,0,106,2,0,112,55,0,103,0,0,102,2,0,83, + 41,2,122,197,84,114,121,32,116,111,32,102,105,110,100,32, + 97,32,108,111,97,100,101,114,32,102,111,114,32,116,104,101, + 32,115,112,101,99,105,102,105,101,100,32,109,111,100,117,108, + 101,44,32,111,114,32,116,104,101,32,110,97,109,101,115,112, + 97,99,101,10,32,32,32,32,32,32,32,32,112,97,99,107, + 97,103,101,32,112,111,114,116,105,111,110,115,46,32,82,101, + 116,117,114,110,115,32,40,108,111,97,100,101,114,44,32,108, + 105,115,116,45,111,102,45,112,111,114,116,105,111,110,115,41, + 46,10,10,32,32,32,32,32,32,32,32,84,104,105,115,32, + 109,101,116,104,111,100,32,105,115,32,100,101,112,114,101,99, + 97,116,101,100,46,32,32,85,115,101,32,102,105,110,100,95, + 115,112,101,99,40,41,32,105,110,115,116,101,97,100,46,10, + 10,32,32,32,32,32,32,32,32,78,41,3,114,183,0,0, + 0,114,129,0,0,0,114,159,0,0,0,41,3,114,110,0, + 0,0,114,128,0,0,0,114,167,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,6,0,0,0,114,126,0,0,0, + 206,4,0,0,115,8,0,0,0,0,7,15,1,12,1,10, + 1,122,22,70,105,108,101,70,105,110,100,101,114,46,102,105, + 110,100,95,108,111,97,100,101,114,99,6,0,0,0,0,0, + 0,0,7,0,0,0,7,0,0,0,67,0,0,0,115,40, + 0,0,0,124,1,0,124,2,0,124,3,0,131,2,0,125, + 6,0,116,0,0,124,2,0,124,3,0,100,1,0,124,6, + 0,100,2,0,124,4,0,131,2,2,83,41,3,78,114,129, + 0,0,0,114,159,0,0,0,41,1,114,170,0,0,0,41, + 7,114,110,0,0,0,114,168,0,0,0,114,128,0,0,0, + 114,37,0,0,0,90,4,115,109,115,108,114,182,0,0,0, + 114,129,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 6,0,0,0,114,7,1,0,0,218,4,0,0,115,6,0, + 0,0,0,1,15,1,18,1,122,20,70,105,108,101,70,105, + 110,100,101,114,46,95,103,101,116,95,115,112,101,99,78,99, + 3,0,0,0,0,0,0,0,14,0,0,0,15,0,0,0, + 67,0,0,0,115,234,1,0,0,100,1,0,125,3,0,124, + 1,0,106,0,0,100,2,0,131,1,0,100,3,0,25,125, + 4,0,121,34,0,116,1,0,124,0,0,106,2,0,112,49, + 0,116,3,0,106,4,0,131,0,0,131,1,0,106,5,0, + 125,5,0,87,110,24,0,4,116,6,0,107,10,0,114,85, + 0,1,1,1,100,10,0,125,5,0,89,110,1,0,88,124, + 5,0,124,0,0,106,7,0,107,3,0,114,120,0,124,0, + 0,106,8,0,131,0,0,1,124,5,0,124,0,0,95,7, + 0,116,9,0,131,0,0,114,153,0,124,0,0,106,10,0, + 125,6,0,124,4,0,106,11,0,131,0,0,125,7,0,110, + 15,0,124,0,0,106,12,0,125,6,0,124,4,0,125,7, + 0,124,7,0,124,6,0,107,6,0,114,45,1,116,13,0, + 124,0,0,106,2,0,124,4,0,131,2,0,125,8,0,120, + 100,0,124,0,0,106,14,0,68,93,77,0,92,2,0,125, + 9,0,125,10,0,100,5,0,124,9,0,23,125,11,0,116, + 13,0,124,8,0,124,11,0,131,2,0,125,12,0,116,15, + 0,124,12,0,131,1,0,114,208,0,124,0,0,106,16,0, + 124,10,0,124,1,0,124,12,0,124,8,0,103,1,0,124, + 2,0,131,5,0,83,113,208,0,87,116,17,0,124,8,0, + 131,1,0,125,3,0,120,123,0,124,0,0,106,14,0,68, + 93,112,0,92,2,0,125,9,0,125,10,0,116,13,0,124, + 0,0,106,2,0,124,4,0,124,9,0,23,131,2,0,125, + 12,0,116,18,0,100,6,0,106,19,0,124,12,0,131,1, + 0,100,7,0,100,3,0,131,1,1,1,124,7,0,124,9, + 0,23,124,6,0,107,6,0,114,55,1,116,15,0,124,12, + 0,131,1,0,114,55,1,124,0,0,106,16,0,124,10,0, + 124,1,0,124,12,0,100,8,0,124,2,0,131,5,0,83, + 113,55,1,87,124,3,0,114,230,1,116,18,0,100,9,0, + 106,19,0,124,8,0,131,1,0,131,1,0,1,116,20,0, + 106,21,0,124,1,0,100,8,0,131,2,0,125,13,0,124, + 8,0,103,1,0,124,13,0,95,22,0,124,13,0,83,100, + 8,0,83,41,11,122,102,84,114,121,32,116,111,32,102,105, + 110,100,32,97,32,115,112,101,99,32,102,111,114,32,116,104, + 101,32,115,112,101,99,105,102,105,101,100,32,109,111,100,117, + 108,101,46,32,32,82,101,116,117,114,110,115,32,116,104,101, + 10,32,32,32,32,32,32,32,32,109,97,116,99,104,105,110, + 103,32,115,112,101,99,44,32,111,114,32,78,111,110,101,32, + 105,102,32,110,111,116,32,102,111,117,110,100,46,70,114,60, + 0,0,0,114,58,0,0,0,114,31,0,0,0,114,187,0, + 0,0,122,9,116,114,121,105,110,103,32,123,125,114,100,0, + 0,0,78,122,25,112,111,115,115,105,98,108,101,32,110,97, + 109,101,115,112,97,99,101,32,102,111,114,32,123,125,114,89, + 0,0,0,41,23,114,34,0,0,0,114,41,0,0,0,114, + 37,0,0,0,114,3,0,0,0,114,47,0,0,0,114,221, + 0,0,0,114,42,0,0,0,114,10,1,0,0,218,11,95, + 102,105,108,108,95,99,97,99,104,101,114,7,0,0,0,114, + 13,1,0,0,114,90,0,0,0,114,12,1,0,0,114,30, + 0,0,0,114,9,1,0,0,114,46,0,0,0,114,7,1, + 0,0,114,48,0,0,0,114,107,0,0,0,114,49,0,0, + 0,114,123,0,0,0,114,163,0,0,0,114,159,0,0,0, + 41,14,114,110,0,0,0,114,128,0,0,0,114,182,0,0, + 0,90,12,105,115,95,110,97,109,101,115,112,97,99,101,90, + 11,116,97,105,108,95,109,111,100,117,108,101,114,135,0,0, + 0,90,5,99,97,99,104,101,90,12,99,97,99,104,101,95, + 109,111,100,117,108,101,90,9,98,97,115,101,95,112,97,116, + 104,114,227,0,0,0,114,168,0,0,0,90,13,105,110,105, + 116,95,102,105,108,101,110,97,109,101,90,9,102,117,108,108, + 95,112,97,116,104,114,167,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,183,0,0,0,223,4, + 0,0,115,68,0,0,0,0,3,6,1,19,1,3,1,34, + 1,13,1,11,1,15,1,10,1,9,2,9,1,9,1,15, + 2,9,1,6,2,12,1,18,1,22,1,10,1,15,1,12, + 1,32,4,12,2,22,1,22,1,25,1,16,1,12,1,29, + 1,6,1,19,1,18,1,12,1,4,1,122,20,70,105,108, + 101,70,105,110,100,101,114,46,102,105,110,100,95,115,112,101, + 99,99,1,0,0,0,0,0,0,0,9,0,0,0,13,0, + 0,0,67,0,0,0,115,11,1,0,0,124,0,0,106,0, + 0,125,1,0,121,31,0,116,1,0,106,2,0,124,1,0, + 112,33,0,116,1,0,106,3,0,131,0,0,131,1,0,125, + 2,0,87,110,33,0,4,116,4,0,116,5,0,116,6,0, + 102,3,0,107,10,0,114,75,0,1,1,1,103,0,0,125, + 2,0,89,110,1,0,88,116,7,0,106,8,0,106,9,0, + 100,1,0,131,1,0,115,112,0,116,10,0,124,2,0,131, + 1,0,124,0,0,95,11,0,110,111,0,116,10,0,131,0, + 0,125,3,0,120,90,0,124,2,0,68,93,82,0,125,4, + 0,124,4,0,106,12,0,100,2,0,131,1,0,92,3,0, + 125,5,0,125,6,0,125,7,0,124,6,0,114,191,0,100, + 3,0,106,13,0,124,5,0,124,7,0,106,14,0,131,0, + 0,131,2,0,125,8,0,110,6,0,124,5,0,125,8,0, + 124,3,0,106,15,0,124,8,0,131,1,0,1,113,128,0, + 87,124,3,0,124,0,0,95,11,0,116,7,0,106,8,0, + 106,9,0,116,16,0,131,1,0,114,7,1,100,4,0,100, + 5,0,132,0,0,124,2,0,68,131,1,0,124,0,0,95, + 17,0,100,6,0,83,41,7,122,68,70,105,108,108,32,116, + 104,101,32,99,97,99,104,101,32,111,102,32,112,111,116,101, + 110,116,105,97,108,32,109,111,100,117,108,101,115,32,97,110, + 100,32,112,97,99,107,97,103,101,115,32,102,111,114,32,116, + 104,105,115,32,100,105,114,101,99,116,111,114,121,46,114,0, + 0,0,0,114,60,0,0,0,122,5,123,125,46,123,125,99, + 1,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, + 83,0,0,0,115,28,0,0,0,104,0,0,124,0,0,93, + 18,0,125,1,0,124,1,0,106,0,0,131,0,0,146,2, + 0,113,6,0,83,114,4,0,0,0,41,1,114,90,0,0, + 0,41,2,114,24,0,0,0,90,2,102,110,114,4,0,0, + 0,114,4,0,0,0,114,6,0,0,0,250,9,60,115,101, + 116,99,111,109,112,62,41,5,0,0,115,2,0,0,0,9, + 0,122,41,70,105,108,101,70,105,110,100,101,114,46,95,102, + 105,108,108,95,99,97,99,104,101,46,60,108,111,99,97,108, + 115,62,46,60,115,101,116,99,111,109,112,62,78,41,18,114, + 37,0,0,0,114,3,0,0,0,90,7,108,105,115,116,100, + 105,114,114,47,0,0,0,114,2,1,0,0,218,15,80,101, + 114,109,105,115,115,105,111,110,69,114,114,111,114,218,18,78, + 111,116,65,68,105,114,101,99,116,111,114,121,69,114,114,111, + 114,114,8,0,0,0,114,9,0,0,0,114,10,0,0,0, + 114,11,1,0,0,114,12,1,0,0,114,85,0,0,0,114, + 49,0,0,0,114,90,0,0,0,218,3,97,100,100,114,11, + 0,0,0,114,13,1,0,0,41,9,114,110,0,0,0,114, + 37,0,0,0,90,8,99,111,110,116,101,110,116,115,90,21, + 108,111,119,101,114,95,115,117,102,102,105,120,95,99,111,110, + 116,101,110,116,115,114,247,0,0,0,114,108,0,0,0,114, + 239,0,0,0,114,227,0,0,0,90,8,110,101,119,95,110, + 97,109,101,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,114,15,1,0,0,12,5,0,0,115,34,0,0,0, + 0,2,9,1,3,1,31,1,22,3,11,3,18,1,18,7, + 9,1,13,1,24,1,6,1,27,2,6,1,17,1,9,1, + 18,1,122,22,70,105,108,101,70,105,110,100,101,114,46,95, + 102,105,108,108,95,99,97,99,104,101,99,1,0,0,0,0, + 0,0,0,3,0,0,0,3,0,0,0,7,0,0,0,115, + 25,0,0,0,135,0,0,135,1,0,102,2,0,100,1,0, + 100,2,0,134,0,0,125,2,0,124,2,0,83,41,3,97, + 20,1,0,0,65,32,99,108,97,115,115,32,109,101,116,104, + 111,100,32,119,104,105,99,104,32,114,101,116,117,114,110,115, + 32,97,32,99,108,111,115,117,114,101,32,116,111,32,117,115, + 101,32,111,110,32,115,121,115,46,112,97,116,104,95,104,111, + 111,107,10,32,32,32,32,32,32,32,32,119,104,105,99,104, + 32,119,105,108,108,32,114,101,116,117,114,110,32,97,110,32, + 105,110,115,116,97,110,99,101,32,117,115,105,110,103,32,116, + 104,101,32,115,112,101,99,105,102,105,101,100,32,108,111,97, + 100,101,114,115,32,97,110,100,32,116,104,101,32,112,97,116, + 104,10,32,32,32,32,32,32,32,32,99,97,108,108,101,100, + 32,111,110,32,116,104,101,32,99,108,111,115,117,114,101,46, + 10,10,32,32,32,32,32,32,32,32,73,102,32,116,104,101, + 32,112,97,116,104,32,99,97,108,108,101,100,32,111,110,32, + 116,104,101,32,99,108,111,115,117,114,101,32,105,115,32,110, + 111,116,32,97,32,100,105,114,101,99,116,111,114,121,44,32, + 73,109,112,111,114,116,69,114,114,111,114,32,105,115,10,32, + 32,32,32,32,32,32,32,114,97,105,115,101,100,46,10,10, + 32,32,32,32,32,32,32,32,99,1,0,0,0,0,0,0, + 0,1,0,0,0,4,0,0,0,19,0,0,0,115,43,0, + 0,0,116,0,0,124,0,0,131,1,0,115,30,0,116,1, + 0,100,1,0,100,2,0,124,0,0,131,1,1,130,1,0, + 136,0,0,124,0,0,136,1,0,140,1,0,83,41,3,122, + 45,80,97,116,104,32,104,111,111,107,32,102,111,114,32,105, + 109,112,111,114,116,108,105,98,46,109,97,99,104,105,110,101, + 114,121,46,70,105,108,101,70,105,110,100,101,114,46,122,30, + 111,110,108,121,32,100,105,114,101,99,116,111,114,105,101,115, + 32,97,114,101,32,115,117,112,112,111,114,116,101,100,114,37, + 0,0,0,41,2,114,48,0,0,0,114,109,0,0,0,41, + 1,114,37,0,0,0,41,2,114,173,0,0,0,114,14,1, + 0,0,114,4,0,0,0,114,6,0,0,0,218,24,112,97, + 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, + 70,105,110,100,101,114,53,5,0,0,115,6,0,0,0,0, + 2,12,1,18,1,122,54,70,105,108,101,70,105,110,100,101, + 114,46,112,97,116,104,95,104,111,111,107,46,60,108,111,99, + 97,108,115,62,46,112,97,116,104,95,104,111,111,107,95,102, + 111,114,95,70,105,108,101,70,105,110,100,101,114,114,4,0, + 0,0,41,3,114,173,0,0,0,114,14,1,0,0,114,20, + 1,0,0,114,4,0,0,0,41,2,114,173,0,0,0,114, + 14,1,0,0,114,6,0,0,0,218,9,112,97,116,104,95, + 104,111,111,107,43,5,0,0,115,4,0,0,0,0,10,21, + 6,122,20,70,105,108,101,70,105,110,100,101,114,46,112,97, + 116,104,95,104,111,111,107,99,1,0,0,0,0,0,0,0, + 1,0,0,0,2,0,0,0,67,0,0,0,115,16,0,0, + 0,100,1,0,106,0,0,124,0,0,106,1,0,131,1,0, + 83,41,2,78,122,16,70,105,108,101,70,105,110,100,101,114, + 40,123,33,114,125,41,41,2,114,49,0,0,0,114,37,0, + 0,0,41,1,114,110,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,6,0,0,0,114,246,0,0,0,61,5,0, + 0,115,2,0,0,0,0,1,122,19,70,105,108,101,70,105, + 110,100,101,114,46,95,95,114,101,112,114,95,95,41,15,114, + 114,0,0,0,114,113,0,0,0,114,115,0,0,0,114,116, + 0,0,0,114,187,0,0,0,114,252,0,0,0,114,132,0, + 0,0,114,184,0,0,0,114,126,0,0,0,114,7,1,0, + 0,114,183,0,0,0,114,15,1,0,0,114,185,0,0,0, + 114,21,1,0,0,114,246,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,8, + 1,0,0,177,4,0,0,115,20,0,0,0,12,7,6,2, + 12,14,12,4,6,2,12,12,12,5,15,45,12,31,18,18, + 114,8,1,0,0,99,4,0,0,0,0,0,0,0,6,0, + 0,0,11,0,0,0,67,0,0,0,115,195,0,0,0,124, + 0,0,106,0,0,100,1,0,131,1,0,125,4,0,124,0, + 0,106,0,0,100,2,0,131,1,0,125,5,0,124,4,0, + 115,99,0,124,5,0,114,54,0,124,5,0,106,1,0,125, + 4,0,110,45,0,124,2,0,124,3,0,107,2,0,114,84, + 0,116,2,0,124,1,0,124,2,0,131,2,0,125,4,0, + 110,15,0,116,3,0,124,1,0,124,2,0,131,2,0,125, + 4,0,124,5,0,115,126,0,116,4,0,124,1,0,124,2, + 0,100,3,0,124,4,0,131,2,1,125,5,0,121,44,0, + 124,5,0,124,0,0,100,2,0,60,124,4,0,124,0,0, + 100,1,0,60,124,2,0,124,0,0,100,4,0,60,124,3, + 0,124,0,0,100,5,0,60,87,110,18,0,4,116,5,0, + 107,10,0,114,190,0,1,1,1,89,110,1,0,88,100,0, + 0,83,41,6,78,218,10,95,95,108,111,97,100,101,114,95, + 95,218,8,95,95,115,112,101,99,95,95,114,129,0,0,0, + 90,8,95,95,102,105,108,101,95,95,90,10,95,95,99,97, + 99,104,101,100,95,95,41,6,218,3,103,101,116,114,129,0, + 0,0,114,225,0,0,0,114,220,0,0,0,114,170,0,0, + 0,218,9,69,120,99,101,112,116,105,111,110,41,6,90,2, + 110,115,114,108,0,0,0,90,8,112,97,116,104,110,97,109, + 101,90,9,99,112,97,116,104,110,97,109,101,114,129,0,0, + 0,114,167,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,218,14,95,102,105,120,95,117,112,95,109, + 111,100,117,108,101,67,5,0,0,115,34,0,0,0,0,2, + 15,1,15,1,6,1,6,1,12,1,12,1,18,2,15,1, + 6,1,21,1,3,1,10,1,10,1,10,1,14,1,13,2, + 114,26,1,0,0,99,0,0,0,0,0,0,0,0,3,0, + 0,0,3,0,0,0,67,0,0,0,115,55,0,0,0,116, + 0,0,116,1,0,106,2,0,131,0,0,102,2,0,125,0, + 0,116,3,0,116,4,0,102,2,0,125,1,0,116,5,0, + 116,6,0,102,2,0,125,2,0,124,0,0,124,1,0,124, + 2,0,103,3,0,83,41,1,122,95,82,101,116,117,114,110, + 115,32,97,32,108,105,115,116,32,111,102,32,102,105,108,101, + 45,98,97,115,101,100,32,109,111,100,117,108,101,32,108,111, + 97,100,101,114,115,46,10,10,32,32,32,32,69,97,99,104, + 32,105,116,101,109,32,105,115,32,97,32,116,117,112,108,101, + 32,40,108,111,97,100,101,114,44,32,115,117,102,102,105,120, + 101,115,41,46,10,32,32,32,32,41,7,114,226,0,0,0, + 114,148,0,0,0,218,18,101,120,116,101,110,115,105,111,110, + 95,115,117,102,102,105,120,101,115,114,220,0,0,0,114,86, + 0,0,0,114,225,0,0,0,114,76,0,0,0,41,3,90, + 10,101,120,116,101,110,115,105,111,110,115,90,6,115,111,117, + 114,99,101,90,8,98,121,116,101,99,111,100,101,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,114,164,0,0, + 0,90,5,0,0,115,8,0,0,0,0,5,18,1,12,1, + 12,1,114,164,0,0,0,99,1,0,0,0,0,0,0,0, + 12,0,0,0,12,0,0,0,67,0,0,0,115,70,2,0, + 0,124,0,0,97,0,0,116,0,0,106,1,0,97,1,0, + 116,0,0,106,2,0,97,2,0,116,1,0,106,3,0,116, + 4,0,25,125,1,0,120,76,0,100,26,0,68,93,68,0, + 125,2,0,124,2,0,116,1,0,106,3,0,107,7,0,114, + 83,0,116,0,0,106,5,0,124,2,0,131,1,0,125,3, + 0,110,13,0,116,1,0,106,3,0,124,2,0,25,125,3, + 0,116,6,0,124,1,0,124,2,0,124,3,0,131,3,0, + 1,113,44,0,87,100,5,0,100,6,0,103,1,0,102,2, + 0,100,7,0,100,8,0,100,6,0,103,2,0,102,2,0, + 102,2,0,125,4,0,120,149,0,124,4,0,68,93,129,0, + 92,2,0,125,5,0,125,6,0,116,7,0,100,9,0,100, + 10,0,132,0,0,124,6,0,68,131,1,0,131,1,0,115, + 199,0,116,8,0,130,1,0,124,6,0,100,11,0,25,125, + 7,0,124,5,0,116,1,0,106,3,0,107,6,0,114,241, + 0,116,1,0,106,3,0,124,5,0,25,125,8,0,80,113, + 156,0,121,20,0,116,0,0,106,5,0,124,5,0,131,1, + 0,125,8,0,80,87,113,156,0,4,116,9,0,107,10,0, + 114,28,1,1,1,1,119,156,0,89,113,156,0,88,113,156, + 0,87,116,9,0,100,12,0,131,1,0,130,1,0,116,6, + 0,124,1,0,100,13,0,124,8,0,131,3,0,1,116,6, + 0,124,1,0,100,14,0,124,7,0,131,3,0,1,116,6, + 0,124,1,0,100,15,0,100,16,0,106,10,0,124,6,0, + 131,1,0,131,3,0,1,121,19,0,116,0,0,106,5,0, + 100,17,0,131,1,0,125,9,0,87,110,24,0,4,116,9, + 0,107,10,0,114,147,1,1,1,1,100,18,0,125,9,0, + 89,110,1,0,88,116,6,0,124,1,0,100,17,0,124,9, + 0,131,3,0,1,116,0,0,106,5,0,100,19,0,131,1, + 0,125,10,0,116,6,0,124,1,0,100,19,0,124,10,0, + 131,3,0,1,124,5,0,100,7,0,107,2,0,114,238,1, + 116,0,0,106,5,0,100,20,0,131,1,0,125,11,0,116, + 6,0,124,1,0,100,21,0,124,11,0,131,3,0,1,116, + 6,0,124,1,0,100,22,0,116,11,0,131,0,0,131,3, + 0,1,116,12,0,106,13,0,116,2,0,106,14,0,131,0, + 0,131,1,0,1,124,5,0,100,7,0,107,2,0,114,66, + 2,116,15,0,106,16,0,100,23,0,131,1,0,1,100,24, + 0,116,12,0,107,6,0,114,66,2,100,25,0,116,17,0, + 95,18,0,100,18,0,83,41,27,122,205,83,101,116,117,112, + 32,116,104,101,32,112,97,116,104,45,98,97,115,101,100,32, + 105,109,112,111,114,116,101,114,115,32,102,111,114,32,105,109, + 112,111,114,116,108,105,98,32,98,121,32,105,109,112,111,114, + 116,105,110,103,32,110,101,101,100,101,100,10,32,32,32,32, + 98,117,105,108,116,45,105,110,32,109,111,100,117,108,101,115, + 32,97,110,100,32,105,110,106,101,99,116,105,110,103,32,116, + 104,101,109,32,105,110,116,111,32,116,104,101,32,103,108,111, + 98,97,108,32,110,97,109,101,115,112,97,99,101,46,10,10, + 32,32,32,32,79,116,104,101,114,32,99,111,109,112,111,110, + 101,110,116,115,32,97,114,101,32,101,120,116,114,97,99,116, + 101,100,32,102,114,111,109,32,116,104,101,32,99,111,114,101, + 32,98,111,111,116,115,116,114,97,112,32,109,111,100,117,108, + 101,46,10,10,32,32,32,32,114,51,0,0,0,114,62,0, + 0,0,218,8,98,117,105,108,116,105,110,115,114,145,0,0, + 0,90,5,112,111,115,105,120,250,1,47,218,2,110,116,250, + 1,92,99,1,0,0,0,0,0,0,0,2,0,0,0,3, + 0,0,0,115,0,0,0,115,33,0,0,0,124,0,0,93, + 23,0,125,1,0,116,0,0,124,1,0,131,1,0,100,0, + 0,107,2,0,86,1,113,3,0,100,1,0,83,41,2,114, + 31,0,0,0,78,41,1,114,33,0,0,0,41,2,114,24, + 0,0,0,114,79,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,6,0,0,0,114,229,0,0,0,126,5,0,0, + 115,2,0,0,0,6,0,122,25,95,115,101,116,117,112,46, + 60,108,111,99,97,108,115,62,46,60,103,101,110,101,120,112, + 114,62,114,61,0,0,0,122,30,105,109,112,111,114,116,108, + 105,98,32,114,101,113,117,105,114,101,115,32,112,111,115,105, + 120,32,111,114,32,110,116,114,3,0,0,0,114,27,0,0, + 0,114,23,0,0,0,114,32,0,0,0,90,7,95,116,104, + 114,101,97,100,78,90,8,95,119,101,97,107,114,101,102,90, + 6,119,105,110,114,101,103,114,172,0,0,0,114,7,0,0, + 0,122,4,46,112,121,119,122,6,95,100,46,112,121,100,84, + 41,4,114,51,0,0,0,114,62,0,0,0,114,28,1,0, + 0,114,145,0,0,0,41,19,114,123,0,0,0,114,8,0, + 0,0,114,148,0,0,0,114,241,0,0,0,114,114,0,0, + 0,90,18,95,98,117,105,108,116,105,110,95,102,114,111,109, + 95,110,97,109,101,114,118,0,0,0,218,3,97,108,108,218, + 14,65,115,115,101,114,116,105,111,110,69,114,114,111,114,114, + 109,0,0,0,114,28,0,0,0,114,13,0,0,0,114,231, + 0,0,0,114,152,0,0,0,114,27,1,0,0,114,86,0, + 0,0,114,166,0,0,0,114,171,0,0,0,114,175,0,0, + 0,41,12,218,17,95,98,111,111,116,115,116,114,97,112,95, + 109,111,100,117,108,101,90,11,115,101,108,102,95,109,111,100, + 117,108,101,90,12,98,117,105,108,116,105,110,95,110,97,109, + 101,90,14,98,117,105,108,116,105,110,95,109,111,100,117,108, + 101,90,10,111,115,95,100,101,116,97,105,108,115,90,10,98, + 117,105,108,116,105,110,95,111,115,114,23,0,0,0,114,27, + 0,0,0,90,9,111,115,95,109,111,100,117,108,101,90,13, + 116,104,114,101,97,100,95,109,111,100,117,108,101,90,14,119, + 101,97,107,114,101,102,95,109,111,100,117,108,101,90,13,119, + 105,110,114,101,103,95,109,111,100,117,108,101,114,4,0,0, + 0,114,4,0,0,0,114,6,0,0,0,218,6,95,115,101, + 116,117,112,101,5,0,0,115,82,0,0,0,0,8,6,1, + 9,1,9,3,13,1,13,1,15,1,18,2,13,1,20,3, + 33,1,19,2,31,1,10,1,15,1,13,1,4,2,3,1, + 15,1,5,1,13,1,12,2,12,1,16,1,16,1,25,3, + 3,1,19,1,13,2,11,1,16,3,15,1,16,3,12,1, + 15,1,16,3,19,1,19,1,12,1,13,1,12,1,114,35, + 1,0,0,99,1,0,0,0,0,0,0,0,2,0,0,0, + 3,0,0,0,67,0,0,0,115,116,0,0,0,116,0,0, + 124,0,0,131,1,0,1,116,1,0,131,0,0,125,1,0, + 116,2,0,106,3,0,106,4,0,116,5,0,106,6,0,124, + 1,0,140,0,0,103,1,0,131,1,0,1,116,7,0,106, + 8,0,100,1,0,107,2,0,114,78,0,116,2,0,106,9, + 0,106,10,0,116,11,0,131,1,0,1,116,2,0,106,9, + 0,106,10,0,116,12,0,131,1,0,1,116,5,0,124,0, + 0,95,5,0,116,13,0,124,0,0,95,13,0,100,2,0, + 83,41,3,122,41,73,110,115,116,97,108,108,32,116,104,101, + 32,112,97,116,104,45,98,97,115,101,100,32,105,109,112,111, + 114,116,32,99,111,109,112,111,110,101,110,116,115,46,114,30, + 1,0,0,78,41,14,114,35,1,0,0,114,164,0,0,0, + 114,8,0,0,0,114,0,1,0,0,114,152,0,0,0,114, + 8,1,0,0,114,21,1,0,0,114,3,0,0,0,114,114, + 0,0,0,218,9,109,101,116,97,95,112,97,116,104,114,166, + 0,0,0,114,171,0,0,0,114,251,0,0,0,114,220,0, + 0,0,41,2,114,34,1,0,0,90,17,115,117,112,112,111, + 114,116,101,100,95,108,111,97,100,101,114,115,114,4,0,0, + 0,114,4,0,0,0,114,6,0,0,0,218,8,95,105,110, + 115,116,97,108,108,169,5,0,0,115,16,0,0,0,0,2, + 10,1,9,1,28,1,15,1,16,1,16,4,9,1,114,37, + 1,0,0,41,1,114,0,0,0,0,41,2,114,1,0,0, + 0,114,2,0,0,0,41,62,114,116,0,0,0,114,12,0, + 0,0,90,37,95,67,65,83,69,95,73,78,83,69,78,83, + 73,84,73,86,69,95,80,76,65,84,70,79,82,77,83,95, + 66,89,84,69,83,95,75,69,89,114,11,0,0,0,114,13, + 0,0,0,114,19,0,0,0,114,21,0,0,0,114,30,0, + 0,0,114,40,0,0,0,114,41,0,0,0,114,45,0,0, + 0,114,46,0,0,0,114,48,0,0,0,114,57,0,0,0, + 218,4,116,121,112,101,218,8,95,95,99,111,100,101,95,95, + 114,147,0,0,0,114,17,0,0,0,114,137,0,0,0,114, + 16,0,0,0,114,20,0,0,0,90,17,95,82,65,87,95, + 77,65,71,73,67,95,78,85,77,66,69,82,90,4,95,109, + 115,103,218,11,83,121,115,116,101,109,69,114,114,111,114,114, + 138,0,0,0,114,75,0,0,0,114,74,0,0,0,114,86, + 0,0,0,114,76,0,0,0,90,23,68,69,66,85,71,95, + 66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,69, + 83,90,27,79,80,84,73,77,73,90,69,68,95,66,89,84, + 69,67,79,68,69,95,83,85,70,70,73,88,69,83,114,81, + 0,0,0,114,87,0,0,0,114,93,0,0,0,114,97,0, + 0,0,114,99,0,0,0,114,107,0,0,0,114,125,0,0, + 0,114,132,0,0,0,114,144,0,0,0,114,150,0,0,0, + 114,153,0,0,0,114,158,0,0,0,218,6,111,98,106,101, + 99,116,114,165,0,0,0,114,170,0,0,0,114,171,0,0, + 0,114,186,0,0,0,114,196,0,0,0,114,212,0,0,0, + 114,220,0,0,0,114,225,0,0,0,114,231,0,0,0,114, + 226,0,0,0,114,232,0,0,0,114,249,0,0,0,114,251, + 0,0,0,114,8,1,0,0,114,26,1,0,0,114,164,0, + 0,0,114,35,1,0,0,114,37,1,0,0,114,4,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,182,0,0,0,199,4,0,0,115,68,0,0,0,0,3, - 6,1,19,1,3,1,34,1,13,1,11,1,15,1,10,1, - 9,2,9,1,9,1,15,2,9,1,6,2,12,1,18,1, - 22,1,10,1,15,1,12,1,32,4,12,2,22,1,22,1, - 25,1,16,1,12,1,29,1,6,1,19,1,18,1,12,1, - 4,1,122,20,70,105,108,101,70,105,110,100,101,114,46,102, - 105,110,100,95,115,112,101,99,99,1,0,0,0,0,0,0, - 0,9,0,0,0,13,0,0,0,67,0,0,0,115,11,1, - 0,0,124,0,0,106,0,0,125,1,0,121,31,0,116,1, - 0,106,2,0,124,1,0,112,33,0,116,1,0,106,3,0, - 131,0,0,131,1,0,125,2,0,87,110,33,0,4,116,4, - 0,116,5,0,116,6,0,102,3,0,107,10,0,114,75,0, - 1,1,1,103,0,0,125,2,0,89,110,1,0,88,116,7, - 0,106,8,0,106,9,0,100,1,0,131,1,0,115,112,0, - 116,10,0,124,2,0,131,1,0,124,0,0,95,11,0,110, - 111,0,116,10,0,131,0,0,125,3,0,120,90,0,124,2, - 0,68,93,82,0,125,4,0,124,4,0,106,12,0,100,2, - 0,131,1,0,92,3,0,125,5,0,125,6,0,125,7,0, - 124,6,0,114,191,0,100,3,0,106,13,0,124,5,0,124, - 7,0,106,14,0,131,0,0,131,2,0,125,8,0,110,6, - 0,124,5,0,125,8,0,124,3,0,106,15,0,124,8,0, - 131,1,0,1,113,128,0,87,124,3,0,124,0,0,95,11, - 0,116,7,0,106,8,0,106,9,0,116,16,0,131,1,0, - 114,7,1,100,4,0,100,5,0,132,0,0,124,2,0,68, - 131,1,0,124,0,0,95,17,0,100,6,0,83,41,7,122, - 68,70,105,108,108,32,116,104,101,32,99,97,99,104,101,32, - 111,102,32,112,111,116,101,110,116,105,97,108,32,109,111,100, - 117,108,101,115,32,97,110,100,32,112,97,99,107,97,103,101, - 115,32,102,111,114,32,116,104,105,115,32,100,105,114,101,99, - 116,111,114,121,46,114,0,0,0,0,114,60,0,0,0,122, - 5,123,125,46,123,125,99,1,0,0,0,0,0,0,0,2, - 0,0,0,3,0,0,0,83,0,0,0,115,28,0,0,0, - 104,0,0,124,0,0,93,18,0,125,1,0,124,1,0,106, - 0,0,131,0,0,146,2,0,113,6,0,83,114,4,0,0, - 0,41,1,114,90,0,0,0,41,2,114,24,0,0,0,90, - 2,102,110,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,250,9,60,115,101,116,99,111,109,112,62,17,5,0, - 0,115,2,0,0,0,9,0,122,41,70,105,108,101,70,105, - 110,100,101,114,46,95,102,105,108,108,95,99,97,99,104,101, - 46,60,108,111,99,97,108,115,62,46,60,115,101,116,99,111, - 109,112,62,78,41,18,114,37,0,0,0,114,3,0,0,0, - 90,7,108,105,115,116,100,105,114,114,47,0,0,0,114,1, - 1,0,0,218,15,80,101,114,109,105,115,115,105,111,110,69, - 114,114,111,114,218,18,78,111,116,65,68,105,114,101,99,116, - 111,114,121,69,114,114,111,114,114,8,0,0,0,114,9,0, - 0,0,114,10,0,0,0,114,10,1,0,0,114,11,1,0, - 0,114,85,0,0,0,114,49,0,0,0,114,90,0,0,0, - 218,3,97,100,100,114,11,0,0,0,114,12,1,0,0,41, - 9,114,110,0,0,0,114,37,0,0,0,90,8,99,111,110, - 116,101,110,116,115,90,21,108,111,119,101,114,95,115,117,102, - 102,105,120,95,99,111,110,116,101,110,116,115,114,246,0,0, - 0,114,108,0,0,0,114,238,0,0,0,114,226,0,0,0, - 90,8,110,101,119,95,110,97,109,101,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,14,1,0,0,244,4, - 0,0,115,34,0,0,0,0,2,9,1,3,1,31,1,22, - 3,11,3,18,1,18,7,9,1,13,1,24,1,6,1,27, - 2,6,1,17,1,9,1,18,1,122,22,70,105,108,101,70, - 105,110,100,101,114,46,95,102,105,108,108,95,99,97,99,104, - 101,99,1,0,0,0,0,0,0,0,3,0,0,0,3,0, - 0,0,7,0,0,0,115,25,0,0,0,135,0,0,135,1, - 0,102,2,0,100,1,0,100,2,0,134,0,0,125,2,0, - 124,2,0,83,41,3,97,20,1,0,0,65,32,99,108,97, - 115,115,32,109,101,116,104,111,100,32,119,104,105,99,104,32, - 114,101,116,117,114,110,115,32,97,32,99,108,111,115,117,114, - 101,32,116,111,32,117,115,101,32,111,110,32,115,121,115,46, - 112,97,116,104,95,104,111,111,107,10,32,32,32,32,32,32, - 32,32,119,104,105,99,104,32,119,105,108,108,32,114,101,116, - 117,114,110,32,97,110,32,105,110,115,116,97,110,99,101,32, - 117,115,105,110,103,32,116,104,101,32,115,112,101,99,105,102, - 105,101,100,32,108,111,97,100,101,114,115,32,97,110,100,32, - 116,104,101,32,112,97,116,104,10,32,32,32,32,32,32,32, - 32,99,97,108,108,101,100,32,111,110,32,116,104,101,32,99, - 108,111,115,117,114,101,46,10,10,32,32,32,32,32,32,32, - 32,73,102,32,116,104,101,32,112,97,116,104,32,99,97,108, - 108,101,100,32,111,110,32,116,104,101,32,99,108,111,115,117, - 114,101,32,105,115,32,110,111,116,32,97,32,100,105,114,101, - 99,116,111,114,121,44,32,73,109,112,111,114,116,69,114,114, - 111,114,32,105,115,10,32,32,32,32,32,32,32,32,114,97, - 105,115,101,100,46,10,10,32,32,32,32,32,32,32,32,99, - 1,0,0,0,0,0,0,0,1,0,0,0,4,0,0,0, - 19,0,0,0,115,43,0,0,0,116,0,0,124,0,0,131, - 1,0,115,30,0,116,1,0,100,1,0,100,2,0,124,0, - 0,131,1,1,130,1,0,136,0,0,124,0,0,136,1,0, - 140,1,0,83,41,3,122,45,80,97,116,104,32,104,111,111, - 107,32,102,111,114,32,105,109,112,111,114,116,108,105,98,46, - 109,97,99,104,105,110,101,114,121,46,70,105,108,101,70,105, - 110,100,101,114,46,122,30,111,110,108,121,32,100,105,114,101, - 99,116,111,114,105,101,115,32,97,114,101,32,115,117,112,112, - 111,114,116,101,100,114,37,0,0,0,41,2,114,48,0,0, - 0,114,109,0,0,0,41,1,114,37,0,0,0,41,2,114, - 172,0,0,0,114,13,1,0,0,114,4,0,0,0,114,6, - 0,0,0,218,24,112,97,116,104,95,104,111,111,107,95,102, - 111,114,95,70,105,108,101,70,105,110,100,101,114,29,5,0, - 0,115,6,0,0,0,0,2,12,1,18,1,122,54,70,105, - 108,101,70,105,110,100,101,114,46,112,97,116,104,95,104,111, - 111,107,46,60,108,111,99,97,108,115,62,46,112,97,116,104, - 95,104,111,111,107,95,102,111,114,95,70,105,108,101,70,105, - 110,100,101,114,114,4,0,0,0,41,3,114,172,0,0,0, - 114,13,1,0,0,114,19,1,0,0,114,4,0,0,0,41, - 2,114,172,0,0,0,114,13,1,0,0,114,6,0,0,0, - 218,9,112,97,116,104,95,104,111,111,107,19,5,0,0,115, - 4,0,0,0,0,10,21,6,122,20,70,105,108,101,70,105, - 110,100,101,114,46,112,97,116,104,95,104,111,111,107,99,1, - 0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,67, - 0,0,0,115,16,0,0,0,100,1,0,106,0,0,124,0, - 0,106,1,0,131,1,0,83,41,2,78,122,16,70,105,108, - 101,70,105,110,100,101,114,40,123,33,114,125,41,41,2,114, - 49,0,0,0,114,37,0,0,0,41,1,114,110,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, - 245,0,0,0,37,5,0,0,115,2,0,0,0,0,1,122, - 19,70,105,108,101,70,105,110,100,101,114,46,95,95,114,101, - 112,114,95,95,41,15,114,114,0,0,0,114,113,0,0,0, - 114,115,0,0,0,114,116,0,0,0,114,186,0,0,0,114, - 251,0,0,0,114,132,0,0,0,114,183,0,0,0,114,126, - 0,0,0,114,6,1,0,0,114,182,0,0,0,114,14,1, - 0,0,114,184,0,0,0,114,20,1,0,0,114,245,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,7,1,0,0,153,4,0,0,115,20, - 0,0,0,12,7,6,2,12,14,12,4,6,2,12,12,12, - 5,15,45,12,31,18,18,114,7,1,0,0,99,4,0,0, - 0,0,0,0,0,6,0,0,0,11,0,0,0,67,0,0, - 0,115,195,0,0,0,124,0,0,106,0,0,100,1,0,131, - 1,0,125,4,0,124,0,0,106,0,0,100,2,0,131,1, - 0,125,5,0,124,4,0,115,99,0,124,5,0,114,54,0, - 124,5,0,106,1,0,125,4,0,110,45,0,124,2,0,124, - 3,0,107,2,0,114,84,0,116,2,0,124,1,0,124,2, - 0,131,2,0,125,4,0,110,15,0,116,3,0,124,1,0, - 124,2,0,131,2,0,125,4,0,124,5,0,115,126,0,116, - 4,0,124,1,0,124,2,0,100,3,0,124,4,0,131,2, - 1,125,5,0,121,44,0,124,5,0,124,0,0,100,2,0, - 60,124,4,0,124,0,0,100,1,0,60,124,2,0,124,0, - 0,100,4,0,60,124,3,0,124,0,0,100,5,0,60,87, - 110,18,0,4,116,5,0,107,10,0,114,190,0,1,1,1, - 89,110,1,0,88,100,0,0,83,41,6,78,218,10,95,95, - 108,111,97,100,101,114,95,95,218,8,95,95,115,112,101,99, - 95,95,114,129,0,0,0,90,8,95,95,102,105,108,101,95, - 95,90,10,95,95,99,97,99,104,101,100,95,95,41,6,218, - 3,103,101,116,114,129,0,0,0,114,224,0,0,0,114,219, - 0,0,0,114,169,0,0,0,218,9,69,120,99,101,112,116, - 105,111,110,41,6,90,2,110,115,114,108,0,0,0,90,8, - 112,97,116,104,110,97,109,101,90,9,99,112,97,116,104,110, - 97,109,101,114,129,0,0,0,114,166,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,6,0,0,0,218,14,95,102, - 105,120,95,117,112,95,109,111,100,117,108,101,43,5,0,0, - 115,34,0,0,0,0,2,15,1,15,1,6,1,6,1,12, - 1,12,1,18,2,15,1,6,1,21,1,3,1,10,1,10, - 1,10,1,14,1,13,2,114,25,1,0,0,99,0,0,0, - 0,0,0,0,0,3,0,0,0,3,0,0,0,67,0,0, - 0,115,55,0,0,0,116,0,0,116,1,0,106,2,0,131, - 0,0,102,2,0,125,0,0,116,3,0,116,4,0,102,2, - 0,125,1,0,116,5,0,116,6,0,102,2,0,125,2,0, - 124,0,0,124,1,0,124,2,0,103,3,0,83,41,1,122, - 95,82,101,116,117,114,110,115,32,97,32,108,105,115,116,32, - 111,102,32,102,105,108,101,45,98,97,115,101,100,32,109,111, - 100,117,108,101,32,108,111,97,100,101,114,115,46,10,10,32, - 32,32,32,69,97,99,104,32,105,116,101,109,32,105,115,32, - 97,32,116,117,112,108,101,32,40,108,111,97,100,101,114,44, - 32,115,117,102,102,105,120,101,115,41,46,10,32,32,32,32, - 41,7,114,225,0,0,0,114,147,0,0,0,218,18,101,120, - 116,101,110,115,105,111,110,95,115,117,102,102,105,120,101,115, - 114,219,0,0,0,114,86,0,0,0,114,224,0,0,0,114, - 76,0,0,0,41,3,90,10,101,120,116,101,110,115,105,111, - 110,115,90,6,115,111,117,114,99,101,90,8,98,121,116,101, - 99,111,100,101,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,163,0,0,0,66,5,0,0,115,8,0,0, - 0,0,5,18,1,12,1,12,1,114,163,0,0,0,99,1, - 0,0,0,0,0,0,0,12,0,0,0,12,0,0,0,67, - 0,0,0,115,70,2,0,0,124,0,0,97,0,0,116,0, - 0,106,1,0,97,1,0,116,0,0,106,2,0,97,2,0, - 116,1,0,106,3,0,116,4,0,25,125,1,0,120,76,0, - 100,26,0,68,93,68,0,125,2,0,124,2,0,116,1,0, - 106,3,0,107,7,0,114,83,0,116,0,0,106,5,0,124, - 2,0,131,1,0,125,3,0,110,13,0,116,1,0,106,3, - 0,124,2,0,25,125,3,0,116,6,0,124,1,0,124,2, - 0,124,3,0,131,3,0,1,113,44,0,87,100,5,0,100, - 6,0,103,1,0,102,2,0,100,7,0,100,8,0,100,6, - 0,103,2,0,102,2,0,102,2,0,125,4,0,120,149,0, - 124,4,0,68,93,129,0,92,2,0,125,5,0,125,6,0, - 116,7,0,100,9,0,100,10,0,132,0,0,124,6,0,68, - 131,1,0,131,1,0,115,199,0,116,8,0,130,1,0,124, - 6,0,100,11,0,25,125,7,0,124,5,0,116,1,0,106, - 3,0,107,6,0,114,241,0,116,1,0,106,3,0,124,5, - 0,25,125,8,0,80,113,156,0,121,20,0,116,0,0,106, - 5,0,124,5,0,131,1,0,125,8,0,80,87,113,156,0, - 4,116,9,0,107,10,0,114,28,1,1,1,1,119,156,0, - 89,113,156,0,88,113,156,0,87,116,9,0,100,12,0,131, - 1,0,130,1,0,116,6,0,124,1,0,100,13,0,124,8, - 0,131,3,0,1,116,6,0,124,1,0,100,14,0,124,7, - 0,131,3,0,1,116,6,0,124,1,0,100,15,0,100,16, - 0,106,10,0,124,6,0,131,1,0,131,3,0,1,121,19, - 0,116,0,0,106,5,0,100,17,0,131,1,0,125,9,0, - 87,110,24,0,4,116,9,0,107,10,0,114,147,1,1,1, - 1,100,18,0,125,9,0,89,110,1,0,88,116,6,0,124, - 1,0,100,17,0,124,9,0,131,3,0,1,116,0,0,106, - 5,0,100,19,0,131,1,0,125,10,0,116,6,0,124,1, - 0,100,19,0,124,10,0,131,3,0,1,124,5,0,100,7, - 0,107,2,0,114,238,1,116,0,0,106,5,0,100,20,0, - 131,1,0,125,11,0,116,6,0,124,1,0,100,21,0,124, - 11,0,131,3,0,1,116,6,0,124,1,0,100,22,0,116, - 11,0,131,0,0,131,3,0,1,116,12,0,106,13,0,116, - 2,0,106,14,0,131,0,0,131,1,0,1,124,5,0,100, - 7,0,107,2,0,114,66,2,116,15,0,106,16,0,100,23, - 0,131,1,0,1,100,24,0,116,12,0,107,6,0,114,66, - 2,100,25,0,116,17,0,95,18,0,100,18,0,83,41,27, - 122,205,83,101,116,117,112,32,116,104,101,32,112,97,116,104, - 45,98,97,115,101,100,32,105,109,112,111,114,116,101,114,115, - 32,102,111,114,32,105,109,112,111,114,116,108,105,98,32,98, - 121,32,105,109,112,111,114,116,105,110,103,32,110,101,101,100, - 101,100,10,32,32,32,32,98,117,105,108,116,45,105,110,32, - 109,111,100,117,108,101,115,32,97,110,100,32,105,110,106,101, - 99,116,105,110,103,32,116,104,101,109,32,105,110,116,111,32, - 116,104,101,32,103,108,111,98,97,108,32,110,97,109,101,115, - 112,97,99,101,46,10,10,32,32,32,32,79,116,104,101,114, - 32,99,111,109,112,111,110,101,110,116,115,32,97,114,101,32, - 101,120,116,114,97,99,116,101,100,32,102,114,111,109,32,116, - 104,101,32,99,111,114,101,32,98,111,111,116,115,116,114,97, - 112,32,109,111,100,117,108,101,46,10,10,32,32,32,32,114, - 51,0,0,0,114,62,0,0,0,218,8,98,117,105,108,116, - 105,110,115,114,144,0,0,0,90,5,112,111,115,105,120,250, - 1,47,218,2,110,116,250,1,92,99,1,0,0,0,0,0, - 0,0,2,0,0,0,3,0,0,0,115,0,0,0,115,33, - 0,0,0,124,0,0,93,23,0,125,1,0,116,0,0,124, - 1,0,131,1,0,100,0,0,107,2,0,86,1,113,3,0, - 100,1,0,83,41,2,114,31,0,0,0,78,41,1,114,33, - 0,0,0,41,2,114,24,0,0,0,114,79,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,228, - 0,0,0,102,5,0,0,115,2,0,0,0,6,0,122,25, - 95,115,101,116,117,112,46,60,108,111,99,97,108,115,62,46, - 60,103,101,110,101,120,112,114,62,114,61,0,0,0,122,30, - 105,109,112,111,114,116,108,105,98,32,114,101,113,117,105,114, - 101,115,32,112,111,115,105,120,32,111,114,32,110,116,114,3, - 0,0,0,114,27,0,0,0,114,23,0,0,0,114,32,0, - 0,0,90,7,95,116,104,114,101,97,100,78,90,8,95,119, - 101,97,107,114,101,102,90,6,119,105,110,114,101,103,114,171, - 0,0,0,114,7,0,0,0,122,4,46,112,121,119,122,6, - 95,100,46,112,121,100,84,41,4,114,51,0,0,0,114,62, - 0,0,0,114,27,1,0,0,114,144,0,0,0,41,19,114, - 123,0,0,0,114,8,0,0,0,114,147,0,0,0,114,240, - 0,0,0,114,114,0,0,0,90,18,95,98,117,105,108,116, - 105,110,95,102,114,111,109,95,110,97,109,101,114,118,0,0, - 0,218,3,97,108,108,218,14,65,115,115,101,114,116,105,111, - 110,69,114,114,111,114,114,109,0,0,0,114,28,0,0,0, - 114,13,0,0,0,114,230,0,0,0,114,151,0,0,0,114, - 26,1,0,0,114,86,0,0,0,114,165,0,0,0,114,170, - 0,0,0,114,174,0,0,0,41,12,218,17,95,98,111,111, - 116,115,116,114,97,112,95,109,111,100,117,108,101,90,11,115, - 101,108,102,95,109,111,100,117,108,101,90,12,98,117,105,108, - 116,105,110,95,110,97,109,101,90,14,98,117,105,108,116,105, - 110,95,109,111,100,117,108,101,90,10,111,115,95,100,101,116, - 97,105,108,115,90,10,98,117,105,108,116,105,110,95,111,115, - 114,23,0,0,0,114,27,0,0,0,90,9,111,115,95,109, - 111,100,117,108,101,90,13,116,104,114,101,97,100,95,109,111, - 100,117,108,101,90,14,119,101,97,107,114,101,102,95,109,111, - 100,117,108,101,90,13,119,105,110,114,101,103,95,109,111,100, - 117,108,101,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,6,95,115,101,116,117,112,77,5,0,0,115,82, - 0,0,0,0,8,6,1,9,1,9,3,13,1,13,1,15, - 1,18,2,13,1,20,3,33,1,19,2,31,1,10,1,15, - 1,13,1,4,2,3,1,15,1,5,1,13,1,12,2,12, - 1,16,1,16,1,25,3,3,1,19,1,13,2,11,1,16, - 3,15,1,16,3,12,1,15,1,16,3,19,1,19,1,12, - 1,13,1,12,1,114,34,1,0,0,99,1,0,0,0,0, - 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, - 116,0,0,0,116,0,0,124,0,0,131,1,0,1,116,1, - 0,131,0,0,125,1,0,116,2,0,106,3,0,106,4,0, - 116,5,0,106,6,0,124,1,0,140,0,0,103,1,0,131, - 1,0,1,116,7,0,106,8,0,100,1,0,107,2,0,114, - 78,0,116,2,0,106,9,0,106,10,0,116,11,0,131,1, - 0,1,116,2,0,106,9,0,106,10,0,116,12,0,131,1, - 0,1,116,5,0,124,0,0,95,5,0,116,13,0,124,0, - 0,95,13,0,100,2,0,83,41,3,122,41,73,110,115,116, - 97,108,108,32,116,104,101,32,112,97,116,104,45,98,97,115, - 101,100,32,105,109,112,111,114,116,32,99,111,109,112,111,110, - 101,110,116,115,46,114,29,1,0,0,78,41,14,114,34,1, - 0,0,114,163,0,0,0,114,8,0,0,0,114,255,0,0, - 0,114,151,0,0,0,114,7,1,0,0,114,20,1,0,0, - 114,3,0,0,0,114,114,0,0,0,218,9,109,101,116,97, - 95,112,97,116,104,114,165,0,0,0,114,170,0,0,0,114, - 250,0,0,0,114,219,0,0,0,41,2,114,33,1,0,0, - 90,17,115,117,112,112,111,114,116,101,100,95,108,111,97,100, - 101,114,115,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,8,95,105,110,115,116,97,108,108,145,5,0,0, - 115,16,0,0,0,0,2,10,1,9,1,28,1,15,1,16, - 1,16,4,9,1,114,36,1,0,0,41,1,114,0,0,0, - 0,41,2,114,1,0,0,0,114,2,0,0,0,41,59,114, - 116,0,0,0,114,12,0,0,0,90,37,95,67,65,83,69, - 95,73,78,83,69,78,83,73,84,73,86,69,95,80,76,65, - 84,70,79,82,77,83,95,66,89,84,69,83,95,75,69,89, - 114,11,0,0,0,114,13,0,0,0,114,19,0,0,0,114, - 21,0,0,0,114,30,0,0,0,114,40,0,0,0,114,41, - 0,0,0,114,45,0,0,0,114,46,0,0,0,114,48,0, - 0,0,114,57,0,0,0,218,4,116,121,112,101,218,8,95, - 95,99,111,100,101,95,95,114,146,0,0,0,114,17,0,0, - 0,114,137,0,0,0,114,16,0,0,0,114,20,0,0,0, - 90,17,95,82,65,87,95,77,65,71,73,67,95,78,85,77, - 66,69,82,114,75,0,0,0,114,74,0,0,0,114,86,0, - 0,0,114,76,0,0,0,90,23,68,69,66,85,71,95,66, - 89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,83, - 90,27,79,80,84,73,77,73,90,69,68,95,66,89,84,69, - 67,79,68,69,95,83,85,70,70,73,88,69,83,114,81,0, - 0,0,114,87,0,0,0,114,93,0,0,0,114,97,0,0, - 0,114,99,0,0,0,114,107,0,0,0,114,125,0,0,0, - 114,132,0,0,0,114,143,0,0,0,114,149,0,0,0,114, - 152,0,0,0,114,157,0,0,0,218,6,111,98,106,101,99, - 116,114,164,0,0,0,114,169,0,0,0,114,170,0,0,0, - 114,185,0,0,0,114,195,0,0,0,114,211,0,0,0,114, - 219,0,0,0,114,224,0,0,0,114,230,0,0,0,114,225, - 0,0,0,114,231,0,0,0,114,248,0,0,0,114,250,0, - 0,0,114,7,1,0,0,114,25,1,0,0,114,163,0,0, - 0,114,34,1,0,0,114,36,1,0,0,114,4,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, - 8,60,109,111,100,117,108,101,62,8,0,0,0,115,106,0, - 0,0,6,16,6,1,6,1,3,1,7,3,12,17,12,5, - 12,5,12,6,12,12,12,10,12,9,12,5,12,7,15,22, - 15,114,22,1,18,2,6,1,6,2,9,2,9,2,10,2, - 21,44,12,33,12,19,12,12,12,12,18,8,12,28,12,17, - 21,55,21,12,18,10,12,14,9,3,12,1,15,65,19,64, - 19,28,22,110,19,41,25,43,25,16,6,3,25,53,19,57, - 19,41,19,134,19,146,15,23,12,11,12,68, + 218,8,60,109,111,100,117,108,101,62,8,0,0,0,115,114, + 0,0,0,6,16,6,1,6,1,3,1,7,3,12,17,12, + 5,12,5,12,6,12,12,12,10,12,9,12,5,12,7,15, + 22,15,114,22,1,18,19,12,1,6,1,12,1,22,2,6, + 1,6,2,9,2,9,2,10,2,21,44,12,33,12,19,12, + 12,12,12,18,8,12,28,12,17,21,57,21,12,18,10,12, + 14,9,3,12,1,15,65,19,64,19,28,22,110,19,41,25, + 43,25,16,6,3,25,53,19,57,19,41,19,134,19,146,15, + 23,12,11,12,68, }; diff --git a/Python/marshal.c b/Python/marshal.c index 5b8de99..67e32c8 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -549,7 +549,7 @@ w_complex_object(PyObject *v, char flag, WFILE *p) w_object(co->co_lnotab, p); } else if (PyObject_CheckBuffer(v)) { - /* Write unknown bytes-like objects as a byte string */ + /* Write unknown bytes-like objects as a bytes object */ Py_buffer view; if (PyObject_GetBuffer(v, &view, PyBUF_SIMPLE) != 0) { w_byte(TYPE_UNKNOWN, p); @@ -1079,7 +1079,7 @@ r_object(RFILE *p) if (PyErr_Occurred()) break; if (n < 0 || n > SIZE32_MAX) { - PyErr_SetString(PyExc_ValueError, "bad marshal data (string size out of range)"); + PyErr_SetString(PyExc_ValueError, "bad marshal data (bytes object size out of range)"); break; } v = PyBytes_FromStringAndSize((char *)NULL, n); @@ -1103,7 +1103,7 @@ r_object(RFILE *p) if (PyErr_Occurred()) break; if (n < 0 || n > SIZE32_MAX) { - PyErr_SetString(PyExc_ValueError, "bad marshal data (unicode size out of range)"); + PyErr_SetString(PyExc_ValueError, "bad marshal data (string size out of range)"); break; } goto _read_ascii; @@ -1143,7 +1143,7 @@ r_object(RFILE *p) if (PyErr_Occurred()) break; if (n < 0 || n > SIZE32_MAX) { - PyErr_SetString(PyExc_ValueError, "bad marshal data (unicode size out of range)"); + PyErr_SetString(PyExc_ValueError, "bad marshal data (string size out of range)"); break; } if (n != 0) { @@ -1594,7 +1594,7 @@ PyMarshal_WriteObjectToString(PyObject *x, int version) if (wf.ptr - base > PY_SSIZE_T_MAX) { Py_DECREF(wf.str); PyErr_SetString(PyExc_OverflowError, - "too much marshal data for a string"); + "too much marshal data for a bytes object"); return NULL; } if (_PyBytes_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)) < 0) @@ -1640,8 +1640,7 @@ PyDoc_STRVAR(dump_doc, "dump(value, file[, version])\n\ \n\ Write the value on the open file. The value must be a supported type.\n\ -The file must be an open file object such as sys.stdout or returned by\n\ -open() or os.popen(). It must be opened in binary mode ('wb' or 'w+b').\n\ +The file must be a writeable binary file.\n\ \n\ If the value has (or contains an object that has) an unsupported type, a\n\ ValueError exception is raised - but garbage data will also be written\n\ @@ -1697,8 +1696,7 @@ PyDoc_STRVAR(load_doc, Read one value from the open file and return it. If no valid value is\n\ read (e.g. because the data has a different Python version's\n\ incompatible marshal format), raise EOFError, ValueError or TypeError.\n\ -The file must be an open file object opened in binary mode ('rb' or\n\ -'r+b').\n\ +The file must be a readable binary file.\n\ \n\ Note: If an object containing an unsupported type was marshalled with\n\ dump(), load() will substitute None for the unmarshallable type."); @@ -1717,7 +1715,7 @@ marshal_dumps(PyObject *self, PyObject *args) PyDoc_STRVAR(dumps_doc, "dumps(value[, version])\n\ \n\ -Return the string that would be written to a file by dump(value, file).\n\ +Return the bytes object that would be written to a file by dump(value, file).\n\ The value must be a supported type. Raise a ValueError exception if\n\ value has (or contains an object that has) an unsupported type.\n\ \n\ @@ -1753,8 +1751,8 @@ marshal_loads(PyObject *self, PyObject *args) PyDoc_STRVAR(loads_doc, "loads(bytes)\n\ \n\ -Convert the bytes object to a value. If no valid value is found, raise\n\ -EOFError, ValueError or TypeError. Extra characters in the input are\n\ +Convert the bytes-like object to a value. If no valid value is found,\n\ +raise EOFError, ValueError or TypeError. Extra bytes in the input are\n\ ignored."); static PyMethodDef marshal_methods[] = { @@ -1792,8 +1790,8 @@ Functions:\n\ \n\ dump() -- write value to a file\n\ load() -- read value from a file\n\ -dumps() -- write value to a string\n\ -loads() -- read value from a string"); +dumps() -- marshal value as a bytes object\n\ +loads() -- read value from a bytes-like object"); diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index ce52990..422454c 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -85,7 +85,7 @@ int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */ int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */ int Py_FrozenFlag; /* Needed by getpath.c */ int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */ -int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */ +int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.pyc) */ int Py_NoUserSiteDirectory = 0; /* for -s and site.py */ int Py_UnbufferedStdioFlag = 0; /* Unbuffered binary std{in,out,err} */ int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */ @@ -968,6 +968,14 @@ initsite(void) static int is_valid_fd(int fd) { +#ifdef __APPLE__ + /* bpo-30225: On macOS Tiger, when stdout is redirected to a pipe + and the other side of the pipe is closed, dup(1) succeed, whereas + fstat(1, &st) fails with EBADF. Prefer fstat() over dup() to detect + such error. */ + struct stat st; + return (fstat(fd, &st) == 0); +#else int fd2; if (fd < 0 || !_PyVerify_fd(fd)) return 0; @@ -977,6 +985,7 @@ is_valid_fd(int fd) close(fd2); _Py_END_SUPPRESS_IPH return fd2 >= 0; +#endif } /* returns Py_None if the fd is not valid */ diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 90cb2de..dd41a3a 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -259,6 +259,21 @@ PyRun_InteractiveOneFlags(FILE *fp, const char *filename_str, PyCompilerFlags *f } +/* Issue #29537: handle issue27286 bytecode incompatibility + * See Lib/importlib/_bootstrap_external.py for general discussion + */ +extern PY_UINT32_T _Py_BACKCOMPAT_HALF_MAGIC; +static int +_check_half_magic(unsigned int read_value, unsigned int halfmagic) { + return (read_value == halfmagic || read_value == _Py_BACKCOMPAT_HALF_MAGIC); +} + +extern PY_UINT32_T _Py_BACKCOMPAT_MAGIC_NUMBER; +static int +_check_magic(long read_value, long magic) { + return (read_value == magic || read_value == _Py_BACKCOMPAT_MAGIC_NUMBER); +} + /* Check whether a file maybe a pyc file: Look at the extension, the file type, and, if we may close it, at the first few bytes. */ @@ -290,7 +305,7 @@ maybe_pyc_file(FILE *fp, const char* filename, const char* ext, int closeit) int ispyc = 0; if (ftell(fp) == 0) { if (fread(buf, 1, 2, fp) == 2 && - ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic) + _check_half_magic(((unsigned int)buf[1]<<8 | buf[0]), halfmagic)) ispyc = 1; rewind(fp); } @@ -988,7 +1003,7 @@ run_pyc_file(FILE *fp, const char *filename, PyObject *globals, long PyImport_GetMagicNumber(void); magic = PyMarshal_ReadLongFromFile(fp); - if (magic != PyImport_GetMagicNumber()) { + if (!_check_magic(magic, PyImport_GetMagicNumber())) { if (!PyErr_Occurred()) PyErr_SetString(PyExc_RuntimeError, "Bad magic number in .pyc file"); diff --git a/Python/random.c b/Python/random.c index d203939..31f61d0 100644 --- a/Python/random.c +++ b/Python/random.c @@ -1,6 +1,9 @@ #include "Python.h" #ifdef MS_WINDOWS # include +/* All sample MSDN wincrypt programs include the header below. It is at least + * required with Min GW. */ +# include #else # include # ifdef HAVE_SYS_STAT_H @@ -37,10 +40,9 @@ win32_urandom_init(int raise) return 0; error: - if (raise) + if (raise) { PyErr_SetFromWindowsErr(0); - else - Py_FatalError("Failed to initialize Windows random API (CryptoGen)"); + } return -1; } @@ -53,8 +55,9 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise) if (hCryptProv == 0) { - if (win32_urandom_init(raise) == -1) + if (win32_urandom_init(raise) == -1) { return -1; + } } while (size > 0) @@ -63,11 +66,9 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise) if (!CryptGenRandom(hCryptProv, (DWORD)chunk, buffer)) { /* CryptGenRandom() failed */ - if (raise) + if (raise) { PyErr_SetFromWindowsErr(0); - else - Py_FatalError("Failed to initialized the randomized hash " - "secret using CryptoGen)"); + } return -1; } buffer += chunk; @@ -76,58 +77,23 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise) return 0; } -/* Issue #25003: Don't use getentropy() on Solaris (available since - * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ -#elif defined(HAVE_GETENTROPY) && !defined(sun) -#define PY_GETENTROPY 1 - -/* Fill buffer with size pseudo-random bytes generated by getentropy(). - Return 0 on success, or raise an exception and return -1 on error. - - If fatal is nonzero, call Py_FatalError() instead of raising an exception - on error. */ -static int -py_getentropy(unsigned char *buffer, Py_ssize_t size, int fatal) -{ - while (size > 0) { - Py_ssize_t len = Py_MIN(size, 256); - int res; - - if (!fatal) { - Py_BEGIN_ALLOW_THREADS - res = getentropy(buffer, len); - Py_END_ALLOW_THREADS - - if (res < 0) { - PyErr_SetFromErrno(PyExc_OSError); - return -1; - } - } - else { - res = getentropy(buffer, len); - if (res < 0) - Py_FatalError("getentropy() failed"); - } - - buffer += len; - size -= len; - } - return 0; -} - -#else +#else /* !MS_WINDOWS */ #if defined(HAVE_GETRANDOM) || defined(HAVE_GETRANDOM_SYSCALL) #define PY_GETRANDOM 1 -/* Call getrandom() +/* Call getrandom() to get random bytes: + - Return 1 on success - - Return 0 if getrandom() syscall is not available (failed with ENOSYS or - EPERM) or if getrandom(GRND_NONBLOCK) failed with EAGAIN (system urandom - not initialized yet) and raise=0. + - Return 0 if getrandom() is not available (failed with ENOSYS or EPERM), + or if getrandom(GRND_NONBLOCK) failed with EAGAIN (system urandom not + initialized yet). - Raise an exception (if raise is non-zero) and return -1 on error: - getrandom() failed with EINTR and the Python signal handler raised an - exception, or getrandom() failed with a different error. */ + if getrandom() failed with EINTR, raise is non-zero and the Python signal + handler raised an exception, or if getrandom() failed with a different + error. + + getrandom() is retried if it failed with EINTR: interrupted by a signal. */ static int py_getrandom(void *buffer, Py_ssize_t size, int raise) { @@ -142,16 +108,19 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise) * see https://bugs.python.org/issue26839. To avoid this, use the * GRND_NONBLOCK flag. */ const int flags = GRND_NONBLOCK; + char *dest; long n; if (!getrandom_works) { return 0; } + dest = buffer; while (0 < size) { #ifdef sun /* Issue #26735: On Solaris, getrandom() is limited to returning up - to 1024 bytes */ + to 1024 bytes. Call it multiple times if more bytes are + requested. */ n = Py_MIN(size, 1024); #else n = Py_MIN(size, LONG_MAX); @@ -161,34 +130,35 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise) #ifdef HAVE_GETRANDOM if (raise) { Py_BEGIN_ALLOW_THREADS - n = getrandom(buffer, n, flags); + n = getrandom(dest, n, flags); Py_END_ALLOW_THREADS } else { - n = getrandom(buffer, n, flags); + n = getrandom(dest, n, flags); } #else /* On Linux, use the syscall() function because the GNU libc doesn't - * expose the Linux getrandom() syscall yet. See: - * https://sourceware.org/bugzilla/show_bug.cgi?id=17252 */ + expose the Linux getrandom() syscall yet. See: + https://sourceware.org/bugzilla/show_bug.cgi?id=17252 */ if (raise) { Py_BEGIN_ALLOW_THREADS - n = syscall(SYS_getrandom, buffer, n, flags); + n = syscall(SYS_getrandom, dest, n, flags); Py_END_ALLOW_THREADS } else { - n = syscall(SYS_getrandom, buffer, n, flags); + n = syscall(SYS_getrandom, dest, n, flags); } #endif if (n < 0) { - /* ENOSYS: getrandom() syscall not supported by the kernel (but - * maybe supported by the host which built Python). EPERM: - * getrandom() syscall blocked by SECCOMP or something else. */ + /* ENOSYS: the syscall is not supported by the kernel. + EPERM: the syscall is blocked by a security policy (ex: SECCOMP) + or something else. */ if (errno == ENOSYS || errno == EPERM) { getrandom_works = 0; return 0; } + if (errno == EAGAIN) { /* getrandom(GRND_NONBLOCK) fails with EAGAIN if the system urandom is not initialiazed yet. In this case, fall back on @@ -202,169 +172,225 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise) } if (errno == EINTR) { - if (PyErr_CheckSignals()) { - if (!raise) { - Py_FatalError("getrandom() interrupted by a signal"); + if (raise) { + if (PyErr_CheckSignals()) { + return -1; } - return -1; } - /* retry getrandom() */ + /* retry getrandom() if it was interrupted by a signal */ continue; } if (raise) { PyErr_SetFromErrno(PyExc_OSError); } - else { - Py_FatalError("getrandom() failed"); - } return -1; } - buffer += n; + dest += n; size -= n; } return 1; } -#endif -static struct { - int fd; - dev_t st_dev; - ino_t st_ino; -} urandom_cache = { -1 }; +#elif defined(HAVE_GETENTROPY) +#define PY_GETENTROPY 1 +/* Fill buffer with size pseudo-random bytes generated by getentropy(): -/* Read 'size' random bytes from py_getrandom(). Fall back on reading from - /dev/urandom if getrandom() is not available. + - Return 1 on success + - Return 0 if getentropy() syscall is not available (failed with ENOSYS or + EPERM). + - Raise an exception (if raise is non-zero) and return -1 on error: + if getentropy() failed with EINTR, raise is non-zero and the Python signal + handler raised an exception, or if getentropy() failed with a different + error. - Call Py_FatalError() on error. */ -static void -dev_urandom_noraise(unsigned char *buffer, Py_ssize_t size) + getentropy() is retried if it failed with EINTR: interrupted by a signal. */ +static int +py_getentropy(char *buffer, Py_ssize_t size, int raise) { - int fd; - Py_ssize_t n; + /* Is getentropy() supported by the running kernel? Set to 0 if + getentropy() failed with ENOSYS or EPERM. */ + static int getentropy_works = 1; - assert (0 < size); - -#ifdef PY_GETRANDOM - if (py_getrandom(buffer, size, 0) == 1) { - return; + if (!getentropy_works) { + return 0; } - /* getrandom() failed with ENOSYS or EPERM, - fall back on reading /dev/urandom */ -#endif - fd = _Py_open_noraise("/dev/urandom", O_RDONLY); - if (fd < 0) { - Py_FatalError("Failed to open /dev/urandom"); - } + while (size > 0) { + /* getentropy() is limited to returning up to 256 bytes. Call it + multiple times if more bytes are requested. */ + Py_ssize_t len = Py_MIN(size, 256); + int res; - while (0 < size) - { - do { - n = read(fd, buffer, (size_t)size); - } while (n < 0 && errno == EINTR); + if (raise) { + Py_BEGIN_ALLOW_THREADS + res = getentropy(buffer, len); + Py_END_ALLOW_THREADS + } + else { + res = getentropy(buffer, len); + } - if (n <= 0) { - /* read() failed or returned 0 bytes */ - Py_FatalError("Failed to read bytes from /dev/urandom"); - break; + if (res < 0) { + /* ENOSYS: the syscall is not supported by the running kernel. + EPERM: the syscall is blocked by a security policy (ex: SECCOMP) + or something else. */ + if (errno == ENOSYS || errno == EPERM) { + getentropy_works = 0; + return 0; + } + + if (errno == EINTR) { + if (raise) { + if (PyErr_CheckSignals()) { + return -1; + } + } + + /* retry getentropy() if it was interrupted by a signal */ + continue; + } + + if (raise) { + PyErr_SetFromErrno(PyExc_OSError); + } + return -1; } - buffer += n; - size -= n; + + buffer += len; + size -= len; } - close(fd); + return 1; } +#endif /* defined(HAVE_GETENTROPY) && !defined(sun) */ -/* Read 'size' random bytes from py_getrandom(). Fall back on reading from - /dev/urandom if getrandom() is not available. - Return 0 on success. Raise an exception and return -1 on error. */ +static struct { + int fd; + dev_t st_dev; + ino_t st_ino; +} urandom_cache = { -1 }; + +/* Read random bytes from the /dev/urandom device: + + - Return 0 on success + - Raise an exception (if raise is non-zero) and return -1 on error + + Possible causes of errors: + + - open() failed with ENOENT, ENXIO, ENODEV, EACCES: the /dev/urandom device + was not found. For example, it was removed manually or not exposed in a + chroot or container. + - open() failed with a different error + - fstat() failed + - read() failed or returned 0 + + read() is retried if it failed with EINTR: interrupted by a signal. + + The file descriptor of the device is kept open between calls to avoid using + many file descriptors when run in parallel from multiple threads: + see the issue #18756. + + st_dev and st_ino fields of the file descriptor (from fstat()) are cached to + check if the file descriptor was replaced by a different file (which is + likely a bug in the application): see the issue #21207. + + If the file descriptor was closed or replaced, open a new file descriptor + but don't close the old file descriptor: it probably points to something + important for some third-party code. */ static int -dev_urandom_python(char *buffer, Py_ssize_t size) +dev_urandom(char *buffer, Py_ssize_t size, int raise) { int fd; Py_ssize_t n; - struct _Py_stat_struct st; -#ifdef PY_GETRANDOM - int res; -#endif - - if (size <= 0) - return 0; -#ifdef PY_GETRANDOM - res = py_getrandom(buffer, size, 1); - if (res < 0) { - return -1; - } - if (res == 1) { - return 0; - } - /* getrandom() failed with ENOSYS or EPERM, - fall back on reading /dev/urandom */ -#endif + if (raise) { + struct _Py_stat_struct st; - if (urandom_cache.fd >= 0) { - /* Does the fd point to the same thing as before? (issue #21207) */ - if (_Py_fstat_noraise(urandom_cache.fd, &st) - || st.st_dev != urandom_cache.st_dev - || st.st_ino != urandom_cache.st_ino) { - /* Something changed: forget the cached fd (but don't close it, - since it probably points to something important for some - third-party code). */ - urandom_cache.fd = -1; - } - } - if (urandom_cache.fd >= 0) - fd = urandom_cache.fd; - else { - fd = _Py_open("/dev/urandom", O_RDONLY); - if (fd < 0) { - if (errno == ENOENT || errno == ENXIO || - errno == ENODEV || errno == EACCES) - PyErr_SetString(PyExc_NotImplementedError, - "/dev/urandom (or equivalent) not found"); - /* otherwise, keep the OSError exception raised by _Py_open() */ - return -1; - } if (urandom_cache.fd >= 0) { - /* urandom_fd was initialized by another thread while we were - not holding the GIL, keep it. */ - close(fd); - fd = urandom_cache.fd; + /* Does the fd point to the same thing as before? (issue #21207) */ + if (_Py_fstat_noraise(urandom_cache.fd, &st) + || st.st_dev != urandom_cache.st_dev + || st.st_ino != urandom_cache.st_ino) { + /* Something changed: forget the cached fd (but don't close it, + since it probably points to something important for some + third-party code). */ + urandom_cache.fd = -1; + } } + if (urandom_cache.fd >= 0) + fd = urandom_cache.fd; else { - if (_Py_fstat(fd, &st)) { - close(fd); + fd = _Py_open("/dev/urandom", O_RDONLY); + if (fd < 0) { + if (errno == ENOENT || errno == ENXIO || + errno == ENODEV || errno == EACCES) { + PyErr_SetString(PyExc_NotImplementedError, + "/dev/urandom (or equivalent) not found"); + } + /* otherwise, keep the OSError exception raised by _Py_open() */ return -1; } + if (urandom_cache.fd >= 0) { + /* urandom_fd was initialized by another thread while we were + not holding the GIL, keep it. */ + close(fd); + fd = urandom_cache.fd; + } else { - urandom_cache.fd = fd; - urandom_cache.st_dev = st.st_dev; - urandom_cache.st_ino = st.st_ino; + if (_Py_fstat(fd, &st)) { + close(fd); + return -1; + } + else { + urandom_cache.fd = fd; + urandom_cache.st_dev = st.st_dev; + urandom_cache.st_ino = st.st_ino; + } } } - } - do { - n = _Py_read(fd, buffer, (size_t)size); - if (n == -1) { - return -1; - } - if (n == 0) { - PyErr_Format(PyExc_RuntimeError, - "Failed to read %zi bytes from /dev/urandom", - size); + do { + n = _Py_read(fd, buffer, (size_t)size); + if (n == -1) + return -1; + if (n == 0) { + PyErr_Format(PyExc_RuntimeError, + "Failed to read %zi bytes from /dev/urandom", + size); + return -1; + } + + buffer += n; + size -= n; + } while (0 < size); + } + else { + fd = _Py_open_noraise("/dev/urandom", O_RDONLY); + if (fd < 0) { return -1; } - buffer += n; - size -= n; - } while (0 < size); + while (0 < size) + { + do { + n = read(fd, buffer, (size_t)size); + } while (n < 0 && errno == EINTR); + if (n <= 0) { + /* stop on error or if read(size) returned 0 */ + close(fd); + return -1; + } + + buffer += n; + size -= n; + } + close(fd); + } return 0; } @@ -376,8 +402,8 @@ dev_urandom_close(void) urandom_cache.fd = -1; } } +#endif /* !MS_WINDOWS */ -#endif /* Fill buffer with pseudo-random bytes generated by a linear congruent generator (LCG): @@ -400,31 +426,100 @@ lcg_urandom(unsigned int x0, unsigned char *buffer, size_t size) } } -/* Fill buffer with size pseudo-random bytes from the operating system random - number generator (RNG). It is suitable for most cryptographic purposes - except long living private keys for asymmetric encryption. +/* Read random bytes: - Return 0 on success, raise an exception and return -1 on error. */ -int -_PyOS_URandom(void *buffer, Py_ssize_t size) + - Return 0 on success + - Raise an exception (if raise is non-zero) and return -1 on error + + Used sources of entropy ordered by preference, preferred source first: + + - CryptGenRandom() on Windows + - getrandom() function (ex: Linux and Solaris): call py_getrandom() + - getentropy() function (ex: OpenBSD): call py_getentropy() + - /dev/urandom device + + Read from the /dev/urandom device if getrandom() or getentropy() function + is not available or does not work. + + Prefer getrandom() over getentropy() because getrandom() supports blocking + and non-blocking mode and Python requires non-blocking RNG at startup to + initialize its hash secret: see the PEP 524. + + Prefer getrandom() and getentropy() over reading directly /dev/urandom + because these functions don't need file descriptors and so avoid ENFILE or + EMFILE errors (too many open files): see the issue #18756. + + Only use RNG running in the kernel. They are more secure because it is + harder to get the internal state of a RNG running in the kernel land than a + RNG running in the user land. The kernel has a direct access to the hardware + and has access to hardware RNG, they are used as entropy sources. + + Note: the OpenSSL RAND_pseudo_bytes() function does not automatically reseed + its RNG on fork(), two child processes (with the same pid) generate the same + random numbers: see issue #18747. Kernel RNGs don't have this issue, + they have access to good quality entropy sources. + + If raise is zero: + + - Don't raise an exception on error + - Don't call the Python signal handler (don't call PyErr_CheckSignals()) if + a function fails with EINTR: retry directly the interrupted function + - Don't release the GIL to call functions. +*/ +static int +pyurandom(void *buffer, Py_ssize_t size, int raise) { +#if defined(PY_GETRANDOM) || defined(PY_GETENTROPY) + int res; +#endif + if (size < 0) { - PyErr_Format(PyExc_ValueError, - "negative argument not allowed"); + if (raise) { + PyErr_Format(PyExc_ValueError, + "negative argument not allowed"); + } return -1; } - if (size == 0) + + if (size == 0) { return 0; + } #ifdef MS_WINDOWS - return win32_urandom((unsigned char *)buffer, size, 1); -#elif defined(PY_GETENTROPY) - return py_getentropy(buffer, size, 0); + return win32_urandom((unsigned char *)buffer, size, raise); +#else + +#if defined(PY_GETRANDOM) || defined(PY_GETENTROPY) +#ifdef PY_GETRANDOM + res = py_getrandom(buffer, size, raise); #else - return dev_urandom_python((char*)buffer, size); + res = py_getentropy(buffer, size, raise); +#endif + if (res < 0) { + return -1; + } + if (res == 1) { + return 0; + } + /* getrandom() or getentropy() function is not available: failed with + ENOSYS, EPERM or EAGAIN. Fall back on reading from /dev/urandom. */ +#endif + + return dev_urandom(buffer, size, raise); #endif } +/* Fill buffer with size pseudo-random bytes from the operating system random + number generator (RNG). It is suitable for most cryptographic purposes + except long living private keys for asymmetric encryption. + + Return 0 on success. Raise an exception and return -1 on error. */ +int +_PyOS_URandom(void *buffer, Py_ssize_t size) +{ + return pyurandom(buffer, size, 1); +} + void _PyRandom_Init(void) { @@ -463,13 +558,14 @@ _PyRandom_Init(void) } } else { -#ifdef MS_WINDOWS - (void)win32_urandom(secret, secret_size, 0); -#elif defined(PY_GETENTROPY) - (void)py_getentropy(secret, secret_size, 1); -#else - dev_urandom_noraise(secret, secret_size); -#endif + int res; + + /* _PyRandom_Init() is called very early in the Python initialization + and so exceptions cannot be used (use raise=0). */ + res = pyurandom(secret, secret_size, 0); + if (res < 0) { + Py_FatalError("failed to get random numbers to initialize Python"); + } } } @@ -481,8 +577,6 @@ _PyRandom_Fini(void) CryptReleaseContext(hCryptProv, 0); hCryptProv = 0; } -#elif defined(PY_GETENTROPY) - /* nothing to clean */ #else dev_urandom_close(); #endif diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 1dc7d7c..d62bbf1 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -897,10 +897,10 @@ sys_getwindowsversion(PyObject *self) } PyMem_RawFree(verblock); } - PyStructSequence_SET_ITEM(version, pos++, PyTuple_Pack(3, - PyLong_FromLong(realMajor), - PyLong_FromLong(realMinor), - PyLong_FromLong(realBuild) + PyStructSequence_SET_ITEM(version, pos++, Py_BuildValue("(kkk)", + realMajor, + realMinor, + realBuild )); if (PyErr_Occurred()) { @@ -1816,9 +1816,9 @@ _PySys_Init(void) PyUnicode_FromString(Py_GetVersion())); SET_SYS_FROM_STRING("hexversion", PyLong_FromLong(PY_VERSION_HEX)); - SET_SYS_FROM_STRING("_mercurial", - Py_BuildValue("(szz)", "CPython", _Py_hgidentifier(), - _Py_hgversion())); + SET_SYS_FROM_STRING("_git", + Py_BuildValue("(szz)", "CPython", _Py_gitidentifier(), + _Py_gitversion())); SET_SYS_FROM_STRING("dont_write_bytecode", PyBool_FromLong(Py_DontWriteBytecodeFlag)); SET_SYS_FROM_STRING("api_version", diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index 27e0dc8..8e42262 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -464,61 +464,66 @@ PyLockStatus PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds, int intr_flag) { - PyLockStatus success; + PyLockStatus success = PY_LOCK_FAILURE; pthread_lock *thelock = (pthread_lock *)lock; int status, error = 0; dprintf(("PyThread_acquire_lock_timed(%p, %lld, %d) called\n", lock, microseconds, intr_flag)); - status = pthread_mutex_lock( &thelock->mut ); - CHECK_STATUS("pthread_mutex_lock[1]"); - - if (thelock->locked == 0) { - success = PY_LOCK_ACQUIRED; - } else if (microseconds == 0) { - success = PY_LOCK_FAILURE; - } else { - struct timespec ts; - if (microseconds > 0) - MICROSECONDS_TO_TIMESPEC(microseconds, ts); - /* continue trying until we get the lock */ - - /* mut must be locked by me -- part of the condition - * protocol */ - success = PY_LOCK_FAILURE; - while (success == PY_LOCK_FAILURE) { - if (microseconds > 0) { - status = pthread_cond_timedwait( - &thelock->lock_released, - &thelock->mut, &ts); - if (status == ETIMEDOUT) + if (microseconds == 0) { + status = pthread_mutex_trylock( &thelock->mut ); + if (status != EBUSY) + CHECK_STATUS("pthread_mutex_trylock[1]"); + } + else { + status = pthread_mutex_lock( &thelock->mut ); + CHECK_STATUS("pthread_mutex_lock[1]"); + } + if (status == 0) { + if (thelock->locked == 0) { + success = PY_LOCK_ACQUIRED; + } + else if (microseconds != 0) { + struct timespec ts; + if (microseconds > 0) + MICROSECONDS_TO_TIMESPEC(microseconds, ts); + /* continue trying until we get the lock */ + + /* mut must be locked by me -- part of the condition + * protocol */ + while (success == PY_LOCK_FAILURE) { + if (microseconds > 0) { + status = pthread_cond_timedwait( + &thelock->lock_released, + &thelock->mut, &ts); + if (status == ETIMEDOUT) + break; + CHECK_STATUS("pthread_cond_timed_wait"); + } + else { + status = pthread_cond_wait( + &thelock->lock_released, + &thelock->mut); + CHECK_STATUS("pthread_cond_wait"); + } + + if (intr_flag && status == 0 && thelock->locked) { + /* We were woken up, but didn't get the lock. We probably received + * a signal. Return PY_LOCK_INTR to allow the caller to handle + * it and retry. */ + success = PY_LOCK_INTR; break; - CHECK_STATUS("pthread_cond_timed_wait"); - } - else { - status = pthread_cond_wait( - &thelock->lock_released, - &thelock->mut); - CHECK_STATUS("pthread_cond_wait"); - } - - if (intr_flag && status == 0 && thelock->locked) { - /* We were woken up, but didn't get the lock. We probably received - * a signal. Return PY_LOCK_INTR to allow the caller to handle - * it and retry. */ - success = PY_LOCK_INTR; - break; - } else if (status == 0 && !thelock->locked) { - success = PY_LOCK_ACQUIRED; - } else { - success = PY_LOCK_FAILURE; + } + else if (status == 0 && !thelock->locked) { + success = PY_LOCK_ACQUIRED; + } } } + if (success == PY_LOCK_ACQUIRED) thelock->locked = 1; + status = pthread_mutex_unlock( &thelock->mut ); + CHECK_STATUS("pthread_mutex_unlock[1]"); } - if (success == PY_LOCK_ACQUIRED) thelock->locked = 1; - status = pthread_mutex_unlock( &thelock->mut ); - CHECK_STATUS("pthread_mutex_unlock[1]"); if (error) success = PY_LOCK_FAILURE; dprintf(("PyThread_acquire_lock_timed(%p, %lld, %d) -> %d\n", diff --git a/README b/README index de3a091..d94f259 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 3.5.3 +This is Python version 3.5.4 ============================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, @@ -11,6 +11,14 @@ especially how built-in objects like dictionaries and strings work, have changed considerably, and a lot of deprecated features have finally been removed. +Using Python +------------ + +Installable Python kits, and information about using Python, are available at +`python.org`_. + +.. _python.org: https://www.python.org/ + Build Instructions ------------------ @@ -151,7 +159,7 @@ IMPORTANT: If the tests fail and you decide to mail a bug report, *don't* include the output of "make test". It is useless. Run the failing test manually, as follows: - ./python -m test -v test_whatever + ./python -m test -v test_whatever (substituting the top of the source tree for '.' if you built in a different directory). This runs the test in verbose mode. @@ -198,11 +206,12 @@ Proposals for enhancement ------------------------- If you have a proposal to change Python, you may want to send an email to the -comp.lang.python or python-ideas mailing lists for inital feedback. A Python +comp.lang.python or `python-ideas`_ mailing lists for initial feedback. A Python Enhancement Proposal (PEP) may be submitted if your idea gains ground. All current PEPs, as well as guidelines for submitting a new PEP, are listed at http://www.python.org/dev/peps/. +.. _python-ideas: https://mail.python.org/mailman/listinfo/python-ideas/ Release Schedule ---------------- @@ -214,7 +223,8 @@ Copyright and License Information --------------------------------- Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved. +2012, 2013, 2014, 2015, 2016, 2017 Python Software Foundation. All rights +reserved. Copyright (c) 2000 BeOpen.com. All rights reserved. diff --git a/Tools/README b/Tools/README index 0d961de..edbf4fb 100644 --- a/Tools/README +++ b/Tools/README @@ -45,4 +45,4 @@ unittestgui A Tkinter based GUI test runner for unittest, with test discovery. -(*) A generic benchmark suite is maintained separately at http://hg.python.org/benchmarks/ +(*) A generic benchmark suite is maintained separately at https://github.com/python/performance diff --git a/Tools/hg/hgtouch.py b/Tools/hg/hgtouch.py deleted file mode 100644 index 119d812..0000000 --- a/Tools/hg/hgtouch.py +++ /dev/null @@ -1,130 +0,0 @@ -"""Bring time stamps of generated checked-in files into the right order - -A versioned configuration file .hgtouch specifies generated files, in the -syntax of make rules. - - output: input1 input2 - -In addition to the dependency syntax, #-comments are supported. -""" -from __future__ import with_statement -import errno -import os -import time - -def parse_config(repo): - try: - fp = repo.wfile(".hgtouch") - except IOError, e: - if e.errno != errno.ENOENT: - raise - return {} - result = {} - with fp: - for line in fp: - # strip comments - line = line.split('#')[0].strip() - if ':' not in line: - continue - outputs, inputs = line.split(':', 1) - outputs = outputs.split() - inputs = inputs.split() - for o in outputs: - try: - result[o].extend(inputs) - except KeyError: - result[o] = inputs - return result - -def check_rule(ui, repo, modified, basedir, output, inputs): - """Verify that the output is newer than any of the inputs. - Return (status, stamp), where status is True if the update succeeded, - and stamp is the newest time stamp assigned to any file (might be in - the future). - - If basedir is nonempty, it gives a directory in which the tree is to - be checked. - """ - f_output = repo.wjoin(os.path.join(basedir, output)) - try: - o_time = os.stat(f_output).st_mtime - except OSError: - ui.warn("Generated file %s does not exist\n" % output) - return False, 0 - youngest = 0 # youngest dependency - backdate = None - backdate_source = None - for i in inputs: - f_i = repo.wjoin(os.path.join(basedir, i)) - try: - i_time = os.stat(f_i).st_mtime - except OSError: - ui.warn(".hgtouch input file %s does not exist\n" % i) - return False, 0 - if i in modified: - # input is modified. Need to backdate at least to i_time - if backdate is None or backdate > i_time: - backdate = i_time - backdate_source = i - continue - youngest = max(i_time, youngest) - if backdate is not None: - ui.warn("Input %s for file %s locally modified\n" % (backdate_source, output)) - # set to 1s before oldest modified input - backdate -= 1 - os.utime(f_output, (backdate, backdate)) - return False, 0 - if youngest >= o_time: - ui.note("Touching %s\n" % output) - youngest += 1 - os.utime(f_output, (youngest, youngest)) - return True, youngest - else: - # Nothing to update - return True, 0 - -def do_touch(ui, repo, basedir): - if basedir: - if not os.path.isdir(repo.wjoin(basedir)): - ui.warn("Abort: basedir %r does not exist\n" % basedir) - return - modified = [] - else: - modified = repo.status()[0] - dependencies = parse_config(repo) - success = True - tstamp = 0 # newest time stamp assigned - # try processing all rules in topological order - hold_back = {} - while dependencies: - output, inputs = dependencies.popitem() - # check whether any of the inputs is generated - for i in inputs: - if i in dependencies: - hold_back[output] = inputs - continue - _success, _tstamp = check_rule(ui, repo, modified, basedir, output, inputs) - success = success and _success - tstamp = max(tstamp, _tstamp) - # put back held back rules - dependencies.update(hold_back) - hold_back = {} - now = time.time() - if tstamp > now: - # wait until real time has passed the newest time stamp, to - # avoid having files dated in the future - time.sleep(tstamp-now) - if hold_back: - ui.warn("Cyclic dependency involving %s\n" % (' '.join(hold_back.keys()))) - return False - return success - -def touch(ui, repo, basedir): - "touch generated files that are older than their sources after an update." - do_touch(ui, repo, basedir) - -cmdtable = { - "touch": (touch, - [('b', 'basedir', '', 'base dir of the tree to apply touching')], - "hg touch [-b BASEDIR]") -} diff --git a/Tools/importbench/README b/Tools/importbench/README index 81a5544..6ba386c 100644 --- a/Tools/importbench/README +++ b/Tools/importbench/README @@ -3,4 +3,4 @@ Importbench is a set of micro-benchmarks for various import scenarios. It should not be used as an overall benchmark of import performance, but rather an easy way to measure impact of possible code changes. For a real-world benchmark of import, use the normal_startup benchmark from -hg.python.org/benchmarks. +https://github.com/python/performance diff --git a/Tools/msi/build.bat b/Tools/msi/build.bat index 69f00c0..fe5158d 100644 --- a/Tools/msi/build.bat +++ b/Tools/msi/build.bat @@ -22,8 +22,8 @@ if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) call "%D%get_externals.bat" - -call "%PCBUILD%env.bat" x86 +call "%PCBUILD%find_msbuild.bat" %MSBUILD% +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) if defined BUILDX86 ( call "%PCBUILD%build.bat" -d -e %REBUILD% %BUILDTEST% @@ -44,7 +44,7 @@ if defined BUILDDOC ( ) rem Build the launcher MSI separately -msbuild "%D%launcher\launcher.wixproj" /p:Platform=x86 +%MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86 set BUILD_CMD="%D%bundle\snapshot.wixproj" if defined BUILDTEST ( @@ -58,11 +58,11 @@ if defined REBUILD ( ) if defined BUILDX86 ( - msbuild %BUILD_CMD% + %MSBUILD% %BUILD_CMD% if errorlevel 1 goto :eof ) if defined BUILDX64 ( - msbuild /p:Platform=x64 %BUILD_CMD% + %MSBUILD% /p:Platform=x64 %BUILD_CMD% if errorlevel 1 goto :eof ) diff --git a/Tools/msi/buildrelease.bat b/Tools/msi/buildrelease.bat index f296e61..e8d2311 100644 --- a/Tools/msi/buildrelease.bat +++ b/Tools/msi/buildrelease.bat @@ -57,6 +57,7 @@ if "%1" EQU "--build" (set TARGET=Build) && shift && goto CheckOpts if "%1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts if "%1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts if "%1" EQU "--pgo" (set PGO=%~2) && shift && shift && goto CheckOpts +if "%1" EQU "--skip-pgo" (set PGO=) && shift && goto CheckOpts if "%1" EQU "--skip-nuget" (set BUILDNUGET=) && shift && goto CheckOpts if "%1" EQU "--skip-zip" (set BUILDZIP=) && shift && goto CheckOpts @@ -64,10 +65,12 @@ if "%1" NEQ "" echo Invalid option: "%1" && exit /B 1 if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) -if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" -if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 +if not exist "%GIT%" where git > "%TEMP%\git.loc" 2> nul && set /P GIT= < "%TEMP%\git.loc" & del "%TEMP%\git.loc" +if not exist "%GIT%" echo Cannot find Git on PATH && exit /B 1 call "%D%get_externals.bat" +call "%PCBUILD%find_msbuild.bat" %MSBUILD% +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) :builddoc if "%SKIPBUILD%" EQU "1" goto skipdoc @@ -82,7 +85,7 @@ if errorlevel 1 goto :eof where dlltool /q && goto skipdlltoolsearch set _DLLTOOL_PATH= -where /R "%EXTERNALS%\" dlltool > "%TEMP%\dlltool.loc" 2> nul && set /P _DLLTOOL_PATH= < "%TEMP%\dlltool.loc" & del "%TEMP%\dlltool.loc" +where /R "%EXTERNALS%\" dlltool > "%TEMP%\dlltool.loc" 2> nul && set /P _DLLTOOL_PATH= < "%TEMP%\dlltool.loc" & del "%TEMP%\dlltool.loc" if not exist "%_DLLTOOL_PATH%" echo Cannot find binutils on PATH or in external && exit /B 1 for %%f in (%_DLLTOOL_PATH%) do set PATH=%PATH%;%%~dpf set _DLLTOOL_PATH= @@ -109,21 +112,14 @@ exit /B 0 @echo off if "%1" EQU "x86" ( - call "%PCBUILD%env.bat" x86 + set PGO= set BUILD=%PCBUILD%win32\ set BUILD_PLAT=Win32 set OUTDIR_PLAT=win32 set OBJDIR_PLAT=x86 -) else if "%~2" NEQ "" ( - call "%PCBUILD%env.bat" amd64 - set PGO=%~2 - set BUILD=%PCBUILD%amd64-pgo\ - set BUILD_PLAT=x64 - set OUTDIR_PLAT=amd64 - set OBJDIR_PLAT=x64 ) else ( - call "%PCBUILD%env.bat" amd64 set BUILD=%PCBUILD%amd64\ + set PGO=%~2 set BUILD_PLAT=x64 set OUTDIR_PLAT=amd64 set OBJDIR_PLAT=x64 @@ -135,6 +131,12 @@ if exist "%BUILD%en-us" ( if errorlevel 1 exit /B ) +if exist "%D%obj\Debug_%OBJDIR_PLAT%" ( + echo Deleting "%D%obj\Debug_%OBJDIR_PLAT%" + rmdir /q/s "%D%obj\Debug_%OBJDIR_PLAT%" + if errorlevel 1 exit /B +) + if exist "%D%obj\Release_%OBJDIR_PLAT%" ( echo Deleting "%D%obj\Release_%OBJDIR_PLAT%" rmdir /q/s "%D%obj\Release_%OBJDIR_PLAT%" @@ -146,54 +148,46 @@ if not "%CERTNAME%" EQU "" ( ) else ( set CERTOPTS= ) - +if not "%PGO%" EQU "" ( + set PGOOPTS=--pgo-job "%PGO%" +) else ( + set PGOOPTS= +) if not "%SKIPBUILD%" EQU "1" ( - @call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -d -t %TARGET% %CERTOPTS% + @echo call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %PGOOPTS% %CERTOPTS% + @call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %PGOOPTS% %CERTOPTS% @if errorlevel 1 exit /B @rem build.bat turns echo back on, so we disable it again @echo off - - if "%PGO%" EQU "" ( - @call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %CERTOPTS% - ) else ( - @call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -c PGInstrument -t %TARGET% %CERTOPTS% - @if errorlevel 1 exit /B - - @del "%BUILD%*.pgc" - if "%PGO%" EQU "default" ( - "%BUILD%python.exe" -m test -q --pgo - ) else if "%PGO%" EQU "default2" ( - "%BUILD%python.exe" -m test -r -q --pgo - "%BUILD%python.exe" -m test -r -q --pgo - ) else if "%PGO%" EQU "default10" ( - for /L %%i in (0, 1, 9) do "%BUILD%python.exe" -m test -q -r --pgo - ) else if "%PGO%" EQU "pybench" ( - "%BUILD%python.exe" "%PCBUILD%..\Tools\pybench\pybench.py" - ) else ( - "%BUILD%python.exe" %PGO% - ) - - @call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -c PGUpdate -t Build %CERTOPTS% - ) + + @echo call "%PCBUILD%build.bat" -d -e -p %BUILD_PLAT% -t %TARGET% + @call "%PCBUILD%build.bat" -d -e -p %BUILD_PLAT% -t %TARGET% @if errorlevel 1 exit /B + @rem build.bat turns echo back on, so we disable it again @echo off ) -set BUILDOPTS=/p:BuildForRelease=true /p:DownloadUrl=%DOWNLOAD_URL% /p:DownloadUrlBase=%DOWNLOAD_URL_BASE% /p:ReleaseUri=%RELEASE_URI% -if "%PGO%" NEQ "" set BUILDOPTS=%BUILDOPTS% /p:PGOBuildPath=%BUILD% -msbuild "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI% -msbuild "%D%bundle\releaselocal.wixproj" /t:Rebuild /p:Platform=%1 %BUILDOPTS% %CERTOPTS% /p:RebuildAll=true +if "%OUTDIR_PLAT%" EQU "win32" ( + %MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI% + if errorlevel 1 exit /B +) else if not exist "%PCBUILD%win32\en-us\launcher.msi" ( + %MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI% + if errorlevel 1 exit /B +) + +set BUILDOPTS=/p:Platform=%1 /p:BuildForRelease=true /p:DownloadUrl=%DOWNLOAD_URL% /p:DownloadUrlBase=%DOWNLOAD_URL_BASE% /p:ReleaseUri=%RELEASE_URI% +%MSBUILD% "%D%bundle\releaselocal.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=true if errorlevel 1 exit /B -msbuild "%D%bundle\releaseweb.wixproj" /t:Rebuild /p:Platform=%1 %BUILDOPTS% %CERTOPTS% /p:RebuildAll=false +%MSBUILD% "%D%bundle\releaseweb.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=false if errorlevel 1 exit /B if defined BUILDZIP ( - msbuild "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% /p:OutputPath="%BUILD%en-us" + %MSBUILD% "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% /p:OutputPath="%BUILD%en-us" if errorlevel 1 exit /B ) if defined BUILDNUGET ( - msbuild "%D%..\nuget\make_pkg.proj" /t:Build /p:Configuration=Release /p:Platform=%1 /p:OutputPath="%BUILD%en-us" + %MSBUILD% "%D%..\nuget\make_pkg.proj" /t:Build /p:Configuration=Release /p:Platform=%1 /p:OutputPath="%BUILD%en-us" if errorlevel 1 exit /B ) @@ -210,7 +204,7 @@ exit /B 0 :Help echo buildrelease.bat [--out DIR] [-x86] [-x64] [--certificate CERTNAME] [--build] [--pgo COMMAND] -echo [--skip-build] [--skip-doc] [--skip-nuget] [--skip-zip] +echo [--skip-build] [--skip-doc] [--skip-nuget] [--skip-zip] [--skip-pgo] echo [--download DOWNLOAD URL] [--test TARGETDIR] echo [-h] echo. @@ -220,9 +214,10 @@ echo -x64 Build x64 installers echo --build (-b) Incrementally build Python rather than rebuilding echo --skip-build (-B) Do not build Python (just do the installers) echo --skip-doc (-D) Do not build documentation +echo --pgo Specify PGO command for x64 installers +echo --skip-pgo Build x64 installers without using PGO echo --skip-nuget Do not build Nuget packages echo --skip-zip Do not build embeddable package -echo --pgo Build x64 installers using PGO echo --download Specify the full download URL for MSIs echo --test Specify the test directory to run the installer tests echo -h Display this help information @@ -230,13 +225,8 @@ echo. echo If no architecture is specified, all architectures will be built. echo If --test is not specified, the installer tests are not run. echo. -echo For the --pgo option, any Python command line can be used as well as the -echo following shortcuts: -echo Shortcut Description -echo default Test suite with --pgo -echo default2 2x test suite with --pgo and randomized test order -echo default10 10x test suite with --pgo and randomized test order -echo pybench pybench script +echo For the --pgo option, any Python command line can be used, or 'default' to +echo use the default task (-m test --pgo). echo. echo The following substitutions will be applied to the download URL: echo Variable Description Example diff --git a/Tools/msi/bundle/bootstrap/pythonba.sln b/Tools/msi/bundle/bootstrap/pythonba.sln index bf43fed..4857180 100644 --- a/Tools/msi/bundle/bootstrap/pythonba.sln +++ b/Tools/msi/bundle/bootstrap/pythonba.sln @@ -1,22 +1,22 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30501.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonba", "pythonba.vcxproj", "{7A09B132-B3EE-499B-A700-A4B2157FEA3D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7A09B132-B3EE-499B-A700-A4B2157FEA3D}.Debug|Win32.ActiveCfg = Debug|Win32 - {7A09B132-B3EE-499B-A700-A4B2157FEA3D}.Debug|Win32.Build.0 = Debug|Win32 - {7A09B132-B3EE-499B-A700-A4B2157FEA3D}.Release|Win32.ActiveCfg = Release|Win32 - {7A09B132-B3EE-499B-A700-A4B2157FEA3D}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30501.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonba", "pythonba.vcxproj", "{7A09B132-B3EE-499B-A700-A4B2157FEA3D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7A09B132-B3EE-499B-A700-A4B2157FEA3D}.Debug|Win32.ActiveCfg = Debug|Win32 + {7A09B132-B3EE-499B-A700-A4B2157FEA3D}.Debug|Win32.Build.0 = Debug|Win32 + {7A09B132-B3EE-499B-A700-A4B2157FEA3D}.Release|Win32.ActiveCfg = Release|Win32 + {7A09B132-B3EE-499B-A700-A4B2157FEA3D}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Tools/msi/bundle/bootstrap/pythonba.vcxproj b/Tools/msi/bundle/bootstrap/pythonba.vcxproj index bcd3951..3b101d7 100644 --- a/Tools/msi/bundle/bootstrap/pythonba.vcxproj +++ b/Tools/msi/bundle/bootstrap/pythonba.vcxproj @@ -1,69 +1,69 @@ - - - - - - Debug - Win32 - - - Release - Win32 - - - - Release - Win32 - v140 - v120 - {7A09B132-B3EE-499B-A700-A4B2157FEA3D} - PythonBA - - - - - DynamicLibrary - Unicode - $(Py_IntDir)\$(Configuration)_$(Platform)_Setup\Bootstrap\ - $(IntDir) - - - - - _CRT_STDIO_LEGACY_WIDE_SPECIFIERS=1;%(PreprocessorDefinitions) - $(WixInstallPath)sdk\inc - Use - pch.h - MultiThreaded - - - comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib;dutil.lib;balutil.lib;version.lib;uxtheme.lib;%(AdditionalDependencies) - $(WixInstallPath)sdk\vs2015\lib\x86 - $(WixInstallPath)sdk\vs2013\lib\x86 - pythonba.def - true - - - - - - - Create - - - - - - - - - - + + + + + + Debug + Win32 + + + Release + Win32 + + + + Release + Win32 + v140 + v120 + {7A09B132-B3EE-499B-A700-A4B2157FEA3D} + PythonBA + + + + + DynamicLibrary + Unicode + $(Py_IntDir)\$(Configuration)_$(Platform)_Setup\Bootstrap\ + $(IntDir) + + + + + _CRT_STDIO_LEGACY_WIDE_SPECIFIERS=1;%(PreprocessorDefinitions) + $(WixInstallPath)sdk\inc + Use + pch.h + MultiThreaded + + + comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib;dutil.lib;balutil.lib;version.lib;uxtheme.lib;%(AdditionalDependencies) + $(WixInstallPath)sdk\vs2015\lib\x86 + $(WixInstallPath)sdk\vs2013\lib\x86 + pythonba.def + true + + + + + + + Create + + + + + + + + + + \ No newline at end of file diff --git a/Tools/msi/make_zip.proj b/Tools/msi/make_zip.proj index 1af6dd2..379c51d 100644 --- a/Tools/msi/make_zip.proj +++ b/Tools/msi/make_zip.proj @@ -1,41 +1,38 @@ - - - - {10487945-15D1-4092-A214-338395C4116B} - python - - false - - - - - - false - python-$(PythonVersion)-embed-$(ArchName) - .zip - $(OutputPath)\$(TargetName)$(TargetExt) - rmdir /q/s "$(IntermediateOutputPath)\zip_$(ArchName)" - "$(PythonExe)" "$(MSBuildThisFileDirectory)\make_zip.py" - $(Arguments) -e -o "$(TargetPath)" -t "$(IntermediateOutputPath)\zip_$(ArchName)" -b "$(BuildPath.TrimEnd('\'))" - set DOC_FILENAME=python$(PythonVersion).chm -set VCREDIST_PATH=$(VS140COMNTOOLS)\..\..\VC\redist\$(Platform)\Microsoft.VC140.CRT - - - - - - - - - - - - - - - - - + + + + {10487945-15D1-4092-A214-338395C4116B} + python + + false + + + + + + false + python-$(PythonVersion)-embed-$(ArchName) + .zip + $(OutputPath)\$(TargetName)$(TargetExt) + rmdir /q/s "$(IntermediateOutputPath)\zip_$(ArchName)" + "$(PythonExe)" "$(MSBuildThisFileDirectory)\make_zip.py" + $(Arguments) -e -o "$(TargetPath)" -t "$(IntermediateOutputPath)\zip_$(ArchName)" -b "$(BuildPath.TrimEnd('\'))" + set DOC_FILENAME=python$(PythonVersion).chm + $(Environment)%0D%0Aset VCREDIST_PATH=$(CRTRedist)\$(Platform) + + + + + + + + + + + + + + + + + diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py index 9db96cb..6a03cbe 100644 --- a/Tools/msi/make_zip.py +++ b/Tools/msi/make_zip.py @@ -28,12 +28,15 @@ DEBUG_FILES = { EXCLUDE_FROM_LIBRARY = { '__pycache__', - 'ensurepip', 'idlelib', 'pydoc_data', 'site-packages', 'tkinter', 'turtledemo', +} + +EXCLUDE_FROM_EMBEDDABLE_LIBRARY = { + 'ensurepip', 'venv', } @@ -78,6 +81,12 @@ def include_in_lib(p): suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} +def include_in_embeddable_lib(p): + if p.is_dir() and p.name.lower() in EXCLUDE_FROM_EMBEDDABLE_LIBRARY: + return False + + return include_in_lib(p) + def include_in_libs(p): if not is_not_debug(p): return False @@ -108,7 +117,7 @@ EMBED_LAYOUT = [ ('/', '$build', 'python*.exe', is_not_debug), ('/', '$build', '*.pyd', is_not_debug), ('/', '$build', '*.dll', is_not_debug), - ('python{0.major}{0.minor}.zip'.format(sys.version_info), 'Lib', '**/*', include_in_lib), + ('python{0.major}{0.minor}.zip'.format(sys.version_info), 'Lib', '**/*', include_in_embeddable_lib), ] if os.getenv('DOC_FILENAME'): diff --git a/Tools/msi/msi.props b/Tools/msi/msi.props index 0cf7c77..18d0e52 100644 --- a/Tools/msi/msi.props +++ b/Tools/msi/msi.props @@ -1,177 +1,177 @@ - - - - $(OutputName) - false - false - $(SuppressIces);ICE03;ICE57;ICE61 - 1026 - false - true - Release - x86 - perUser - - - - - - - - $(ComputerName)/$(ArchName)/ - $(ReleaseUri)/ - - - - - - - - WixUtilExtension - WixUtilExtension - - - - - $(Py_IntDir)\$(Configuration)_$(Platform)_Setup\$(OutputName) - $(IntermediateOutputPath)_$(OutputSuffix) - $(BuildPath) - $(OutputPath)\ - $(OutputPath) - true - $(ExternalsDir)\windows-installer\redist - - python$(MajorVersionNumber)$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm - - $(MajorVersionNumber).$(MinorVersionNumber).$(Field3Value).0 - - - - $([System.Math]::Floor($([System.DateTime]::Now.Subtract($([System.DateTime]::new(2001, 1, 1))).TotalDays))) - $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)dev$(RevisionNumber) - $(MajorVersionNumber).$(MinorVersionNumber).$(RevisionNumber).0 - - - - 32-bit - 64-bit - - $(DefineConstants); - Version=$(InstallerVersion); - ShortVersion=$(MajorVersionNumber).$(MinorVersionNumber); - LongVersion=$(PythonVersion); - MajorVersionNumber=$(MajorVersionNumber); - MinorVersionNumber=$(MinorVersionNumber); - UpgradeMinimumVersion=$(MajorVersionNumber).$(MinorVersionNumber).0.0; - NextMajorVersionNumber=$(MajorVersionNumber).$([msbuild]::Add($(MinorVersionNumber), 1)).0.0; - Bitness=$(Bitness); - PyDebugExt=$(PyDebugExt); - PyArchExt=$(PyArchExt); - PyTestExt=$(PyTestExt); - OptionalFeatureName=$(OutputName); - - - $(DefineConstants);CRTRedist=$(CRTRedist); - - - $(DefineConstants);Suffix32=-32; - - - $(DefineConstants);Suffix32=; - - - - - - generated_filelist - - - - - false - - - - - - - - - - - src - - - tcltk - - - redist - - - redist - - - build32 - - - build64 - - - - - - - - - <_Uuid Include="CoreUpgradeCode"> - upgradecode - - <_Uuid Include="UpgradeCode"> - upgradecode/$(OutputName) - - <_Uuid Include="InstallDirectoryGuidSeed"> - installdirectoryseed - - <_Uuid Include="PythonExeComponentGuid"> - python.exe - - <_Uuid Include="PythonwExeComponentGuid"> - pythonw.exe - - <_Uuid Include="RemoveLib2to3PickleComponentGuid"> - lib2to3/pickles - - - - - <_Uuids>@(_Uuid->'("%(Identity)", "$(MajorVersionNumber).$(MinorVersionNumber)/%(Uri)")',',') - <_GenerateCommand>import uuid; print('\n'.join('{}={}'.format(i, uuid.uuid5(uuid.UUID('c8d9733e-a70c-43ff-ab0c-e26456f11083'), '$(ReleaseUri.Replace(`{arch}`, `$(ArchName)`))' + j)) for i,j in [$(_Uuids.Replace(`"`,`'`))])) - - - - - - - - - - $(DefineConstants);@(_UuidValue,';'); - - + + + + $(OutputName) + false + false + $(SuppressIces);ICE03;ICE57;ICE61 + 1026 + false + true + Release + x86 + perUser + + + + + + + + $(ComputerName)/$(ArchName)/ + $(ReleaseUri)/ + + + + + + + + WixUtilExtension + WixUtilExtension + + + + + $(Py_IntDir)\$(Configuration)_$(Platform)_Setup\$(OutputName) + $(IntermediateOutputPath)_$(OutputSuffix) + $(BuildPath) + $(OutputPath)\ + $(OutputPath) + true + $(ExternalsDir)\windows-installer\redist + + python$(MajorVersionNumber)$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm + + $(MajorVersionNumber).$(MinorVersionNumber).$(Field3Value).0 + + + + $([System.Math]::Floor($([System.DateTime]::Now.Subtract($([System.DateTime]::new(2001, 1, 1))).TotalDays))) + $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)dev$(RevisionNumber) + $(MajorVersionNumber).$(MinorVersionNumber).$(RevisionNumber).0 + + + + 32-bit + 64-bit + + $(DefineConstants); + Version=$(InstallerVersion); + ShortVersion=$(MajorVersionNumber).$(MinorVersionNumber); + LongVersion=$(PythonVersion); + MajorVersionNumber=$(MajorVersionNumber); + MinorVersionNumber=$(MinorVersionNumber); + UpgradeMinimumVersion=$(MajorVersionNumber).$(MinorVersionNumber).0.0; + NextMajorVersionNumber=$(MajorVersionNumber).$([msbuild]::Add($(MinorVersionNumber), 1)).0.0; + Bitness=$(Bitness); + PyDebugExt=$(PyDebugExt); + PyArchExt=$(PyArchExt); + PyTestExt=$(PyTestExt); + OptionalFeatureName=$(OutputName); + + + $(DefineConstants);CRTRedist=$(CRTRedist); + + + $(DefineConstants);Suffix32=-32; + + + $(DefineConstants);Suffix32=; + + + + + + generated_filelist + + + + + false + + + + + + + + + + + src + + + tcltk + + + redist + + + redist + + + build32 + + + build64 + + + + + + + + + <_Uuid Include="CoreUpgradeCode"> + upgradecode + + <_Uuid Include="UpgradeCode"> + upgradecode/$(OutputName) + + <_Uuid Include="InstallDirectoryGuidSeed"> + installdirectoryseed + + <_Uuid Include="PythonExeComponentGuid"> + python.exe + + <_Uuid Include="PythonwExeComponentGuid"> + pythonw.exe + + <_Uuid Include="RemoveLib2to3PickleComponentGuid"> + lib2to3/pickles + + + + + <_Uuids>@(_Uuid->'("%(Identity)", "$(MajorVersionNumber).$(MinorVersionNumber)/%(Uri)")',',') + <_GenerateCommand>import uuid; print('\n'.join('{}={}'.format(i, uuid.uuid5(uuid.UUID('c8d9733e-a70c-43ff-ab0c-e26456f11083'), '$(ReleaseUri.Replace(`{arch}`, `$(ArchName)`))' + j)) for i,j in [$(_Uuids.Replace(`"`,`'`))])) + + + + + + + + + + $(DefineConstants);@(_UuidValue,';'); + + \ No newline at end of file diff --git a/Tools/msi/uploadrelease.bat b/Tools/msi/uploadrelease.bat index 4e319ce..07b2573 100644 --- a/Tools/msi/uploadrelease.bat +++ b/Tools/msi/uploadrelease.bat @@ -9,6 +9,8 @@ set USER= set TARGET= set DRYRUN=false set NOGPG= +set PURGE_OPTION=/p:Purge=true +set NOTEST= :CheckOpts if "%1" EQU "-h" goto Help @@ -19,7 +21,11 @@ if "%1" EQU "--user" (set USER=%~2) && shift && shift && goto CheckOpts if "%1" EQU "-t" (set TARGET=%~2) && shift && shift && goto CheckOpts if "%1" EQU "--target" (set TARGET=%~2) && shift && shift && goto CheckOpts if "%1" EQU "--dry-run" (set DRYRUN=true) && shift && goto CheckOpts -if "%1" EQU "--no-gpg" (set NOGPG=true) && shift && goto CheckOpts +if "%1" EQU "--skip-gpg" (set NOGPG=true) && shift && goto CheckOpts +if "%1" EQU "--skip-purge" (set PURGE_OPTION=) && shift && godo CheckOpts +if "%1" EQU "--skip-test" (set NOTEST=true) && shift && godo CheckOpts +if "%1" EQU "-T" (set NOTEST=true) && shift && godo CheckOpts +if "%1" NEQ "" echo Unexpected argument "%1" & exit /B 1 if not defined PLINK where plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc" if not defined PLINK where /R "%ProgramFiles(x86)%\PuTTY" plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc" @@ -35,7 +41,7 @@ echo Found pscp.exe at %PSCP% if defined NOGPG ( set GPG= - echo Skipping GPG signature generation because of --no-gpg + echo Skipping GPG signature generation because of --skip-gpg ) else ( if not defined GPG where gpg2 > "%TEMP%\gpg.loc" 2> nul && set /P GPG= < "%TEMP%\gpg.loc" & del "%TEMP%\gpg.loc" if not defined GPG where /R "%PCBUILD%..\externals\windows-installer" gpg2 > "%TEMP%\gpg.loc" 2> nul && set /P GPG= < "%TEMP%\gpg.loc" & del "%TEMP%\gpg.loc" @@ -43,21 +49,29 @@ if defined NOGPG ( echo Found gpg2.exe at %GPG% ) -call "%PCBUILD%env.bat" > nul 2> nul +call "%PCBUILD%find_msbuild.bat" %MSBUILD% +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) pushd "%D%" -msbuild /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86 -msbuild /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false -msbuild /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x86 -msbuild /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x64 /p:IncludeDoc=false +%MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86 %PURGE_OPTION% +%MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false %PURGE_OPTION% +if not defined NOTEST ( + %MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x86 + %MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x64 +) +%MSBUILD% /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x86 +%MSBUILD% /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x64 /p:IncludeDoc=false popd exit /B 0 :Help echo uploadrelease.bat --host HOST --user USERNAME [--target TARGET] [--dry-run] [-h] echo. -echo --host (-o) Specify the upload host (required) -echo --user (-u) Specify the user on the host (required) -echo --target (-t) Specify the target directory on the host -echo --dry-run Display commands and filenames without executing them -echo -h Display this help information +echo --host (-o) Specify the upload host (required) +echo --user (-u) Specify the user on the host (required) +echo --target (-t) Specify the target directory on the host +echo --dry-run Display commands and filenames without executing them +echo --skip-gpg Does not generate GPG signatures before uploading +echo --skip-purge Does not perform CDN purge after uploading +echo --skip-test (-T) Does not perform post-upload tests +echo -h Display this help information echo. diff --git a/Tools/msi/uploadrelease.proj b/Tools/msi/uploadrelease.proj index 0d472de..dd82ee0 100644 --- a/Tools/msi/uploadrelease.proj +++ b/Tools/msi/uploadrelease.proj @@ -1,80 +1,112 @@ - - - - {2D69F2AB-D5D0-4344-84B5-EF6DB34A9BC9} - python - - - $(TARGET) - /srv/www.python.org/ftp/python - true - false - - - - - - - $(DownloadUrlBase.TrimEnd(`/`))/$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber) - $(DownloadUrl.Replace(`{version}`, `$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)`).Replace(`{arch}`, `$(ArchName)`).Replace(`{releasename}`, `$(ReleaseLevelName)`).Replace(`{msi}`, ``).TrimEnd(`/`)) - - - - - $(MSITarget) - - - $(EXETarget) - - - $(EXETarget) - - - - - - - - - - - - - - - - - %(File.CopyTo) - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + {2D69F2AB-D5D0-4344-84B5-EF6DB34A9BC9} + python + + + $(TARGET) + /srv/www.python.org/ftp/python + true + true + false + false + + + + + + + $(DownloadUrlBase.TrimEnd(`/`))/$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber) + $(DownloadUrl.Replace(`{version}`, `$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)`).Replace(`{arch}`, `$(ArchName)`).Replace(`{releasename}`, `$(ReleaseLevelName)`).Replace(`{msi}`, ``).TrimEnd(`/`)) + + + + + $(MSITarget) + + + $(EXETarget) + + + $(EXETarget) + + + + + + + + + + + + + + + + + %(File.CopyTo) + + + + + + + + + + + + + + + + + + + + + + $(TEMP)\%(Filename)_source + $(TEMP)\%(Filename)_source\%(Filename)%(Extension) + $(TEMP)\%(Filename)_layout + $(OutputPath)\%(Filename)_layoutlog + $(OutputPath)\%(Filename)_layoutlog\%(Filename).log + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Tools/msi/wix.props b/Tools/msi/wix.props index fbb2d10..18a304d 100644 --- a/Tools/msi/wix.props +++ b/Tools/msi/wix.props @@ -1,12 +1,12 @@ - - - - - - $(MSBuildThisFileDirectory)\Wix\ - $(ExternalsDir)\windows-installer\wix\ - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Installer XML\3.10@InstallRoot) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Installer XML\3.10@InstallRoot) - $(WixInstallPath)\Wix.targets - + + + + + + $(MSBuildThisFileDirectory)\Wix\ + $(ExternalsDir)\windows-installer\wix\ + $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Installer XML\3.10@InstallRoot) + $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Installer XML\3.10@InstallRoot) + $(WixInstallPath)\Wix.targets + \ No newline at end of file diff --git a/Tools/nuget/build.bat b/Tools/nuget/build.bat index 120b38c..b02e770 100644 --- a/Tools/nuget/build.bat +++ b/Tools/nuget/build.bat @@ -21,7 +21,8 @@ if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckO if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) call "%D%..\msi\get_externals.bat" -call "%PCBUILD%env.bat" x86 +call "%PCBUILD%find_msbuild.bat" %MSBUILD% +if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%" @@ -30,7 +31,7 @@ if defined BUILDX86 ( ) else if not exist "%PCBUILD%win32\python.exe" call "%PCBUILD%build.bat" -e if errorlevel 1 goto :eof - msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% + %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% if errorlevel 1 goto :eof ) @@ -39,7 +40,7 @@ if defined BUILDX64 ( ) else if not exist "%PCBUILD%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e if errorlevel 1 goto :eof - msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% + %MSBUILD% "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% if errorlevel 1 goto :eof ) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj index 81b84f9..007827f 100644 --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -1,57 +1,55 @@ - - - - {10487945-15D1-4092-A214-338395C4116B} - python - $(OutputName)x86 - - false - true - - - - - - $(ExternalsDir)\windows-installer\nuget\nuget.exe - $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber) - $(NuspecVersion)-$(ReleaseLevelName) - false - $(OutputName).$(NuspecVersion) - .nupkg - $(IntermediateOutputPath)\nuget_$(ArchName) - - rmdir /q/s "$(IntermediateOutputPath)" - - "$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py" - $(PythonArguments) -t "$(IntermediateOutputPath)" -b "$(BuildPath.TrimEnd('\'))" - - "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" - "$(IntermediateOutputPath)\python.exe" -B -m pip install -U $(Packages) - - "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" - $(NugetArguments) -BasePath "$(IntermediateOutputPath)" - $(NugetArguments) -OutputDirectory "$(OutputPath.Trim(`\`))" - $(NugetArguments) -Version "$(NuspecVersion)" - $(NugetArguments) -NoPackageAnalysis -NonInteractive - - setlocal -set DOC_FILENAME=python$(PythonVersion).chm -set VCREDIST_PATH=$(VS140COMNTOOLS)\..\..\VC\redist\$(Platform)\Microsoft.VC140.CRT - - - - - - - - - - - - - - - - - + + + + {10487945-15D1-4092-A214-338395C4116B} + python + $(OutputName)x86 + + false + true + + + + + + $(ExternalsDir)\windows-installer\nuget\nuget.exe + $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber) + $(NuspecVersion)-$(ReleaseLevelName) + false + $(OutputName).$(NuspecVersion) + .nupkg + $(IntermediateOutputPath)\nuget_$(ArchName) + + rmdir /q/s "$(IntermediateOutputPath)" + + "$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py" + $(PythonArguments) -t "$(IntermediateOutputPath)" -b "$(BuildPath.TrimEnd('\'))" + + "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + "$(IntermediateOutputPath)\python.exe" -B -m pip install -U $(Packages) + + "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" + $(NugetArguments) -BasePath "$(IntermediateOutputPath)" + $(NugetArguments) -OutputDirectory "$(OutputPath.Trim(`\`))" + $(NugetArguments) -Version "$(NuspecVersion)" + $(NugetArguments) -NoPackageAnalysis -NonInteractive + + set DOC_FILENAME=python$(PythonVersion).chm + $(Environment)%0D%0Aset VCREDIST_PATH=$(CRTRedist)\$(Platform) + + + + + + + + + + + + + + + + + diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py index 58b081a..0aacd9e 100755 --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +"""Check proposed changes for common issues.""" import re import sys import shutil @@ -12,7 +13,6 @@ import untabify SRCDIR = sysconfig.get_config_var('srcdir') - def n_files_str(count): """Return 'N file(s)' with the proper plurality on 'file'.""" return "{} file{}".format(count, "s" if count != 1 else "") @@ -46,27 +46,76 @@ def mq_patches_applied(): return st.returncode == 0 and bstdout +def get_git_branch(): + """Get the symbolic name for the current git branch""" + cmd = "git rev-parse --abbrev-ref HEAD".split() + try: + return subprocess.check_output(cmd, stderr=subprocess.DEVNULL) + except subprocess.CalledProcessError: + return None + + +def get_git_upstream_remote(): + """Get the remote name to use for upstream branches + + Uses "upstream" if it exists, "origin" otherwise + """ + cmd = "git remote get-url upstream".split() + try: + subprocess.check_output(cmd, stderr=subprocess.DEVNULL) + except subprocess.CalledProcessError: + return "origin" + return "upstream" + + +@status("Getting base branch for PR", + info=lambda x: x if x is not None else "not a PR branch") +def get_base_branch(): + if not os.path.exists(os.path.join(SRCDIR, '.git')): + # Not a git checkout, so there's no base branch + return None + version = sys.version_info + if version.releaselevel == 'alpha': + base_branch = "master" + else: + base_branch = "{0.major}.{0.minor}".format(version) + this_branch = get_git_branch() + if this_branch is None or this_branch == base_branch: + # Not on a git PR branch, so there's no base branch + return None + upstream_remote = get_git_upstream_remote() + return upstream_remote + "/" + base_branch + + @status("Getting the list of files that have been added/changed", info=lambda x: n_files_str(len(x))) -def changed_files(): +def changed_files(base_branch=None): """Get the list of changed or added files from Mercurial or git.""" if os.path.isdir(os.path.join(SRCDIR, '.hg')): + if base_branch is not None: + sys.exit('need a git checkout to check PR status') cmd = 'hg status --added --modified --no-status' if mq_patches_applied(): cmd += ' --rev qparent' with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st: return [x.decode().rstrip() for x in st.stdout] - elif os.path.isdir(os.path.join(SRCDIR, '.git')): - cmd = 'git status --porcelain' + elif os.path.exists(os.path.join(SRCDIR, '.git')): + # We just use an existence check here as: + # directory = normal git checkout/clone + # file = git worktree directory + if base_branch: + cmd = 'git diff --name-status ' + base_branch + else: + cmd = 'git status --porcelain' filenames = [] with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st: for line in st.stdout: line = line.decode().rstrip() - status = set(line[:2]) + status_text, filename = line.split(maxsplit=1) + status = set(status_text) # modified, added or unmerged files if not status.intersection('MAU'): continue - filename = line[3:] if ' -> ' in filename: # file is renamed filename = filename.split(' -> ', 2)[1].strip() @@ -87,7 +136,7 @@ def report_modified_files(file_paths): return "\n".join(lines) -@status("Fixing whitespace", info=report_modified_files) +@status("Fixing Python file whitespace", info=report_modified_files) def normalize_whitespace(file_paths): """Make sure that the whitespace for .py files have been normalized.""" reindent.makebackup = False # No need to create backups. @@ -164,8 +213,30 @@ def regenerated_pyconfig_h_in(file_paths): else: return "not needed" +def travis(pull_request): + if pull_request == 'false': + print('Not a pull request; skipping') + return + base_branch = get_base_branch() + file_paths = changed_files(base_branch) + python_files = [fn for fn in file_paths if fn.endswith('.py')] + c_files = [fn for fn in file_paths if fn.endswith(('.c', '.h'))] + doc_files = [fn for fn in file_paths if fn.startswith('Doc') and + fn.endswith(('.rst', '.inc'))] + fixed = [] + fixed.extend(normalize_whitespace(python_files)) + fixed.extend(normalize_c_whitespace(c_files)) + fixed.extend(normalize_docs_whitespace(doc_files)) + if not fixed: + print('No whitespace issues found') + else: + print('Please fix the file(s) with whitespace issues') + print('(on UNIX you can run `make patchcheck` to make the fixes)') + sys.exit(1) + def main(): - file_paths = changed_files() + base_branch = get_base_branch() + file_paths = changed_files(base_branch) python_files = [fn for fn in file_paths if fn.endswith('.py')] c_files = [fn for fn in file_paths if fn.endswith(('.c', '.h'))] doc_files = [fn for fn in file_paths if fn.startswith('Doc') and @@ -197,4 +268,12 @@ def main(): if __name__ == '__main__': - main() + import argparse + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--travis', + help='Perform pass/fail checks') + args = parser.parse_args() + if args.travis: + travis(args.travis) + else: + main() diff --git a/Tools/scripts/reindent.py b/Tools/scripts/reindent.py index 18424de..f6dadaa 100755 --- a/Tools/scripts/reindent.py +++ b/Tools/scripts/reindent.py @@ -118,7 +118,11 @@ def check(file): if verbose: print("checking", file, "...", end=' ') with open(file, 'rb') as f: - encoding, _ = tokenize.detect_encoding(f.readline) + try: + encoding, _ = tokenize.detect_encoding(f.readline) + except SyntaxError as se: + errprint("%s: SyntaxError: %s" % (file, str(se))) + return try: with open(file, encoding=encoding) as f: r = Reindenter(f) diff --git a/Tools/ssl/sslspeed.vcxproj b/Tools/ssl/sslspeed.vcxproj index 8ec4106..5761399 100644 --- a/Tools/ssl/sslspeed.vcxproj +++ b/Tools/ssl/sslspeed.vcxproj @@ -1,70 +1,70 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - {F068BCCF-C0D6-478D-A2C5-26BA3237C992} - sslspeed - - - - - - - - $(OutDir) - $(MSBuildProjectDirectory)\$(ArchName)\ - $(MSBuildProjectDirectory)\$(ArchName)\obj\ - Application - MultiByte - - - - - - - - - - - - _CONSOLE;%(PreprocessorDefinitions) - $(opensslIncDir);%(AdditionalIncludeDirectories) - - - ws2_32.lib;crypt32.lib;libeay$(PyDebugExt).lib;ssleay$(PyDebugExt).lib;%(AdditionalDependencies) - $(OriginalOutDir);%(AdditionalLibraryDirectories) - Console - - - - - - {10615b24-73bf-4efa-93aa-236916321317} - false - - - {e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0} - false - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + {F068BCCF-C0D6-478D-A2C5-26BA3237C992} + sslspeed + + + + + + + + $(OutDir) + $(MSBuildProjectDirectory)\$(ArchName)\ + $(MSBuildProjectDirectory)\$(ArchName)\obj\ + Application + MultiByte + + + + + + + + + + + + _CONSOLE;%(PreprocessorDefinitions) + $(opensslIncDir);%(AdditionalIncludeDirectories) + + + ws2_32.lib;crypt32.lib;libeay$(PyDebugExt).lib;ssleay$(PyDebugExt).lib;%(AdditionalDependencies) + $(OriginalOutDir);%(AdditionalLibraryDirectories) + Console + + + + + + {10615b24-73bf-4efa-93aa-236916321317} + false + + + {e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0} + false + + + + \ No newline at end of file diff --git a/config.guess b/config.guess index 2e9ad7f..2193702 100755 --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2016-10-02' +timestamp='2017-05-27' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -837,10 +837,11 @@ EOF UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -1303,14 +1304,21 @@ EOF if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub @@ -1334,15 +1342,18 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-?:NONSTOP_KERNEL:*:*) + NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; - NSR-?:NONSTOP_KERNEL:*:*) + NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk${UNAME_RELEASE} + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; diff --git a/config.sub b/config.sub index 3478c1f..40ea5df 100755 --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2016-11-19' +timestamp='2017-04-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -67,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -263,7 +263,7 @@ case $basic_machine in | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ - | i370 | i860 | i960 | ia64 \ + | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ @@ -315,6 +315,7 @@ case $basic_machine in | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ + | wasm32 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -388,7 +389,7 @@ case $basic_machine in | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ @@ -446,6 +447,7 @@ case $basic_machine in | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ + | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -948,6 +950,9 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -1243,6 +1248,9 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; + wasm32) + basic_machine=wasm32-unknown + ;; w65*) basic_machine=w65-wdc os=-none @@ -1409,7 +1417,7 @@ case $os in | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix* | -fuchsia*) + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1638,6 +1646,9 @@ case $basic_machine in sparc-* | *-sun) os=-sunos4.1.1 ;; + pru-*) + os=-elf + ;; *-be) os=-beos ;; diff --git a/configure b/configure index 1f84647..5640c2d 100755 --- a/configure +++ b/configure @@ -666,6 +666,7 @@ OTHER_LIBTOOL_OPT UNIVERSAL_ARCH_FLAGS CFLAGS_NODIST BASECFLAGS +CFLAGS_ALIASING OPT LLVM_PROF_FOUND target_os @@ -746,9 +747,8 @@ UNIVERSALSDK CONFIG_ARGS SOVERSION VERSION -GENERATED_COMMENT PYTHON_FOR_BUILD -PYTHON_FOR_GEN +PYTHON_FOR_REGEN host_os host_vendor host_cpu @@ -757,10 +757,10 @@ build_os build_vendor build_cpu build -HAS_HG -HGBRANCH -HGTAG -HGVERSION +HAS_GIT +GITBRANCH +GITTAG +GITVERSION BASECPPFLAGS target_alias host_alias @@ -781,7 +781,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -893,7 +892,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1146,15 +1144,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1292,7 +1281,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1445,7 +1434,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1486,8 +1474,8 @@ Optional Features: Build (MacOSX|Darwin) framework --enable-shared disable/enable building shared python library --enable-profiling enable C-level code profiling - --enable-optimizations Enable expensive optimizations (PGO, maybe LTO, - etc). Disabled by default. + --enable-optimizations Enable expensive, stable optimizations (PGO, etc). + Disabled by default. --enable-loadable-sqlite-extensions support loadable extensions in _sqlite module --enable-ipv6 Enable ipv6 (with ipv4) support @@ -2839,17 +2827,17 @@ fi -if test -e $srcdir/.hg/dirstate +if test -e $srcdir/.git then -# Extract the first word of "hg", so it can be a program name with args. -set dummy hg; ac_word=$2 +# Extract the first word of "git", so it can be a program name with args. +set dummy git; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_HAS_HG+:} false; then : +if ${ac_cv_prog_HAS_GIT+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$HAS_HG"; then - ac_cv_prog_HAS_HG="$HAS_HG" # Let the user override the test. + if test -n "$HAS_GIT"; then + ac_cv_prog_HAS_GIT="$HAS_GIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -2858,7 +2846,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_HAS_HG="found" + ac_cv_prog_HAS_GIT="found" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2866,13 +2854,13 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_prog_HAS_HG" && ac_cv_prog_HAS_HG="not-found" + test -z "$ac_cv_prog_HAS_GIT" && ac_cv_prog_HAS_GIT="not-found" fi fi -HAS_HG=$ac_cv_prog_HAS_HG -if test -n "$HAS_HG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAS_HG" >&5 -$as_echo "$HAS_HG" >&6; } +HAS_GIT=$ac_cv_prog_HAS_GIT +if test -n "$HAS_GIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAS_GIT" >&5 +$as_echo "$HAS_GIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -2880,17 +2868,17 @@ fi else -HAS_HG=no-repository +HAS_GIT=no-repository fi -if test $HAS_HG = found +if test $HAS_GIT = found then - HGVERSION="hg id -i \$(srcdir)" - HGTAG="hg id -t \$(srcdir)" - HGBRANCH="hg id -b \$(srcdir)" + GITVERSION="git -C \$(srcdir) rev-parse --short HEAD" + GITTAG="git -C \$(srcdir) describe --all --always --dirty" + GITBRANCH="git -C \$(srcdir) name-rev --name-only HEAD" else - HGVERSION="" - HGTAG="" - HGBRANCH="" + GITVERSION="" + GITTAG="" + GITBRANCH="" fi @@ -3009,11 +2997,11 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_PYTHON_FOR_GEN+:} false; then : +if ${ac_cv_prog_PYTHON_FOR_REGEN+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$PYTHON_FOR_GEN"; then - ac_cv_prog_PYTHON_FOR_GEN="$PYTHON_FOR_GEN" # Let the user override the test. + if test -n "$PYTHON_FOR_REGEN"; then + ac_cv_prog_PYTHON_FOR_REGEN="$PYTHON_FOR_REGEN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -3022,7 +3010,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_PYTHON_FOR_GEN="$ac_prog" + ac_cv_prog_PYTHON_FOR_REGEN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -3032,25 +3020,20 @@ IFS=$as_save_IFS fi fi -PYTHON_FOR_GEN=$ac_cv_prog_PYTHON_FOR_GEN -if test -n "$PYTHON_FOR_GEN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_FOR_GEN" >&5 -$as_echo "$PYTHON_FOR_GEN" >&6; } +PYTHON_FOR_REGEN=$ac_cv_prog_PYTHON_FOR_REGEN +if test -n "$PYTHON_FOR_REGEN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_FOR_REGEN" >&5 +$as_echo "$PYTHON_FOR_REGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$PYTHON_FOR_GEN" && break + test -n "$PYTHON_FOR_REGEN" && break done -test -n "$PYTHON_FOR_GEN" || PYTHON_FOR_GEN="not-found" +test -n "$PYTHON_FOR_REGEN" || PYTHON_FOR_REGEN="python3" -if test "$PYTHON_FOR_GEN" = not-found; then - PYTHON_FOR_GEN='@echo "Cannot generate $@, python not found !" && \ - echo "To skip re-generation of $@ run or ." && \ - echo "Otherwise, set python in PATH and run configure or run ." && false &&' -fi if test "$cross_compiling" = yes; then @@ -3071,18 +3054,14 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; } $as_echo "$interp" >&6; } PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp fi - # Used to comment out stuff for rebuilding generated files - GENERATED_COMMENT='#' elif test "$cross_compiling" = maybe; then as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5 else PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' - GENERATED_COMMENT='' fi - if test "$prefix" != "/"; then prefix=`echo "$prefix" | sed -e 's/\/$//g'` fi @@ -6548,7 +6527,7 @@ $as_echo_n "checking for --enable-optimizations... " >&6; } # Check whether --enable-optimizations was given. if test "${enable_optimizations+set}" = set; then : enableval=$enable_optimizations; -if test "$withval" != no +if test "$enableval" != no then Py_OPT='true' { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -6859,6 +6838,7 @@ esac # tweak OPT based on compiler and platform, only if the user didn't set # it on the command line + if test "${OPT-unset}" = "unset" then case $GCC in @@ -6871,30 +6851,49 @@ then WRAP="-fwrapv" fi - # Clang also needs -fwrapv case $CC in - *clang*) WRAP="-fwrapv" - ;; + *clang*) + cc_is_clang=1 + ;; + *) + if $CC --version 2>&1 | grep -q clang + then + cc_is_clang=1 + else + cc_is_clang= + fi esac + if test -n "${cc_is_clang}" + then + # Clang also needs -fwrapv + WRAP="-fwrapv" + # bpo-30104: disable strict aliasing to compile correctly dtoa.c, + # see Makefile.pre.in for more information + CFLAGS_ALIASING="-fno-strict-aliasing" + fi + case $ac_cv_prog_cc_g in yes) if test "$Py_DEBUG" = 'true' ; then # Optimization messes up debuggers, so turn it off for # debug builds. if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then - OPT="-g -Og -Wall $STRICT_PROTO" + OPT="-g -Og -Wall" else - OPT="-g -O0 -Wall $STRICT_PROTO" + OPT="-g -O0 -Wall" fi else - OPT="-g $WRAP -O3 -Wall $STRICT_PROTO" + OPT="-g $WRAP -O3 -Wall" fi ;; *) - OPT="-O3 -Wall $STRICT_PROTO" + OPT="-O3 -Wall" ;; esac + + OPT="$OPT $STRICT_PROTO" + case $ac_sys_system in SCO_SV*) OPT="$OPT -m486 -DSCO5" ;; @@ -17827,7 +17826,7 @@ mv config.c Modules if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then echo "" >&6 echo "" >&6 - echo "If you want a release build with all optimizations active (LTO, PGO, etc)," + echo "If you want a release build with all stable optimizations active (PGO, etc)," echo "please run ./configure --enable-optimizations" >&6 echo "" >&6 echo "" >&6 diff --git a/configure.ac b/configure.ac index 49d1a37..c9b755f 100644 --- a/configure.ac +++ b/configure.ac @@ -25,25 +25,25 @@ else BASECPPFLAGS="" fi -AC_SUBST(HGVERSION) -AC_SUBST(HGTAG) -AC_SUBST(HGBRANCH) +AC_SUBST(GITVERSION) +AC_SUBST(GITTAG) +AC_SUBST(GITBRANCH) -if test -e $srcdir/.hg/dirstate +if test -e $srcdir/.git then -AC_CHECK_PROG(HAS_HG, hg, found, not-found) +AC_CHECK_PROG(HAS_GIT, git, found, not-found) else -HAS_HG=no-repository +HAS_GIT=no-repository fi -if test $HAS_HG = found +if test $HAS_GIT = found then - HGVERSION="hg id -i \$(srcdir)" - HGTAG="hg id -t \$(srcdir)" - HGBRANCH="hg id -b \$(srcdir)" + GITVERSION="git -C \$(srcdir) rev-parse --short HEAD" + GITTAG="git -C \$(srcdir) describe --all --always --dirty" + GITBRANCH="git -C \$(srcdir) name-rev --name-only HEAD" else - HGVERSION="" - HGTAG="" - HGBRANCH="" + GITVERSION="" + GITTAG="" + GITBRANCH="" fi AC_CONFIG_SRCDIR([Include/object.h]) @@ -56,13 +56,8 @@ AC_SUBST(host) # pybuilddir.txt will be created by --generate-posix-vars in the Makefile rm -f pybuilddir.txt -AC_CHECK_PROGS(PYTHON_FOR_GEN, python$PACKAGE_VERSION python3 python, not-found) -if test "$PYTHON_FOR_GEN" = not-found; then - PYTHON_FOR_GEN='@echo "Cannot generate $@, python not found !" && \ - echo "To skip re-generation of $@ run or ." && \ - echo "Otherwise, set python in PATH and run configure or run ." && false &&' -fi -AC_SUBST(PYTHON_FOR_GEN) +AC_CHECK_PROGS(PYTHON_FOR_REGEN, python$PACKAGE_VERSION python3 python, python3) +AC_SUBST(PYTHON_FOR_REGEN) if test "$cross_compiling" = yes; then AC_MSG_CHECKING([for python interpreter for cross build]) @@ -80,16 +75,12 @@ if test "$cross_compiling" = yes; then AC_MSG_RESULT($interp) PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp fi - # Used to comment out stuff for rebuilding generated files - GENERATED_COMMENT='#' elif test "$cross_compiling" = maybe; then AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) else PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' - GENERATED_COMMENT='' fi AC_SUBST(PYTHON_FOR_BUILD) -AC_SUBST(GENERATED_COMMENT) dnl Ensure that if prefix is specified, it does not end in a slash. If dnl it does, we get path names containing '//' which is both ugly and @@ -1235,9 +1226,9 @@ AC_SUBST(DEF_MAKE_ALL_RULE) AC_SUBST(DEF_MAKE_RULE) Py_OPT='false' AC_MSG_CHECKING(for --enable-optimizations) -AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations], [Enable expensive optimizations (PGO, maybe LTO, etc). Disabled by default.]), +AC_ARG_ENABLE(optimizations, AS_HELP_STRING([--enable-optimizations], [Enable expensive, stable optimizations (PGO, etc). Disabled by default.]), [ -if test "$withval" != no +if test "$enableval" != no then Py_OPT='true' AC_MSG_RESULT(yes); @@ -1403,6 +1394,7 @@ esac # tweak OPT based on compiler and platform, only if the user didn't set # it on the command line AC_SUBST(OPT) +AC_SUBST(CFLAGS_ALIASING) if test "${OPT-unset}" = "unset" then case $GCC in @@ -1415,30 +1407,49 @@ then WRAP="-fwrapv" fi - # Clang also needs -fwrapv case $CC in - *clang*) WRAP="-fwrapv" - ;; + *clang*) + cc_is_clang=1 + ;; + *) + if $CC --version 2>&1 | grep -q clang + then + cc_is_clang=1 + else + cc_is_clang= + fi esac + if test -n "${cc_is_clang}" + then + # Clang also needs -fwrapv + WRAP="-fwrapv" + # bpo-30104: disable strict aliasing to compile correctly dtoa.c, + # see Makefile.pre.in for more information + CFLAGS_ALIASING="-fno-strict-aliasing" + fi + case $ac_cv_prog_cc_g in yes) if test "$Py_DEBUG" = 'true' ; then # Optimization messes up debuggers, so turn it off for # debug builds. if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then - OPT="-g -Og -Wall $STRICT_PROTO" + OPT="-g -Og -Wall" else - OPT="-g -O0 -Wall $STRICT_PROTO" + OPT="-g -O0 -Wall" fi else - OPT="-g $WRAP -O3 -Wall $STRICT_PROTO" + OPT="-g $WRAP -O3 -Wall" fi ;; *) - OPT="-O3 -Wall $STRICT_PROTO" + OPT="-O3 -Wall" ;; esac + + OPT="$OPT $STRICT_PROTO" + case $ac_sys_system in SCO_SV*) OPT="$OPT -m486 -DSCO5" ;; @@ -5378,7 +5389,7 @@ mv config.c Modules if test "$Py_OPT" = 'false' -a "$Py_DEBUG" != 'true'; then echo "" >&AS_MESSAGE_FD echo "" >&AS_MESSAGE_FD - echo "If you want a release build with all optimizations active (LTO, PGO, etc)," + echo "If you want a release build with all stable optimizations active (PGO, etc)," echo "please run ./configure --enable-optimizations" >&AS_MESSAGE_FD echo "" >&AS_MESSAGE_FD echo "" >&AS_MESSAGE_FD -- 2.7.4