Imported Upstream version 3.8.3 upstream/3.8.3
authorDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 9 Dec 2020 00:30:49 +0000 (09:30 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Wed, 9 Dec 2020 00:30:49 +0000 (09:30 +0900)
444 files changed:
Doc/Makefile
Doc/c-api/arg.rst
Doc/c-api/code.rst
Doc/c-api/dict.rst
Doc/c-api/exceptions.rst
Doc/c-api/init.rst
Doc/c-api/init_config.rst
Doc/c-api/intro.rst
Doc/c-api/iter.rst
Doc/c-api/long.rst
Doc/c-api/mapping.rst
Doc/c-api/memory.rst
Doc/c-api/module.rst
Doc/c-api/object.rst
Doc/c-api/typeobj.rst
Doc/copyright.rst
Doc/data/refcounts.dat
Doc/extending/extending.rst
Doc/faq/design.rst
Doc/faq/programming.rst
Doc/glossary.rst
Doc/howto/functional.rst
Doc/howto/pyporting.rst
Doc/includes/custom.c
Doc/install/index.rst
Doc/library/ast.rst
Doc/library/asyncio-eventloop.rst
Doc/library/code.rst
Doc/library/collections.rst
Doc/library/csv.rst
Doc/library/ctypes.rst
Doc/library/dataclasses.rst
Doc/library/datetime.rst
Doc/library/decimal.rst
Doc/library/dis.rst
Doc/library/ensurepip.rst
Doc/library/enum.rst
Doc/library/fcntl.rst
Doc/library/functions.rst
Doc/library/functools.rst
Doc/library/gettext.rst
Doc/library/http.client.rst
Doc/library/idle.rst
Doc/library/importlib.rst
Doc/library/inspect.rst
Doc/library/io.rst
Doc/library/keyword.rst
Doc/library/logging.rst
Doc/library/mailcap.rst
Doc/library/msvcrt.rst
Doc/library/multiprocessing.rst
Doc/library/nntplib.rst
Doc/library/os.rst
Doc/library/pathlib.rst
Doc/library/pickle.rst
Doc/library/platform.rst
Doc/library/pprint.rst
Doc/library/pty.rst
Doc/library/py_compile.rst
Doc/library/pyclbr.rst
Doc/library/queue.rst
Doc/library/random.rst
Doc/library/re.rst
Doc/library/resource.rst
Doc/library/shutil.rst
Doc/library/signal.rst
Doc/library/site.rst
Doc/library/socket.rst
Doc/library/socketserver.rst
Doc/library/sqlite3.rst
Doc/library/ssl.rst
Doc/library/statistics.rst
Doc/library/stdtypes.rst
Doc/library/string.rst
Doc/library/subprocess.rst
Doc/library/sys.rst
Doc/library/syslog.rst
Doc/library/textwrap.rst
Doc/library/threading.rst
Doc/library/time.rst
Doc/library/timeit.rst
Doc/library/token.rst
Doc/library/tokenize.rst
Doc/library/tracemalloc.rst
Doc/library/turtle.rst
Doc/library/types.rst
Doc/library/typing.rst
Doc/library/unittest.mock.rst
Doc/library/unittest.rst
Doc/library/weakref.rst
Doc/library/zipapp.rst
Doc/library/zipfile.rst
Doc/license.rst
Doc/make.bat
Doc/reference/compound_stmts.rst
Doc/reference/datamodel.rst
Doc/reference/expressions.rst
Doc/reference/import.rst
Doc/reference/lexical_analysis.rst
Doc/tools/templates/download.html
Doc/tools/templates/indexsidebar.html
Doc/tutorial/classes.rst
Doc/tutorial/controlflow.rst
Doc/tutorial/datastructures.rst
Doc/tutorial/errors.rst
Doc/using/cmdline.rst
Doc/using/venv-create.inc
Doc/using/windows.rst
Doc/whatsnew/3.0.rst
Doc/whatsnew/3.7.rst
Doc/whatsnew/3.8.rst
Include/code.h
Include/compile.h
Include/cpython/pystate.h
Include/object.h
Include/patchlevel.h
LICENSE
Lib/__future__.py
Lib/_osx_support.py
Lib/_pydecimal.py
Lib/argparse.py
Lib/ast.py
Lib/asyncio/base_events.py
Lib/asyncio/base_tasks.py
Lib/asyncio/staggered.py
Lib/asyncio/unix_events.py
Lib/base64.py
Lib/bdb.py
Lib/code.py
Lib/codecs.py
Lib/collections/__init__.py
Lib/compileall.py
Lib/copy.py
Lib/ctypes/test/test_loading.py
Lib/ctypes/test/test_structures.py
Lib/distutils/_msvccompiler.py
Lib/distutils/command/build_ext.py
Lib/distutils/tests/test_build_ext.py
Lib/distutils/tests/test_config_cmd.py
Lib/distutils/tests/test_msvccompiler.py
Lib/distutils/unixccompiler.py
Lib/doctest.py
Lib/encodings/punycode.py
Lib/ensurepip/__init__.py
Lib/fractions.py
Lib/functools.py
Lib/glob.py
Lib/gzip.py
Lib/http/client.py
Lib/http/server.py
Lib/idlelib/Icons/README.txt [new file with mode: 0644]
Lib/idlelib/Icons/idle.icns [deleted file]
Lib/idlelib/Icons/idle_256.png [new file with mode: 0644]
Lib/idlelib/NEWS.txt
Lib/idlelib/README.txt
Lib/idlelib/autocomplete_w.py
Lib/idlelib/calltip.py
Lib/idlelib/codecontext.py
Lib/idlelib/config_key.py
Lib/idlelib/configdialog.py
Lib/idlelib/editor.py
Lib/idlelib/help.html
Lib/idlelib/idle_test/test_calltip.py
Lib/idlelib/idle_test/test_codecontext.py
Lib/idlelib/idle_test/test_configdialog.py
Lib/idlelib/idle_test/test_editor.py
Lib/idlelib/idle_test/test_pyparse.py
Lib/idlelib/idle_test/test_query.py
Lib/idlelib/idle_test/test_sidebar.py
Lib/idlelib/idle_test/test_squeezer.py
Lib/idlelib/pyparse.py
Lib/idlelib/pyshell.py
Lib/idlelib/query.py
Lib/idlelib/textview.py
Lib/importlib/metadata.py
Lib/inspect.py
Lib/json/tool.py
Lib/lib2to3/Grammar.txt
Lib/lib2to3/fixes/fix_filter.py
Lib/lib2to3/pgen2/grammar.py
Lib/lib2to3/pgen2/token.py
Lib/lib2to3/pgen2/tokenize.py
Lib/lib2to3/tests/test_fixers.py
Lib/lib2to3/tests/test_parser.py
Lib/logging/__init__.py
Lib/logging/config.py
Lib/mimetypes.py
Lib/modulefinder.py
Lib/multiprocessing/connection.py
Lib/multiprocessing/forkserver.py
Lib/multiprocessing/managers.py
Lib/multiprocessing/pool.py
Lib/multiprocessing/shared_memory.py
Lib/multiprocessing/spawn.py
Lib/multiprocessing/util.py
Lib/nntplib.py
Lib/os.py
Lib/pathlib.py
Lib/pickle.py
Lib/platform.py
Lib/pty.py
Lib/pydoc.py
Lib/pydoc_data/topics.py
Lib/re.py
Lib/runpy.py
Lib/shutil.py
Lib/socket.py
Lib/sqlite3/test/regression.py
Lib/sqlite3/test/types.py
Lib/subprocess.py
Lib/symtable.py
Lib/tarfile.py
Lib/tempfile.py
Lib/test/_test_multiprocessing.py
Lib/test/audit-tests.py
Lib/test/clinic.test
Lib/test/libregrtest/cmdline.py
Lib/test/libregrtest/main.py
Lib/test/libregrtest/runtest.py
Lib/test/libregrtest/runtest_mp.py
Lib/test/libregrtest/utils.py
Lib/test/pickletester.py
Lib/test/pythoninfo.py
Lib/test/sortperf.py
Lib/test/support/__init__.py
Lib/test/test__osx_support.py
Lib/test/test__xxsubinterpreters.py
Lib/test/test_argparse.py
Lib/test/test_ast.py
Lib/test/test_asyncgen.py
Lib/test/test_asyncio/test_context.py
Lib/test/test_asyncio/test_events.py
Lib/test/test_audit.py
Lib/test/test_base64.py
Lib/test/test_buffer.py
Lib/test/test_builtin.py
Lib/test/test_capi.py
Lib/test/test_cmd_line.py
Lib/test/test_codecs.py
Lib/test/test_compileall.py
Lib/test/test_concurrent_futures.py
Lib/test/test_copy.py
Lib/test/test_crypt.py
Lib/test/test_dataclasses.py
Lib/test/test_decimal.py
Lib/test/test_deque.py
Lib/test/test_dict.py
Lib/test/test_doctest.py
Lib/test/test_email/test_email.py
Lib/test/test_eof.py
Lib/test/test_exceptions.py
Lib/test/test_fractions.py
Lib/test/test_future.py
Lib/test/test_gdb.py
Lib/test/test_gzip.py
Lib/test/test_heapq.py
Lib/test/test_httplib.py
Lib/test/test_importlib/fixtures.py
Lib/test/test_importlib/stubs.py [new file with mode: 0644]
Lib/test/test_importlib/test_main.py
Lib/test/test_importlib/util.py
Lib/test/test_io.py
Lib/test/test_isinstance.py
Lib/test/test_json/test_tool.py
Lib/test/test_list.py
Lib/test/test_logging.py
Lib/test/test_math.py
Lib/test/test_mimetypes.py
Lib/test/test_modulefinder.py
Lib/test/test_named_expressions.py
Lib/test/test_nntplib.py
Lib/test/test_ordered_dict.py
Lib/test/test_os.py
Lib/test/test_pathlib.py
Lib/test/test_positional_only_arg.py
Lib/test/test_pty.py
Lib/test/test_pwd.py
Lib/test/test_regrtest.py
Lib/test/test_repl.py
Lib/test/test_runpy.py
Lib/test/test_shutil.py
Lib/test/test_site.py
Lib/test/test_socket.py
Lib/test/test_subprocess.py
Lib/test/test_support.py
Lib/test/test_symtable.py
Lib/test/test_syntax.py
Lib/test/test_tempfile.py
Lib/test/test_tools/test_unparse.py
Lib/test/test_typing.py
Lib/test/test_urllib.py
Lib/test/test_urllib2.py
Lib/test/test_urlparse.py
Lib/test/test_venv.py
Lib/test/test_warnings/__init__.py
Lib/test/test_xml_etree_c.py
Lib/test/test_zipfile.py
Lib/test/test_zipimport.py
Lib/threading.py
Lib/timeit.py
Lib/tkinter/test/widget_tests.py
Lib/tkinter/tix.py
Lib/tkinter/ttk.py
Lib/trace.py
Lib/traceback.py
Lib/turtledemo/__main__.py
Lib/typing.py
Lib/unittest/case.py
Lib/unittest/mock.py
Lib/unittest/test/test_case.py
Lib/unittest/test/testmock/testasync.py
Lib/unittest/test/testmock/testmock.py
Lib/urllib/parse.py
Lib/urllib/request.py
Lib/venv/scripts/common/Activate.ps1
Lib/warnings.py
Lib/webbrowser.py
Lib/zipfile.py
Lib/zipimport.py
Mac/BuildScript/build-installer.py
Mac/BuildScript/resources/License.rtf
Mac/BuildScript/resources/ReadMe.rtf
Mac/IDLE/IDLE.app/Contents/Info.plist
Mac/PythonLauncher/Info.plist.in
Mac/README.rst
Mac/Resources/app/Info.plist.in
Mac/Tools/pythonw.c
Makefile.pre.in
Misc/ACKS
Misc/NEWS
Misc/gdbinit
Misc/python.man
Misc/valgrind-python.supp
Modules/_asynciomodule.c
Modules/_collectionsmodule.c
Modules/_ctypes/_ctypes.c
Modules/_ctypes/callproc.c
Modules/_decimal/_decimal.c
Modules/_decimal/libmpdec/mpdecimal.c
Modules/_decimal/tests/deccheck.py
Modules/_decimal/tests/runall-memorydebugger.sh
Modules/_decimal/tests/runall.bat
Modules/_elementtree.c
Modules/_heapqmodule.c
Modules/_io/bufferedio.c
Modules/_io/textio.c
Modules/_pickle.c
Modules/_sqlite/cursor.c
Modules/_ssl_data.h
Modules/_struct.c
Modules/_testcapimodule.c
Modules/_xxsubinterpretersmodule.c
Modules/clinic/_pickle.c.h
Modules/clinic/posixmodule.c.h
Modules/fcntlmodule.c
Modules/mathmodule.c
Modules/md5module.c
Modules/ossaudiodev.c
Modules/posixmodule.c
Modules/resource.c
Modules/signalmodule.c
Modules/socketmodule.c
Modules/syslogmodule.c
Objects/abstract.c
Objects/bytes_methods.c
Objects/clinic/codeobject.c.h
Objects/codeobject.c
Objects/complexobject.c
Objects/descrobject.c
Objects/dictobject.c
Objects/floatobject.c
Objects/genobject.c
Objects/listobject.c
Objects/listsort.txt
Objects/longobject.c
Objects/memoryobject.c
Objects/methodobject.c
Objects/object.c
Objects/obmalloc.c
Objects/odictobject.c
Objects/stringlib/asciilib.h
Objects/stringlib/codecs.h
Objects/stringlib/find_max_char.h
Objects/tupleobject.c
Objects/unicodeobject.c
PC/getpathp.c
PC/icons/logo.svg [new file with mode: 0644]
PC/icons/logox128.png [new file with mode: 0644]
PC/layout/main.py
PC/layout/support/nuspec.py
PC/layout/support/props.py
PC/msvcrtmodule.c
PC/pyconfig.h
PCbuild/build.bat
PCbuild/find_msbuild.bat
PCbuild/get_externals.bat
PCbuild/lib.pyproj
PCbuild/pyproject.props
PCbuild/python.props
PCbuild/python_uwp.vcxproj
PCbuild/pythoncore.vcxproj
PCbuild/pythonw_uwp.vcxproj
PCbuild/readme.txt
Parser/parsetok.c
Parser/tokenizer.c
Python/_warnings.c
Python/ast.c
Python/ast_opt.c
Python/ast_unparse.c
Python/bltinmodule.c
Python/ceval.c
Python/codecs.c
Python/compile.c
Python/errors.c
Python/getcopyright.c
Python/getopt.c
Python/hamt.c
Python/import.c
Python/importlib_zipimport.h
Python/initconfig.c
Python/marshal.c
Python/modsupport.c
Python/pathconfig.c
Python/pyhash.c
Python/pylifecycle.c
Python/pystate.c
Python/symtable.c
Python/sysmodule.c
Python/thread_nt.h
README.rst
Tools/clinic/cpp.py
Tools/gdb/libpython.py
Tools/msi/exe/exe.wixproj
Tools/msi/exe/exe_files.wxs
Tools/nuget/make_pkg.proj
Tools/parser/unparse.py
Tools/ssl/make_ssl_data.py
Tools/ssl/multissltests.py
aclocal.m4
configure
configure.ac
m4/ax_c_float_words_bigendian.m4
pyconfig.h.in
setup.py

index f589b6e75f6180426ae6e4fca6d28a265473cf41..2169f1a369549585353c75c443d0b6c71b6c29f3 100644 (file)
@@ -143,7 +143,7 @@ clean:
 venv:
        $(PYTHON) -m venv $(VENVDIR)
        $(VENVDIR)/bin/python3 -m pip install -U pip setuptools
-       $(VENVDIR)/bin/python3 -m pip install -U Sphinx blurb python-docs-theme
+       $(VENVDIR)/bin/python3 -m pip install -U Sphinx==1.8.2 blurb python-docs-theme
        @echo "The venv has been created in the $(VENVDIR) directory"
 
 dist:
index f17c63d0b9dc93208bff058924942af853705ed9..b7baad589a72c83a73d8624ba0ed1b1e318f6dda 100644 (file)
@@ -105,7 +105,7 @@ which disallows mutable objects such as :class:`bytearray`.
    Like ``s*``, but the Python object may also be ``None``, in which case the
    ``buf`` member of the :c:type:`Py_buffer` structure is set to ``NULL``.
 
-``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) [const char \*, int]
+``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
    Like ``s#``, but the Python object may also be ``None``, in which case the C
    pointer is set to ``NULL``.
 
@@ -124,7 +124,7 @@ which disallows mutable objects such as :class:`bytearray`.
    bytes-like objects.  **This is the recommended way to accept
    binary data.**
 
-``y#`` (read-only :term:`bytes-like object`) [const char \*, int]
+``y#`` (read-only :term:`bytes-like object`) [const char \*, int or :c:type:`Py_ssize_t`]
    This variant on ``s#`` doesn't accept Unicode objects, only bytes-like
    objects.
 
@@ -155,7 +155,7 @@ which disallows mutable objects such as :class:`bytearray`.
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsWideCharString`.
 
-``u#`` (:class:`str`) [const Py_UNICODE \*, int]
+``u#`` (:class:`str`) [const Py_UNICODE \*, int or :c:type:`Py_ssize_t`]
    This variant on ``u`` stores into two C variables, the first one a pointer to a
    Unicode data buffer, the second one its length.  This variant allows
    null code points.
@@ -172,7 +172,7 @@ which disallows mutable objects such as :class:`bytearray`.
       Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
       :c:func:`PyUnicode_AsWideCharString`.
 
-``Z#`` (:class:`str` or ``None``) [const Py_UNICODE \*, int]
+``Z#`` (:class:`str` or ``None``) [const Py_UNICODE \*, int or :c:type:`Py_ssize_t`]
    Like ``u#``, but the Python object may also be ``None``, in which case the
    :c:type:`Py_UNICODE` pointer is set to ``NULL``.
 
@@ -213,7 +213,7 @@ which disallows mutable objects such as :class:`bytearray`.
    recoding them.  Instead, the implementation assumes that the byte string object uses
    the encoding passed in as parameter.
 
-``es#`` (:class:`str`) [const char \*encoding, char \*\*buffer, int \*buffer_length]
+``es#`` (:class:`str`) [const char \*encoding, char \*\*buffer, int or :c:type:`Py_ssize_t` \*buffer_length]
    This variant on ``s#`` is used for encoding Unicode into a character buffer.
    Unlike the ``es`` format, this variant allows input data which contains NUL
    characters.
@@ -244,7 +244,7 @@ which disallows mutable objects such as :class:`bytearray`.
    In both cases, *\*buffer_length* is set to the length of the encoded data
    without the trailing NUL byte.
 
-``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \*encoding, char \*\*buffer, int \*buffer_length]
+``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \*encoding, char \*\*buffer, int or :c:type:`Py_ssize_t` \*buffer_length]
    Same as ``es#`` except that byte string objects are passed through without recoding
    them. Instead, the implementation assumes that the byte string object uses the
    encoding passed in as parameter.
@@ -549,7 +549,7 @@ Building values
       Convert a null-terminated C string to a Python :class:`str` object using ``'utf-8'``
       encoding. If the C string pointer is ``NULL``, ``None`` is used.
 
-   ``s#`` (:class:`str` or ``None``) [const char \*, int]
+   ``s#`` (:class:`str` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
       Convert a C string and its length to a Python :class:`str` object using ``'utf-8'``
       encoding. If the C string pointer is ``NULL``, the length is ignored and
       ``None`` is returned.
@@ -558,14 +558,14 @@ Building values
       This converts a C string to a Python :class:`bytes` object.  If the C
       string pointer is ``NULL``, ``None`` is returned.
 
-   ``y#`` (:class:`bytes`) [const char \*, int]
+   ``y#`` (:class:`bytes`) [const char \*, int or :c:type:`Py_ssize_t`]
       This converts a C string and its lengths to a Python object.  If the C
       string pointer is ``NULL``, ``None`` is returned.
 
    ``z`` (:class:`str` or ``None``) [const char \*]
       Same as ``s``.
 
-   ``z#`` (:class:`str` or ``None``) [const char \*, int]
+   ``z#`` (:class:`str` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
       Same as ``s#``.
 
    ``u`` (:class:`str`) [const wchar_t \*]
@@ -573,7 +573,7 @@ Building values
       data to a Python Unicode object.  If the Unicode buffer pointer is ``NULL``,
       ``None`` is returned.
 
-   ``u#`` (:class:`str`) [const wchar_t \*, int]
+   ``u#`` (:class:`str`) [const wchar_t \*, int or :c:type:`Py_ssize_t`]
       Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python
       Unicode object.   If the Unicode buffer pointer is ``NULL``, the length is ignored
       and ``None`` is returned.
@@ -581,7 +581,7 @@ Building values
    ``U`` (:class:`str` or ``None``) [const char \*]
       Same as ``s``.
 
-   ``U#`` (:class:`str` or ``None``) [const char \*, int]
+   ``U#`` (:class:`str` or ``None``) [const char \*, int or :c:type:`Py_ssize_t`]
       Same as ``s#``.
 
    ``i`` (:class:`int`) [int]
index 45a6b4a753a729e9f94ad6b89d61260e455c032a..6f8c41ccbf6e853d9728f101e4f0b4e9dbb63203 100644 (file)
@@ -42,7 +42,7 @@ bound into a function.
 
 .. c:function:: PyCodeObject* PyCode_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab)
 
-   Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positonal-only arguments.
+   Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positional-only arguments.
 
    .. versionadded:: 3.8
 
index e7922dc0c73f2a06fa5d178c17462e37cc77f177..e48c11d336b8ce8e024bab0736733313f8573e0f 100644 (file)
@@ -62,19 +62,20 @@ Dictionary Objects
 
 .. c:function:: int PyDict_SetItem(PyObject *p, PyObject *key, PyObject *val)
 
-   Insert *value* into the dictionary *p* with a key of *key*.  *key* must be
+   Insert *val* into the dictionary *p* with a key of *key*.  *key* must be
    :term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return
-   ``0`` on success or ``-1`` on failure.
+   ``0`` on success or ``-1`` on failure.  This function *does not* steal a
+   reference to *val*.
 
 
 .. c:function:: int PyDict_SetItemString(PyObject *p, const char *key, PyObject *val)
 
    .. index:: single: PyUnicode_FromString()
 
-   Insert *value* into the dictionary *p* using *key* as a key. *key* should
+   Insert *val* into the dictionary *p* using *key* as a key. *key* should
    be a :c:type:`const char\*`.  The key object is created using
    ``PyUnicode_FromString(key)``.  Return ``0`` on success or ``-1`` on
-   failure.
+   failure.  This function *does not* steal a reference to *val*.
 
 
 .. c:function:: int PyDict_DelItem(PyObject *p, PyObject *key)
index c7ba74cc8d587424f5f14da84b1b4151f2673d6e..85a3d941ed8c11a05ba8c389e05b1cde2c96d200 100644 (file)
@@ -358,7 +358,7 @@ an error value).
 .. c:function:: int PyErr_ResourceWarning(PyObject *source, Py_ssize_t stack_level, const char *format, ...)
 
    Function similar to :c:func:`PyErr_WarnFormat`, but *category* is
-   :exc:`ResourceWarning` and pass *source* to :func:`warnings.WarningMessage`.
+   :exc:`ResourceWarning` and it passes *source* to :func:`warnings.WarningMessage`.
 
    .. versionadded:: 3.6
 
@@ -971,9 +971,6 @@ Notes:
    This is a base class for other standard exceptions.
 
 (2)
-   This is the same as :exc:`weakref.ReferenceError`.
-
-(3)
    Only defined on Windows; protect code that uses this by testing that the
    preprocessor macro ``MS_WINDOWS`` is defined.
 
index 155edba82f96dfec97ae4c47fe5189f6d128cef2..68d892dcae4046118d6028111f30a0be5dca0cd3 100644 (file)
@@ -1181,7 +1181,7 @@ It is usually the only Python interpreter in a process.  Unlike sub-interpreters
 the main interpreter has unique process-global responsibilities like signal
 handling.  It is also responsible for execution during runtime initialization and
 is usually the active interpreter during runtime finalization.  The
-:c:func:`PyInterpreterState_Main` funtion returns a pointer to its state.
+:c:func:`PyInterpreterState_Main` function returns a pointer to its state.
 
 You can switch between sub-interpreters using the :c:func:`PyThreadState_Swap`
 function. You can create and destroy them using the following functions:
@@ -1222,15 +1222,31 @@ function. You can create and destroy them using the following functions:
       single: Py_FinalizeEx()
       single: Py_Initialize()
 
-   Extension modules are shared between (sub-)interpreters as follows: the first
-   time a particular extension is imported, it is initialized normally, and a
-   (shallow) copy of its module's dictionary is squirreled away.  When the same
-   extension is imported by another (sub-)interpreter, a new module is initialized
-   and filled with the contents of this copy; the extension's ``init`` function is
-   not called.  Note that this is different from what happens when an extension is
-   imported after the interpreter has been completely re-initialized by calling
-   :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, the extension's
-   ``initmodule`` function *is* called again.
+   Extension modules are shared between (sub-)interpreters as follows:
+
+   *  For modules using multi-phase initialization,
+      e.g. :c:func:`PyModule_FromDefAndSpec`, a separate module object is
+      created and initialized for each interpreter.
+      Only C-level static and global variables are shared between these
+      module objects.
+
+   *  For modules using single-phase initialization,
+      e.g. :c:func:`PyModule_Create`, the first time a particular extension
+      is imported, it is initialized normally, and a (shallow) copy of its
+      module's dictionary is squirreled away.
+      When the same extension is imported by another (sub-)interpreter, a new
+      module is initialized and filled with the contents of this copy; the
+      extension's ``init`` function is not called.
+      Objects in the module's dictionary thus end up shared across
+      (sub-)interpreters, which might cause unwanted behavior (see
+      `Bugs and caveats`_ below).
+
+      Note that this is different from what happens when an extension is
+      imported after the interpreter has been completely re-initialized by
+      calling :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that
+      case, the extension's ``initmodule`` function *is* called again.
+      As with multi-phase initialization, this means that only C-level static
+      and global variables are shared between these modules.
 
    .. index:: single: close() (in module os)
 
@@ -1256,14 +1272,16 @@ process, the insulation between them isn't perfect --- for example, using
 low-level file operations like  :func:`os.close` they can
 (accidentally or maliciously) affect each other's open files.  Because of the
 way extensions are shared between (sub-)interpreters, some extensions may not
-work properly; this is especially likely when the extension makes use of
-(static) global variables, or when the extension manipulates its module's
-dictionary after its initialization.  It is possible to insert objects created
-in one sub-interpreter into a namespace of another sub-interpreter; this should
-be done with great care to avoid sharing user-defined functions, methods,
-instances or classes between sub-interpreters, since import operations executed
-by such objects may affect the wrong (sub-)interpreter's dictionary of loaded
-modules.
+work properly; this is especially likely when using single-phase initialization
+or (static) global variables.
+It is possible to insert objects created in one sub-interpreter into
+a namespace of another (sub-)interpreter; this should be avoided if possible.
+
+Special care should be taken to avoid sharing user-defined functions,
+methods, instances or classes between sub-interpreters, since import
+operations executed by such objects may affect the wrong (sub-)interpreter's
+dictionary of loaded modules. It is equally important to avoid sharing
+objects from which the above are reachable.
 
 Also note that combining this functionality with :c:func:`PyGILState_\*` APIs
 is delicate, because these APIs assume a bijection between Python thread states
index 6b16b5bb72859a507e18ab4c5d31353310ef1c7f..79a8815ed4199dc68457fe2c4731d0e4102804b0 100644 (file)
@@ -757,7 +757,7 @@ configuration, and then override some parameters::
         PyConfig config;
         PyConfig_InitPythonConfig(&config);
 
-        /* Set the program name before reading the configuraton
+        /* Set the program name before reading the configuration
            (decode byte string from the locale encoding).
 
            Implicitly preinitialize Python. */
index d08d4f97a308e72d1601e8bc173d8a72e36ec15a..718f40eb6c2474e1246582c2abb89a9a212fb880 100644 (file)
@@ -174,6 +174,39 @@ complete listing.
    .. versionchanged:: 3.8
       MSVC support was added.
 
+.. c:macro:: PyDoc_STRVAR(name, str)
+
+   Creates a variable with name ``name`` that can be used in docstrings.
+   If Python is built without docstrings, the value will be empty.
+
+   Use :c:macro:`PyDoc_STRVAR` for docstrings to support building
+   Python without docstrings, as specified in :pep:`7`.
+
+   Example::
+
+      PyDoc_STRVAR(pop_doc, "Remove and return the rightmost element.");
+
+      static PyMethodDef deque_methods[] = {
+          // ...
+          {"pop", (PyCFunction)deque_pop, METH_NOARGS, pop_doc},
+          // ...
+      }
+
+.. c:macro:: PyDoc_STR(str)
+
+   Creates a docstring for the given input string or an empty string
+   if docstrings are disabled.
+
+   Use :c:macro:`PyDoc_STR` in specifying docstrings to support
+   building Python without docstrings, as specified in :pep:`7`.
+
+   Example::
+
+      static PyMethodDef pysqlite_row_methods[] = {
+          {"keys", (PyCFunction)pysqlite_row_keys, METH_NOARGS,
+              PyDoc_STR("Returns the keys of the row.")},
+          {NULL, NULL}
+      };
 
 .. _api-objects:
 
index 0224d37f1a41a00bd550c6d1a44344a8e417c081..a2992b3452f91c3c1fb9d3fc9a5ebd4a75e3be3d 100644 (file)
@@ -29,7 +29,7 @@ something like this::
        /* propagate error */
    }
 
-   while (item = PyIter_Next(iterator)) {
+   while ((item = PyIter_Next(iterator))) {
        /* do something with item */
        ...
        /* release reference when done */
index 33f6b3be58307a224bb0f84f057951c88634ecbe..f41d419bd37758c58a965c9ea2d10863c8dfb15c 100644 (file)
@@ -179,7 +179,7 @@ distinguished from a number.  Use :c:func:`PyErr_Occurred` to disambiguate.
    :c:type:`PyLongObject`.
 
    Raise :exc:`OverflowError` if the value of *obj* is out of range for a
-   :c:type:`long`.
+   :c:type:`long long`.
 
    Returns ``-1`` on error.  Use :c:func:`PyErr_Occurred` to disambiguate.
 
index 6a80b033b651ec8d0523106949795b55c7129dc7..682160d1475c1c4b9cfff1aa0b386dff9299ab9d 100644 (file)
@@ -37,7 +37,8 @@ See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` and
 
    Map the string *key* to the value *v* in object *o*.  Returns ``-1`` on
    failure.  This is the equivalent of the Python statement ``o[key] = v``.
-   See also :c:func:`PyObject_SetItem`.
+   See also :c:func:`PyObject_SetItem`.  This function *does not* steal a
+   reference to *v*.
 
 
 .. c:function:: int PyMapping_DelItem(PyObject *o, PyObject *key)
index ba7bd3b9a53878b66748044c45d7c70d6c891463..8a8542f0479ec595d08358f16c069ebbd7f80153 100644 (file)
@@ -533,7 +533,7 @@ tracemalloc C API
 
 .. versionadded:: 3.7
 
-.. c:function: int PyTraceMalloc_Track(unsigned int domain, uintptr_t ptr, size_t size)
+.. c:function:: int PyTraceMalloc_Track(unsigned int domain, uintptr_t ptr, size_t size)
 
    Track an allocated memory block in the :mod:`tracemalloc` module.
 
@@ -542,7 +542,7 @@ tracemalloc C API
 
    If memory block is already tracked, update the existing trace.
 
-.. c:function: int PyTraceMalloc_Untrack(unsigned int domain, uintptr_t ptr)
+.. c:function:: int PyTraceMalloc_Untrack(unsigned int domain, uintptr_t ptr)
 
    Untrack an allocated memory block in the :mod:`tracemalloc` module.
    Do nothing if the block was not tracked.
index 57902a9c7f8384784c96f0779213ad0e40efdea0..d2b8f4c12503e76fad6797093624306f1dfa2181 100644 (file)
@@ -153,7 +153,7 @@ or request "multi-phase initialization" by returning the definition struct itsel
    .. c:member:: const char *m_doc
 
       Docstring for the module; usually a docstring variable created with
-      :c:func:`PyDoc_STRVAR` is used.
+      :c:macro:`PyDoc_STRVAR` is used.
 
    .. c:member:: Py_ssize_t m_size
 
index 404a98fb417bb1565b170c4fcc75e4d7db924841..3bdc0f56eb251548663bc88518b0e2cad8f5f31d 100644 (file)
@@ -128,7 +128,7 @@ Object Protocol
    .. versionadded:: 3.3
 
 
-.. c:function:: int PyObject_GenericSetDict(PyObject *o, void *context)
+.. c:function:: int PyObject_GenericSetDict(PyObject *o, PyObject *value, void *context)
 
    A generic implementation for the setter of a ``__dict__`` descriptor. This
    implementation does not allow the dictionary to be deleted.
@@ -503,7 +503,8 @@ Object Protocol
 
    Map the object *key* to the value *v*.  Raise an exception and
    return ``-1`` on failure; return ``0`` on success.  This is the
-   equivalent of the Python statement ``o[key] = v``.
+   equivalent of the Python statement ``o[key] = v``.  This function *does
+   not* steal a reference to *v*.
 
 
 .. c:function:: int PyObject_DelItem(PyObject *o, PyObject *key)
index bff5abfea48ee92c10756ed13fe0c7d6a05abb4e..163f599d1c2641673be98344f03cde5ea112cea6 100644 (file)
@@ -1218,7 +1218,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
    The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage collector to detect
    reference cycles. A typical implementation of a :c:member:`~PyTypeObject.tp_traverse` function
    simply calls :c:func:`Py_VISIT` on each of the instance's members that are Python
-   objects For example, this is function :c:func:`local_traverse` from the
+   objects that the instance owns. For example, this is function :c:func:`local_traverse` from the
    :mod:`_thread` extension module::
 
       static int
@@ -1238,6 +1238,18 @@ and :c:type:`PyType_Type` effectively act as defaults.)
    debugging aid you may want to visit it anyway just so the :mod:`gc` module's
    :func:`~gc.get_referents` function will include it.
 
+   .. warning::
+       When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members
+       that the instance *owns* (by having strong references to them) must be
+       visited. For instance, if an object supports weak references via the
+       :c:member:`~PyTypeObject.tp_weaklist` slot, the pointer supporting
+       the linked list (what *tp_weaklist* points to) must **not** be
+       visited as the instance does not directly own the weak references to itself
+       (the weakreference list is there to support the weak reference machinery,
+       but the instance has no strong reference to the elements inside it, as they
+       are allowed to be removed even if the instance is still alive).
+
+
    Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to
    :c:func:`local_traverse` to have these specific names; don't name them just
    anything.
index 393a1f03751f823fdc370686ebaf3aa6fb848099..1b90d9f172c992e852a95fd128f92e06dd776cc4 100644 (file)
@@ -4,7 +4,7 @@ Copyright
 
 Python and this documentation is:
 
-Copyright © 2001-2019 Python Software Foundation. All rights reserved.
+Copyright © 2001-2020 Python Software Foundation. All rights reserved.
 
 Copyright © 2000 BeOpen.com. All rights reserved.
 
index cfed1bd503118e607433fa1e775458edef292ef8..3ccc20b70c62e6509180951e1264d6248f1b7de9 100644 (file)
@@ -1673,7 +1673,8 @@ PyObject_GenericSetAttr:PyObject*:name:0:
 PyObject_GenericSetAttr:PyObject*:value:+1:
 
 PyObject_GenericSetDict:int:::
-PyObject_GenericSetDict:PyObject*:o:+1:
+PyObject_GenericSetDict:PyObject*:o:0:
+PyObject_GenericSetDict:PyObject*:value:+1:
 PyObject_GenericSetDict:void*:context::
 
 PyObject_GetAttr:PyObject*::+1:
index 5b32a2cdc5506efa302d979a76c2e8dda136040c..25dc2934d29ef6fcaba24faa96e21d934dc0b308 100644 (file)
@@ -395,18 +395,26 @@ optionally followed by an import of the module::
        }
 
        /* Add a built-in module, before Py_Initialize */
-       PyImport_AppendInittab("spam", PyInit_spam);
+       if (PyImport_AppendInittab("spam", PyInit_spam) == -1) {
+           fprintf(stderr, "Error: could not extend in-built modules table\n");
+           exit(1);
+       }
 
        /* Pass argv[0] to the Python interpreter */
        Py_SetProgramName(program);
 
-       /* Initialize the Python interpreter.  Required. */
+       /* Initialize the Python interpreter.  Required.
+          If this step fails, it will be a fatal error. */
        Py_Initialize();
 
        /* Optionally import the module; alternatively,
           import can be deferred until the embedded script
           imports it. */
-       PyImport_ImportModule("spam");
+       pmodule = PyImport_ImportModule("spam");
+       if (!pmodule) {
+           PyErr_Print();
+           fprintf(stderr, "Error: could not import module 'spam'\n");
+       }
 
        ...
 
index 81c0f474ac16241fb4780e15d8fc4d1a7f887994..e7921baf242f52c1813b8f35dcfcbe3d9b633d31 100644 (file)
@@ -146,6 +146,8 @@ variables and instance variables live in two different namespaces, and you need
 to tell Python which namespace to use.
 
 
+.. _why-can-t-i-use-an-assignment-in-an-expression:
+
 Why can't I use an assignment in an expression?
 -----------------------------------------------
 
index 9d45765abaacf2ee8cffdb8fbd43db58592a1be6..6cc1b52ed7b98bfcbf40eb746c7d598119b4fa01 100644 (file)
@@ -1019,7 +1019,7 @@ That's a tough one, in general.  First, here are a list of things to
 remember before diving further:
 
 * Performance characteristics vary across Python implementations.  This FAQ
-  focusses on :term:`CPython`.
+  focuses on :term:`CPython`.
 * Behaviour can vary across operating systems, especially when talking about
   I/O or multi-threading.
 * You should always find the hot spots in your program *before* attempting to
@@ -1494,8 +1494,8 @@ to uppercase::
 
 Here the ``UpperOut`` class redefines the ``write()`` method to convert the
 argument string to uppercase before calling the underlying
-``self.__outfile.write()`` method.  All other methods are delegated to the
-underlying ``self.__outfile`` object.  The delegation is accomplished via the
+``self._outfile.write()`` method.  All other methods are delegated to the
+underlying ``self._outfile`` object.  The delegation is accomplished via the
 ``__getattr__`` method; consult :ref:`the language reference <attribute-access>`
 for more information about controlling attribute access.
 
index 9ce0357f1cb42415e9241b966a21ae0dfe76e8dc..6189cb045049c2a20ee59fcf4aa27bfa60b52f17 100644 (file)
@@ -824,9 +824,11 @@ Glossary
       .. _positional-only_parameter:
 
       * :dfn:`positional-only`: specifies an argument that can be supplied only
-        by position.  Python has no syntax for defining positional-only
-        parameters.  However, some built-in functions have positional-only
-        parameters (e.g. :func:`abs`).
+        by position. Positional-only parameters can be defined by including a
+        ``/`` character in the parameter list of the function definition after
+        them, for example *posonly1* and *posonly2* in the following::
+
+           def func(posonly1, posonly2, /, positional_or_keyword): ...
 
       .. _keyword-only_parameter:
 
index f8f2aac70f9b063aad79ebc3f35d31dd09c1184a..74e861480d2ff8873caa78f08c42bddb9be61727 100644 (file)
@@ -1229,9 +1229,9 @@ Text Processing".
 
 Mertz also wrote a 3-part series of articles on functional programming
 for IBM's DeveloperWorks site; see
-`part 1 <https://www.ibm.com/developerworks/linux/library/l-prog/index.html>`__,
-`part 2 <https://www.ibm.com/developerworks/linux/library/l-prog2/index.html>`__, and
-`part 3 <https://www.ibm.com/developerworks/linux/library/l-prog3/index.html>`__,
+`part 1 <https://developer.ibm.com/articles/l-prog/>`__,
+`part 2 <https://developer.ibm.com/tutorials/l-prog2/>`__, and
+`part 3 <https://developer.ibm.com/tutorials/l-prog3/>`__,
 
 
 Python documentation
index 3be6bb380d663b28040212c54dfe0269ce84e6a1..8608162bace357a2676fbbac5b3fcc2fbac5fe06 100644 (file)
@@ -119,7 +119,7 @@ Once you have your code well-tested you are ready to begin porting your code to
 Python 3! But to fully understand how your code is going to change and what
 you want to look out for while you code, you will want to learn what changes
 Python 3 makes in terms of Python 2. Typically the two best ways of doing that
-is reading the `"What's New"`_ doc for each release of Python 3 and the
+is reading the :ref:`"What's New" <whatsnew-index>` doc for each release of Python 3 and the
 `Porting to Python 3`_ book (which is free online). There is also a handy
 `cheat sheet`_ from the Python-Future project.
 
@@ -302,10 +302,10 @@ If for some reason that doesn't work then you should make the version check be
 against Python 2 and not Python 3. To help explain this, let's look at an
 example.
 
-Let's pretend that you need access to a feature of importlib_ that
+Let's pretend that you need access to a feature of :mod:`importlib` that
 is available in Python's standard library since Python 3.3 and available for
 Python 2 through importlib2_ on PyPI. You might be tempted to write code to
-access e.g. the ``importlib.abc`` module by doing the following::
+access e.g. the :mod:`importlib.abc` module by doing the following::
 
   import sys
 
@@ -426,12 +426,10 @@ can also explicitly state whether your APIs use textual or binary data, helping
 to make sure everything functions as expected in both versions of Python.
 
 
-.. _2to3: https://docs.python.org/3/library/2to3.html
 .. _caniusepython3: https://pypi.org/project/caniusepython3
 .. _cheat sheet: http://python-future.org/compatible_idioms.html
 .. _coverage.py: https://pypi.org/project/coverage
 .. _Futurize: http://python-future.org/automatic_conversion.html
-.. _importlib: https://docs.python.org/3/library/importlib.html#module-importlib
 .. _importlib2: https://pypi.org/project/importlib2
 .. _Modernize: https://python-modernize.readthedocs.io/
 .. _mypy: http://mypy-lang.org/
@@ -447,6 +445,4 @@ to make sure everything functions as expected in both versions of Python.
 .. _tox: https://pypi.org/project/tox
 .. _trove classifier: https://pypi.org/classifiers
 
-.. _"What's New": https://docs.python.org/3/whatsnew/index.html
-
 .. _Why Python 3 exists: https://snarky.ca/why-python-3-exists
index bda32e2ad81d464c54aac5a442346ce95691e03e..f361baf830dd1b3c9a0b644479683b4f884affd5 100644 (file)
@@ -37,7 +37,7 @@ PyInit_custom(void)
     Py_INCREF(&CustomType);
     if (PyModule_AddObject(m, "Custom", (PyObject *) &CustomType) < 0) {
         Py_DECREF(&CustomType);
-        PY_DECREF(m);
+        Py_DECREF(m);
         return NULL;
     }
 
index a91606c0f38e6140e4e6d8855c3d18ed653bc635..e6d5a3e6ebde6031a7e33791daed86885cdc2036 100644 (file)
@@ -532,7 +532,7 @@ scripts will wind up in :file:`/usr/local/python/bin`.  If you want them in
 
    python setup.py install --install-scripts=/usr/local/bin
 
-(This performs an installation using the "prefix scheme," where the prefix is
+(This performs an installation using the "prefix scheme", where the prefix is
 whatever your Python interpreter was installed with--- :file:`/usr/local/python`
 in this case.)
 
index 92bf8912eb53dd1af9bd99750af1b072cfe5a21f..6ca27609e93bae5bf92e8a420add10b82b1ca7a9 100644 (file)
@@ -101,12 +101,16 @@ Node classes
       node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),
                          lineno=0, col_offset=0)
 
+.. versionchanged:: 3.8
+
+   Class :class:`ast.Constant` is now used for all constants.
+
 .. deprecated:: 3.8
 
-   Class :class:`ast.Constant` is now used for all constants. Old classes
-   :class:`ast.Num`, :class:`ast.Str`, :class:`ast.Bytes`,
+   Old classes :class:`ast.Num`, :class:`ast.Str`, :class:`ast.Bytes`,
    :class:`ast.NameConstant` and :class:`ast.Ellipsis` are still available,
-   but they will be removed in future Python releases.
+   but they will be removed in future Python releases.  In the meanwhile,
+   instantiating them will return an instance of a different class.
 
 
 .. _abstract-grammar:
@@ -300,11 +304,11 @@ and classes for traversing abstract syntax trees:
       class RewriteName(NodeTransformer):
 
           def visit_Name(self, node):
-              return copy_location(Subscript(
+              return Subscript(
                   value=Name(id='data', ctx=Load()),
                   slice=Index(value=Constant(value=node.id)),
                   ctx=node.ctx
-              ), node)
+              )
 
    Keep in mind that if the node you're operating on has child nodes you must
    either transform the child nodes yourself or call the :meth:`generic_visit`
@@ -314,6 +318,14 @@ and classes for traversing abstract syntax trees:
    statement nodes), the visitor may also return a list of nodes rather than
    just a single node.
 
+   If :class:`NodeTransformer` introduces new nodes (that weren't part of
+   original tree) without giving them location information (such as
+   :attr:`lineno`), :func:`fix_missing_locations` should be called with
+   the new sub-tree to recalculate the location information::
+
+      tree = ast.parse('foo', mode='eval')
+      new_tree = fix_missing_locations(RewriteName().visit(tree))
+
    Usually you use the transformer like this::
 
       node = YourTransformer().visit(node)
index ecd69fd669f1a5a215708aa85e711f9401bdb20e..9022993e619a59c8c021daa3899e36f72abfef53 100644 (file)
@@ -38,8 +38,10 @@ an event loop:
 
 .. function:: get_event_loop()
 
-   Get the current event loop.  If there is no current event loop set
-   in the current OS thread and :func:`set_event_loop` has not yet
+   Get the current event loop.
+
+   If there is no current event loop set in the current OS thread,
+   the OS thread is main, and :func:`set_event_loop` has not yet
    been called, asyncio will create a new event loop and set it as the
    current one.
 
@@ -345,7 +347,8 @@ Opening network connections
                           host=None, port=None, \*, ssl=None, \
                           family=0, proto=0, flags=0, sock=None, \
                           local_addr=None, server_hostname=None, \
-                          ssl_handshake_timeout=None)
+                          ssl_handshake_timeout=None, \
+                          happy_eyeballs_delay=None, interleave=None)
 
    Open a streaming transport connection to a given
    address specified by *host* and *port*.
@@ -434,7 +437,18 @@ Opening network connections
 
    .. versionadded:: 3.8
 
-      The *happy_eyeballs_delay* and *interleave* parameters.
+      Added the *happy_eyeballs_delay* and *interleave* parameters.
+
+      Happy Eyeballs Algorithm: Success with Dual-Stack Hosts.
+      When a server's IPv4 path and protocol are working, but the server's
+      IPv6 path and protocol are not working, a dual-stack client
+      application experiences significant connection delay compared to an
+      IPv4-only client.  This is undesirable because it causes the dual-
+      stack client to have a worse user experience.  This document
+      specifies requirements for algorithms that reduce this user-visible
+      delay and provides an algorithm.
+
+      For more information: https://tools.ietf.org/html/rfc6555
 
    .. versionadded:: 3.7
 
@@ -467,7 +481,7 @@ Opening network connections
       UDP. Explicitly passing ``reuse_address=True`` will raise an exception.
 
       When multiple processes with differing UIDs assign sockets to an
-      indentical UDP socket address with ``SO_REUSEADDR``, incoming packets can
+      identical UDP socket address with ``SO_REUSEADDR``, incoming packets can
       become randomly distributed among the sockets.
 
       For supported platforms, *reuse_port* can be used as a replacement for
index e2c47bab5a0b9173b6b123afc33787ab75c80aac..6708079f778c1acca53b45116774bab063628abd 100644 (file)
@@ -76,7 +76,7 @@ Interactive Interpreter Objects
 
    Compile and run some source in the interpreter. Arguments are the same as for
    :func:`compile_command`; the default for *filename* is ``'<input>'``, and for
-   *symbol* is ``'single'``.  One several things can happen:
+   *symbol* is ``'single'``.  One of several things can happen:
 
    * The input is incorrect; :func:`compile_command` raised an exception
      (:exc:`SyntaxError` or :exc:`OverflowError`).  A syntax traceback will be
index a5e8d04099b22f9acc0dc58d78466791dd9d6e37..8dcf9451d72bfe48e469e2df31d7887945b8f980 100644 (file)
@@ -33,10 +33,10 @@ Python's general purpose built-in containers, :class:`dict`, :class:`list`,
 :class:`UserString`     wrapper around string objects for easier string subclassing
 =====================   ====================================================================
 
-.. deprecated-removed:: 3.3 3.9
+.. deprecated-removed:: 3.3 3.10
     Moved :ref:`collections-abstract-base-classes` to the :mod:`collections.abc` module.
     For backwards compatibility, they continue to be visible in this module through
-    Python 3.8.
+    Python 3.9.
 
 
 :class:`ChainMap` objects
index 49e22fa73ed2655ad2887c934b09aa48936754bd..61d39828e0194add42fac1e47fd1393c8a9d10fe 100644 (file)
@@ -161,7 +161,8 @@ The :mod:`csv` module defines the following classes:
    If a row has more fields than fieldnames, the remaining data is put in a
    list and stored with the fieldname specified by *restkey* (which defaults
    to ``None``).  If a non-blank row has fewer fields than fieldnames, the
-   missing values are filled-in with ``None``.
+   missing values are filled-in with the value of *restval* (which defaults
+   to ``None``).
 
    All other optional or keyword arguments are passed to the underlying
    :class:`reader` instance.
index e0bc28f5e5058c83f45642a5d7bb84061ecc4df4..2d6c6d0a1c3c574c2648a2eb76631f633af2e7e7 100644 (file)
@@ -161,13 +161,6 @@ as the ``NULL`` pointer)::
    0x1d000000
    >>>
 
-.. note::
-
-   :mod:`ctypes` may raise a :exc:`ValueError` after calling the function, if
-   it detects that an invalid number of arguments were passed.  This behavior
-   should not be relied upon.  It is deprecated in 3.6.2, and will be removed
-   in 3.7.
-
 :exc:`ValueError` is raised when you call an ``stdcall`` function with the
 ``cdecl`` calling convention, or vice versa::
 
@@ -624,7 +617,7 @@ Structure/union alignment and byte order
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 By default, Structure and Union fields are aligned in the same way the C
-compiler does it. It is possible to override this behavior be specifying a
+compiler does it. It is possible to override this behavior by specifying a
 :attr:`_pack_` class attribute in the subclass definition. This must be set to a
 positive integer and specifies the maximum alignment for the fields. This is
 what ``#pragma pack(n)`` also does in MSVC.
@@ -922,7 +915,7 @@ attribute later, after the class statement::
    ...                  ("next", POINTER(cell))]
    >>>
 
-Lets try it. We create two instances of ``cell``, and let them point to each
+Let's try it. We create two instances of ``cell``, and let them point to each
 other, and finally follow the pointer chain a few times::
 
    >>> c1 = cell()
@@ -1125,8 +1118,8 @@ hit the ``NULL`` entry::
    >>>
 
 The fact that standard Python has a frozen module and a frozen package
-(indicated by the negative size member) is not well known, it is only used for
-testing. Try it out with ``import __hello__`` for example.
+(indicated by the negative ``size`` member) is not well known, it is only used
+for testing. Try it out with ``import __hello__`` for example.
 
 
 .. _ctypes-surprises:
index 9aa4a19d57ac7447a427863107675c40499c051f..10edcac7e8a9b67fadc0a87a3deea43cb3e379d6 100644 (file)
@@ -19,6 +19,8 @@ in :pep:`557`.
 The member variables to use in these generated methods are defined
 using :pep:`526` type annotations.  For example this code::
 
+  from dataclasses import dataclass
+
   @dataclass
   class InventoryItem:
       '''Class for keeping track of an item in inventory.'''
@@ -60,8 +62,9 @@ Module-level decorators, classes, and functions
 
    The :func:`dataclass` decorator will add various "dunder" methods to
    the class, described below.  If any of the added methods already
-   exist on the class, a :exc:`TypeError` will be raised.  The decorator
-   returns the same class that is called on: no new class is created.
+   exist on the class, the behavior depends on the parameter, as documented
+   below. The decorator returns the same class that is called on; no new
+   class is created.
 
    If :func:`dataclass` is used just as a simple decorator with no parameters,
    it acts as if it has the default values documented in this
@@ -115,7 +118,7 @@ Module-level decorators, classes, and functions
 
      If the class already defines any of :meth:`__lt__`,
      :meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`, then
-     :exc:`ValueError` is raised.
+     :exc:`TypeError` is raised.
 
    - ``unsafe_hash``: If ``False`` (the default), a :meth:`__hash__` method
      is generated according to how ``eq`` and ``frozen`` are set.
index b49eab44aef9e3364ffbab796ab3eddf00e2c28f..29c6b5a4736c0d1c8bd8630532676ca88d80c9e4 100644 (file)
@@ -997,8 +997,6 @@ Other constructors, all class methods:
      as the inverse operation of :meth:`datetime.isoformat`. A more full-featured
      ISO 8601 parser, ``dateutil.parser.isoparse`` is available in the third-party package
      `dateutil <https://dateutil.readthedocs.io/en/stable/parser.html#dateutil.parser.isoparse>`__.
-     This does not support parsing arbitrary ISO 8601 strings - it is only intended
-     as the inverse operation of :meth:`datetime.isoformat`.
 
    Examples::
 
@@ -2514,7 +2512,7 @@ Notes:
       :meth:`utcoffset` is transformed into a string of the form
       ``±HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number
       of UTC offset hours, ``MM`` is a 2-digit string giving the number of UTC
-      offset minutes, SS is a 2-digit string giving the number of UTC offset
+      offset minutes, ``SS`` is a 2-digit string giving the number of UTC offset
       seconds and ``ffffff`` is a 6-digit string giving the number of UTC
       offset microseconds. The ``ffffff`` part is omitted when the offset is a
       whole number of seconds and both the ``ffffff`` and the ``SS`` part is
index bcae55eb8217844bb37e30c1f4380407053294d5..3dda35fbd35dbda49574577f135afb486bfdef69 100644 (file)
@@ -1475,9 +1475,18 @@ are also included in the pure Python version for compatibility.
 
 .. data:: HAVE_THREADS
 
-   The default value is ``True``. If Python is compiled without threads, the
-   C version automatically disables the expensive thread local context
-   machinery. In this case, the value is ``False``.
+   The value is ``True``.  Deprecated, because Python now always has threads.
+
+.. deprecated:: 3.9
+
+.. data:: HAVE_CONTEXTVAR
+
+   The default value is ``True``. If Python is compiled ``--without-decimal-contextvar``,
+   the C version uses a thread-local rather than a coroutine-local context and the value
+   is ``False``.  This is slightly faster in some nested context scenarios.
+
+.. versionadded:: 3.9 backported to 3.7 and 3.8
+
 
 Rounding modes
 --------------
@@ -2121,17 +2130,67 @@ Q. Is the CPython implementation fast for large numbers?
 A. Yes.  In the CPython and PyPy3 implementations, the C/CFFI versions of
 the decimal module integrate the high speed `libmpdec
 <https://www.bytereef.org/mpdecimal/doc/libmpdec/index.html>`_ library for
-arbitrary precision correctly-rounded decimal floating point arithmetic.
+arbitrary precision correctly-rounded decimal floating point arithmetic [#]_.
 ``libmpdec`` uses `Karatsuba multiplication
 <https://en.wikipedia.org/wiki/Karatsuba_algorithm>`_
 for medium-sized numbers and the `Number Theoretic Transform
 <https://en.wikipedia.org/wiki/Discrete_Fourier_transform_(general)#Number-theoretic_transform>`_
-for very large numbers.  However, to realize this performance gain, the
-context needs to be set for unrounded calculations.
+for very large numbers.
+
+The context must be adapted for exact arbitrary precision arithmetic. :attr:`Emin`
+and :attr:`Emax` should always be set to the maximum values, :attr:`clamp`
+should always be 0 (the default).  Setting :attr:`prec` requires some care.
+
+The easiest approach for trying out bignum arithmetic is to use the maximum
+value for :attr:`prec` as well [#]_::
+
+    >>> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN))
+    >>> x = Decimal(2) ** 256
+    >>> x / 128
+    Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')
+
+
+For inexact results, :attr:`MAX_PREC` is far too large on 64-bit platforms and
+the available memory will be insufficient::
+
+   >>> Decimal(1) / 3
+   Traceback (most recent call last):
+     File "<stdin>", line 1, in <module>
+   MemoryError
+
+On systems with overallocation (e.g. Linux), a more sophisticated approach is to
+adjust :attr:`prec` to the amount of available RAM.  Suppose that you have 8GB of
+RAM and expect 10 simultaneous operands using a maximum of 500MB each::
+
+   >>> import sys
+   >>>
+   >>> # Maximum number of digits for a single operand using 500MB in 8-byte words
+   >>> # with 19 digits per word (4-byte and 9 digits for the 32-bit build):
+   >>> maxdigits = 19 * ((500 * 1024**2) // 8)
+   >>>
+   >>> # Check that this works:
+   >>> c = Context(prec=maxdigits, Emax=MAX_EMAX, Emin=MIN_EMIN)
+   >>> c.traps[Inexact] = True
+   >>> setcontext(c)
+   >>>
+   >>> # Fill the available precision with nines:
+   >>> x = Decimal(0).logical_invert() * 9
+   >>> sys.getsizeof(x)
+   524288112
+   >>> x + 2
+   Traceback (most recent call last):
+     File "<stdin>", line 1, in <module>
+     decimal.Inexact: [<class 'decimal.Inexact'>]
+
+In general (and especially on systems without overallocation), it is recommended
+to estimate even tighter bounds and set the :attr:`Inexact` trap if all calculations
+are expected to be exact.
+
 
-    >>> c = getcontext()
-    >>> c.prec = MAX_PREC
-    >>> c.Emax = MAX_EMAX
-    >>> c.Emin = MIN_EMIN
+.. [#]
+    .. versionadded:: 3.3
 
-.. versionadded:: 3.3
\ No newline at end of file
+.. [#]
+    .. versionchanged:: 3.9
+       This approach now works for all exact results except for non-integer powers.
+       Also backported to 3.7 and 3.8.
index 39a3e130afd3e0fcab3466b88473779f99246f3e..5b34e68cb027c00e3ee40d90bbeeddb943fb8cd8 100644 (file)
@@ -244,7 +244,7 @@ operation is being performed, so the intermediate analysis object isn't useful:
 
 .. function:: findlabels(code)
 
-   Detect all offsets in the code object *code* which are jump targets, and
+   Detect all offsets in the raw compiled bytecode string *code* which are jump targets, and
    return a list of these offsets.
 
 
@@ -894,9 +894,9 @@ All of the following opcodes use their arguments.
 
 .. opcode:: BUILD_CONST_KEY_MAP (count)
 
-   The version of :opcode:`BUILD_MAP` specialized for constant keys.  *count*
-   values are consumed from the stack.  The top element on the stack contains
-   a tuple of keys.
+   The version of :opcode:`BUILD_MAP` specialized for constant keys. Pops the
+   top element on the stack which contains a tuple of keys, then starting from
+   ``TOS1``, pops *count* values to form values in the built dictionary.
 
    .. versionadded:: 3.6
 
@@ -1176,27 +1176,29 @@ All of the following opcodes use their arguments.
 
 .. opcode:: LOAD_METHOD (namei)
 
-   Loads a method named ``co_names[namei]`` from TOS object. TOS is popped and
-   method and TOS are pushed when interpreter can call unbound method directly.
-   TOS will be used as the first argument (``self``) by :opcode:`CALL_METHOD`.
-   Otherwise, ``NULL`` and  method is pushed (method is bound method or
-   something else).
+   Loads a method named ``co_names[namei]`` from the TOS object. TOS is popped.
+   This bytecode distinguishes two cases: if TOS has a method with the correct
+   name, the bytecode pushes the unbound method and TOS. TOS will be used as
+   the first argument (``self``) by :opcode:`CALL_METHOD` when calling the
+   unbound method. Otherwise, ``NULL`` and the object return by the attribute
+   lookup are pushed.
 
    .. versionadded:: 3.7
 
 
 .. opcode:: CALL_METHOD (argc)
 
-   Calls a method.  *argc* is number of positional arguments.
+   Calls a method.  *argc* is the number of positional arguments.
    Keyword arguments are not supported.  This opcode is designed to be used
    with :opcode:`LOAD_METHOD`.  Positional arguments are on top of the stack.
-   Below them, two items described in :opcode:`LOAD_METHOD` on the stack.
-   All of them are popped and return value is pushed.
+   Below them, the two items described in :opcode:`LOAD_METHOD` are on the
+   stack (either ``self`` and an unbound method object or ``NULL`` and an
+   arbitrary callable). All of them are popped and the return value is pushed.
 
    .. versionadded:: 3.7
 
 
-.. opcode:: MAKE_FUNCTION (argc)
+.. opcode:: MAKE_FUNCTION (flags)
 
    Pushes a new function object on the stack.  From bottom to top, the consumed
    stack must consist of values if the argument carries a specified flag value
index a2bb045e57e3c03df39c736e9a4564793165e884..a5221250c40486af667f398d22db9d830452baab 100644 (file)
@@ -74,7 +74,7 @@ options:
   script will *not* be installed.
 
 * ``--default-pip``: if a "default pip" installation is requested, the
-   ``pip`` script will be installed in addition to the two regular scripts.
+  ``pip`` script will be installed in addition to the two regular scripts.
 
 Providing both of the script selection options will trigger an exception.
 
index 19277d76995fedd5a3bcd9fa5cbb7a9cf76bf974..7538084767d760257faf2bc921b42c5b67623d01 100644 (file)
@@ -55,7 +55,7 @@ helper, :class:`auto`.
 
 .. class:: auto
 
-    Instances are replaced with an appropriate value for Enum members.
+    Instances are replaced with an appropriate value for Enum members. Initial value starts at 1.
 
 .. versionadded:: 3.6  ``Flag``, ``IntFlag``, ``auto``
 
index a7390150f7910d9933e1743fa7eaeffe2560661c..69484b647363ddf88d04a3790fd0fd2b953a357e 100644 (file)
@@ -57,6 +57,8 @@ The module defines the following functions:
 
    If the :c:func:`fcntl` fails, an :exc:`OSError` is raised.
 
+   .. audit-event:: fcntl.fcntl fd,cmd,arg fcntl.fcntl
+
 
 .. function:: ioctl(fd, request, arg=0, mutate_flag=True)
 
@@ -106,6 +108,8 @@ The module defines the following functions:
       >>> buf
       array('h', [13341])
 
+   .. audit-event:: fcntl.ioctl fd,request,arg fcntl.ioctl
+
 
 .. function:: flock(fd, operation)
 
@@ -116,6 +120,8 @@ The module defines the following functions:
 
    If the :c:func:`flock` fails, an :exc:`OSError` exception is raised.
 
+   .. audit-event:: fcntl.flock fd,operation fcntl.flock
+
 
 .. function:: lockf(fd, cmd, len=0, start=0, whence=0)
 
@@ -149,6 +155,8 @@ The module defines the following functions:
    The default for *len* is 0 which means to lock to the end of the file.  The
    default for *whence* is also 0.
 
+   .. audit-event:: fcntl.lockf fd,cmd,len,start,whence fcntl.lockf
+
 Examples (all on a SVR4 compliant system)::
 
    import struct, fcntl, os
index 7968eef4fb96bd6061bfd0c18409b85038ee245a..0f7df0e5e9107fde7f737b8c87cca8e62a85f5e9 100644 (file)
@@ -950,7 +950,7 @@ are always available.  They are listed here in alphabetical order.
 
 
 .. _func-memoryview:
-.. function:: memoryview(obj)
+.. class:: memoryview(obj)
    :noindex:
 
    Return a "memory view" object created from the given argument.  See
@@ -1304,7 +1304,7 @@ are always available.  They are listed here in alphabetical order.
       the second argument to be negative, permitting computation of modular
       inverses.
 
-   .. versionchanged:: 3.9
+   .. versionchanged:: 3.8
       Allow keyword arguments.  Formerly, only positional arguments were
       supported.
 
@@ -1412,7 +1412,7 @@ are always available.  They are listed here in alphabetical order.
 
 
 .. _func-range:
-.. function:: range(stop)
+.. class:: range(stop)
               range(start, stop[, step])
    :noindex:
 
@@ -1659,7 +1659,7 @@ are always available.  They are listed here in alphabetical order.
 
 
 .. _func-tuple:
-.. function:: tuple([iterable])
+.. class:: tuple([iterable])
    :noindex:
 
    Rather than being a function, :class:`tuple` is actually an immutable
index 3a0b554e923c7a62c639a0f770bbcd940792d0be..0fb8d900c7362713c4297200474be6c60cf97c25 100644 (file)
@@ -101,8 +101,7 @@ The :mod:`functools` module defines the following functions:
            return sum(sentence.count(vowel) for vowel in 'aeiou')
 
    If *maxsize* is set to ``None``, the LRU feature is disabled and the cache can
-   grow without bound.  The LRU feature performs best when *maxsize* is a
-   power-of-two.
+   grow without bound.
 
    If *typed* is set to true, function arguments of different types will be
    cached separately.  For example, ``f(3)`` and ``f(3.0)`` will be treated
index 937330bb201b083ab0d8fb0ec70447e9c34b781d..ec2c12806b41608cc26388610ccea41e459f5b6e 100644 (file)
@@ -724,8 +724,8 @@ implementations, and valuable experience to the creation of this module:
 .. [#] The default locale directory is system dependent; for example, on RedHat Linux
    it is :file:`/usr/share/locale`, but on Solaris it is :file:`/usr/lib/locale`.
    The :mod:`gettext` module does not try to support these system dependent
-   defaults; instead its default is :file:`{sys.prefix}/share/locale` (see
-   :data:`sys.prefix`). For this reason, it is always best to call
+   defaults; instead its default is :file:`{sys.base_prefix}/share/locale` (see
+   :data:`sys.base_prefix`). For this reason, it is always best to call
    :func:`bindtextdomain` with an explicit absolute path at the start of your
    application.
 
index 9cdabc2a03a751536e484ea8802f4c7b5a73328e..be31c3c07154f40aaafe67bb0d28803fc29bc167 100644 (file)
@@ -563,8 +563,8 @@ Here is an example session that shows how to ``POST`` requests::
 Client side ``HTTP PUT`` requests are very similar to ``POST`` requests. The
 difference lies only the server side where HTTP server will allow resources to
 be created via ``PUT`` request. It should be noted that custom HTTP methods
-+are also handled in :class:`urllib.request.Request` by sending the appropriate
-+method attribute.Here is an example session that shows how to do ``PUT``
+are also handled in :class:`urllib.request.Request` by setting the appropriate
+method attribute. Here is an example session that shows how to send a ``PUT``
 request using http.client::
 
     >>> # This creates an HTTP message
index 273b5830e4293ed1ba5b608458fc46fdf8669e0a..b1192e7bb4655230f92a727a7717c39d50b6a360 100644 (file)
@@ -142,7 +142,9 @@ Replace...
    Open a search-and-replace dialog.
 
 Go to Line
-   Move cursor to the line number requested and make that line visible.
+   Move the cursor to the beginning of the line requested and make that
+   line visible.  A request past the end of the file goes to the end.
+   Clear any selection and update the line and column status.
 
 Show Completions
    Open a scrollable list allowing selection of keywords and attributes. See
@@ -370,7 +372,8 @@ Paste
 
 Editor windows also have breakpoint functions.  Lines with a breakpoint set are
 specially marked.  Breakpoints only have an effect when running under the
-debugger.  Breakpoints for a file are saved in the user's .idlerc directory.
+debugger.  Breakpoints for a file are saved in the user's ``.idlerc``
+directory.
 
 Set Breakpoint
    Set a breakpoint on the current line.
@@ -680,19 +683,22 @@ clash, or cannot or does not want to run as admin, it might be easiest to
 completely remove Python and start over.
 
 A zombie pythonw.exe process could be a problem.  On Windows, use Task
-Manager to detect and stop one.  Sometimes a restart initiated by a program
-crash or Keyboard Interrupt (control-C) may fail to connect.  Dismissing
-the error box or Restart Shell on the Shell menu may fix a temporary problem.
+Manager to check for one and stop it if there is.  Sometimes a restart
+initiated by a program crash or Keyboard Interrupt (control-C) may fail
+to connect.  Dismissing the error box or using Restart Shell on the Shell
+menu may fix a temporary problem.
 
 When IDLE first starts, it attempts to read user configuration files in
-~/.idlerc/ (~ is one's home directory).  If there is a problem, an error
+``~/.idlerc/`` (~ is one's home directory).  If there is a problem, an error
 message should be displayed.  Leaving aside random disk glitches, this can
-be prevented by never editing the files by hand, using the configuration
-dialog, under Options, instead Options.  Once it happens, the solution may
-be to delete one or more of the configuration files.
+be prevented by never editing the files by hand.  Instead, use the
+configuration dialog, under Options.  Once there is an error in a user
+configuration file, the best solution may be to delete it and start over
+with the settings dialog.
 
 If IDLE quits with no message, and it was not started from a console, try
-starting from a console (``python -m idlelib)`` and see if a message appears.
+starting it from a console or terminal (``python -m idlelib``) and see if
+this results in an error message.
 
 Running user code
 ^^^^^^^^^^^^^^^^^
@@ -863,13 +869,13 @@ Or click the TOC (Table of Contents) button and select a section
 header in the opened box.
 
 Help menu entry "Python Docs" opens the extensive sources of help,
-including tutorials, available at docs.python.org/x.y, where 'x.y'
+including tutorials, available at ``docs.python.org/x.y``, where 'x.y'
 is the currently running Python version.  If your system
 has an off-line copy of the docs (this may be an installation option),
 that will be opened instead.
 
 Selected URLs can be added or removed from the help menu at any time using the
-General tab of the Configure IDLE dialog .
+General tab of the Configure IDLE dialog.
 
 .. _preferences:
 
@@ -878,9 +884,9 @@ Setting preferences
 
 The font preferences, highlighting, keys, and general preferences can be
 changed via Configure IDLE on the Option menu.
-Non-default user settings are saved in a .idlerc directory in the user's
+Non-default user settings are saved in a ``.idlerc`` directory in the user's
 home directory.  Problems caused by bad user configuration files are solved
-by editing or deleting one or more of the files in .idlerc.
+by editing or deleting one or more of the files in ``.idlerc``.
 
 On the Font tab, see the text sample for the effect of font face and size
 on multiple characters in multiple languages.  Edit the sample to add
index aa22a5b16838be2b59514c9a908b88682630a0e6..2de10435904aa1c3fc0b338d9d96e44e6310562f 100644 (file)
@@ -1029,6 +1029,10 @@ find and load modules.
     Only class methods are defined by this class to alleviate the need for
     instantiation.
 
+    .. versionchanged:: 3.4
+       Gained :meth:`~Loader.create_module` and :meth:`~Loader.exec_module`
+       methods.
+
 
 .. class:: WindowsRegistryFinder
 
index 10f347dd420f314f04411876efc8a3927c54e18e..bab2c41e4e2242a24ac9544eb08a320dc8af9648 100644 (file)
@@ -70,6 +70,9 @@ attributes:
 |           |                   | method is bound, or       |
 |           |                   | ``None``                  |
 +-----------+-------------------+---------------------------+
+|           | __module__        | name of module in which   |
+|           |                   | this method was defined   |
++-----------+-------------------+---------------------------+
 | function  | __doc__           | documentation string      |
 +-----------+-------------------+---------------------------+
 |           | __name__          | name with which this      |
@@ -98,6 +101,9 @@ attributes:
 |           |                   | reserved for return       |
 |           |                   | annotations.              |
 +-----------+-------------------+---------------------------+
+|           | __module__        | name of module in which   |
+|           |                   | this function was defined |
++-----------+-------------------+---------------------------+
 | traceback | tb_frame          | frame object at this      |
 |           |                   | level                     |
 +-----------+-------------------+---------------------------+
index 70e01153d41966e79656d52ce413ffb3c2facd8c..32151a0ace458e2b4647942e6d0a02d513ae0a69 100644 (file)
@@ -132,12 +132,13 @@ High-level Module Interface
    Opens the provided file with mode ``'rb'``. This function should be used
    when the intent is to treat the contents as executable code.
 
-   ``path`` should be an absolute path.
+   ``path`` should be a :class:`str` and an absolute path.
 
    The behavior of this function may be overridden by an earlier call to the
-   :c:func:`PyFile_SetOpenCodeHook`, however, it should always be considered
-   interchangeable with ``open(path, 'rb')``. Overriding the behavior is
-   intended for additional validation or preprocessing of the file.
+   :c:func:`PyFile_SetOpenCodeHook`. However, assuming that ``path`` is a
+   :class:`str` and an absolute path, ``open_code(path)`` should always behave
+   the same as ``open(path, 'rb')``. Overriding the behavior is intended for
+   additional validation or preprocessing of the file.
 
    .. versionadded:: 3.8
 
index 3768df969c55c96e106463c67b728cc58357b007..acec45cdcd586e36a3ed65461dc513fd17d808ae 100644 (file)
@@ -8,16 +8,17 @@
 
 --------------
 
-This module allows a Python program to determine if a string is a keyword.
+This module allows a Python program to determine if a string is a
+:ref:`keyword <keywords>`.
 
 
 .. function:: iskeyword(s)
 
-   Return ``True`` if *s* is a Python keyword.
+   Return ``True`` if *s* is a Python :ref:`keyword <keywords>`.
 
 
 .. data:: kwlist
 
-   Sequence containing all the keywords defined for the interpreter.  If any
-   keywords are defined to only be active when particular :mod:`__future__`
-   statements are in effect, these will be included as well.
+   Sequence containing all the :ref:`keywords <keywords>` defined for the
+   interpreter.  If any keywords are defined to only be active when particular
+   :mod:`__future__` statements are in effect, these will be included as well.
index 4da5778fa641657a0c25dc3028b82056befff8b0..14e7190cbb0fe220025c13ff8da48eb40c8f3254 100644 (file)
@@ -159,6 +159,7 @@ is the module's name in the Python package namespace.
       message format string, and the *args* are the arguments which are merged into
       *msg* using the string formatting operator. (Note that this means that you can
       use keywords in the format string, together with a single dictionary argument.)
+      No % formatting operation is performed on *msg* when no *args* are supplied.
 
       There are four keyword arguments in *kwargs* which are inspected:
       *exc_info*, *stack_info*, *stacklevel* and *extra*.
index 896afd1d7306286c05c3274b75e0f13fa10904a4..bf9639bdaca50a8c7b9b833bb06f0497760adadf 100644 (file)
@@ -18,7 +18,7 @@ belonging to a temporary file) and the :program:`xmpeg` program can be
 automatically started to view the file.
 
 The mailcap format is documented in :rfc:`1524`, "A User Agent Configuration
-Mechanism For Multimedia Mail Format Information," but is not an Internet
+Mechanism For Multimedia Mail Format Information", but is not an Internet
 standard.  However, mailcap files are supported on most Unix systems.
 
 
index 14ad2cd4373afe369df39aae7357fd6aa067e7eb..42fffee6a0f449244178b5dd022f7f99d0120be9 100644 (file)
@@ -42,6 +42,8 @@ File Operations
    regions in a file may be locked at the same time, but may not overlap.  Adjacent
    regions are not merged; they must be unlocked individually.
 
+   .. audit-event:: msvcrt.locking fd,mode,nbytes msvcrt.locking
+
 
 .. data:: LK_LOCK
           LK_RLCK
@@ -77,12 +79,16 @@ File Operations
    and :const:`os.O_TEXT`.  The returned file descriptor may be used as a parameter
    to :func:`os.fdopen` to create a file object.
 
+   .. audit-event:: msvcrt.open_osfhandle handle,flags msvcrt.open_osfhandle
+
 
 .. function:: get_osfhandle(fd)
 
    Return the file handle for the file descriptor *fd*.  Raises :exc:`OSError` if
    *fd* is not recognized.
 
+   .. audit-event:: msvcrt.get_osfhandle fd msvcrt.get_osfhandle
+
 
 .. _msvcrt-console:
 
index 3c7b5cc1262097d410336e982ac747f1d89e71de..ec9521f1fb4a0cc7229bb6332508b63e946d987d 100644 (file)
@@ -439,7 +439,8 @@ process which created it.
       >>> def f(x):
       ...     return x*x
       ...
-      >>> p.map(f, [1,2,3])
+      >>> with p:
+      ...   p.map(f, [1,2,3])
       Process PoolWorker-1:
       Process PoolWorker-2:
       Process PoolWorker-3:
@@ -2127,6 +2128,16 @@ with the :class:`Pool` class.
    Note that the methods of the pool object should only be called by
    the process which created the pool.
 
+   .. warning::
+      :class:`multiprocessing.pool` objects have internal resources that need to be
+      properly managed (like any other resource) by using the pool as a context manager
+      or by calling :meth:`close` and :meth:`terminate` manually. Failure to do this
+      can lead to the process hanging on finalization.
+
+      Note that is **not correct** to rely on the garbage colletor to destroy the pool
+      as CPython does not assure that the finalizer of the pool will be called
+      (see :meth:`object.__del__` for more information).
+
    .. versionadded:: 3.2
       *maxtasksperchild*
 
@@ -2279,7 +2290,7 @@ with the :class:`Pool` class.
    .. method:: successful()
 
       Return whether the call completed without raising an exception.  Will
-      raise :exc:`AssertionError` if the result is not ready.
+      raise :exc:`ValueError` if the result is not ready.
 
       .. versionchanged:: 3.7
          If the result is not ready, :exc:`ValueError` is raised instead of
index 46f1c0783551c20eeea8aebd9ee068430bfa7375..e8480b548073ab043980d2107ff1a82bd348eaf5 100644 (file)
@@ -20,7 +20,7 @@ as well as the older :rfc:`977` and :rfc:`2980`.
 Here are two small examples of how it can be used.  To list some statistics
 about a newsgroup and print the subjects of the last 10 articles::
 
-   >>> s = nntplib.NNTP('news.gmane.org')
+   >>> s = nntplib.NNTP('news.gmane.io')
    >>> resp, count, first, last, name = s.group('gmane.comp.python.committers')
    >>> print('Group', name, 'has', count, 'articles, range', first, 'to', last)
    Group gmane.comp.python.committers has 1096 articles, range 1 to 1096
@@ -44,7 +44,7 @@ about a newsgroup and print the subjects of the last 10 articles::
 To post an article from a binary file (this assumes that the article has valid
 headers, and that you have right to post on the particular newsgroup)::
 
-   >>> s = nntplib.NNTP('news.gmane.org')
+   >>> s = nntplib.NNTP('news.gmane.io')
    >>> f = open('article.txt', 'rb')
    >>> s.post(f)
    '240 Article posted successfully.'
@@ -73,7 +73,7 @@ The module itself defines the following classes:
    connection when done, e.g.:
 
     >>> from nntplib import NNTP
-    >>> with NNTP('news.gmane.org') as n:
+    >>> with NNTP('news.gmane.io') as n:
     ...     n.group('gmane.comp.python.committers')
     ... # doctest: +SKIP
     ('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp.python.committers')
@@ -225,7 +225,7 @@ tuples or objects that the method normally returns will be empty.
    of values. On legacy servers which don't understand the ``CAPABILITIES``
    command, an empty dictionary is returned instead.
 
-      >>> s = NNTP('news.gmane.org')
+      >>> s = NNTP('news.gmane.io')
       >>> 'POST' in s.getcapabilities()
       True
 
index 9d2e8b2eea2392aed649a58257ffa82a066839f0..77bbf998863459bdc1ec73491ecb770035c3e4d1 100644 (file)
@@ -451,6 +451,8 @@ process and user.
    calls to :func:`putenv` don't update ``os.environ``, so it is actually
    preferable to assign to items of ``os.environ``.
 
+   .. audit-event:: os.putenv key,value os.putenv
+
 
 .. function:: setegid(egid)
 
@@ -643,7 +645,9 @@ process and user.
    calls to :func:`unsetenv` don't update ``os.environ``, so it is actually
    preferable to delete items of ``os.environ``.
 
-   .. availability:: most flavors of Unix, Windows.
+   .. audit-event:: os.unsetenv key os.unsetenv
+
+   .. availability:: most flavors of Unix.
 
 
 .. _os-newstreams:
@@ -768,6 +772,8 @@ as internal buffering of data.
    docs for :func:`chmod` for possible values of *mode*.  As of Python 3.3, this
    is equivalent to ``os.chmod(fd, mode)``.
 
+   .. audit-event:: os.chmod path,mode,dir_fd os.fchmod
+
    .. availability:: Unix.
 
 
@@ -778,6 +784,8 @@ as internal buffering of data.
    :func:`chown`.  As of Python 3.3, this is equivalent to ``os.chown(fd, uid,
    gid)``.
 
+   .. audit-event:: os.chown path,uid,gid,dir_fd os.fchown
+
    .. availability:: Unix.
 
 
@@ -885,6 +893,8 @@ as internal buffering of data.
    :data:`F_ULOCK` or :data:`F_TEST`.
    *len* specifies the section of the file to lock.
 
+   .. audit-event:: os.lockf fd,cmd,len os.lockf
+
    .. availability:: Unix.
 
    .. versionadded:: 3.3
@@ -1602,6 +1612,8 @@ features:
    This function can raise :exc:`OSError` and subclasses such as
    :exc:`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`.
 
+   .. audit-event:: os.chdir path os.chdir
+
    .. versionadded:: 3.3
       Added support for specifying *path* as a file descriptor
       on some platforms.
@@ -1630,6 +1642,8 @@ features:
 
    This function can support :ref:`not following symlinks <follow_symlinks>`.
 
+   .. audit-event:: os.chflags path,flags os.chflags
+
    .. availability:: Unix.
 
    .. versionadded:: 3.3
@@ -1675,6 +1689,8 @@ features:
       read-only flag with it (via the ``stat.S_IWRITE`` and ``stat.S_IREAD``
       constants or a corresponding integer value).  All other bits are ignored.
 
+   .. audit-event:: os.chmod path,mode,dir_fd os.chmod
+
    .. versionadded:: 3.3
       Added support for specifying *path* as an open file descriptor,
       and the *dir_fd* and *follow_symlinks* arguments.
@@ -1695,6 +1711,8 @@ features:
    See :func:`shutil.chown` for a higher-level function that accepts names in
    addition to numeric ids.
 
+   .. audit-event:: os.chown path,uid,gid,dir_fd os.chown
+
    .. availability:: Unix.
 
    .. versionadded:: 3.3
@@ -1721,6 +1739,8 @@ features:
    descriptor *fd*.  The descriptor must refer to an opened directory, not an
    open file.  As of Python 3.3, this is equivalent to ``os.chdir(fd)``.
 
+   .. audit-event:: os.chdir path os.fchdir
+
    .. availability:: Unix.
 
 
@@ -1745,6 +1765,8 @@ features:
    not follow symbolic links.  As of Python 3.3, this is equivalent to
    ``os.chflags(path, flags, follow_symlinks=False)``.
 
+   .. audit-event:: os.chflags path,flags os.lchflags
+
    .. availability:: Unix.
 
    .. versionchanged:: 3.6
@@ -1758,6 +1780,8 @@ features:
    for possible values of *mode*.  As of Python 3.3, this is equivalent to
    ``os.chmod(path, mode, follow_symlinks=False)``.
 
+   .. audit-event:: os.chmod path,mode,dir_fd os.lchmod
+
    .. availability:: Unix.
 
    .. versionchanged:: 3.6
@@ -1769,6 +1793,8 @@ features:
    function will not follow symbolic links.  As of Python 3.3, this is equivalent
    to ``os.chown(path, uid, gid, follow_symlinks=False)``.
 
+   .. audit-event:: os.chown path,uid,gid,dir_fd os.lchown
+
    .. availability:: Unix.
 
    .. versionchanged:: 3.6
@@ -1783,6 +1809,8 @@ features:
    supply :ref:`paths relative to directory descriptors <dir_fd>`, and :ref:`not
    following symlinks <follow_symlinks>`.
 
+   .. audit-event:: os.link src,dst,src_dir_fd,dst_dir_fd os.link
+
    .. availability:: Unix, Windows.
 
    .. versionchanged:: 3.2
@@ -1885,6 +1913,8 @@ features:
    It is also possible to create temporary directories; see the
    :mod:`tempfile` module's :func:`tempfile.mkdtemp` function.
 
+   .. audit-event:: os.mkdir path,mode,dir_fd os.mkdir
+
    .. versionadded:: 3.3
       The *dir_fd* argument.
 
@@ -1917,6 +1947,8 @@ features:
 
    This function handles UNC paths correctly.
 
+   .. audit-event:: os.mkdir path,mode,dir_fd os.makedirs
+
    .. versionadded:: 3.2
       The *exist_ok* parameter.
 
@@ -2082,6 +2114,8 @@ features:
 
    This function is semantically identical to :func:`unlink`.
 
+   .. audit-event:: os.remove path,dir_fd os.remove
+
    .. versionadded:: 3.3
       The *dir_fd* argument.
 
@@ -2102,6 +2136,8 @@ features:
    they are empty. Raises :exc:`OSError` if the leaf directory could not be
    successfully removed.
 
+   .. audit-event:: os.remove path,dir_fd os.removedirs
+
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object`.
 
@@ -2127,6 +2163,8 @@ features:
 
    If you want cross-platform overwriting of the destination, use :func:`replace`.
 
+   .. audit-event:: os.rename src,dst,src_dir_fd,dst_dir_fd os.rename
+
    .. versionadded:: 3.3
       The *src_dir_fd* and *dst_dir_fd* arguments.
 
@@ -2146,6 +2184,8 @@ features:
       This function can fail with the new directory structure made if you lack
       permissions needed to remove the leaf directory or file.
 
+   .. audit-event:: os.rename src,dst,src_dir_fd,dst_dir_fd os.renames
+
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object` for *old* and *new*.
 
@@ -2161,6 +2201,8 @@ features:
    This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to
    supply :ref:`paths relative to directory descriptors <dir_fd>`.
 
+   .. audit-event:: os.rename src,dst,src_dir_fd,dst_dir_fd os.replace
+
    .. versionadded:: 3.3
 
    .. versionchanged:: 3.6
@@ -2177,6 +2219,8 @@ features:
    This function can support :ref:`paths relative to directory descriptors
    <dir_fd>`.
 
+   .. audit-event:: os.rmdir path,dir_fd os.rmdir
+
    .. versionadded:: 3.3
       The *dir_fd* parameter.
 
@@ -2820,6 +2864,8 @@ features:
       :exc:`OSError` is raised when the function is called by an unprivileged
       user.
 
+   .. audit-event:: os.symlink src,dst,dir_fd os.symlink
+
    .. availability:: Unix, Windows.
 
    .. versionchanged:: 3.2
@@ -2872,6 +2918,8 @@ features:
    traditional Unix name.  Please see the documentation for
    :func:`remove` for further information.
 
+   .. audit-event:: os.remove path,dir_fd os.unlink
+
    .. versionadded:: 3.3
       The *dir_fd* parameter.
 
@@ -2909,6 +2957,8 @@ features:
    :ref:`paths relative to directory descriptors <dir_fd>` and :ref:`not
    following symlinks <follow_symlinks>`.
 
+   .. audit-event:: os.utime path,times,ns,dir_fd os.utime
+
    .. versionadded:: 3.3
       Added support for specifying *path* as an open file descriptor,
       and the *dir_fd*, *follow_symlinks*, and *ns* parameters.
@@ -3134,6 +3184,8 @@ These functions are all available on Linux only.
    This function can support :ref:`specifying a file descriptor <path_fd>` and
    :ref:`not following symlinks <follow_symlinks>`.
 
+   .. audit-event:: os.getxattr path,attribute os.getxattr
+
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object` for *path* and *attribute*.
 
@@ -3148,6 +3200,8 @@ These functions are all available on Linux only.
    This function can support :ref:`specifying a file descriptor <path_fd>` and
    :ref:`not following symlinks <follow_symlinks>`.
 
+   .. audit-event:: os.listxattr path os.listxattr
+
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object`.
 
@@ -3162,6 +3216,8 @@ These functions are all available on Linux only.
    This function can support :ref:`specifying a file descriptor <path_fd>` and
    :ref:`not following symlinks <follow_symlinks>`.
 
+   .. audit-event:: os.removexattr path,attribute os.removexattr
+
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object` for *path* and *attribute*.
 
@@ -3185,6 +3241,8 @@ These functions are all available on Linux only.
       A bug in Linux kernel versions less than 2.6.39 caused the flags argument
       to be ignored on some filesystems.
 
+   .. audit-event:: os.setxattr path,attribute,value,flags os.setxattr
+
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object` for *path* and *attribute*.
 
@@ -3247,6 +3305,8 @@ to be ignored.
    <https://msdn.microsoft.com/44228cf2-6306-466c-8f16-f513cd3ba8b5>`_
    for more information about how DLLs are loaded.
 
+   .. audit-event:: os.add_dll_directory path os.add_dll_directory
+
    .. availability:: Windows.
 
    .. versionadded:: 3.8
@@ -3313,6 +3373,8 @@ to be ignored.
    you can check whether or not it is available using :data:`os.supports_fd`.
    If it is unavailable, using it will raise a :exc:`NotImplementedError`.
 
+   .. audit-event:: os.exec path,args,env os.execl
+
    .. availability:: Unix, Windows.
 
    .. versionadded:: 3.3
@@ -3477,6 +3539,8 @@ written in Python, such as a mail server's external command delivery program.
    Note that some platforms including FreeBSD <= 6.3 and Cygwin have
    known issues when using ``fork()`` from a thread.
 
+   .. audit-event:: os.fork "" os.fork
+
    .. versionchanged:: 3.8
       Calling ``fork()`` in a subinterpreter is no longer supported
       (:exc:`RuntimeError` is raised).
@@ -3496,6 +3560,8 @@ written in Python, such as a mail server's external command delivery program.
    master end of the pseudo-terminal.  For a more portable approach, use the
    :mod:`pty` module.  If an error occurs :exc:`OSError` is raised.
 
+   .. audit-event:: os.forkpty "" os.forkpty
+
    .. versionchanged:: 3.8
       Calling ``forkpty()`` in a subinterpreter is no longer supported
       (:exc:`RuntimeError` is raised).
@@ -3522,6 +3588,8 @@ written in Python, such as a mail server's external command delivery program.
 
    See also :func:`signal.pthread_kill`.
 
+   .. audit-event:: os.kill pid,sig os.kill
+
    .. versionadded:: 3.2
       Windows support.
 
@@ -3534,6 +3602,8 @@ written in Python, such as a mail server's external command delivery program.
 
    Send the signal *sig* to the process group *pgid*.
 
+   .. audit-event:: os.killpg pgid,sig os.killpg
+
    .. availability:: Unix.
 
 
@@ -3656,6 +3726,8 @@ written in Python, such as a mail server's external command delivery program.
    :c:data:`POSIX_SPAWN_SETSCHEDPARAM` and :c:data:`POSIX_SPAWN_SETSCHEDULER`
    flags.
 
+   .. audit-event:: os.posix_spawn path,argv,env os.posix_spawn
+
    .. versionadded:: 3.8
 
    .. availability:: Unix.
@@ -3670,6 +3742,8 @@ written in Python, such as a mail server's external command delivery program.
    for the *executable* file in the list of directories specified by the
    :envvar:`PATH` environment variable (in the same way as for ``execvp(3)``).
 
+   .. audit-event:: os.posix_spawn path,argv,env os.posix_spawnp
+
    .. versionadded:: 3.8
 
    .. availability:: See :func:`posix_spawn` documentation.
@@ -3770,6 +3844,8 @@ written in Python, such as a mail server's external command delivery program.
       L = ['cp', 'index.html', '/dev/null']
       os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)
 
+   .. audit-event:: os.spawn mode,path,args,env os.spawnl
+
    .. availability:: Unix, Windows.  :func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp`
       and :func:`spawnvpe` are not available on Windows.  :func:`spawnle` and
       :func:`spawnve` are not thread-safe on Windows; we advise you to use the
@@ -3839,6 +3915,8 @@ written in Python, such as a mail server's external command delivery program.
    function is not resolved until this function is first called.  If the function
    cannot be resolved, :exc:`NotImplementedError` will be raised.
 
+   .. audit-event:: os.startfile path,operation os.startfile
+
    .. availability:: Windows.
 
 
@@ -3888,10 +3966,8 @@ written in Python, such as a mail server's external command delivery program.
 
    See the Unix manual page
    :manpage:`times(2)` and :manpage:`times(3)` manual page on Unix or `the GetProcessTimes MSDN
-   <https://docs.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes>`
-   _ on Windows.
-   On Windows, only :attr:`user` and :attr:`system` are known; the other
-   attributes are zero.
+   <https://docs.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes>`_
+   on Windows. On Windows, only :attr:`user` and :attr:`system` are known; the other attributes are zero.
 
    .. availability:: Unix, Windows.
 
@@ -4052,28 +4128,36 @@ used to determine the disposition of a process.
    Return ``True`` if a core dump was generated for the process, otherwise
    return ``False``.
 
+   This function should be employed only if :func:`WIFSIGNALED` is true.
+
    .. availability:: Unix.
 
 
 .. function:: WIFCONTINUED(status)
 
-   Return ``True`` if the process has been continued from a job control stop,
-   otherwise return ``False``.
+   Return ``True`` if a stopped child has been resumed by delivery of
+   :data:`~signal.SIGCONT` (if the process has been continued from a job
+   control stop), otherwise return ``False``.
+
+   See :data:`WCONTINUED` option.
 
    .. availability:: Unix.
 
 
 .. function:: WIFSTOPPED(status)
 
-   Return ``True`` if the process has been stopped, otherwise return
-   ``False``.
+   Return ``True`` if the process was stopped by delivery of a signal,
+   otherwise return ``False``.
 
-   .. availability:: Unix.
+   :func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was
+   done using :data:`WUNTRACED` option or when the process is being traced (see
+   :manpage:`ptrace(2)`).
 
+   .. availability:: Unix.
 
 .. function:: WIFSIGNALED(status)
 
-   Return ``True`` if the process exited due to a signal, otherwise return
+   Return ``True`` if the process was terminated by a signal, otherwise return
    ``False``.
 
    .. availability:: Unix.
@@ -4081,7 +4165,8 @@ used to determine the disposition of a process.
 
 .. function:: WIFEXITED(status)
 
-   Return ``True`` if the process exited using the :manpage:`exit(2)` system call,
+   Return ``True`` if the process exited terminated normally, that is,
+   by calling ``exit()`` or ``_exit()``, or by returning from ``main()``;
    otherwise return ``False``.
 
    .. availability:: Unix.
@@ -4089,8 +4174,9 @@ used to determine the disposition of a process.
 
 .. function:: WEXITSTATUS(status)
 
-   If ``WIFEXITED(status)`` is true, return the integer parameter to the
-   :manpage:`exit(2)` system call.  Otherwise, the return value is meaningless.
+   Return the process exit status.
+
+   This function should be employed only if :func:`WIFEXITED` is true.
 
    .. availability:: Unix.
 
@@ -4099,12 +4185,16 @@ used to determine the disposition of a process.
 
    Return the signal which caused the process to stop.
 
+   This function should be employed only if :func:`WIFSTOPPED` is true.
+
    .. availability:: Unix.
 
 
 .. function:: WTERMSIG(status)
 
-   Return the signal which caused the process to exit.
+   Return the number of the signal that caused the process to terminate.
+
+   This function should be employed only if :func:`WIFSIGNALED` is true.
 
    .. availability:: Unix.
 
index 326bb2e933cdb2ddbea283a7ce3c5520e62a4e68..b900d093b7565b382707f75856240ced07538763 100644 (file)
@@ -515,8 +515,10 @@ Pure paths provide the following methods and properties:
       >>> PurePath('a/b.py').match('/*.py')
       False
 
-   As with other methods, case-sensitivity is observed::
+   As with other methods, case-sensitivity follows platform defaults::
 
+      >>> PurePosixPath('b.py').match('*.PY')
+      False
       >>> PureWindowsPath('b.py').match('*.PY')
       True
 
@@ -672,7 +674,7 @@ call fails (for example because the path doesn't exist).
 
 .. method:: Path.stat()
 
-   Return information about this path (similarly to :func:`os.stat`).
+   Return a :class:`os.stat_result` object containing information about this path, like :func:`os.stat`.
    The result is looked up at each call to this method.
 
    ::
index 779b60ed4da00e3831f80ab275a6dd0810878b29..d92e947a76403e1cf7017e8d4d70d7279d80a487 100644 (file)
@@ -252,10 +252,10 @@ process more convenient:
    .. versionchanged:: 3.8
       The *buffers* argument was added.
 
-.. function:: loads(bytes_object, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
+.. function:: loads(data, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
 
    Return the reconstituted object hierarchy of the pickled representation
-   *bytes_object* of an object.
+   *data* of an object. *data* must be a :term:`bytes-like object`.
 
    The protocol version of the pickle is detected automatically, so no
    protocol argument is needed.  Bytes past the pickled representation
@@ -639,9 +639,9 @@ the methods :meth:`__getstate__` and :meth:`__setstate__`.
    At unpickling time, some methods like :meth:`__getattr__`,
    :meth:`__getattribute__`, or :meth:`__setattr__` may be called upon the
    instance.  In case those methods rely on some internal invariant being
-   true, the type should implement :meth:`__getnewargs__` or
-   :meth:`__getnewargs_ex__` to establish such an invariant; otherwise,
-   neither :meth:`__new__` nor :meth:`__init__` will be called.
+   true, the type should implement :meth:`__new__` to establish such an
+   invariant, as :meth:`__init__` is not called when unpickling an
+   instance.
 
 .. index:: pair: copy; protocol
 
index 1d33afc75870a5f480d0c9a25ec39d9a6daeab38..8e8e3775aaff4a11c187a9d595fbacf3c8ee3356 100644 (file)
@@ -145,8 +145,8 @@ Cross Platform
 
 .. function:: system()
 
-   Returns the system/OS name, e.g. ``'Linux'``, ``'Windows'``, or ``'Java'``. An
-   empty string is returned if the value cannot be determined.
+   Returns the system/OS name, such as ``'Linux'``, ``'Darwin'``, ``'Java'``,
+   ``'Windows'``. An empty string is returned if the value cannot be determined.
 
 
 .. function:: system_alias(system, release, version)
@@ -260,4 +260,3 @@ Unix Platforms
    using :program:`gcc`.
 
    The file is read and scanned in chunks of *chunksize* bytes.
-
index 9abf2865ef6143c0c1ea6d7df3244a4d916aae8f..b8b7f4213969a9b02f07aba07db18623f96fec15 100644 (file)
@@ -144,7 +144,7 @@ The :mod:`pprint` module also provides several shortcut functions:
 
    .. index:: builtin: eval
 
-   Determine if the formatted representation of *object* is "readable," or can be
+   Determine if the formatted representation of *object* is "readable", or can be
    used to reconstruct the value using :func:`eval`.  This always returns ``False``
    for recursive objects.
 
index 12268437d07e984dfa91504fec480ae77ecf28e3..e85d2e239fdbdb69537f4fe3f0ac96031f40d542 100644 (file)
@@ -69,6 +69,7 @@ The :mod:`pty` module defines the following functions:
    *select* throws an error on your platform when passed three empty lists. This
    is a bug, documented in `issue 26228 <https://bugs.python.org/issue26228>`_.
 
+   .. audit-event:: pty.spawn argv pty.spawn
 
    .. versionchanged:: 3.4
       :func:`spawn` now returns the status value from :func:`os.waitpid`
index 3824353abda1f832d804fc68e50b38f81af3069d..a12a5bb0b1aa2c0c5c290d5c619ac1cd08be11c1 100644 (file)
@@ -27,7 +27,7 @@ byte-code cache files in the directory containing the source code.
    Exception raised when an error occurs while attempting to compile the file.
 
 
-.. function:: compile(file, cfile=None, dfile=None, doraise=False, optimize=-1, invalidation_mode=PycInvalidationMode.TIMESTAMP)
+.. function:: compile(file, cfile=None, dfile=None, doraise=False, optimize=-1, invalidation_mode=PycInvalidationMode.TIMESTAMP, quiet=0)
 
    Compile a source file to byte-code and write out the byte-code cache file.
    The source code is loaded from the file named *file*.  The byte-code is
index b80a2faed9b424e0e2b78538f5b839e10459aae5..36e83e85c23141fded94d3d362c7d75a60f0dafd 100644 (file)
@@ -1,8 +1,8 @@
-:mod:`pyclbr` --- Python class browser support
-==============================================
+:mod:`pyclbr` --- Python module browser support
+===============================================
 
 .. module:: pyclbr
-   :synopsis: Supports information extraction for a Python class browser.
+   :synopsis: Supports information extraction for a Python module browser.
 
 .. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
 
@@ -29,6 +29,9 @@ modules.
    *path* is a sequence of directory paths prepended to ``sys.path``,
    which is used to locate the module source code.
 
+   This function is the original interface and is only kept for back
+   compatibility.  It returns a filtered version of the following.
+
 
 .. function:: readmodule_ex(module, path=None)
 
index 2eeab5e26266470646f7ab4b9cd02aa7134f3de1..0ec5900bef5bbff6da218e066b9d4f1ac8998876 100644 (file)
@@ -190,32 +190,28 @@ fully processed by daemon consumer threads.
 
 Example of how to wait for enqueued tasks to be completed::
 
+    import threading, queue
+
+    q = queue.Queue()
+
     def worker():
         while True:
             item = q.get()
-            if item is None:
-                break
-            do_work(item)
+            print(f'Working on {item}')
+            print(f'Finished {item}')
             q.task_done()
 
-    q = queue.Queue()
-    threads = []
-    for i in range(num_worker_threads):
-        t = threading.Thread(target=worker)
-        t.start()
-        threads.append(t)
+    # turn-on the worker thread
+    threading.Thread(target=worker, daemon=True).start()
 
-    for item in source():
+    # send thirty task requests to the worker
+    for item in range(30):
         q.put(item)
+    print('All task requests sent\n', end='')
 
     # block until all tasks are done
     q.join()
-
-    # stop workers
-    for i in range(num_worker_threads):
-        q.put(None)
-    for t in threads:
-        t.join()
+    print('All work completed')
 
 
 SimpleQueue Objects
index 90b86248e6e1c3654886836998f2675fc03f571d..2149e800e16572e765b4935797b0c23028562161 100644 (file)
@@ -102,7 +102,7 @@ Bookkeeping functions
 .. function:: getrandbits(k)
 
    Returns a Python integer with *k* random bits. This method is supplied with
-   the MersenneTwister generator and some other generators may also provide it
+   the Mersenne Twister generator and some other generators may also provide it
    as an optional part of the API. When available, :meth:`getrandbits` enables
    :meth:`randrange` to handle arbitrarily large ranges.
 
@@ -394,29 +394,28 @@ Simulations::
    >>> def trial():
    ...     return choices('HT', cum_weights=(0.60, 1.00), k=7).count('H') >= 5
    ...
-   >>> sum(trial() for i in range(10000)) / 10000
+   >>> sum(trial() for i in range(10_000)) / 10_000
    0.4169
 
    >>> # Probability of the median of 5 samples being in middle two quartiles
    >>> def trial():
-   ...     return 2500 <= sorted(choices(range(10000), k=5))[2] < 7500
+   ...     return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500
    ...
-   >>> sum(trial() for i in range(10000)) / 10000
+   >>> sum(trial() for i in range(10_000)) / 10_000
    0.7958
 
 Example of `statistical bootstrapping
 <https://en.wikipedia.org/wiki/Bootstrapping_(statistics)>`_ using resampling
-with replacement to estimate a confidence interval for the mean of a sample of
-size five::
+with replacement to estimate a confidence interval for the mean of a sample::
 
    # http://statistics.about.com/od/Applications/a/Example-Of-Bootstrapping.htm
    from statistics import fmean as mean
    from random import choices
 
-   data = 1, 2, 4, 4, 10
-   means = sorted(mean(choices(data, k=5)) for i in range(20))
+   data = [41, 50, 29, 37, 81, 30, 73, 63, 20, 35, 68, 22, 60, 31, 95]
+   means = sorted(mean(choices(data, k=len(data))) for i in range(100))
    print(f'The sample mean of {mean(data):.1f} has a 90% confidence '
-         f'interval from {means[1]:.1f} to {means[-2]:.1f}')
+         f'interval from {means[5]:.1f} to {means[94]:.1f}')
 
 Example of a `resampling permutation test
 <https://en.wikipedia.org/wiki/Resampling_(statistics)#Permutation_tests>`_
@@ -432,7 +431,7 @@ between the effects of a drug versus a placebo::
     placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46]
     observed_diff = mean(drug) - mean(placebo)
 
-    n = 10000
+    n = 10_000
     count = 0
     combined = drug + placebo
     for i in range(n):
@@ -445,32 +444,29 @@ between the effects of a drug versus a placebo::
     print(f'The one-sided p-value of {count / n:.4f} leads us to reject the null')
     print(f'hypothesis that there is no difference between the drug and the placebo.')
 
-Simulation of arrival times and service deliveries in a single server queue::
+Simulation of arrival times and service deliveries for a multiserver queue::
 
+    from heapq import heappush, heappop
     from random import expovariate, gauss
     from statistics import mean, median, stdev
 
     average_arrival_interval = 5.6
-    average_service_time = 5.0
-    stdev_service_time = 0.5
-
-    num_waiting = 0
-    arrivals = []
-    starts = []
-    arrival = service_end = 0.0
-    for i in range(20000):
-        if arrival <= service_end:
-            num_waiting += 1
-            arrival += expovariate(1.0 / average_arrival_interval)
-            arrivals.append(arrival)
-        else:
-            num_waiting -= 1
-            service_start = service_end if num_waiting else arrival
-            service_time = gauss(average_service_time, stdev_service_time)
-            service_end = service_start + service_time
-            starts.append(service_start)
-
-    waits = [start - arrival for arrival, start in zip(arrivals, starts)]
+    average_service_time = 15.0
+    stdev_service_time = 3.5
+    num_servers = 3
+
+    waits = []
+    arrival_time = 0.0
+    servers = [0.0] * num_servers  # time when each server becomes available
+    for i in range(100_000):
+        arrival_time += expovariate(1.0 / average_arrival_interval)
+        next_server_available = heappop(servers)
+        wait = max(0.0, next_server_available - arrival_time)
+        waits.append(wait)
+        service_duration = gauss(average_service_time, stdev_service_time)
+        service_completed = arrival_time + wait + service_duration
+        heappush(servers, service_completed)
+
     print(f'Mean wait: {mean(waits):.1f}.  Stdev wait: {stdev(waits):.1f}.')
     print(f'Median wait: {median(waits):.1f}.  Max wait: {max(waits):.1f}.')
 
index 7c950bfd5b1fd521e5701a660be6dc64b8e69740..9abbd8ba73616eeceae8adb72abf884a34a33aae 100644 (file)
@@ -1617,10 +1617,14 @@ The text categories are specified with regular expressions.  The technique is
 to combine those into a single master regular expression and to loop over
 successive matches::
 
-    import collections
+    from typing import NamedTuple
     import re
 
-    Token = collections.namedtuple('Token', ['type', 'value', 'line', 'column'])
+    class Token(NamedTuple):
+        type: str
+        value: str
+        line: int
+        column: int
 
     def tokenize(code):
         keywords = {'IF', 'THEN', 'ENDIF', 'FOR', 'NEXT', 'GOSUB', 'RETURN'}
index 3573da7ea2d71609057303dc0df3954ff27b8698..e4eac43642d14de7e64e3a6415ac0ff79f0a784d 100644 (file)
@@ -78,6 +78,9 @@ this module for those platforms.
 
    VxWorks only supports setting :data:`RLIMIT_NOFILE`.
 
+   .. audit-event:: resource.setrlimit resource,limits resource.setrlimit
+
+
 .. function:: prlimit(pid, resource[, limits])
 
    Combines :func:`setrlimit` and :func:`getrlimit` in one function and
@@ -94,6 +97,8 @@ this module for those platforms.
    :exc:`PermissionError` when the user doesn't have ``CAP_SYS_RESOURCE`` for
    the process.
 
+   .. audit-event:: resource.prlimit pid,resource,limits resource.prlimit
+
    .. availability:: Linux 2.6.36 or later with glibc 2.13 or later.
 
    .. versionadded:: 3.4
index 174b7e875a38a484ccffe1827d7392622dd92052..bd24de720232140bf1a94b82b64f7db43e8f7337 100644 (file)
@@ -67,6 +67,8 @@ Directory and files operations
    a new symbolic link will be created instead of copying the
    file *src* points to.
 
+   .. audit-event:: shutil.copyfile src,dst shutil.copyfile
+
    .. versionchanged:: 3.3
       :exc:`IOError` used to be raised instead of :exc:`OSError`.
       Added *follow_symlinks* argument.
@@ -101,6 +103,8 @@ Directory and files operations
    :func:`copymode` cannot modify symbolic links on the local platform, and it
    is asked to do so, it will do nothing and return.
 
+   .. audit-event:: shutil.copymode src,dst shutil.copymode
+
    .. versionchanged:: 3.3
       Added *follow_symlinks* argument.
 
@@ -146,6 +150,8 @@ Directory and files operations
       Please see :data:`os.supports_follow_symlinks`
       for more information.
 
+   .. audit-event:: shutil.copystat src,dst shutil.copystat
+
    .. versionchanged:: 3.3
       Added *follow_symlinks* argument and support for Linux extended attributes.
 
@@ -167,6 +173,10 @@ Directory and files operations
    To preserve all file metadata from the original, use
    :func:`~shutil.copy2` instead.
 
+   .. audit-event:: shutil.copyfile src,dst shutil.copy
+
+   .. audit-event:: shutil.copymode src,dst shutil.copy
+
    .. versionchanged:: 3.3
       Added *follow_symlinks* argument.
       Now returns path to the newly created file.
@@ -194,6 +204,10 @@ Directory and files operations
    Please see :func:`copystat` for more information
    about platform support for modifying symbolic link metadata.
 
+   .. audit-event:: shutil.copyfile src,dst shutil.copy2
+
+   .. audit-event:: shutil.copystat src,dst shutil.copy2
+
    .. versionchanged:: 3.3
       Added *follow_symlinks* argument, try to copy extended
       file system attributes too (currently Linux only).
@@ -342,6 +356,8 @@ Directory and files operations
    *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.
 
+   .. audit-event:: shutil.move src,dst shutil.move
+
    .. versionchanged:: 3.3
       Added explicit symlink handling for foreign filesystems, thus adapting
       it to the behavior of GNU's :program:`mv`.
@@ -378,6 +394,8 @@ Directory and files operations
 
    See also :func:`os.chown`, the underlying function.
 
+   .. audit-event:: shutil.chown path,user,group shutil.chown
+
    .. availability:: Unix.
 
    .. versionadded:: 3.3
@@ -629,6 +647,8 @@ provided.  They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
    registered for that extension.  In case none is found,
    a :exc:`ValueError` is raised.
 
+   .. audit-event:: shutil.unpack_archive filename,extract_dir,format shutil.unpack_archive
+
    .. versionchanged:: 3.7
       Accepts a :term:`path-like object` for *filename* and *extract_dir*.
 
index 8fecc2b7eed0e0c654942fe47faa9405c9ad3b1a..5488f4a1f9685f7d863817f45fb68ad2a1e55a4b 100644 (file)
@@ -91,6 +91,110 @@ The variables defined in the :mod:`signal` module are:
    signal.
 
 
+.. data:: SIGABRT
+
+   Abort signal from :manpage:`abort(3)`.
+
+.. data:: SIGALRM
+
+   Timer signal from :manpage:`alarm(2)`.
+
+   .. availability:: Unix.
+
+.. data:: SIGBREAK
+
+   Interrupt from keyboard (CTRL + BREAK).
+
+   .. availability:: Windows.
+
+.. data:: SIGBUS
+
+   Bus error (bad memory access).
+
+   .. availability:: Unix.
+
+.. data:: SIGCHLD
+
+   Child process stopped or terminated.
+
+   .. availability:: Windows.
+
+.. data:: SIGCLD
+
+   Alias to :data:`SIGCHLD`.
+
+.. data:: SIGCONT
+
+   Continue the process if it is currently stopped
+
+   .. availability:: Unix.
+
+.. data:: SIGFPE
+
+   Floating-point exception. For example, division by zero.
+
+   .. seealso::
+      :exc:`ZeroDivisionError` is raised when the second argument of a division
+      or modulo operation is zero.
+
+.. data:: SIGHUP
+
+   Hangup detected on controlling terminal or death of controlling process.
+
+   .. availability:: Unix.
+
+.. data:: SIGILL
+
+   Illegal instruction.
+
+.. data:: SIGINT
+
+   Interrupt from keyboard (CTRL + C).
+
+   Default action is to raise :exc:`KeyboardInterrupt`.
+
+.. data:: SIGKILL
+
+   Kill signal.
+
+   It cannot be caught, blocked, or ignored.
+
+   .. availability:: Unix.
+
+.. data:: SIGPIPE
+
+   Broken pipe: write to pipe with no readers.
+
+   Default action is to ignore the signal.
+
+   .. availability:: Unix.
+
+.. data:: SIGSEGV
+
+   Segmentation fault: invalid memory reference.
+
+.. data:: SIGTERM
+
+   Termination signal.
+
+.. data:: SIGUSR1
+
+   User-defined signal 1.
+
+   .. availability:: Unix.
+
+.. data:: SIGUSR2
+
+   User-defined signal 2.
+
+   .. availability:: Unix.
+
+.. data:: SIGWINCH
+
+   Window resize signal.
+
+   .. availability:: Unix.
+
 .. data:: SIG*
 
    All the signal numbers are defined symbolically.  For example, the hangup signal
@@ -264,6 +368,8 @@ The :mod:`signal` module defines the following functions:
    If *signalnum* is 0, then no signal is sent, but error checking is still
    performed; this can be used to check if the target thread is still running.
 
+   .. audit-event:: signal.pthread_kill thread_id,signalnum signal.pthread_kill
+
    .. availability:: Unix.  See the man page :manpage:`pthread_kill(3)` for further
       information.
 
@@ -295,6 +401,8 @@ The :mod:`signal` module defines the following functions:
    For example, ``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` reads the
    signal mask of the calling thread.
 
+   :data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked.
+
    .. availability:: Unix.  See the man page :manpage:`sigprocmask(3)` and
       :manpage:`pthread_sigmask(3)` for further information.
 
index e1ca160c107b8b88983546d2b006f66d99b1e9b8..b424e1ba348d870a7534d54cec06a29fcb9cec88 100644 (file)
@@ -236,6 +236,13 @@ Module contents
    .. versionadded:: 3.2
 
 
+.. _site-commandline:
+
+Command Line Interface
+----------------------
+
+.. program:: site
+
 The :mod:`site` module also provides a way to get the user directories from the
 command line:
 
@@ -244,8 +251,6 @@ command line:
    $ python3 -m site --user-site
    /home/user/.local/lib/python3.3/site-packages
 
-.. program:: site
-
 If it is called without arguments, it will print the contents of
 :data:`sys.path` on the standard output, followed by the value of
 :data:`USER_BASE` and whether the directory exists, then the same thing for
index ae82e43e00ff088cfa0a20608cf13fe6d97271a3..c72f22b5f6699ecc74317145bbdae9ac9a71e8d0 100644 (file)
@@ -548,7 +548,9 @@ The following functions all create :ref:`socket objects <socket-objects>`.
       When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC`
       bit flags are applied to *type* they are cleared, and
       :attr:`socket.type` will not reflect them.  They are still passed
-      to the underlying system `socket()` call.  Therefore::
+      to the underlying system `socket()` call.  Therefore,
+
+      ::
 
           sock = socket.socket(
               socket.AF_INET,
index 7c8c8d52e03d95461b425ba5e80af3cb73d78a4a..232c0616d925dc00a6632a847b024a1127e0c8f7 100644 (file)
@@ -237,6 +237,8 @@ Server Objects
    .. method:: shutdown()
 
       Tell the :meth:`serve_forever` loop to stop and wait until it does.
+      :meth:`shutdown` must be called while :meth:`serve_forever` is running in a
+      different thread otherwise it will deadlock.
 
 
    .. method:: server_close()
index 67ea2b1d776638514693c71c7f978d56a87f500c..314d3a58e2759a85ba1bb3316e8e490f01cbfe23 100644 (file)
@@ -165,9 +165,10 @@ Module functions and constants
    that 'mytype' is the type of the column. It will try to find an entry of
    'mytype' in the converters dictionary and then use the converter function found
    there to return the value. The column name found in :attr:`Cursor.description`
-   is only the first word of the column name, i.  e. if you use something like
-   ``'as "x [datetime]"'`` in your SQL, then we will parse out everything until the
-   first blank for the column name: the column name would simply be "x".
+   does not include the type, i. e. if you use something like
+   ``'as "Expiration date [datetime]"'`` in your SQL, then we will parse out
+   everything until the first ``'['`` for the column name and strip
+   the preceeding space: the column name would simply be "Expiration date".
 
 
 .. function:: connect(database[, timeout, detect_types, isolation_level, check_same_thread, factory, cached_statements, uri])
index bbb4c412d9303e20c11b40aeef4378bbfda94ec5..4142e41dcb451870887b2ff219de27e2c92772ca 100644 (file)
@@ -42,7 +42,7 @@ This module provides a class, :class:`ssl.SSLSocket`, which is derived from the
 :class:`socket.socket` type, and provides a socket-like wrapper that also
 encrypts and decrypts the data going over the socket with SSL.  It supports
 additional methods such as :meth:`getpeercert`, which retrieves the
-certificate of the other side of the connection, and :meth:`cipher`,which
+certificate of the other side of the connection, and :meth:`cipher`, which
 retrieves the cipher being used for the secure connection.
 
 For more sophisticated applications, the :class:`ssl.SSLContext` class
@@ -2271,7 +2271,7 @@ Visual inspection shows that the certificate does identify the desired service
                 (('postalCode', '03894-4801'),),
                 (('countryName', 'US'),),
                 (('stateOrProvinceName', 'NH'),),
-                (('localityName', 'Wolfeboro,'),),
+                (('localityName', 'Wolfeboro'),),
                 (('organizationName', 'Python Software Foundation'),),
                 (('commonName', 'www.python.org'),)),
     'subjectAltName': (('DNS', 'www.python.org'),
index 4c7239c1895fbfe32bd694b4a4e1beaac20cd7b4..026f4aa462d3d73d671422900ef5224f3a062639 100644 (file)
@@ -734,10 +734,10 @@ of applications in statistics.
 :class:`NormalDist` readily solves classic probability problems.
 
 For example, given `historical data for SAT exams
-<https://blog.prepscholar.com/sat-standard-deviation>`_ showing that scores
-are normally distributed with a mean of 1060 and a standard deviation of 192,
-determine the percentage of students with test scores between 1100 and
-1200, after rounding to the nearest whole number:
+<https://nces.ed.gov/programs/digest/d17/tables/dt17_226.40.asp>`_ showing
+that scores are normally distributed with a mean of 1060 and a standard
+deviation of 195, determine the percentage of students with test scores
+between 1100 and 1200, after rounding to the nearest whole number:
 
 .. doctest::
 
@@ -772,6 +772,42 @@ Carlo simulation <https://en.wikipedia.org/wiki/Monte_Carlo_method>`_:
     >>> quantiles(map(model, X, Y, Z))       # doctest: +SKIP
     [1.4591308524824727, 1.8035946855390597, 2.175091447274739]
 
+Normal distributions can be used to approximate `Binomial
+distributions <http://mathworld.wolfram.com/BinomialDistribution.html>`_
+when the sample size is large and when the probability of a successful
+trial is near 50%.
+
+For example, an open source conference has 750 attendees and two rooms with a
+500 person capacity.  There is a talk about Python and another about Ruby.
+In previous conferences, 65% of the attendees preferred to listen to Python
+talks.  Assuming the population preferences haven't changed, what is the
+probability that the Python room will stay within its capacity limits?
+
+.. doctest::
+
+    >>> n = 750             # Sample size
+    >>> p = 0.65            # Preference for Python
+    >>> q = 1.0 - p         # Preference for Ruby
+    >>> k = 500             # Room capacity
+
+    >>> # Approximation using the cumulative normal distribution
+    >>> from math import sqrt
+    >>> round(NormalDist(mu=n*p, sigma=sqrt(n*p*q)).cdf(k + 0.5), 4)
+    0.8402
+
+    >>> # Solution using the cumulative binomial distribution
+    >>> from math import comb, fsum
+    >>> round(fsum(comb(n, r) * p**r * q**(n-r) for r in range(k+1)), 4)
+    0.8402
+
+    >>> # Approximation using a simulation
+    >>> from random import seed, choices
+    >>> seed(8675309)
+    >>> def trial():
+    ...     return choices(('Python', 'Ruby'), (p, q), k=n).count('Python')
+    >>> mean(trial() <= k for i in range(10_000))
+    0.8398
+
 Normal distributions commonly arise in machine learning problems.
 
 Wikipedia has a `nice example of a Naive Bayesian Classifier
index be72695462c7bc9c265928450c25daa3aa429e58..8cc57c30c322cb4e270ad989854bd889eeaa60c7 100644 (file)
@@ -261,8 +261,10 @@ and imaginary parts.
 Python fully supports mixed arithmetic: when a binary arithmetic operator has
 operands of different numeric types, the operand with the "narrower" type is
 widened to that of the other, where integer is narrower than floating point,
-which is narrower than complex.  Comparisons between numbers of mixed type use
-the same rule. [2]_ The constructors :func:`int`, :func:`float`, and
+which is narrower than complex. A comparison between numbers of different types
+behaves as though the exact values of those numbers were being compared. [2]_
+
+The constructors :func:`int`, :func:`float`, and
 :func:`complex` can be used to produce numbers of a specific type.
 
 All numeric types (except complex) support the following operations (for priorities of
@@ -2399,7 +2401,7 @@ data and are closely related to string objects in a variety of other ways.
    A reverse conversion function exists to transform a bytes object into its
    hexadecimal representation.
 
-   .. method:: hex()
+   .. method:: hex([sep[, bytes_per_sep]])
 
       Return a string object containing two hexadecimal digits for each
       byte in the instance.
@@ -2493,7 +2495,7 @@ objects.
    A reverse conversion function exists to transform a bytearray object into its
    hexadecimal representation.
 
-   .. method:: hex()
+   .. method:: hex([sep[, bytes_per_sep]])
 
       Return a string object containing two hexadecimal digits for each
       byte in the instance.
@@ -2503,6 +2505,11 @@ objects.
 
       .. versionadded:: 3.5
 
+      .. versionchanged:: 3.8
+         Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports
+         optional *sep* and *bytes_per_sep* parameters to insert separators
+         between bytes in the hex output.
+
 Since bytearray objects are sequences of integers (akin to a list), for a
 bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be
 a bytearray object of length 1.  (This contrasts with text strings, where
@@ -3649,7 +3656,7 @@ copying.
          in-memory Fortran order is preserved. For non-contiguous views, the
          data is converted to C first. *order=None* is the same as *order='C'*.
 
-   .. method:: hex()
+   .. method:: hex([sep[, bytes_per_sep]])
 
       Return a string object containing two hexadecimal digits for each
       byte in the buffer. ::
@@ -3660,6 +3667,11 @@ copying.
 
       .. versionadded:: 3.5
 
+      .. versionchanged:: 3.8
+         Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports
+         optional *sep* and *bytes_per_sep* parameters to insert separators
+         between bytes in the hex output.
+
    .. method:: tolist()
 
       Return the data in the buffer as a list of elements. ::
@@ -4326,6 +4338,8 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
       Return a reverse iterator over the keys of the dictionary. This is a
       shortcut for ``reversed(d.keys())``.
 
+      .. versionadded:: 3.8
+
    .. method:: setdefault(key[, default])
 
       If *key* is in the dictionary, return its value.  If not, insert *key*
index e2983db1ac832198a14b85dedf0847613d029b0d..fa906f799c1082c627d391fb1d9558fa16354ee4 100644 (file)
@@ -302,9 +302,9 @@ specification is to be interpreted.
 Most built-in types implement the following options for format specifications,
 although some of the formatting options are only supported by the numeric types.
 
-A general convention is that an empty format string (``""``) produces
+A general convention is that an empty format specification produces
 the same result as if you had called :func:`str` on the value. A
-non-empty format string typically modifies the result.
+non-empty format specification typically modifies the result.
 
 The general form of a *standard format specifier* is:
 
@@ -415,8 +415,9 @@ error.
 .. versionchanged:: 3.6
    Added the ``'_'`` option (see also :pep:`515`).
 
-*width* is a decimal integer defining the minimum field width.  If not
-specified, then the field width will be determined by the content.
+*width* is a decimal integer defining the minimum total field width,
+including any prefixes, separators, and other formatting characters.
+If not specified, then the field width will be determined by the content.
 
 When no explicit alignment is given, preceding the *width* field by a zero
 (``'0'``) character enables
index ea12cd133a6ffca8a850b59822133e5bcafa3fc0..cce7da1c9b16696fa1572ce0495a0fde321eb6a0 100644 (file)
@@ -355,14 +355,20 @@ functions.
    arguments for additional differences from the default behavior.  Unless
    otherwise stated, it is recommended to pass *args* as a sequence.
 
+   An example of passing some arguments to an external program
+   as a sequence is::
+
+     Popen(["/usr/bin/git", "commit", "-m", "Fixes a bug."])
+
    On POSIX, if *args* is a string, the string is interpreted as the name or
    path of the program to execute.  However, this can only be done if not
    passing arguments to the program.
 
    .. note::
 
-      :meth:`shlex.split` can be useful when determining the correct
-      tokenization for *args*, especially in complex cases::
+      It may not be obvious how to break a shell command into a sequence of arguments,
+      especially in complex cases. :meth:`shlex.split` can illustrate how to
+      determine the correct tokenization for *args*::
 
          >>> import shlex, subprocess
          >>> command_line = input()
index 1cf19b8ad6c025087351c280eef6999b0d14c08a..d3473de1292eab8a997100683dc26e35ab16db17 100644 (file)
@@ -343,6 +343,8 @@ always available.
    .. versionadded:: 3.7
       __breakpointhook__
 
+   .. versionadded:: 3.8
+      __unraisablehook__
 
 .. function:: exc_info()
 
@@ -479,8 +481,8 @@ always available.
    +---------------------+----------------+--------------------------------------------------+
    | attribute           | float.h macro  | explanation                                      |
    +=====================+================+==================================================+
-   | :const:`epsilon`    | DBL_EPSILON    | difference between 1 and the least value greater |
-   |                     |                | than 1 that is representable as a float          |
+   | :const:`epsilon`    | DBL_EPSILON    | difference between 1.0 and the least value       |
+   |                     |                | greater than 1.0 that is representable as a float|
    +---------------------+----------------+--------------------------------------------------+
    | :const:`dig`        | DBL_DIG        | maximum number of decimal digits that can be     |
    |                     |                | faithfully represented in a float;  see below    |
@@ -488,20 +490,20 @@ always available.
    | :const:`mant_dig`   | DBL_MANT_DIG   | float precision: the number of base-``radix``    |
    |                     |                | digits in the significand of a float             |
    +---------------------+----------------+--------------------------------------------------+
-   | :const:`max`        | DBL_MAX        | maximum representable finite float               |
+   | :const:`max`        | DBL_MAX        | maximum representable positive finite float      |
    +---------------------+----------------+--------------------------------------------------+
-   | :const:`max_exp`    | DBL_MAX_EXP    | maximum integer e such that ``radix**(e-1)`` is  |
+   | :const:`max_exp`    | DBL_MAX_EXP    | maximum integer *e* such that ``radix**(e-1)`` is|
    |                     |                | a representable finite float                     |
    +---------------------+----------------+--------------------------------------------------+
-   | :const:`max_10_exp` | DBL_MAX_10_EXP | maximum integer e such that ``10**e`` is in the  |
+   | :const:`max_10_exp` | DBL_MAX_10_EXP | maximum integer *e* such that ``10**e`` is in the|
    |                     |                | range of representable finite floats             |
    +---------------------+----------------+--------------------------------------------------+
-   | :const:`min`        | DBL_MIN        | minimum positive normalized float                |
+   | :const:`min`        | DBL_MIN        | minimum representable positive *normalized* float|
    +---------------------+----------------+--------------------------------------------------+
-   | :const:`min_exp`    | DBL_MIN_EXP    | minimum integer e such that ``radix**(e-1)`` is  |
+   | :const:`min_exp`    | DBL_MIN_EXP    | minimum integer *e* such that ``radix**(e-1)`` is|
    |                     |                | a normalized float                               |
    +---------------------+----------------+--------------------------------------------------+
-   | :const:`min_10_exp` | DBL_MIN_10_EXP | minimum integer e such that ``10**e`` is a       |
+   | :const:`min_10_exp` | DBL_MIN_10_EXP | minimum integer *e* such that ``10**e`` is a     |
    |                     |                | normalized float                                 |
    +---------------------+----------------+--------------------------------------------------+
    | :const:`radix`      | FLT_RADIX      | radix of exponent representation                 |
index 7151527ce57a548341757cb5a1ccbbccfb28283c..d264a3340c98b01fcc6f568025760ad70140b91d 100644 (file)
@@ -31,6 +31,8 @@ The module defines the following functions:
    If :func:`openlog` has not been called prior to the call to :func:`syslog`,
    ``openlog()`` will be called with no arguments.
 
+   .. audit-event:: syslog.syslog priority,message syslog.syslog
+
 
 .. function:: openlog([ident[, logoption[, facility]]])
 
@@ -45,6 +47,8 @@ The module defines the following functions:
    keyword argument (default is :const:`LOG_USER`) sets the default facility for
    messages which do not have a facility explicitly encoded.
 
+   .. audit-event:: syslog.openlog ident,logoption,facility syslog.openlog
+
    .. versionchanged:: 3.2
       In previous versions, keyword arguments were not allowed, and *ident* was
       required.  The default for *ident* was dependent on the system libraries,
@@ -60,6 +64,8 @@ The module defines the following functions:
    :func:`openlog` hasn't already been called), and *ident* and other
    :func:`openlog` parameters are reset to defaults.
 
+   .. audit-event:: syslog.closelog "" syslog.closelog
+
 
 .. function:: setlogmask(maskpri)
 
@@ -70,6 +76,8 @@ The module defines the following functions:
    ``LOG_UPTO(pri)`` calculates the mask for all priorities up to and including
    *pri*.
 
+   .. audit-event:: syslog.setlogmask maskpri syslog.setlogmask
+
 The module defines the following constants:
 
 Priority levels (high to low):
index 0f11ef401569de600fe0194f62475cc66cf7ce1d..16837104b6cebcde285fbfad8c3289617de36443 100644 (file)
@@ -239,7 +239,7 @@ hyphenated words; only then will long words be broken if necessary, unless
       :attr:`fix_sentence_endings` is false by default.
 
       Since the sentence detection algorithm relies on ``string.lowercase`` for
-      the definition of "lowercase letter," and a convention of using two spaces
+      the definition of "lowercase letter", and a convention of using two spaces
       after a period to separate sentences on the same line, it is specific to
       English-language texts.
 
index 93ea4bda7cd7aaa805c044b035c91a5d61a2fb54..f4b58d3d3aebb142eade32a0dcd4b29bde23c453 100644 (file)
@@ -489,6 +489,7 @@ All methods are executed atomically.
       There is no return value.
 
    .. method:: locked()
+
       Return true if the lock is acquired.
 
 
index e628ac44e806432dd0ce194fc966157995ef85df..6842e9075e1a682fbc014cb0959d4b463d7a3f68 100644 (file)
@@ -218,7 +218,6 @@ Functions
    Supported clock names and the corresponding functions to read their value
    are:
 
-   * ``'clock'``: :func:`time.clock`
    * ``'monotonic'``: :func:`time.monotonic`
    * ``'perf_counter'``: :func:`time.perf_counter`
    * ``'process_time'``: :func:`time.process_time`
index ef7a4e40be65908cbf8b47fc532b47b9e24a32cd..46fa62c15fc2ef0001b114ea018f333c6706db06 100644 (file)
@@ -251,7 +251,8 @@ quotes and using leading spaces.  Multiple :option:`-s` options are treated
 similarly.
 
 If :option:`-n` is not given, a suitable number of loops is calculated by trying
-successive powers of 10 until the total time is at least 0.2 seconds.
+increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the total
+time is at least 0.2 seconds.
 
 :func:`default_timer` measurements can be affected by other programs running on
 the same machine, so the best thing to do when accurate timing is necessary is
index 1777929be739d1d7387e8dad2d5fc0edfb76f1a8..dab8f0fa9b64fcf348dba3044e8bfef498c63b2a 100644 (file)
@@ -87,7 +87,7 @@ the :mod:`tokenize` module.
    now tokenized as :data:`NAME` tokens.
 
 .. versionchanged:: 3.8
-   Added :data:`TYPE_COMMENT`.
+   Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`.
    Added :data:`AWAIT` and :data:`ASYNC` tokens back (they're needed
    to support parsing older Python versions for :func:`ast.parse` with
    ``feature_version`` set to 6 or lower).
index b208ba46d17d99de7b4835697ea923fb92f4ff44..11f569df2e7cde774f2d14f120796e373208824f 100644 (file)
@@ -13,7 +13,7 @@
 
 The :mod:`tokenize` module provides a lexical scanner for Python source code,
 implemented in Python.  The scanner in this module returns comments as tokens
-as well, making it useful for implementing "pretty-printers," including
+as well, making it useful for implementing "pretty-printers", including
 colorizers for on-screen displays.
 
 To simplify token stream handling, all :ref:`operator <operators>` and
@@ -278,3 +278,22 @@ The exact token type names can be displayed using the :option:`-e` option:
     4,10-4,11:          RPAR           ')'
     4,11-4,12:          NEWLINE        '\n'
     5,0-5,0:            ENDMARKER      ''
+
+Example of tokenizing a file programmatically, reading unicode
+strings instead of bytes with :func:`generate_tokens`::
+
+    import tokenize
+
+    with tokenize.open('hello.py') as f:
+        tokens = tokenize.generate_tokens(f.readline)
+        for token in tokens:
+            print(token)
+
+Or reading bytes directly with :func:`.tokenize`::
+
+    import tokenize
+
+    with open('hello.py', 'rb') as f:
+        tokens = tokenize.tokenize(f.readline)
+        for token in tokens:
+            print(token)
index 2d327c02540995ebb1dcff9289166c33346429ac..000c0ee9405901672aac648c5654b44fdcd16f11 100644 (file)
@@ -202,10 +202,8 @@ ignoring ``<frozen importlib._bootstrap>`` and ``<unknown>`` files::
         print("Top %s lines" % limit)
         for index, stat in enumerate(top_stats[:limit], 1):
             frame = stat.traceback[0]
-            # replace "/path/to/module/file.py" with "module/file.py"
-            filename = os.sep.join(frame.filename.split(os.sep)[-2:])
             print("#%s: %s:%s: %.1f KiB"
-                  % (index, filename, frame.lineno, stat.size / 1024))
+                  % (index, frame.filename, frame.lineno, stat.size / 1024))
             line = linecache.getline(frame.filename, frame.lineno).strip()
             if line:
                 print('    %s' % line)
index 7f9f0c34386799fea45b340d3cdc6754751b83ab..fed85045435b1b614f84d3a917f2102876fef133 100644 (file)
@@ -1051,6 +1051,11 @@ Filling
 
    Fill the shape drawn after the last call to :func:`begin_fill`.
 
+   Whether or not overlap regions for self-intersecting polygons
+   or multiple shapes are filled depends on the operating system graphics,
+   type of overlap, and number of overlaps.  For example, the Turtle star
+   above may be either all yellow or have some white regions.
+
    .. doctest::
       :skipif: _tkinter is None
 
index 9393f9e6db9909cac2ae30b2c2ae4f3bab3f2447..3529c2b0edb896630fdf6c9a78ddff033f9114b3 100644 (file)
@@ -132,7 +132,7 @@ Standard names are defined for the following types:
    .. versionadded:: 3.6
 
 
-.. data:: CodeType
+.. class:: CodeType(**kwargs)
 
    .. index:: builtin: compile
 
@@ -143,6 +143,12 @@ Standard names are defined for the following types:
    Note that the audited arguments may not match the names or positions
    required by the initializer.
 
+   .. method:: CodeType.replace(**kwargs)
+
+     Return a copy of the code object with new values for the specified fields.
+
+     .. versionadded:: 3.8
+
 .. data:: CellType
 
    The type for cell objects: such objects are used as containers for
index 323dac20822010bd87065b9c5aac0dd137043c0b..7269e181c73497300390a17ce6acad3079e463a1 100644 (file)
@@ -959,7 +959,7 @@ The module defines the following classes, functions and decorators:
    .. versionchanged:: 3.6.1
       Added support for default values, methods, and docstrings.
 
-   .. versionchanged:: 3.8
+   .. deprecated-removed:: 3.8 3.9
       Deprecated the ``_field_types`` attribute in favor of the more
       standard ``__annotations__`` attribute which has the same information.
 
@@ -996,8 +996,20 @@ The module defines the following classes, functions and decorators:
       Point2D = TypedDict('Point2D', x=int, y=int, label=str)
       Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
 
-   See :pep:`589` for more examples and detailed rules of using ``TypedDict``
-   with type checkers.
+   By default, all keys must be present in a TypedDict. It is possible
+   to override this by specifying totality.
+   Usage::
+
+      class point2D(TypedDict, total=False):
+          x: int
+          y: int
+
+   This means that a point2D TypedDict can have any of the keys omitted. A type
+   checker is only expected to support a literal False or True as the value of
+   the total argument. True is the default, and makes all items defined in the
+   class body be required.
+
+   See :pep:`589` for more examples and detailed rules of using ``TypedDict``.
 
    .. versionadded:: 3.8
 
index ebfaf7d643956aaaddea43679f8f25f7fcb7b653..e92f5545d3eb0573da999ce88a1c2087162a6da8 100644 (file)
@@ -915,6 +915,7 @@ object::
   >>> mock.async_foo
   <AsyncMock name='mock.async_foo' id='...'>
 
+  .. versionadded:: 3.8
 
   .. method:: assert_awaited()
 
index a559d0988bee2ef2c57e99b5223857eba144d49f..d9f080a862ff25344755eacf636b2950024b2a3d 100644 (file)
@@ -910,10 +910,10 @@ Test cases
       .. versionadded:: 3.1
 
 
-   .. method:: assertIn(first, second, msg=None)
-               assertNotIn(first, second, msg=None)
+   .. method:: assertIn(member, container, msg=None)
+               assertNotIn(member, container, msg=None)
 
-      Test that *first* is (or is not) in *second*.
+      Test that *member* is (or is not) in *container*.
 
       .. versionadded:: 3.1
 
index b3c8e3545533113581d93d5a55f639a38aafbe8d..2dbe5e33bd0117ea69911c650da0cea7ae618cdf 100644 (file)
@@ -327,12 +327,6 @@ objects.
    types.
 
 
-.. exception:: ReferenceError
-
-   Exception raised when a proxy object is used but the underlying object has been
-   collected.  This is the same as the standard :exc:`ReferenceError` exception.
-
-
 .. seealso::
 
    :pep:`205` - Weak References
index 728315251e082439bcd896069d9029d25cd53205..fb40a2b3e964e4d52124d64134451a023dc4465c 100644 (file)
@@ -198,7 +198,7 @@ Pack up a directory into an archive, and run it.
 The same can be done using the :func:`create_archive` function::
 
    >>> import zipapp
-   >>> zipapp.create_archive('myapp.pyz', 'myapp')
+   >>> zipapp.create_archive('myapp', 'myapp.pyz')
 
 To make the application directly executable on POSIX, specify an interpreter
 to use.
index e8a2530fb8c1710834d525472e0683644cec3d29..97da6cab806e397b6d2a0924726ea8b31368948e 100644 (file)
@@ -494,6 +494,12 @@ Path objects are traversable using the ``/`` operator.
    Invoke :meth:`ZipFile.open` on the current path. Accepts
    the same arguments as :meth:`ZipFile.open`.
 
+   .. caution::
+
+      The signature on this function changes in an incompatible way
+      in Python 3.9. For a future-compatible version, consider using
+      the third-party zipp.Path package (3.0 or later).
+
 .. method:: Path.iterdir()
 
    Enumerate the children of the current directory.
index 810d2e63fd48c45045b9d16c15dd68f498dbad1e..472a5cf3d88b3409c838cff7e26ec7436fb96e4b 100644 (file)
@@ -87,7 +87,7 @@ PSF LICENSE AGREEMENT FOR PYTHON |release|
       analyze, test, perform and/or display publicly, prepare derivative works,
       distribute, and otherwise use Python |release| alone or in any derivative
       version, provided, however, that PSF's License Agreement and PSF's notice of
-      copyright, i.e., "Copyright © 2001-2019 Python Software Foundation; All Rights
+      copyright, i.e., "Copyright © 2001-2020 Python Software Foundation; All Rights
       Reserved" are retained in Python |release| alone or in any derivative version
       prepared by Licensee.
 
index 9687d0f7960950cc886b5475487b6620e5518046..a2f64ffddbf5342c25431b4d1cfe888043460f64 100644 (file)
@@ -54,9 +54,9 @@ if not exist "%HTMLHELP%" (
 )\r
 :skiphhcsearch\r
 \r
-if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/extensions/patchlevel.py`) do set DISTVERSION=%%v\r
+if not defined DISTVERSION for /f "usebackq" %%v in (`%PYTHON% tools/extensions/patchlevel.py`) do set DISTVERSION=%%v\r
 \r
-if "%BUILDDIR%" EQU "" set BUILDDIR=build\r
+if not defined BUILDDIR set BUILDDIR=build\r
 \r
 rem Targets that don't require sphinx-build\r
 if "%1" EQU "" goto help\r
@@ -131,7 +131,7 @@ if exist ..\Misc\NEWS (
     )\r
 )\r
 \r
-if NOT "%PAPER%" == "" (\r
+if defined PAPER (\r
     set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS%\r
 )\r
 if "%1" EQU "htmlhelp" (\r
index 988eec6d254e102e95630f8cc3d0a2b4d061b1f1..feaf3109d5a24e1d10c53e59055cd49b6e973aca 100644 (file)
@@ -90,8 +90,8 @@ The :keyword:`!if` statement
 The :keyword:`if` statement is used for conditional execution:
 
 .. productionlist::
-   if_stmt: "if" `expression` ":" `suite`
-          : ("elif" `expression` ":" `suite`)*
+   if_stmt: "if" `assignment_expression` ":" `suite`
+          : ("elif" `assignment_expression` ":" `suite`)*
           : ["else" ":" `suite`]
 
 It selects exactly one of the suites by evaluating the expressions one by one
@@ -116,7 +116,7 @@ The :keyword:`while` statement is used for repeated execution as long as an
 expression is true:
 
 .. productionlist::
-   while_stmt: "while" `expression` ":" `suite`
+   while_stmt: "while" `assignment_expression` ":" `suite`
              : ["else" ":" `suite`]
 
 This repeatedly tests the expression and, if it is true, executes the first
@@ -399,6 +399,8 @@ The execution of the :keyword:`with` statement with one "item" proceeds as follo
 #. The context expression (the expression given in the :token:`with_item`) is
    evaluated to obtain a context manager.
 
+#. The context manager's :meth:`__enter__` is loaded for later use.
+
 #. The context manager's :meth:`__exit__` is loaded for later use.
 
 #. The context manager's :meth:`__enter__` method is invoked.
@@ -430,17 +432,41 @@ The execution of the :keyword:`with` statement with one "item" proceeds as follo
    value from :meth:`__exit__` is ignored, and execution proceeds at the normal
    location for the kind of exit that was taken.
 
+The following code::
+
+    with EXPRESSION as TARGET:
+        SUITE
+
+is semantically equivalent to::
+
+    manager = (EXPRESSION)
+    enter = type(manager).__enter__
+    exit = type(manager).__exit__
+    value = enter(manager)
+    hit_except = False
+
+    try:
+        TARGET = value
+        SUITE
+    except:
+        hit_except = True
+        if not exit(manager, *sys.exc_info()):
+            raise
+    finally:
+        if not hit_except:
+            exit(manager, None, None, None)
+
 With more than one item, the context managers are processed as if multiple
 :keyword:`with` statements were nested::
 
    with A() as a, B() as b:
-       suite
+       SUITE
 
-is equivalent to ::
+is semantically equivalent to::
 
    with A() as a:
        with B() as b:
-           suite
+           SUITE
 
 .. versionchanged:: 3.1
    Support for multiple context expressions.
@@ -772,24 +798,25 @@ iterators.
 The following code::
 
     async for TARGET in ITER:
-        BLOCK
+        SUITE
     else:
-        BLOCK2
+        SUITE2
 
 Is semantically equivalent to::
 
     iter = (ITER)
     iter = type(iter).__aiter__(iter)
     running = True
+
     while running:
         try:
             TARGET = await type(iter).__anext__(iter)
         except StopAsyncIteration:
             running = False
         else:
-            BLOCK
+            SUITE
     else:
-        BLOCK2
+        SUITE2
 
 See also :meth:`__aiter__` and :meth:`__anext__` for details.
 
@@ -811,23 +838,27 @@ able to suspend execution in its *enter* and *exit* methods.
 
 The following code::
 
-    async with EXPR as VAR:
-        BLOCK
+    async with EXPRESSION as TARGET:
+        SUITE
 
-Is semantically equivalent to::
+is semantically equivalent to::
 
-    mgr = (EXPR)
-    aexit = type(mgr).__aexit__
-    aenter = type(mgr).__aenter__(mgr)
+    manager = (EXPRESSION)
+    aexit = type(manager).__aexit__
+    aenter = type(manager).__aenter__
+    value = await aenter(manager)
+    hit_except = False
 
-    VAR = await aenter
     try:
-        BLOCK
+        TARGET = value
+        SUITE
     except:
-        if not await aexit(mgr, *sys.exc_info()):
+        hit_except = True
+        if not await aexit(manager, *sys.exc_info()):
             raise
-    else:
-        await aexit(mgr, None, None, None)
+    finally:
+        if not hit_except:
+            await aexit(manager, None, None, None)
 
 See also :meth:`__aenter__` and :meth:`__aexit__` for details.
 
index 46d50ad600ff52391b47f8bdb08a5a2af69a5d42..d364e61b8cf46f2f792656b5ad7e09e165dfae78 100644 (file)
@@ -17,7 +17,7 @@ Objects, values and types
 
 :dfn:`Objects` are Python's abstraction for data.  All data in a Python program
 is represented by objects or by relations between objects. (In a sense, and in
-conformance to Von Neumann's model of a "stored program computer," code is also
+conformance to Von Neumann's model of a "stored program computer", code is also
 represented by objects.)
 
 .. index::
@@ -420,6 +420,11 @@ Mappings
       equal (e.g., ``1`` and ``1.0``) then they can be used interchangeably to index
       the same dictionary entry.
 
+      Dictionaries preserve insertion order, meaning that keys will be produced
+      in the same order they were added sequentially over the dictionary.
+      Replacing an existing key does not change the order, however removing a key
+      and re-inserting it will add it to the end instead of keeping its old place.
+
       Dictionaries are mutable; they can be created by the ``{...}`` notation (see
       section :ref:`dict`).
 
@@ -431,6 +436,11 @@ Mappings
       additional examples of mapping types, as does the :mod:`collections`
       module.
 
+      .. versionchanged:: 3.7
+         Dictionaries did not preserve insertion order in versions of Python before 3.6.
+         In CPython 3.6, insertion order was preserved, but it was considered
+         an implementation detail at that time rather than a language guarantee.
+
 Callable types
    .. index::
       object: callable
@@ -925,8 +935,8 @@ Internal types
       the first line number of the function; :attr:`co_lnotab` is a string
       encoding the mapping from bytecode offsets to line numbers (for details
       see the source code of the interpreter); :attr:`co_stacksize` is the
-      required stack size (including local variables); :attr:`co_flags` is an
-      integer encoding a number of flags for the interpreter.
+      required stack size; :attr:`co_flags` is an integer encoding a number
+      of flags for the interpreter.
 
       .. index:: object: generator
 
@@ -1945,7 +1955,10 @@ Preparing the class namespace
 Once the appropriate metaclass has been identified, then the class namespace
 is prepared. If the metaclass has a ``__prepare__`` attribute, it is called
 as ``namespace = metaclass.__prepare__(name, bases, **kwds)`` (where the
-additional keyword arguments, if any, come from the class definition).
+additional keyword arguments, if any, come from the class definition). The
+``__prepare__`` method should be implemented as a :func:`classmethod`. The
+namespace returned by ``__prepare__`` is passed in to ``__new__``, but when
+the final class object is created the namespace is copied into a new ``dict``.
 
 If the metaclass has no ``__prepare__`` attribute, then the class namespace
 is initialised as an empty ordered mapping.
@@ -2331,7 +2344,7 @@ left undefined.
             object.__rfloordiv__(self, other)
             object.__rmod__(self, other)
             object.__rdivmod__(self, other)
-            object.__rpow__(self, other)
+            object.__rpow__(self, other[, modulo])
             object.__rlshift__(self, other)
             object.__rrshift__(self, other)
             object.__rand__(self, other)
index d9db33a78568e436411ecad05eb0ee5283590c32..8036a491c29ab11266f3cf0cf0ab121b96fc0216 100644 (file)
@@ -28,7 +28,7 @@ Arithmetic conversions
 .. index:: pair: arithmetic; conversion
 
 When a description of an arithmetic operator below uses the phrase "the numeric
-arguments are converted to a common type," this means that the operator
+arguments are converted to a common type", this means that the operator
 implementation for built-in types works as follows:
 
 * If either argument is a complex number, the other is converted to complex;
@@ -178,7 +178,7 @@ called "displays", each of them in two flavors:
 Common syntax elements for comprehensions are:
 
 .. productionlist::
-   comprehension: `expression` `comp_for`
+   comprehension: `assignment_expression` `comp_for`
    comp_for: ["async"] "for" `target_list` "in" `or_test` [`comp_iter`]
    comp_iter: `comp_for` | `comp_if`
    comp_if: "if" `expression_nocond` [`comp_iter`]
@@ -911,7 +911,8 @@ series of :term:`arguments <argument>`:
                 :   ["," `keywords_arguments`]
                 : | `starred_and_keywords` ["," `keywords_arguments`]
                 : | `keywords_arguments`
-   positional_arguments: ["*"] `expression` ("," ["*"] `expression`)*
+   positional_arguments: positional_item ("," positional_item)*
+   positional_item: `assignment_expression` | "*" `expression`
    starred_and_keywords: ("*" `expression` | `keyword_item`)
                 : ("," "*" `expression` | "," `keyword_item`)*
    keywords_arguments: (`keyword_item` | "**" `expression`)
@@ -1421,8 +1422,9 @@ built-in types.
   The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are
   special.  Any ordered comparison of a number to a not-a-number value is false.
   A counter-intuitive implication is that not-a-number values are not equal to
-  themselves.  For example, if ``x = float('NaN')``, ``3 < x``, ``x < 3``, ``x
-  == x``, ``x != x`` are all false.  This behavior is compliant with IEEE 754.
+  themselves.  For example, if ``x = float('NaN')``, ``3 < x``, ``x < 3`` and
+  ``x == x`` are all false, while ``x != x`` is true.  This behavior is
+  compliant with IEEE 754.
 
 * ``None`` and ``NotImplemented`` are singletons.  :PEP:`8` advises that
   comparisons for singletons should always be done with ``is`` or ``is not``,
@@ -1642,6 +1644,17 @@ returns a boolean value regardless of the type of its argument
 (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)
 
 
+Assignment expressions
+======================
+
+.. productionlist::
+   assignment_expression: [`identifier` ":="] `expression`
+
+.. TODO: BPO-39868
+
+See :pep:`572` for more details about assignment expressions.
+
+
 .. _if_expr:
 
 Conditional expressions
@@ -1711,7 +1724,7 @@ Expression lists
    expression_list: `expression` ("," `expression`)* [","]
    starred_list: `starred_item` ("," `starred_item`)* [","]
    starred_expression: `expression` | (`starred_item` ",")* [`starred_item`]
-   starred_item: `expression` | "*" `or_expr`
+   starred_item: `assignment_expression` | "*" `or_expr`
 
 .. index:: object: tuple
 
index c6f6d030d2ac3f8dce902f1c45759642665c91bc..1c98aab7d83aadb138ce98faa758b0545cf2f598 100644 (file)
@@ -855,7 +855,7 @@ module.  ``find_spec()`` returns a fully populated spec for the module.
 This spec will always have "loader" set (with one exception).
 
 To indicate to the import machinery that the spec represents a namespace
-:term:`portion`. the path entry finder sets "loader" on the spec to
+:term:`portion`, the path entry finder sets "loader" on the spec to
 ``None`` and "submodule_search_locations" to a list containing the
 portion.
 
index c0e13b53698e6b86e6ffc061a1e21e3645a9bb07..844bd7cc870e829845bb940258c9d6ac25ced59b 100644 (file)
@@ -376,11 +376,11 @@ characters:
       information on this convention.
 
 ``__*__``
-   System-defined names. These names are defined by the interpreter and its
-   implementation (including the standard library).  Current system names are
-   discussed in the :ref:`specialnames` section and elsewhere.  More will likely
-   be defined in future versions of Python.  *Any* use of ``__*__`` names, in
-   any context, that does not follow explicitly documented use, is subject to
+   System-defined names, informally known as "dunder" names. These names are
+   defined by the interpreter and its implementation (including the standard library).
+   Current system names are discussed in the :ref:`specialnames` section and elsewhere.
+   More will likely be defined in future versions of Python.  *Any* use of ``__*__`` names,
+   in any context, that does not follow explicitly documented use, is subject to
    breakage without warning.
 
 ``__*``
@@ -685,6 +685,11 @@ strings), but they cannot contain comments.  Each expression is evaluated
 in the context where the formatted string literal appears, in order from
 left to right.
 
+.. versionchanged:: 3.7
+   Prior to Python 3.7, an :keyword:`await` expression and comprehensions
+   containing an :keyword:`async for` clause were illegal in the expressions
+   in formatted string literals due to a problem with the implementation.
+
 If a conversion is specified, the result of evaluating the expression
 is converted before formatting.  Conversion ``'!s'`` calls :func:`str` on
 the result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`.
index d9364d6ced729f18d9d53b4292545f3bce5464d0..987c63a7f3575ceba6984a541663667e3452f558 100644 (file)
@@ -40,7 +40,7 @@ Python in one of various formats, follow one of links in this table.</p>
 
 <p>These archives contain all the content in the documentation.</p>
 
-<p>HTML Help (<tt>.chm</tt>) files are made available in the "Windows" section
+<p>HTML Help (<code>.chm</code>) files are made available in the "Windows" section
 on the <a href="https://www.python.org/downloads/release/python-{{ release.replace('.', '') }}/">Python
 download page</a>.</p>
 
index c51dcc7582e54f8dcc9194ecc5eb2fbd7cdd43f1..4730a5fe5db7bcc28f92155b7c6f04e19448d9b7 100644 (file)
@@ -7,7 +7,7 @@
   <li><a href="https://docs.python.org/3.7/">{% trans %}Python 3.7 (stable){% endtrans %}</a></li>
   <li><a href="https://docs.python.org/3.6/">{% trans %}Python 3.6 (security-fixes){% endtrans %}</a></li>
   <li><a href="https://docs.python.org/3.5/">{% trans %}Python 3.5 (security-fixes){% endtrans %}</a></li>
-  <li><a href="https://docs.python.org/2.7/">{% trans %}Python 2.7 (stable){% endtrans %}</a></li>
+  <li><a href="https://docs.python.org/2.7/">{% trans %}Python 2.7 (EOL){% endtrans %}</a></li>
   <li><a href="https://www.python.org/doc/versions/">{% trans %}All versions{% endtrans %}</a></li>
 </ul>
 
index 0c0dca99f21f286fe600392378d7121b0c917423..06bdd0d93515edd9751da61321448eaa209ff87b 100644 (file)
@@ -143,10 +143,10 @@ language definition is evolving towards static name resolution, at "compile"
 time, so don't rely on dynamic name resolution!  (In fact, local variables are
 already determined statically.)
 
-A special quirk of Python is that -- if no :keyword:`global` statement is in
-effect -- assignments to names always go into the innermost scope.  Assignments
-do not copy data --- they just bind names to objects.  The same is true for
-deletions: the statement ``del x`` removes the binding of ``x`` from the
+A special quirk of Python is that -- if no :keyword:`global` or :keyword:`nonlocal`
+statement is in effect -- assignments to names always go into the innermost scope.
+Assignments do not copy data --- they just bind names to objects.  The same is true
+for deletions: the statement ``del x`` removes the binding of ``x`` from the
 namespace referenced by the local scope.  In fact, all operations that introduce
 new names use the local scope: in particular, :keyword:`import` statements and
 function definitions bind the module or function name in the local scope.
@@ -323,7 +323,7 @@ Instance Objects
 
 Now what can we do with instance objects?  The only operations understood by
 instance objects are attribute references.  There are two kinds of valid
-attribute names, data attributes and methods.
+attribute names: data attributes and methods.
 
 *data attributes* correspond to "instance variables" in Smalltalk, and to "data
 members" in C++.  Data attributes need not be declared; like local variables,
index 7dfd33af258867c5f853f64acc4f58186e26852b..f05f5edd5ccc409cd210c0e0fa3c4c2c34b62a34 100644 (file)
@@ -142,7 +142,7 @@ the list, thus saving space.
 We say such an object is :term:`iterable`, that is, suitable as a target for
 functions and constructs that expect something from which they can
 obtain successive items until the supply is exhausted.  We have seen that
-the :keyword:`for` statement is such a construct, while an example of function
+the :keyword:`for` statement is such a construct, while an example of function
 that takes an iterable is :func:`sum`::
 
     >>> sum(range(4))  # 0 + 1 + 2 + 3
index 2f7afb088f3bbbffe6aee9d9975163f17e000204..0edb73ad736919dfe3e941e721b97d52ae9d0078 100644 (file)
@@ -676,9 +676,10 @@ to a variable.  For example, ::
    'Trondheim'
 
 Note that in Python, unlike C, assignment inside expressions must be done
-explicitly with the walrus operator ``:=``. This avoids a common class of
-problems encountered in C programs: typing ``=`` in an expression when ``==``
-was intended.
+explicitly with the
+:ref:`walrus operator <why-can-t-i-use-an-assignment-in-an-expression>` ``:=``.
+This avoids a common class of problems encountered in C programs: typing ``=``
+in an expression when ``==`` was intended.
 
 
 .. _tut-comparing:
index 4bc7184d1078c543a400e089ba6d18a9d7a785a3..27c67c6e015af531cc2c94c6ac3943ef7537c653 100644 (file)
@@ -341,15 +341,33 @@ example::
      File "<stdin>", line 2, in <module>
    KeyboardInterrupt
 
-If a :keyword:`finally` clause is present, the :keyword:`finally` clause will execute as the last task before the :keyword:`try` statement completes. The :keyword:`finally` clause runs whether or not the :keyword:`try` statement produces an exception. The following points discuss more complex cases when an exception occurs:
-
-* If an exception occurs during execution of the :keyword:`!try` clause, the exception may be handled by an :keyword:`except` clause. If the exception is not handled by an :keyword:`except` clause, the exception is re-raised after the :keyword:`!finally` clause has been executed.
-
-* An exception could occur during execution of an :keyword:`!except` or :keyword:`!else` clause. Again, the exception is re-raised after the :keyword:`!finally` clause has been executed.
-
-* If the :keyword:`!try` statement reaches a :keyword:`break`, :keyword:`continue` or :keyword:`return` statement, the :keyword:`finally` clause will execute just prior to the :keyword:`break`, :keyword:`continue` or :keyword:`return` statement's execution.
-
-* If a :keyword:`finally` clause includes a :keyword:`return` statement, the :keyword:`finally` clause's :keyword:`return` statement will execute before, and instead of, the :keyword:`return` statement in a :keyword:`try` clause.
+If a :keyword:`finally` clause is present, the :keyword:`!finally`
+clause will execute as the last task before the :keyword:`try`
+statement completes. The :keyword:`!finally` clause runs whether or
+not the :keyword:`!try` statement produces an exception. The following
+points discuss more complex cases when an exception occurs:
+
+* If an exception occurs during execution of the :keyword:`!try`
+  clause, the exception may be handled by an :keyword:`except`
+  clause. If the exception is not handled by an :keyword:`!except`
+  clause, the exception is re-raised after the :keyword:`!finally`
+  clause has been executed.
+
+* An exception could occur during execution of an :keyword:`!except`
+  or :keyword:`!else` clause. Again, the exception is re-raised after
+  the :keyword:`!finally` clause has been executed.
+
+* If the :keyword:`!try` statement reaches a :keyword:`break`,
+  :keyword:`continue` or :keyword:`return` statement, the
+  :keyword:`!finally` clause will execute just prior to the
+  :keyword:`!break`, :keyword:`!continue` or :keyword:`!return`
+  statement's execution.
+
+* If a :keyword:`!finally` clause includes a :keyword:`!return`
+  statement, the returned value will be the one from the
+  :keyword:`!finally` clause's :keyword:`!return` statement, not the
+  value from the :keyword:`!try` clause's :keyword:`!return`
+  statement.
 
 For example::
 
index c30f6fc7cfd87cdc7a752a2a4b88706590462d5e..d3f04004efc750ab894ee85998a7ef6308e50a82 100644 (file)
@@ -109,8 +109,8 @@ source.
    Many standard library modules contain code that is invoked on their execution
    as a script.  An example is the :mod:`timeit` module::
 
-       python -mtimeit -s 'setup here' 'benchmarked code here'
-       python -mtimeit -h # for details
+       python -m timeit -s 'setup here' 'benchmarked code here'
+       python -m timeit -h # for details
 
    .. audit-event:: cpython.run_module module-name cmdoption-m
 
@@ -936,8 +936,6 @@ conflict.
 
    Also available as the :option:`-X` ``utf8`` option.
 
-   .. availability:: \*nix.
-
    .. versionadded:: 3.7
       See :pep:`540` for more details.
 
index 1b24721bbcbc3af4ff28e89dcc2f3747c57da27d..99b2a19a18d06fbfd2844fbe5763769638626da9 100644 (file)
@@ -78,6 +78,17 @@ The command, if run with ``-h``, will show the available options::
    particular note is that double-clicking ``python.exe`` in File Explorer
    will resolve the symlink eagerly and ignore the virtual environment.
 
+.. note::
+   On Microsoft Windows, it may be required to enable the ``Activate.ps1``
+   script by setting the execution policy for the user. You can do this by
+   issuing the following PowerShell command:
+
+   PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
+
+   See `About Execution Policies
+   <ttps:/go.microsoft.com/fwlink/?LinkID=135170>`_
+   for more information.
+
 The created ``pyvenv.cfg`` file also includes the
 ``include-system-site-packages`` key, set to ``true`` if ``venv`` is
 run with the ``--system-site-packages`` option, ``false`` otherwise.
index 9dc3e796cc2110f3723cd42da6484948ee1183dc..636f48dfb012b07927fa969a48a45bfda6ef17ea 100644 (file)
@@ -602,6 +602,50 @@ existed)::
 
     C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Python 3.8
 
+.. _win-utf8-mode:
+
+UTF-8 mode
+==========
+
+.. versionadded:: 3.7
+
+Windows still uses legacy encodings for the system encoding (the ANSI Code
+Page).  Python uses it for the default encoding of text files (e.g.
+:func:`locale.getpreferredencoding`).
+
+This may cause issues because UTF-8 is widely used on the internet
+and most Unix systems, including WSL (Windows Subsystem for Linux).
+
+You can use UTF-8 mode to change the default text encoding to UTF-8.
+You can enable UTF-8 mode via the ``-X utf8`` command line option, or
+the ``PYTHONUTF8=1`` environment variable.  See :envvar:`PYTHONUTF8` for
+enabling UTF-8 mode, and :ref:`setting-envvars` for how to modify
+environment variables.
+
+When UTF-8 mode is enabled:
+
+* :func:`locale.getpreferredencoding` returns ``'UTF-8'`` instead of
+  the system encoding.  This function is used for the default text
+  encoding in many places, including :func:`open`, :class:`Popen`,
+  :meth:`Path.read_text`, etc.
+* :data:`sys.stdin`, :data:`sys.stdout`, and :data:`sys.stderr`
+  all use UTF-8 as their text encoding.
+* You can still use the system encoding via the "mbcs" codec.
+
+Note that adding ``PYTHONUTF8=1`` to the default environment variables
+will affect all Python 3.7+ applications on your system.
+If you have any Python 3.7+ applications which rely on the legacy
+system encoding, it is recommended to set the environment variable
+temporarily or use the ``-X utf8`` command line option.
+
+.. note::
+   Even when UTF-8 mode is disabled, Python uses UTF-8 by default
+   on Windows for:
+
+   * Console I/O including standard I/O (see :pep:`528` for details).
+   * The filesystem encoding (see :pep:`529` for details).
+
+
 .. _launcher:
 
 Python Launcher for Windows
index 880958d3edb900c822b80be9dd6ad94fe42698d2..6b8bd8861fe9b3900f3e0b1e38128417f8350c0e 100644 (file)
@@ -2,6 +2,8 @@
   What's New In Python 3.0
 ****************************
 
+TEST CHANGE TO BE UNDONE
+
 .. XXX Add trademark info for Apple, Microsoft.
 
 :Author: Guido van Rossum
index 8a70fe22d52bdc679a5b78fafdd94be77fc909fc..b9b50216d23a639d548679afb6862428ba32914c 100644 (file)
@@ -493,6 +493,11 @@ of this mode.
 Other Language Changes
 ======================
 
+* An :keyword:`await` expression and comprehensions containing an
+  :keyword:`async for` clause were illegal in the expressions in
+  :ref:`formatted string literals <f-strings>` due to a problem with the
+  implementation.  In Python 3.7 this restriction was lifted.
+
 * More than 255 arguments can now be passed to a function, and a function can
   now have more than 255 parameters. (Contributed by Serhiy Storchaka in
   :issue:`12844` and :issue:`18896`.)
index 546fa2d5f016ec3837a3e4682c095e33f7324968..d2db5bff5afcf5871cdf55bc1a7de6f0905d3267 100644 (file)
@@ -144,12 +144,11 @@ However, these are invalid calls::
 
 One use case for this notation is that it allows pure Python functions
 to fully emulate behaviors of existing C coded functions.  For example,
-the built-in :func:`pow` function does not accept keyword arguments::
+the built-in :func:`divmod` function does not accept keyword arguments::
 
-  def pow(x, y, z=None, /):
-      "Emulate the built in pow() function"
-      r = x ** y
-      return r if z is None else r%z
+  def divmod(a, b, /):
+      "Emulate the built in divmod() function"
+      return (a // b, a % b)
 
 Another use case is to preclude keyword arguments when the parameter
 name is not helpful.  For example, the builtin :func:`len` function has
@@ -727,7 +726,7 @@ csv
 The :class:`csv.DictReader` now returns instances of :class:`dict` instead of
 a :class:`collections.OrderedDict`.  The tool is now faster and uses less
 memory while still preserving the field order.
-(Contributed by Michael Seek in :issue:`34003`.)
+(Contributed by Michael Selik in :issue:`34003`.)
 
 
 curses
@@ -1942,6 +1941,12 @@ Changes in the Python API
   :exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) instead of :exc:`KeyError`.
   (Contributed by Xiang Zhang in :issue:`33106`.)
 
+* Simplified AST for literals.  All constants will be represented as
+  :class:`ast.Constant` instances.  Instantiating old classes ``Num``,
+  ``Str``, ``Bytes``, ``NameConstant`` and ``Ellipsis`` will return
+  an instance of ``Constant``.
+  (Contributed by Serhiy Storchaka in :issue:`32892`.)
+
 * :func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFILE`
   environment variable and does not use :envvar:`HOME`, which is not normally
   set for regular user accounts.
@@ -2111,7 +2116,7 @@ Changes in the C API
 
   .. code-block:: shell
 
-      gendef python38.dll > tmp.def
+      gendef python38.dll > tmp.def
       dlltool --dllname python38.dll --def tmp.def --output-lib libpython38.a
 
   The location of an installed :file:`pythonXY.dll` will depend on the
@@ -2205,7 +2210,13 @@ Here's a summary of performance improvements since Python 3.3:
     Timing loop:
         loop_overhead                    0.3     0.5     0.6     0.4     0.3     0.3
 
-    (Measured from the macOS 64-bit builds found at python.org)
+The benchmarks were measured on an
+`Intel® Core™ i7-4960HQ processor
+<https://ark.intel.com/content/www/us/en/ark/products/76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz.html>`_
+running the macOS 64-bit builds found at
+`python.org <https://www.python.org/downloads/mac-osx/>`_.
+The benchmark script displays timings in nanoseconds.
+
 
 Notable changes in Python 3.8.1
 ===============================
@@ -2216,3 +2227,18 @@ because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more
 details, see the documentation for ``loop.create_datagram_endpoint()``.
 (Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in
 :issue:`37228`.)
+
+Notable changes in Python 3.8.2
+===============================
+
+Fixed a regression with the ``ignore`` callback of :func:`shutil.copytree`.
+The argument types are now str and List[str] again.
+(Contributed by Manuel Barkhau and Giampaolo Rodola in :issue:`39390`.)
+
+Notable changes in Python 3.8.3
+===============================
+
+The constant values of future flags in the :mod:`__future__` module
+are updated in order to prevent collision with compiler flags. Previously
+``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``.
+(Contributed by Batuhan Taskaya in :issue:`39562`)
index 3afddd20c80d74b84b3d48a5d587d050c2dd99a4..a1cd58f44a0e892b6ac1b6a9e63e572e75c11765 100644 (file)
@@ -88,19 +88,19 @@ typedef struct {
 #define CO_ITERABLE_COROUTINE   0x0100
 #define CO_ASYNC_GENERATOR      0x0200
 
-/* These are no longer used. */
-#if 0
-#define CO_GENERATOR_ALLOWED    0x1000
-#endif
-#define CO_FUTURE_DIVISION      0x2000
-#define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */
-#define CO_FUTURE_WITH_STATEMENT  0x8000
-#define CO_FUTURE_PRINT_FUNCTION  0x10000
-#define CO_FUTURE_UNICODE_LITERALS 0x20000
-
-#define CO_FUTURE_BARRY_AS_BDFL  0x40000
-#define CO_FUTURE_GENERATOR_STOP  0x80000
-#define CO_FUTURE_ANNOTATIONS    0x100000
+/* bpo-39562: These constant values are changed in Python 3.9
+   to prevent collision with compiler flags. CO_FUTURE_ and PyCF_
+   constants must be kept unique. PyCF_ constants can use bits from
+   0x0100 to 0x10000. CO_FUTURE_ constants use bits starting at 0x20000. */
+#define CO_FUTURE_DIVISION      0x20000
+#define CO_FUTURE_ABSOLUTE_IMPORT 0x40000 /* do absolute imports by default */
+#define CO_FUTURE_WITH_STATEMENT  0x80000
+#define CO_FUTURE_PRINT_FUNCTION  0x100000
+#define CO_FUTURE_UNICODE_LITERALS 0x200000
+
+#define CO_FUTURE_BARRY_AS_BDFL  0x400000
+#define CO_FUTURE_GENERATOR_STOP  0x800000
+#define CO_FUTURE_ANNOTATIONS    0x1000000
 
 /* This value is found in the co_cell2arg array when the associated cell
    variable does not correspond to an argument. */
index 1cda955c1425512a429fb2c1cefe79197e60bf42..015584d03b0233aba038f8e1e2c0032a53739b57 100644 (file)
@@ -18,12 +18,18 @@ PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *);
                    CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
                    CO_FUTURE_GENERATOR_STOP | CO_FUTURE_ANNOTATIONS)
 #define PyCF_MASK_OBSOLETE (CO_NESTED)
+
+/* bpo-39562: CO_FUTURE_ and PyCF_ constants must be kept unique.
+   PyCF_ constants can use bits from 0x0100 to 0x10000.
+   CO_FUTURE_ constants use bits starting at 0x20000. */
 #define PyCF_SOURCE_IS_UTF8  0x0100
 #define PyCF_DONT_IMPLY_DEDENT 0x0200
 #define PyCF_ONLY_AST 0x0400
 #define PyCF_IGNORE_COOKIE 0x0800
 #define PyCF_TYPE_COMMENTS 0x1000
 #define PyCF_ALLOW_TOP_LEVEL_AWAIT 0x2000
+#define PyCF_COMPILE_MASK (PyCF_ONLY_AST | PyCF_ALLOW_TOP_LEVEL_AWAIT | \
+                           PyCF_TYPE_COMMENTS | PyCF_DONT_IMPLY_DEDENT)
 
 #ifndef Py_LIMITED_API
 typedef struct {
index 94b0809cd4f0158d456134f270c531a67bf73d3f..e22b0539136083eea918f7ea42906c7419aa0863 100644 (file)
@@ -55,6 +55,7 @@ struct _ts {
     struct _ts *next;
     PyInterpreterState *interp;
 
+    /* Borrowed reference to the current frame (it can be NULL) */
     struct _frame *frame;
     int recursion_depth;
     char overflowed; /* The stack has overflowed. Allow 50 more calls
index cc98d8a1def7e7ab56d4702992c00b6bd591aa57..5558f65687adc05e00edcad040a0d01b0d777444 100644 (file)
@@ -29,7 +29,7 @@ of data it contains.  An object's type is fixed when it is created.
 Types themselves are represented as objects; an object contains a
 pointer to the corresponding type object.  The type itself has a type
 pointer pointing to the object representing the type 'type', which
-contains a pointer to itself!).
+contains a pointer to itself!.
 
 Objects do not float around in memory; once allocated an object keeps
 the same size and address.  Objects that must hold variable-size data
index 6936a3feee7c0f4fd78ba2f5d97d7aac41071b80..2f6a68fbe0ad8f0f66e2578714524b1a8f9bbfcc 100644 (file)
 /*--start constants--*/
 #define PY_MAJOR_VERSION        3
 #define PY_MINOR_VERSION        8
-#define PY_MICRO_VERSION        1
+#define PY_MICRO_VERSION        3
 #define PY_RELEASE_LEVEL        PY_RELEASE_LEVEL_FINAL
 #define PY_RELEASE_SERIAL       0
 
 /* Version as a string */
-#define PY_VERSION              "3.8.1"
+#define PY_VERSION              "3.8.3"
 /*--end constants--*/
 
 /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
diff --git a/LICENSE b/LICENSE
index 9dc010d80348fcce0c7ec1a57da2123e79412566..66a3ac80d729a3a5bdfd22002d34be59a6daf222 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -73,7 +73,7 @@ analyze, test, perform and/or display publicly, prepare derivative works,
 distribute, and otherwise use Python alone or in any derivative version,
 provided, however, that PSF's License Agreement and PSF's notice of copyright,
 i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation;
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
 All Rights Reserved" are retained in Python alone or in any derivative version
 prepared by Licensee.
 
index e1135685d846ce7064559aa4aa4c24839f7145aa..d7cb8ac5f497456f1dfac50b584302e99648cf06 100644 (file)
@@ -68,14 +68,14 @@ __all__ = ["all_feature_names"] + all_feature_names
 # this module.
 CO_NESTED            = 0x0010   # nested_scopes
 CO_GENERATOR_ALLOWED = 0        # generators (obsolete, was 0x1000)
-CO_FUTURE_DIVISION   = 0x2000   # division
-CO_FUTURE_ABSOLUTE_IMPORT = 0x4000 # perform absolute imports by default
-CO_FUTURE_WITH_STATEMENT  = 0x8000   # with statement
-CO_FUTURE_PRINT_FUNCTION  = 0x10000   # print function
-CO_FUTURE_UNICODE_LITERALS = 0x20000 # unicode string literals
-CO_FUTURE_BARRY_AS_BDFL = 0x40000
-CO_FUTURE_GENERATOR_STOP  = 0x80000 # StopIteration becomes RuntimeError in generators
-CO_FUTURE_ANNOTATIONS     = 0x100000  # annotations become strings at runtime
+CO_FUTURE_DIVISION   = 0x20000   # division
+CO_FUTURE_ABSOLUTE_IMPORT = 0x40000 # perform absolute imports by default
+CO_FUTURE_WITH_STATEMENT  = 0x80000   # with statement
+CO_FUTURE_PRINT_FUNCTION  = 0x100000   # print function
+CO_FUTURE_UNICODE_LITERALS = 0x200000 # unicode string literals
+CO_FUTURE_BARRY_AS_BDFL = 0x400000
+CO_FUTURE_GENERATOR_STOP  = 0x800000 # StopIteration becomes RuntimeError in generators
+CO_FUTURE_ANNOTATIONS     = 0x1000000  # annotations become strings at runtime
 
 class _Feature:
     def __init__(self, optionalRelease, mandatoryRelease, compiler_flag):
index db6674ea293fb05fd26ef917fb9aab4d341f11e5..e9efce7d7ed5bddc632fca35882d4e985da99c1e 100644 (file)
@@ -211,7 +211,7 @@ def _remove_universal_flags(_config_vars):
         if cv in _config_vars and cv not in os.environ:
             flags = _config_vars[cv]
             flags = re.sub(r'-arch\s+\w+\s', ' ', flags, flags=re.ASCII)
-            flags = re.sub('-isysroot [^ \t]*', ' ', flags)
+            flags = re.sub(r'-isysroot\s*\S+', ' ', flags)
             _save_modified_value(_config_vars, cv, flags)
 
     return _config_vars
@@ -287,7 +287,7 @@ def _check_for_unavailable_sdk(_config_vars):
     # to /usr and /System/Library by either a standalone CLT
     # package or the CLT component within Xcode.
     cflags = _config_vars.get('CFLAGS', '')
-    m = re.search(r'-isysroot\s+(\S+)', cflags)
+    m = re.search(r'-isysroot\s*(\S+)', cflags)
     if m is not None:
         sdk = m.group(1)
         if not os.path.exists(sdk):
@@ -295,7 +295,7 @@ def _check_for_unavailable_sdk(_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(r'-isysroot\s+\S+(?:\s|$)', ' ', flags)
+                    flags = re.sub(r'-isysroot\s*\S+(?:\s|$)', ' ', flags)
                     _save_modified_value(_config_vars, cv, flags)
 
     return _config_vars
@@ -320,7 +320,7 @@ def compiler_fixup(compiler_so, cc_args):
         stripArch = stripSysroot = True
     else:
         stripArch = '-arch' in cc_args
-        stripSysroot = '-isysroot' in cc_args
+        stripSysroot = any(arg for arg in cc_args if arg.startswith('-isysroot'))
 
     if stripArch or 'ARCHFLAGS' in os.environ:
         while True:
@@ -338,23 +338,34 @@ def compiler_fixup(compiler_so, cc_args):
 
     if stripSysroot:
         while True:
-            try:
-                index = compiler_so.index('-isysroot')
+            indices = [i for i,x in enumerate(compiler_so) if x.startswith('-isysroot')]
+            if not indices:
+                break
+            index = indices[0]
+            if compiler_so[index] == '-isysroot':
                 # Strip this argument and the next one:
                 del compiler_so[index:index+2]
-            except ValueError:
-                break
+            else:
+                # It's '-isysroot/some/path' in one arg
+                del compiler_so[index:index+1]
 
     # Check if the SDK that is used during compilation actually exists,
     # the universal build requires the usage of a universal SDK and not all
     # users have that installed by default.
     sysroot = None
-    if '-isysroot' in cc_args:
-        idx = cc_args.index('-isysroot')
-        sysroot = cc_args[idx+1]
-    elif '-isysroot' in compiler_so:
-        idx = compiler_so.index('-isysroot')
-        sysroot = compiler_so[idx+1]
+    argvar = cc_args
+    indices = [i for i,x in enumerate(cc_args) if x.startswith('-isysroot')]
+    if not indices:
+        argvar = compiler_so
+        indices = [i for i,x in enumerate(compiler_so) if x.startswith('-isysroot')]
+
+    for idx in indices:
+        if argvar[idx] == '-isysroot':
+            sysroot = argvar[idx+1]
+            break
+        else:
+            sysroot = argvar[idx][len('-isysroot'):]
+            break
 
     if sysroot and not os.path.isdir(sysroot):
         from distutils import log
index c14d8ca86a1181d951048b2fb939560793b1bb64..ab989e5206a9e9067c03b95734385f7588e1a7ee 100644 (file)
@@ -140,8 +140,11 @@ __all__ = [
     # Limits for the C version for compatibility
     'MAX_PREC',  'MAX_EMAX', 'MIN_EMIN', 'MIN_ETINY',
 
-    # C version: compile time choice that enables the thread local context
-    'HAVE_THREADS'
+    # C version: compile time choice that enables the thread local context (deprecated, now always true)
+    'HAVE_THREADS',
+
+    # C version: compile time choice that enables the coroutine local context
+    'HAVE_CONTEXTVAR'
 ]
 
 __xname__ = __name__    # sys.modules lookup (--without-threads)
@@ -172,6 +175,7 @@ ROUND_05UP = 'ROUND_05UP'
 
 # Compatibility with the C version
 HAVE_THREADS = True
+HAVE_CONTEXTVAR = True
 if sys.maxsize == 2**63-1:
     MAX_PREC = 999999999999999999
     MAX_EMAX = 999999999999999999
index fd61bc78c2c3dd0226765543ae74b4924b47cb91..2dad5f123f3903e482a9e5b50941905d26816eb5 100644 (file)
@@ -2144,24 +2144,23 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
                 action = self._option_string_actions[option_string]
                 return action, option_string, explicit_arg
 
-        if self.allow_abbrev or not arg_string.startswith('--'):
-            # search through all possible prefixes of the option string
-            # and all actions in the parser for possible interpretations
-            option_tuples = self._get_option_tuples(arg_string)
-
-            # if multiple actions match, the option string was ambiguous
-            if len(option_tuples) > 1:
-                options = ', '.join([option_string
-                    for action, option_string, explicit_arg in option_tuples])
-                args = {'option': arg_string, 'matches': options}
-                msg = _('ambiguous option: %(option)s could match %(matches)s')
-                self.error(msg % args)
-
-            # if exactly one action matched, this segmentation is good,
-            # so return the parsed action
-            elif len(option_tuples) == 1:
-                option_tuple, = option_tuples
-                return option_tuple
+        # search through all possible prefixes of the option string
+        # and all actions in the parser for possible interpretations
+        option_tuples = self._get_option_tuples(arg_string)
+
+        # if multiple actions match, the option string was ambiguous
+        if len(option_tuples) > 1:
+            options = ', '.join([option_string
+                for action, option_string, explicit_arg in option_tuples])
+            args = {'option': arg_string, 'matches': options}
+            msg = _('ambiguous option: %(option)s could match %(matches)s')
+            self.error(msg % args)
+
+        # if exactly one action matched, this segmentation is good,
+        # so return the parsed action
+        elif len(option_tuples) == 1:
+            option_tuple, = option_tuples
+            return option_tuple
 
         # if it was not found as an option, but it looks like a negative
         # number, it was meant to be positional
@@ -2185,16 +2184,17 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
         # split at the '='
         chars = self.prefix_chars
         if option_string[0] in chars and option_string[1] in chars:
-            if '=' in option_string:
-                option_prefix, explicit_arg = option_string.split('=', 1)
-            else:
-                option_prefix = option_string
-                explicit_arg = None
-            for option_string in self._option_string_actions:
-                if option_string.startswith(option_prefix):
-                    action = self._option_string_actions[option_string]
-                    tup = action, option_string, explicit_arg
-                    result.append(tup)
+            if self.allow_abbrev:
+                if '=' in option_string:
+                    option_prefix, explicit_arg = option_string.split('=', 1)
+                else:
+                    option_prefix = option_string
+                    explicit_arg = None
+                for option_string in self._option_string_actions:
+                    if option_string.startswith(option_prefix):
+                        action = self._option_string_actions[option_string]
+                        tup = action, option_string, explicit_arg
+                        result.append(tup)
 
         # single character options can be concatenated with their arguments
         # but multiple character options always have to have their argument
index b45f1e47c197d5600b7e8130daa60c638d3b13e9..0c88bcf4c821eac0d22840cde691fc817af8f806 100644 (file)
@@ -59,11 +59,12 @@ def literal_eval(node_or_string):
         node_or_string = parse(node_or_string, mode='eval')
     if isinstance(node_or_string, Expression):
         node_or_string = node_or_string.body
+    def _raise_malformed_node(node):
+        raise ValueError(f'malformed node or string: {node!r}')
     def _convert_num(node):
-        if isinstance(node, Constant):
-            if type(node.value) in (int, float, complex):
-                return node.value
-        raise ValueError('malformed node or string: ' + repr(node))
+        if not isinstance(node, Constant) or type(node.value) not in (int, float, complex):
+            _raise_malformed_node(node)
+        return node.value
     def _convert_signed_num(node):
         if isinstance(node, UnaryOp) and isinstance(node.op, (UAdd, USub)):
             operand = _convert_num(node.operand)
@@ -82,6 +83,8 @@ def literal_eval(node_or_string):
         elif isinstance(node, Set):
             return set(map(_convert, node.elts))
         elif isinstance(node, Dict):
+            if len(node.keys) != len(node.values):
+                _raise_malformed_node(node)
             return dict(zip(map(_convert, node.keys),
                             map(_convert, node.values)))
         elif isinstance(node, BinOp) and isinstance(node.op, (Add, Sub)):
@@ -408,11 +411,11 @@ class NodeTransformer(NodeVisitor):
        class RewriteName(NodeTransformer):
 
            def visit_Name(self, node):
-               return copy_location(Subscript(
+               return Subscript(
                    value=Name(id='data', ctx=Load()),
                    slice=Index(value=Str(s=node.id)),
                    ctx=node.ctx
-               ), node)
+               )
 
     Keep in mind that if the node you're operating on has child nodes you must
     either transform the child nodes yourself or call the :meth:`generic_visit`
index bfd40115bed38ac10a2b59a4eed5882d081d7d48..799013d5ccccb593201b8ab829ba6bb5ad76add8 100644 (file)
@@ -547,14 +547,17 @@ class BaseEventLoop(events.AbstractEventLoop):
                     'asyncgen': agen
                 })
 
-    def run_forever(self):
-        """Run until stop() is called."""
-        self._check_closed()
+    def _check_running(self):
         if self.is_running():
             raise RuntimeError('This event loop is already running')
         if events._get_running_loop() is not None:
             raise RuntimeError(
                 'Cannot run the event loop while another loop is running')
+
+    def run_forever(self):
+        """Run until stop() is called."""
+        self._check_closed()
+        self._check_running()
         self._set_coroutine_origin_tracking(self._debug)
         self._thread_id = threading.get_ident()
 
@@ -586,6 +589,7 @@ class BaseEventLoop(events.AbstractEventLoop):
         Return the Future's result, or raise its exception.
         """
         self._check_closed()
+        self._check_running()
 
         new_task = not futures.isfuture(future)
         future = tasks.ensure_future(future, loop=self)
index e2da462fde7400555b3332d4f040440d53205895..09bb171a2ce750a06a39e978bea0d3a7accf25f4 100644 (file)
@@ -24,11 +24,18 @@ def _task_repr_info(task):
 
 def _task_get_stack(task, limit):
     frames = []
-    try:
-        # 'async def' coroutines
+    if hasattr(task._coro, 'cr_frame'):
+        # case 1: 'async def' coroutines
         f = task._coro.cr_frame
-    except AttributeError:
+    elif hasattr(task._coro, 'gi_frame'):
+        # case 2: legacy coroutines
         f = task._coro.gi_frame
+    elif hasattr(task._coro, 'ag_frame'):
+        # case 3: async generators
+        f = task._coro.ag_frame
+    else:
+        # case 4: unknown objects
+        f = None
     if f is not None:
         while f is not None:
             if limit is not None:
index 27c665a9910ab2d239b9a448397dd38738b297e7..451a53a16f3831611b6fc9b55f9eff5468924793 100644 (file)
@@ -6,7 +6,7 @@ import contextlib
 import typing
 
 from . import events
-from . import futures
+from . import exceptions as exceptions_mod
 from . import locks
 from . import tasks
 
@@ -83,7 +83,7 @@ async def staggered_race(
             previous_failed: typing.Optional[locks.Event]) -> None:
         # Wait for the previous task to finish, or for delay seconds
         if previous_failed is not None:
-            with contextlib.suppress(futures.TimeoutError):
+            with contextlib.suppress(exceptions_mod.TimeoutError):
                 # Use asyncio.wait_for() instead of asyncio.wait() here, so
                 # that if we get cancelled at this point, Event.wait() is also
                 # cancelled, otherwise there will be a "Task destroyed but it is
index d8f653045aee4c0cb99cdf773fef75a2c053978f..8c0a57482b7a4945ee7d1ceb35ee7e762902a288 100644 (file)
@@ -1266,7 +1266,14 @@ class ThreadedChildWatcher(AbstractChildWatcher):
         return True
 
     def close(self):
-        pass
+        self._join_threads()
+
+    def _join_threads(self):
+        """Internal: Join all non-daemon threads"""
+        threads = [thread for thread in list(self._threads.values())
+                   if thread.is_alive() and not thread.daemon]
+        for thread in threads:
+            thread.join()
 
     def __enter__(self):
         return self
index 2be9c395a96674718fd51d5afe716598e577b8aa..2e70223dfe78244739be541c439f64e4f6acb28f 100755 (executable)
@@ -82,7 +82,7 @@ def b64decode(s, altchars=None, validate=False):
         altchars = _bytes_from_decode_data(altchars)
         assert len(altchars) == 2, repr(altchars)
         s = s.translate(bytes.maketrans(altchars, b'+/'))
-    if validate and not re.match(b'^[A-Za-z0-9+/]*={0,2}$', s):
+    if validate and not re.fullmatch(b'[A-Za-z0-9+/]*={0,2}', s):
         raise binascii.Error('Non-base64 digit found')
     return binascii.a2b_base64(s)
 
index 50d9eece89ad722e3fb23f2709fee96e039e7ed2..18491da897357e152dfe92527b361bf0765002db 100644 (file)
@@ -548,14 +548,7 @@ class Bdb:
             s += frame.f_code.co_name
         else:
             s += "<lambda>"
-        if '__args__' in frame.f_locals:
-            args = frame.f_locals['__args__']
-        else:
-            args = None
-        if args:
-            s += reprlib.repr(args)
-        else:
-            s += '()'
+        s += '()'
         if '__return__' in frame.f_locals:
             rv = frame.f_locals['__return__']
             s += '->'
index d8106ae612c4b404c31c36201e6c92072ee5562e..76000f8c8b2c1e1c98f8fb4c831c2ea3e2de268d 100644 (file)
@@ -40,7 +40,7 @@ class InteractiveInterpreter:
 
         Arguments are as for compile_command().
 
-        One several things can happen:
+        One of several things can happen:
 
         1) The input is incorrect; compile_command() raised an
         exception (SyntaxError or OverflowError).  A syntax traceback
index 21c45a7d10a4c9adf3a864a2d7dab49551116602..7f23e9775df804e79e4d0869a29dc05e1396a892 100644 (file)
@@ -905,11 +905,16 @@ def open(filename, mode='r', encoding=None, errors='strict', buffering=-1):
     file = builtins.open(filename, mode, buffering)
     if encoding is None:
         return file
-    info = lookup(encoding)
-    srw = StreamReaderWriter(file, info.streamreader, info.streamwriter, errors)
-    # Add attributes to simplify introspection
-    srw.encoding = encoding
-    return srw
+
+    try:
+        info = lookup(encoding)
+        srw = StreamReaderWriter(file, info.streamreader, info.streamwriter, errors)
+        # Add attributes to simplify introspection
+        srw.encoding = encoding
+        return srw
+    except:
+        file.close()
+        raise
 
 def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'):
 
index cadf1c72f08d47c7abe787df9ea8e182f0dd4a35..a78a47c55a8fc9b434184134649268aed696cc61 100644 (file)
@@ -695,6 +695,13 @@ class Counter(dict):
     #
     # To strip negative and zero counts, add-in an empty counter:
     #       c += Counter()
+    #
+    # Rich comparison operators for multiset subset and superset tests
+    # are deliberately omitted due to semantic conflicts with the
+    # existing inherited dict equality method.  Subset and superset
+    # semantics ignore zero counts and require that p≤q ∧ p≥q → p=q;
+    # however, that would not be the case for p=Counter(a=1, b=0)
+    # and q=Counter(a=1) where the dictionaries are not equal.
 
     def __add__(self, other):
         '''Add counts from two counters.
index 49306d9dabbc51437d2e5d066633a7c4795d2a42..bfac8efc804d06ee8b20081fd72722506c751844 100644 (file)
@@ -41,7 +41,7 @@ def _walk_dir(dir, ddir=None, maxlevels=10, quiet=0):
         else:
             dfile = None
         if not os.path.isdir(fullname):
-            yield fullname
+            yield fullname, ddir
         elif (maxlevels > 0 and name != os.curdir and name != os.pardir and
               os.path.isdir(fullname) and not os.path.islink(fullname)):
             yield from _walk_dir(fullname, ddir=dfile,
@@ -76,28 +76,33 @@ def compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None,
             from concurrent.futures import ProcessPoolExecutor
         except ImportError:
             workers = 1
-    files = _walk_dir(dir, quiet=quiet, maxlevels=maxlevels,
-                      ddir=ddir)
+    files_and_ddirs = _walk_dir(dir, quiet=quiet, maxlevels=maxlevels,
+                                ddir=ddir)
     success = True
     if workers != 1 and ProcessPoolExecutor is not None:
         # If workers == 0, let ProcessPoolExecutor choose
         workers = workers or None
         with ProcessPoolExecutor(max_workers=workers) as executor:
-            results = executor.map(partial(compile_file,
-                                           ddir=ddir, force=force,
-                                           rx=rx, quiet=quiet,
-                                           legacy=legacy,
-                                           optimize=optimize,
-                                           invalidation_mode=invalidation_mode),
-                                   files)
+            results = executor.map(
+                    partial(_compile_file_tuple,
+                            force=force, rx=rx, quiet=quiet,
+                            legacy=legacy, optimize=optimize,
+                            invalidation_mode=invalidation_mode,
+                        ),
+                    files_and_ddirs)
             success = min(results, default=True)
     else:
-        for file in files:
-            if not compile_file(file, ddir, force, rx, quiet,
+        for file, dfile in files_and_ddirs:
+            if not compile_file(file, dfile, force, rx, quiet,
                                 legacy, optimize, invalidation_mode):
                 success = False
     return success
 
+def _compile_file_tuple(file_and_dfile, **kwargs):
+    """Needs to be toplevel for ProcessPoolExecutor."""
+    file, dfile = file_and_dfile
+    return compile_file(file, dfile, **kwargs)
+
 def compile_file(fullname, ddir=None, force=False, rx=None, quiet=0,
                  legacy=False, optimize=-1,
                  invalidation_mode=None):
index f53cd8c58749543941dcc2d89460b040a26308cb..41873f2c046cac9ea3db6a284c57b2b53d7e6fa3 100644 (file)
@@ -107,7 +107,7 @@ _copy_dispatch = d = {}
 def _copy_immutable(x):
     return x
 for t in (type(None), int, float, bool, complex, str, tuple,
-          bytes, frozenset, type, range, slice,
+          bytes, frozenset, type, range, slice, property,
           types.BuiltinFunctionType, type(Ellipsis), type(NotImplemented),
           types.FunctionType, weakref.ref):
     d[t] = _copy_immutable
@@ -195,6 +195,7 @@ d[type] = _deepcopy_atomic
 d[types.BuiltinFunctionType] = _deepcopy_atomic
 d[types.FunctionType] = _deepcopy_atomic
 d[weakref.ref] = _deepcopy_atomic
+d[property] = _deepcopy_atomic
 
 def _deepcopy_list(x, memo, deepcopy=deepcopy):
     y = []
index 9b97d80086044d77c92408fa7720257155858132..a62044e370af69f10e074d694c289f9aeb127270 100644 (file)
@@ -158,8 +158,11 @@ class LoaderTest(unittest.TestCase):
             # Relative path (but not just filename) should succeed
             should_pass("WinDLL('./_sqlite3.dll')")
 
-            # Insecure load flags should succeed
-            should_pass("WinDLL('_sqlite3.dll', winmode=0)")
+            # XXX: This test has started failing on Azure Pipelines CI.  See
+            #      bpo-40214 for more information.
+            if 0:
+                # Insecure load flags should succeed
+                should_pass("WinDLL('_sqlite3.dll', winmode=0)")
 
             # Full path load without DLL_LOAD_DIR shouldn't find dependency
             should_fail("WinDLL(nt._getfullpathname('_sqlite3.dll'), " +
index 19c4430bea344d9ccfcd6a05d98084a9293563d6..cdbaa7fbd65baf3eeb6ab327cfadb57ccb2fe11a 100644 (file)
@@ -571,6 +571,7 @@ class StructureTestCase(unittest.TestCase):
             self.assertEqual(f2, [0x4567, 0x0123, 0xcdef, 0x89ab,
                                   0x3210, 0x7654, 0xba98, 0xfedc])
 
+    @unittest.skipIf(True, 'Test disabled for now - see bpo-16575/bpo-16576')
     def test_union_by_value(self):
         # See bpo-16575
 
@@ -651,7 +652,7 @@ class StructureTestCase(unittest.TestCase):
         self.assertEqual(test5.nested.an_int, 0)
         self.assertEqual(test5.another_int, 0)
 
-    #@unittest.skipIf('s390' in MACHINE, 'Test causes segfault on S390')
+    @unittest.skipIf(True, 'Test disabled for now - see bpo-16575/bpo-16576')
     def test_bitfield_by_value(self):
         # See bpo-16576
 
index e8e4b717b9736f22ddbde50fd57499eb33e76d68..03a5986d984dc36d2f15cbb399c29de1dd954032 100644 (file)
@@ -97,28 +97,11 @@ PLAT_SPEC_TO_RUNTIME = {
 }
 
 def _find_vcvarsall(plat_spec):
+    # bpo-38597: Removed vcruntime return value
     _, best_dir = _find_vc2017()
-    vcruntime = None
-
-    if plat_spec in PLAT_SPEC_TO_RUNTIME:
-        vcruntime_plat = PLAT_SPEC_TO_RUNTIME[plat_spec]
-    else:
-        vcruntime_plat = 'x64' if 'amd64' in plat_spec else 'x86'
-
-    if best_dir:
-        vcredist = os.path.join(best_dir, "..", "..", "redist", "MSVC", "**",
-            vcruntime_plat, "Microsoft.VC14*.CRT", "vcruntime140.dll")
-        try:
-            import glob
-            vcruntime = glob.glob(vcredist, recursive=True)[-1]
-        except (ImportError, OSError, LookupError):
-            vcruntime = None
 
     if not best_dir:
         best_version, best_dir = _find_vc2015()
-        if best_version:
-            vcruntime = os.path.join(best_dir, 'redist', vcruntime_plat,
-                "Microsoft.VC140.CRT", "vcruntime140.dll")
 
     if not best_dir:
         log.debug("No suitable Visual C++ version found")
@@ -129,11 +112,7 @@ def _find_vcvarsall(plat_spec):
         log.debug("%s cannot be found", vcvarsall)
         return None, None
 
-    if not vcruntime or not os.path.isfile(vcruntime):
-        log.debug("%s cannot be found", vcruntime)
-        vcruntime = None
-
-    return vcvarsall, vcruntime
+    return vcvarsall, None
 
 def _get_vc_env(plat_spec):
     if os.getenv("DISTUTILS_USE_SDK"):
@@ -142,7 +121,7 @@ def _get_vc_env(plat_spec):
             for key, value in os.environ.items()
         }
 
-    vcvarsall, vcruntime = _find_vcvarsall(plat_spec)
+    vcvarsall, _ = _find_vcvarsall(plat_spec)
     if not vcvarsall:
         raise DistutilsPlatformError("Unable to find vcvarsall.bat")
 
@@ -163,8 +142,6 @@ def _get_vc_env(plat_spec):
         if key and value
     }
 
-    if vcruntime:
-        env['py_vcruntime_redist'] = vcruntime
     return env
 
 def _find_exe(exe, paths=None):
@@ -194,12 +171,6 @@ PLAT_TO_VCVARS = {
     'win-arm64' : 'x86_arm64'
 }
 
-# A set containing the DLLs that are guaranteed to be available for
-# all micro versions of this Python version. Known extension
-# dependencies that are not in this set will be copied to the output
-# path.
-_BUNDLED_DLLS = frozenset(['vcruntime140.dll'])
-
 class MSVCCompiler(CCompiler) :
     """Concrete class that implements an interface to Microsoft Visual C++,
        as defined by the CCompiler abstract class."""
@@ -263,7 +234,6 @@ class MSVCCompiler(CCompiler) :
         self.rc = _find_exe("rc.exe", paths)   # resource compiler
         self.mc = _find_exe("mc.exe", paths)   # message compiler
         self.mt = _find_exe("mt.exe", paths)   # message compiler
-        self._vcruntime_redist = vc_env.get('py_vcruntime_redist', '')
 
         for dir in vc_env.get('include', '').split(os.pathsep):
             if dir:
@@ -274,13 +244,12 @@ class MSVCCompiler(CCompiler) :
                 self.add_library_dir(dir.rstrip(os.sep))
 
         self.preprocess_options = None
-        # If vcruntime_redist is available, link against it dynamically. Otherwise,
-        # use /MT[d] to build statically, then switch from libucrt[d].lib to ucrt[d].lib
-        # later to dynamically link to ucrtbase but not vcruntime.
+        # bpo-38597: Always compile with dynamic linking
+        # Future releases of Python 3.x will include all past
+        # versions of vcruntime*.dll for compatibility.
         self.compile_options = [
-            '/nologo', '/Ox', '/W3', '/GL', '/DNDEBUG'
+            '/nologo', '/Ox', '/W3', '/GL', '/DNDEBUG', '/MD'
         ]
-        self.compile_options.append('/MD' if self._vcruntime_redist else '/MT')
 
         self.compile_options_debug = [
             '/nologo', '/Od', '/MDd', '/Zi', '/W3', '/D_DEBUG'
@@ -289,8 +258,6 @@ class MSVCCompiler(CCompiler) :
         ldflags = [
             '/nologo', '/INCREMENTAL:NO', '/LTCG'
         ]
-        if not self._vcruntime_redist:
-            ldflags.extend(('/nodefaultlib:libucrt.lib', 'ucrt.lib'))
 
         ldflags_debug = [
             '/nologo', '/INCREMENTAL:NO', '/LTCG', '/DEBUG:FULL'
@@ -532,24 +499,11 @@ class MSVCCompiler(CCompiler) :
             try:
                 log.debug('Executing "%s" %s', self.linker, ' '.join(ld_args))
                 self.spawn([self.linker] + ld_args)
-                self._copy_vcruntime(output_dir)
             except DistutilsExecError as msg:
                 raise LinkError(msg)
         else:
             log.debug("skipping %s (up-to-date)", output_filename)
 
-    def _copy_vcruntime(self, output_dir):
-        vcruntime = self._vcruntime_redist
-        if not vcruntime or not os.path.isfile(vcruntime):
-            return
-
-        if os.path.basename(vcruntime).lower() in _BUNDLED_DLLS:
-            return
-
-        log.debug('Copying "%s"', vcruntime)
-        vcruntime = shutil.copy(vcruntime, output_dir)
-        os.chmod(vcruntime, stat.S_IWRITE)
-
     def spawn(self, cmd):
         old_path = os.getenv('path')
         try:
index 2d7cdf063f01db798ee9e3c3499084993c7422b8..dbcd9d16f28c599114e479288e2b6e6ffff34a67 100644 (file)
@@ -688,7 +688,15 @@ class build_ext(Command):
         provided, "PyInit_" + module_name.  Only relevant on Windows, where
         the .pyd file (DLL) must export the module "PyInit_" function.
         """
-        initfunc_name = "PyInit_" + ext.name.split('.')[-1]
+        suffix = '_' + ext.name.split('.')[-1]
+        try:
+            # Unicode module name support as defined in PEP-489
+            # https://www.python.org/dev/peps/pep-0489/#export-hook-name
+            suffix.encode('ascii')
+        except UnicodeEncodeError:
+            suffix = 'U' + suffix.encode('punycode').replace(b'-', b'_').decode('ascii')
+
+        initfunc_name = "PyInit" + suffix
         if initfunc_name not in ext.export_symbols:
             ext.export_symbols.append(initfunc_name)
         return ext.export_symbols
index 52d36b2484f4147430a39aed911edb23efb81d64..5e47e0773a964912b1783a63c735a02638379fab 100644 (file)
@@ -304,6 +304,19 @@ class BuildExtTestCase(TempdirManager,
         cmd.ensure_finalized()
         self.assertEqual(cmd.get_source_files(), ['xxx'])
 
+    def test_unicode_module_names(self):
+        modules = [
+            Extension('foo', ['aaa'], optional=False),
+            Extension('föö', ['uuu'], optional=False),
+        ]
+        dist = Distribution({'name': 'xx', 'ext_modules': modules})
+        cmd = self.build_ext(dist)
+        cmd.ensure_finalized()
+        self.assertRegex(cmd.get_ext_filename(modules[0].name), r'foo(_d)?\..*')
+        self.assertRegex(cmd.get_ext_filename(modules[1].name), r'föö(_d)?\..*')
+        self.assertEqual(cmd.get_export_symbols(modules[0]), ['PyInit_foo'])
+        self.assertEqual(cmd.get_export_symbols(modules[1]), ['PyInitU_f_gkaa'])
+
     def test_compiler_option(self):
         # cmd.compiler is an option and
         # should not be overridden by a compiler instance
index b735fd334d87805d0693e71885e18f985311b069..8bd2c94237846acb1878d617a93b5d3fa92565d1 100644 (file)
@@ -47,8 +47,7 @@ class ConfigTestCase(support.LoggingSilencer,
         cmd = config(dist)
         cmd._check_compiler()
         compiler = cmd.compiler
-        is_xlc = shutil.which(compiler.preprocessor[0]).startswith("/usr/vac")
-        if is_xlc:
+        if sys.platform[:3] == "aix" and "xlc" in compiler.preprocessor[0].lower():
             self.skipTest('xlc: The -E option overrides the -P, -o, and -qsyntaxonly options')
 
         # simple pattern searches
index 70a9c93a4e8805e8baf84744a0b3328f2698019b..b518d6a78b33266c09258eff5fc51376e13777f9 100644 (file)
@@ -32,57 +32,6 @@ class msvccompilerTestCase(support.TempdirManager,
         finally:
             _msvccompiler._find_vcvarsall = old_find_vcvarsall
 
-    def test_compiler_options(self):
-        import distutils._msvccompiler as _msvccompiler
-        # suppress path to vcruntime from _find_vcvarsall to
-        # check that /MT is added to compile options
-        old_find_vcvarsall = _msvccompiler._find_vcvarsall
-        def _find_vcvarsall(plat_spec):
-            return old_find_vcvarsall(plat_spec)[0], None
-        _msvccompiler._find_vcvarsall = _find_vcvarsall
-        try:
-            compiler = _msvccompiler.MSVCCompiler()
-            compiler.initialize()
-
-            self.assertIn('/MT', compiler.compile_options)
-            self.assertNotIn('/MD', compiler.compile_options)
-        finally:
-            _msvccompiler._find_vcvarsall = old_find_vcvarsall
-
-    def test_vcruntime_copy(self):
-        import distutils._msvccompiler as _msvccompiler
-        # force path to a known file - it doesn't matter
-        # what we copy as long as its name is not in
-        # _msvccompiler._BUNDLED_DLLS
-        old_find_vcvarsall = _msvccompiler._find_vcvarsall
-        def _find_vcvarsall(plat_spec):
-            return old_find_vcvarsall(plat_spec)[0], __file__
-        _msvccompiler._find_vcvarsall = _find_vcvarsall
-        try:
-            tempdir = self.mkdtemp()
-            compiler = _msvccompiler.MSVCCompiler()
-            compiler.initialize()
-            compiler._copy_vcruntime(tempdir)
-
-            self.assertTrue(os.path.isfile(os.path.join(
-                tempdir, os.path.basename(__file__))))
-        finally:
-            _msvccompiler._find_vcvarsall = old_find_vcvarsall
-
-    def test_vcruntime_skip_copy(self):
-        import distutils._msvccompiler as _msvccompiler
-
-        tempdir = self.mkdtemp()
-        compiler = _msvccompiler.MSVCCompiler()
-        compiler.initialize()
-        dll = compiler._vcruntime_redist
-        self.assertTrue(os.path.isfile(dll), dll or "<None>")
-
-        compiler._copy_vcruntime(tempdir)
-
-        self.assertFalse(os.path.isfile(os.path.join(
-            tempdir, os.path.basename(dll))), dll or "<None>")
-
     def test_get_vc_env_unicode(self):
         import distutils._msvccompiler as _msvccompiler
 
index d10a78da311405f1152c93a063ffc1c702bde8fe..4d7a6de740ab3a647a6a2157c0e1dae4b7a10fd4 100644 (file)
@@ -288,7 +288,7 @@ class UnixCCompiler(CCompiler):
             # vs
             #   /usr/lib/libedit.dylib
             cflags = sysconfig.get_config_var('CFLAGS')
-            m = re.search(r'-isysroot\s+(\S+)', cflags)
+            m = re.search(r'-isysroot\s*(\S+)', cflags)
             if m is None:
                 sysroot = '/'
             else:
index dcbcfe52e90f6b2a243de2425ec6906e9917a3fa..ee71984a7d97cf888d400e9dda0d9612a80e22b9 100644 (file)
@@ -211,6 +211,13 @@ def _normalize_module(module, depth=2):
     else:
         raise TypeError("Expected a module, string, or None")
 
+def _newline_convert(data):
+    # We have two cases to cover and we need to make sure we do
+    # them in the right order
+    for newline in ('\r\n', '\r'):
+        data = data.replace(newline, '\n')
+    return data
+
 def _load_testfile(filename, package, module_relative, encoding):
     if module_relative:
         package = _normalize_module(package, 3)
@@ -221,7 +228,7 @@ def _load_testfile(filename, package, module_relative, encoding):
                 file_contents = file_contents.decode(encoding)
                 # get_data() opens files as 'rb', so one must do the equivalent
                 # conversion as universal newlines would do.
-                return file_contents.replace(os.linesep, '\n'), filename
+                return _newline_convert(file_contents), filename
     with open(filename, encoding=encoding) as f:
         return f.read(), filename
 
index 66c51013ea431ace41d4c7b20da8df3349dc834c..1c5726447077b1716e4fa772ff85345c54d441f2 100644 (file)
@@ -143,7 +143,7 @@ def decode_generalized_number(extended, extpos, bias, errors):
             digit = char - 22 # 0x30-26
         elif errors == "strict":
             raise UnicodeError("Invalid extended code point '%s'"
-                               % extended[extpos])
+                               % extended[extpos-1])
         else:
             return extpos, None
         t = T(j, bias)
index fc0edec6e3de6e9197e315a0b9fd1739257b2edf..566fb2a096bcfe93dd4619a1543bc7a9db4de2cb 100644 (file)
@@ -2,6 +2,7 @@ import os
 import os.path
 import pkgutil
 import sys
+import runpy
 import tempfile
 
 
@@ -23,9 +24,18 @@ def _run_pip(args, additional_paths=None):
     if additional_paths is not None:
         sys.path = additional_paths + sys.path
 
-    # Install the bundled software
-    import pip._internal
-    return pip._internal.main(args)
+    # Invoke pip as if it's the main module, and catch the exit.
+    backup_argv = sys.argv[:]
+    sys.argv[1:] = args
+    try:
+        # run_module() alters sys.modules and sys.argv, but restores them at exit
+        runpy.run_module("pip", run_name="__main__", alter_sys=True)
+    except SystemExit as exc:
+        return exc.code
+    finally:
+        sys.argv[:] = backup_argv
+
+    raise SystemError("pip did not exit, this should never happen")
 
 
 def version():
index e774d58e403539bfee8c999031388451738865d2..e4fcc8901bbf40e18d52ca7e8075e9252219d074 100644 (file)
@@ -636,7 +636,9 @@ class Fraction(numbers.Rational):
 
     def __bool__(a):
         """a != 0"""
-        return a._numerator != 0
+        # bpo-39274: Use bool() because (a._numerator != 0) can return an
+        # object which is not a bool.
+        return bool(a._numerator)
 
     # support for pickling, copy, and deepcopy
 
index b41dea79083fc0274b8de0679080c1efa2cd20fc..4cde5f590cf29043e8a15ad582001025eb27cf96 100644 (file)
@@ -11,7 +11,8 @@
 
 __all__ = ['update_wrapper', 'wraps', 'WRAPPER_ASSIGNMENTS', 'WRAPPER_UPDATES',
            'total_ordering', 'cmp_to_key', 'lru_cache', 'reduce', 'partial',
-           'partialmethod', 'singledispatch', 'singledispatchmethod']
+           'partialmethod', 'singledispatch', 'singledispatchmethod',
+           "cached_property"]
 
 from abc import get_cache_token
 from collections import namedtuple
index 0b3fcc6bbb9af3b63f8c2a5577f6301ea9c65b60..0dd2f8be6610945c27abc4bab25c06fcf58dac60 100644 (file)
@@ -31,6 +31,7 @@ def iglob(pathname, *, recursive=False):
     If recursive is true, the pattern '**' will match any files and
     zero or more directories and subdirectories.
     """
+    sys.audit("glob.glob", pathname, recursive)
     it = _iglob(pathname, recursive, False)
     if recursive and _isrecursive(pathname):
         s = next(it)  # skip empty string
@@ -38,7 +39,6 @@ def iglob(pathname, *, recursive=False):
     return it
 
 def _iglob(pathname, recursive, dironly):
-    sys.audit("glob.glob", pathname, recursive)
     dirname, basename = os.path.split(pathname)
     if not has_magic(pathname):
         assert not dironly
index 2968f475efad313511c2a5a8fcdd943fc18b328c..87b553df66cd8504b27e99f5cc9e8e7970745ae7 100644 (file)
@@ -201,7 +201,7 @@ class GzipFile(_compression.BaseStream):
         self.fileobj = fileobj
 
         if self.mode == WRITE:
-            self._write_gzip_header()
+            self._write_gzip_header(compresslevel)
 
     @property
     def filename(self):
@@ -228,7 +228,7 @@ class GzipFile(_compression.BaseStream):
         self.bufsize = 0
         self.offset = 0  # Current file offset for seek(), tell(), etc
 
-    def _write_gzip_header(self):
+    def _write_gzip_header(self, compresslevel):
         self.fileobj.write(b'\037\213')             # magic header
         self.fileobj.write(b'\010')                 # compression method
         try:
@@ -249,7 +249,13 @@ class GzipFile(_compression.BaseStream):
         if mtime is None:
             mtime = time.time()
         write32u(self.fileobj, int(mtime))
-        self.fileobj.write(b'\002')
+        if compresslevel == _COMPRESS_LEVEL_BEST:
+            xfl = b'\002'
+        elif compresslevel == _COMPRESS_LEVEL_FAST:
+            xfl = b'\004'
+        else:
+            xfl = b'\000'
+        self.fileobj.write(xfl)
         self.fileobj.write(b'\377')
         if fname:
             self.fileobj.write(fname + b'\000')
index 33a434733f8a46cc8280e7450967cc4851b3d44b..019380a72031810c7ca53a750a3bf21a89c8238c 100644 (file)
@@ -828,6 +828,8 @@ class HTTPConnection:
 
         (self.host, self.port) = self._get_hostport(host, port)
 
+        self._validate_host(self.host)
+
         # This is stored as an instance variable to allow unit
         # tests to replace it with a suitable mockup
         self._create_connection = socket.create_connection
@@ -1183,6 +1185,14 @@ class HTTPConnection:
             raise InvalidURL(f"URL can't contain control characters. {url!r} "
                              f"(found at least {match.group()!r})")
 
+    def _validate_host(self, host):
+        """Validate a host so it doesn't contain control characters."""
+        # Prevent CVE-2019-18348.
+        match = _contains_disallowed_url_pchar_re.search(host)
+        if match:
+            raise InvalidURL(f"URL can't contain control characters. {host!r} "
+                             f"(found at least {match.group()!r})")
+
     def putheader(self, header, *values):
         """Send a request header line to the server.
 
index b247675ec45e81c52c3c7f25462fab85b5894a1a..38f7accad7a346499a7de40c481a8fe73c81ca4c 100644 (file)
@@ -103,6 +103,7 @@ import socketserver
 import sys
 import time
 import urllib.parse
+import contextlib
 from functools import partial
 
 from http import HTTPStatus
@@ -1280,4 +1281,19 @@ if __name__ == '__main__':
     else:
         handler_class = partial(SimpleHTTPRequestHandler,
                                 directory=args.directory)
-    test(HandlerClass=handler_class, port=args.port, bind=args.bind)
+
+    # ensure dual-stack is not disabled; ref #38907
+    class DualStackServer(ThreadingHTTPServer):
+        def server_bind(self):
+            # suppress exception when protocol is IPv4
+            with contextlib.suppress(Exception):
+                self.socket.setsockopt(
+                    socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
+            return super().server_bind()
+
+    test(
+        HandlerClass=handler_class,
+        ServerClass=DualStackServer,
+        port=args.port,
+        bind=args.bind,
+    )
diff --git a/Lib/idlelib/Icons/README.txt b/Lib/idlelib/Icons/README.txt
new file mode 100644 (file)
index 0000000..8b47162
--- /dev/null
@@ -0,0 +1,9 @@
+The IDLE icons are from https://bugs.python.org/issue1490384
+
+Created by Andrew Clover.
+
+The original sources are available from Andrew's website:
+https://www.doxdesk.com/software/py/pyicons.html
+
+Various different formats and sizes are available at this GitHub Pull Request:
+https://github.com/python/cpython/pull/17473
diff --git a/Lib/idlelib/Icons/idle.icns b/Lib/idlelib/Icons/idle.icns
deleted file mode 100644 (file)
index f65e313..0000000
Binary files a/Lib/idlelib/Icons/idle.icns and /dev/null differ
diff --git a/Lib/idlelib/Icons/idle_256.png b/Lib/idlelib/Icons/idle_256.png
new file mode 100644 (file)
index 0000000..99ffa6f
Binary files /dev/null and b/Lib/idlelib/Icons/idle_256.png differ
index e829bc910ea877f3c788ffd9adb1a8f65feaee9c..de7543e3701988bc9e125ceeb86bbf37ed9d8291 100644 (file)
@@ -3,10 +3,42 @@ Released on 2019-12-16?
 ======================================
 
 
+bpo-38689: IDLE will no longer freeze when inspect.signature fails
+when fetching a calltip.
+
+bpo-27115: For 'Go to Line', use a Query entry box subclass with
+IDLE standard behavior and improved error checking.
+
+bpo-39885: Since clicking to get an IDLE context menu moves the
+cursor, any text selection should be and now is cleared.
+
+bpo-39852: Edit "Go to line" now clears any selection, preventing
+accidental deletion.  It also updates Ln and Col on the status bar.
+
+bpo-39781: Selecting code context lines no longer causes a jump.
+
+bpo-39663: Add tests for pyparse find_good_parse_start().
+
+bpo-39600: Remove duplicate font names from configuration list.
+
+bpo-38792: Close a shell calltip if a :exc:`KeyboardInterrupt`
+or shell restart occurs.  Patch by Zackery Spytz.
+
+bpo-30780: Add remaining configdialog tests for buttons and
+highlights and keys tabs.
+
+bpo-39388: Settings dialog Cancel button cancels pending changes.
+
+bpo-39050: Settings dialog Help button again displays help text.
+
+bpo-32989: Add tests for editor newline_and_indent_event method.
+Remove unneeded arguments and dead code from pyparse
+find_good_parse_start method.
+
 bpo-38943: Fix autocomplete windows not always appearing on some
 systems.  Patch by Johnny Najera.
 
-bpo-38944: Excape key now closes IDLE completion windows.  Patch by
+bpo-38944: Escape key now closes IDLE completion windows.  Patch by
 Johnny Najera.
 
 bpo-38862: 'Strip Trailing Whitespace' on the Format menu removes extra
index 48a1f4a425c9e374274f653da7b8abe33f182a55..bc3d978f43f1ad263e2a2b2e1c4088209fa0f81f 100644 (file)
@@ -90,7 +90,7 @@ Configuration
 config-extensions.def # Defaults for extensions
 config-highlight.def  # Defaults for colorizing
 config-keys.def       # Defaults for key bindings
-config-main.def       # Defai;ts fpr font and geneal
+config-main.def       # Defaults for font and general tabs
 
 Text
 ----
index 0643c092c6e54818b65ac74063ae1d0df114a59a..fe7a6be83d586b2bb5dfe50cd9110efa46602579 100644 (file)
@@ -4,7 +4,7 @@ An auto-completion window for IDLE, used by the autocomplete extension
 import platform
 
 from tkinter import *
-from tkinter.ttk import Frame, Scrollbar
+from tkinter.ttk import Scrollbar
 
 from idlelib.autocomplete import FILES, ATTRS
 from idlelib.multicall import MC_SHIFT
index a3dda2678bd4da48220757196c15694d5066f47a..d4092c7847186bf6317fe0cdc97e5bd1d00ec520 100644 (file)
@@ -33,7 +33,7 @@ class Calltip:
         # See __init__ for usage
         return calltip_w.CalltipWindow(self.text)
 
-    def _remove_calltip_window(self, event=None):
+    def remove_calltip_window(self, event=None):
         if self.active_calltip:
             self.active_calltip.hidetip()
             self.active_calltip = None
@@ -55,7 +55,7 @@ class Calltip:
             self.open_calltip(False)
 
     def open_calltip(self, evalfuncs):
-        self._remove_calltip_window()
+        self.remove_calltip_window()
 
         hp = HyperParser(self.editwin, "insert")
         sur_paren = hp.get_surrounding_brackets('(')
@@ -129,20 +129,22 @@ def get_argspec(ob):
     empty line or _MAX_LINES.    For builtins, this typically includes
     the arguments in addition to the return value.
     '''
-    argspec = default = ""
+    # Determine function object fob to inspect.
     try:
         ob_call = ob.__call__
-    except BaseException:
-        return default
-
+    except BaseException:  # Buggy user object could raise anything.
+        return ''  # No popup for non-callables.
     fob = ob_call if isinstance(ob_call, types.MethodType) else ob
 
+    # Initialize argspec and wrap it to get lines.
     try:
         argspec = str(inspect.signature(fob))
-    except ValueError as err:
+    except Exception as err:
         msg = str(err)
         if msg.startswith(_invalid_method):
             return _invalid_method
+        else:
+            argspec = ''
 
     if '/' in argspec and len(argspec) < _MAX_COLS - len(_argument_positional):
         # Add explanation TODO remove after 3.7, before 3.9.
@@ -154,6 +156,7 @@ def get_argspec(ob):
     lines = (textwrap.wrap(argspec, _MAX_COLS, subsequent_indent=_INDENT)
              if len(argspec) > _MAX_COLS else [argspec] if argspec else [])
 
+    # Augment lines from docstring, if any, and join to get argspec.
     if isinstance(ob_call, types.MethodType):
         doc = ob_call.__doc__
     else:
@@ -167,9 +170,8 @@ def get_argspec(ob):
                 line = line[: _MAX_COLS - 3] + '...'
             lines.append(line)
     argspec = '\n'.join(lines)
-    if not argspec:
-        argspec = _default_callable_argspec
-    return argspec
+
+    return argspec or _default_callable_argspec
 
 
 if __name__ == '__main__':
index 4ce98136fe417592ba0e1aa05146ae12b6742007..989b30e5994650c745eccb302c0e24ef636a4522 100644 (file)
@@ -7,7 +7,6 @@ the lines which contain the block opening keywords, e.g. 'if', for the
 enclosing block.  The number of hint lines is determined by the maxlines
 variable in the codecontext section of config-extensions.def. Lines which do
 not open blocks are not shown in the context hints pane.
-
 """
 import re
 from sys import maxsize as INFINITY
@@ -17,8 +16,8 @@ from tkinter.constants import NSEW, SUNKEN
 
 from idlelib.config import idleConf
 
-BLOCKOPENERS = {"class", "def", "elif", "else", "except", "finally", "for",
-                "if", "try", "while", "with", "async"}
+BLOCKOPENERS = {'class', 'def', 'if', 'elif', 'else', 'while', 'for',
+                 'try', 'except', 'finally', 'with', 'async'}
 
 
 def get_spaces_firstword(codeline, c=re.compile(r"^(\s*)(\w*)")):
@@ -84,7 +83,7 @@ class CodeContext:
         if self.t1 is not None:
             try:
                 self.text.after_cancel(self.t1)
-            except tkinter.TclError:
+            except tkinter.TclError:  # pragma: no cover
                 pass
             self.t1 = None
 
@@ -112,7 +111,7 @@ class CodeContext:
                 padx += widget.tk.getint(info['padx'])
                 padx += widget.tk.getint(widget.cget('padx'))
                 border += widget.tk.getint(widget.cget('border'))
-            self.context = tkinter.Text(
+            context = self.context = tkinter.Text(
                 self.editwin.text_frame,
                 height=1,
                 width=1,  # Don't request more than we get.
@@ -120,11 +119,11 @@ class CodeContext:
                 padx=padx, border=border, relief=SUNKEN, state='disabled')
             self.update_font()
             self.update_highlight_colors()
-            self.context.bind('<ButtonRelease-1>', self.jumptoline)
+            context.bind('<ButtonRelease-1>', self.jumptoline)
             # Get the current context and initiate the recurring update event.
             self.timer_event()
             # Grid the context widget above the text widget.
-            self.context.grid(row=0, column=1, sticky=NSEW)
+            context.grid(row=0, column=1, sticky=NSEW)
 
             line_number_colors = idleConf.GetHighlight(idleConf.CurrentTheme(),
                                                        'linenumber')
@@ -215,18 +214,25 @@ class CodeContext:
         self.context['state'] = 'disabled'
 
     def jumptoline(self, event=None):
-        "Show clicked context line at top of editor."
-        lines = len(self.info)
-        if lines == 1:  # No context lines are showing.
-            newtop = 1
-        else:
-            # Line number clicked.
-            contextline = int(float(self.context.index('insert')))
-            # Lines not displayed due to maxlines.
-            offset = max(1, lines - self.context_depth) - 1
-            newtop = self.info[offset + contextline][0]
-        self.text.yview(f'{newtop}.0')
-        self.update_code_context()
+        """ Show clicked context line at top of editor.
+
+        If a selection was made, don't jump; allow copying.
+        If no visible context, show the top line of the file.
+        """
+        try:
+            self.context.index("sel.first")
+        except tkinter.TclError:
+            lines = len(self.info)
+            if lines == 1:  # No context lines are showing.
+                newtop = 1
+            else:
+                # Line number clicked.
+                contextline = int(float(self.context.index('insert')))
+                # Lines not displayed due to maxlines.
+                offset = max(1, lines - self.context_depth) - 1
+                newtop = self.info[offset + contextline][0]
+            self.text.yview(f'{newtop}.0')
+            self.update_code_context()
 
     def timer_event(self):
         "Event on editor text widget triggered every UPDATEINTERVAL ms."
index 4478323fcc2c51eb07621289c23ecde52ba3f22d..7510aa9f3d87864a0974b4db91f5504c1249a999 100644 (file)
@@ -1,7 +1,7 @@
 """
 Dialog for building Tkinter accelerator key bindings
 """
-from tkinter import Toplevel, Listbox, Text, StringVar, TclError
+from tkinter import Toplevel, Listbox, StringVar, TclError
 from tkinter.ttk import Frame, Button, Checkbutton, Entry, Label, Scrollbar
 from tkinter import messagebox
 import string
index aaf319bbe1befd0fa0fa71e1eff134e79561814c..82596498d346111cdc4a7aa52e932130834201e6 100644 (file)
@@ -11,7 +11,7 @@ Refer to comments in EditorWindow autoindent code for details.
 """
 import re
 
-from tkinter import (Toplevel, Listbox, Text, Scale, Canvas,
+from tkinter import (Toplevel, Listbox, Scale, Canvas,
                      StringVar, BooleanVar, IntVar, TRUE, FALSE,
                      TOP, BOTTOM, RIGHT, LEFT, SOLID, GROOVE,
                      NONE, BOTH, X, Y, W, E, EW, NS, NSEW, NW,
@@ -149,17 +149,19 @@ class ConfigDialog(Toplevel):
         else:
             padding_args = {'padding': (6, 3)}
         outer = Frame(self, padding=2)
-        buttons = Frame(outer, padding=2)
+        buttons_frame = Frame(outer, padding=2)
+        self.buttons = {}
         for txt, cmd in (
             ('Ok', self.ok),
             ('Apply', self.apply),
             ('Cancel', self.cancel),
             ('Help', self.help)):
-            Button(buttons, text=txt, command=cmd, takefocus=FALSE,
-                   **padding_args).pack(side=LEFT, padx=5)
+            self.buttons[txt] = Button(buttons_frame, text=txt, command=cmd,
+                       takefocus=FALSE, **padding_args)
+            self.buttons[txt].pack(side=LEFT, padx=5)
         # Add space above buttons.
         Frame(outer, height=2, borderwidth=0).pack(side=TOP)
-        buttons.pack(side=BOTTOM)
+        buttons_frame.pack(side=BOTTOM)
         return outer
 
     def ok(self):
@@ -191,6 +193,7 @@ class ConfigDialog(Toplevel):
         Methods:
             destroy: inherited
         """
+        changes.clear()
         self.destroy()
 
     def destroy(self):
@@ -204,13 +207,12 @@ class ConfigDialog(Toplevel):
 
         Attributes accessed:
             note
-
         Methods:
             view_text: Method from textview module.
         """
         page = self.note.tab(self.note.select(), option='text').strip()
         view_text(self, title='Help for IDLE preferences',
-                 text=help_common+help_pages.get(page, ''))
+                  contents=help_common+help_pages.get(page, ''))
 
     def deactivate_current_config(self):
         """Remove current key bindings.
@@ -604,9 +606,8 @@ class FontPage(Frame):
         font_size = configured_font[1]
         font_bold  = configured_font[2]=='bold'
 
-        # Set editor font selection list and font_name.
-        fonts = list(tkFont.families(self))
-        fonts.sort()
+        # Set sorted no-duplicate editor font selection list and font_name.
+        fonts = sorted(set(tkFont.families(self)))
         for font in fonts:
             self.fontlist.insert(END, font)
         self.font_name.set(font_name)
@@ -851,6 +852,7 @@ class HighPage(Frame):
         text.configure(
                 font=('courier', 12, ''), cursor='hand2', width=1, height=1,
                 takefocus=FALSE, highlightthickness=0, wrap=NONE)
+        # Prevent perhaps invisible selection of word or slice.
         text.bind('<Double-Button-1>', lambda e: 'break')
         text.bind('<B1-Motion>', lambda e: 'break')
         string_tags=(
@@ -1283,8 +1285,7 @@ class HighPage(Frame):
         theme_name - string, the name of the new theme
         theme - dictionary containing the new theme
         """
-        if not idleConf.userCfg['highlight'].has_section(theme_name):
-            idleConf.userCfg['highlight'].add_section(theme_name)
+        idleConf.userCfg['highlight'].AddSection(theme_name)
         for element in theme:
             value = theme[element]
             idleConf.userCfg['highlight'].SetOption(theme_name, element, value)
@@ -1729,8 +1730,7 @@ class KeysPage(Frame):
         keyset_name - string, the name of the new key set
         keyset - dictionary containing the new keybindings
         """
-        if not idleConf.userCfg['keys'].has_section(keyset_name):
-            idleConf.userCfg['keys'].add_section(keyset_name)
+        idleConf.userCfg['keys'].AddSection(keyset_name)
         for event in keyset:
             value = keyset[event]
             idleConf.userCfg['keys'].SetOption(keyset_name, event, value)
index 92dcf57c4ff260eb96abaee9e80fd2c7fcdd789a..b0f88b5463d1b6e52d66868e13101d9a032f9888 100644 (file)
@@ -328,7 +328,7 @@ class EditorWindow(object):
         text.bind("<<run-module>>", scriptbinding.run_module_event)
         text.bind("<<run-custom>>", scriptbinding.run_custom_event)
         text.bind("<<do-rstrip>>", self.Rstrip(self).do_rstrip)
-        ctip = self.Calltip(self)
+        self.ctip = ctip = self.Calltip(self)
         text.bind("<<try-open-calltip>>", ctip.try_open_calltip_event)
         #refresh-calltip must come after paren-closed to work right
         text.bind("<<refresh-calltip>>", ctip.refresh_calltip_event)
@@ -499,6 +499,7 @@ class EditorWindow(object):
     rmenu = None
 
     def right_menu_event(self, event):
+        self.text.tag_remove("sel", "1.0", "end")
         self.text.mark_set("insert", "@%d,%d" % (event.x, event.y))
         if not self.rmenu:
             self.make_rmenu()
@@ -671,15 +672,16 @@ class EditorWindow(object):
 
     def goto_line_event(self, event):
         text = self.text
-        lineno = tkSimpleDialog.askinteger("Goto",
-                "Go to line number:",parent=text)
-        if lineno is None:
-            return "break"
-        if lineno <= 0:
-            text.bell()
-            return "break"
-        text.mark_set("insert", "%d.0" % lineno)
-        text.see("insert")
+        lineno = query.Goto(
+                text, "Go To Line",
+                "Enter a positive integer\n"
+                "('big' = end of file):"
+                ).result
+        if lineno is not None:
+            text.tag_remove("sel", "1.0", "end")
+            text.mark_set("insert", f'{lineno}.0')
+            text.see("insert")
+            self.set_line_and_column()
         return "break"
 
     def open_module(self):
@@ -1342,38 +1344,51 @@ class EditorWindow(object):
             text.undo_block_stop()
 
     def newline_and_indent_event(self, event):
+        """Insert a newline and indentation after Enter keypress event.
+
+        Properly position the cursor on the new line based on information
+        from the current line.  This takes into account if the current line
+        is a shell prompt, is empty, has selected text, contains a block
+        opener, contains a block closer, is a continuation line, or
+        is inside a string.
+        """
         text = self.text
         first, last = self.get_selection_indices()
         text.undo_block_start()
-        try:
+        try:  # Close undo block and expose new line in finally clause.
             if first and last:
                 text.delete(first, last)
                 text.mark_set("insert", first)
             line = text.get("insert linestart", "insert")
+
+            # Count leading whitespace for indent size.
             i, n = 0, len(line)
             while i < n and line[i] in " \t":
-                i = i+1
+                i += 1
             if i == n:
-                # the cursor is in or at leading indentation in a continuation
-                # line; just inject an empty line at the start
+                # The cursor is in or at leading indentation in a continuation
+                # line; just inject an empty line at the start.
                 text.insert("insert linestart", '\n')
                 return "break"
             indent = line[:i]
-            # strip whitespace before insert point unless it's in the prompt
+
+            # Strip whitespace before insert point unless it's in the prompt.
             i = 0
             while line and line[-1] in " \t" and line != self.prompt_last_line:
                 line = line[:-1]
-                i = i+1
+                i += 1
             if i:
                 text.delete("insert - %d chars" % i, "insert")
-            # strip whitespace after insert point
+
+            # Strip whitespace after insert point.
             while text.get("insert") in " \t":
                 text.delete("insert")
-            # start new line
+
+            # Insert new line.
             text.insert("insert", '\n')
 
-            # adjust indentation for continuations and block
-            # open/close first need to find the last stmt
+            # Adjust indentation for continuations and block open/close.
+            # First need to find the last statement.
             lno = index2line(text.index('insert'))
             y = pyparse.Parser(self.indentwidth, self.tabwidth)
             if not self.prompt_last_line:
@@ -1383,7 +1398,7 @@ class EditorWindow(object):
                     rawtext = text.get(startatindex, "insert")
                     y.set_code(rawtext)
                     bod = y.find_good_parse_start(
-                              self._build_char_in_string_func(startatindex))
+                            self._build_char_in_string_func(startatindex))
                     if bod is not None or startat == 1:
                         break
                 y.set_lo(bod or 0)
@@ -1399,26 +1414,26 @@ class EditorWindow(object):
 
             c = y.get_continuation_type()
             if c != pyparse.C_NONE:
-                # The current stmt hasn't ended yet.
+                # The current statement hasn't ended yet.
                 if c == pyparse.C_STRING_FIRST_LINE:
-                    # after the first line of a string; do not indent at all
+                    # After the first line of a string do not indent at all.
                     pass
                 elif c == pyparse.C_STRING_NEXT_LINES:
-                    # inside a string which started before this line;
-                    # just mimic the current indent
+                    # Inside a string which started before this line;
+                    # just mimic the current indent.
                     text.insert("insert", indent)
                 elif c == pyparse.C_BRACKET:
-                    # line up with the first (if any) element of the
+                    # Line up with the first (if any) element of the
                     # last open bracket structure; else indent one
                     # level beyond the indent of the line with the
-                    # last open bracket
+                    # last open bracket.
                     self.reindent_to(y.compute_bracket_indent())
                 elif c == pyparse.C_BACKSLASH:
-                    # if more than one line in this stmt already, just
+                    # If more than one line in this statement already, just
                     # mimic the current indent; else if initial line
                     # has a start on an assignment stmt, indent to
                     # beyond leftmost =; else to beyond first chunk of
-                    # non-whitespace on initial line
+                    # non-whitespace on initial line.
                     if y.get_num_lines_in_stmt() > 1:
                         text.insert("insert", indent)
                     else:
@@ -1427,9 +1442,9 @@ class EditorWindow(object):
                     assert 0, "bogus continuation type %r" % (c,)
                 return "break"
 
-            # This line starts a brand new stmt; indent relative to
+            # This line starts a brand new statement; indent relative to
             # indentation of initial line of closest preceding
-            # interesting stmt.
+            # interesting statement.
             indent = y.get_base_indent_string()
             text.insert("insert", indent)
             if y.is_block_opener():
index 09dc4c57bcdc0fb9fe698ce8af3461b07c197e70..424c6b50f339e1c2c42ddb597037f4b22b4d2444 100644 (file)
@@ -4,7 +4,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta charset="utf-8" />
-    <title>IDLE &#8212; Python 3.9.0a1 documentation</title>
+    <title>IDLE &#8212; Python 3.9.0a4 documentation</title>
     <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
     <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
 
@@ -17,7 +17,7 @@
     <script type="text/javascript" src="../_static/sidebar.js"></script>
 
     <link rel="search" type="application/opensearchdescription+xml"
-          title="Search within Python 3.9.0a1 documentation"
+          title="Search within Python 3.9.0a4 documentation"
           href="../_static/opensearch.xml"/>
     <link rel="author" title="About these documents" href="../about.html" />
     <link rel="index" title="Index" href="../genindex.html" />
@@ -71,7 +71,7 @@
 
 
     <li>
-      <a href="../index.html">3.9.0a1 Documentation</a> &#187;
+      <a href="../index.html">3.9.0a4 Documentation</a> &#187;
     </li>
 
           <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
@@ -197,7 +197,9 @@ be undone.</p>
 </dd>
 <dt>Replace…</dt><dd><p>Open a search-and-replace dialog.</p>
 </dd>
-<dt>Go to Line</dt><dd><p>Move cursor to the line number requested and make that line visible.</p>
+<dt>Go to Line</dt><dd><p>Move the cursor to the beginning of the line requested and make that
+line visible.  A request past the end of the file goes to the end.
+Clear any selection and update the line and column status.</p>
 </dd>
 <dt>Show Completions</dt><dd><p>Open a scrollable list allowing selection of keywords and attributes. See
 <a class="reference internal" href="#completions"><span class="std std-ref">Completions</span></a> in the Editing and navigation section below.</p>
@@ -382,7 +384,8 @@ Context menus have the standard clipboard functions also on the Edit menu.</p>
 </dl>
 <p>Editor windows also have breakpoint functions.  Lines with a breakpoint set are
 specially marked.  Breakpoints only have an effect when running under the
-debugger.  Breakpoints for a file are saved in the user’s .idlerc directory.</p>
+debugger.  Breakpoints for a file are saved in the user’s <code class="docutils literal notranslate"><span class="pre">.idlerc</span></code>
+directory.</p>
 <dl class="simple">
 <dt>Set Breakpoint</dt><dd><p>Set a breakpoint on the current line.</p>
 </dd>
@@ -634,17 +637,20 @@ clash, or a single installation might need admin access.  If one undo the
 clash, or cannot or does not want to run as admin, it might be easiest to
 completely remove Python and start over.</p>
 <p>A zombie pythonw.exe process could be a problem.  On Windows, use Task
-Manager to detect and stop one.  Sometimes a restart initiated by a program
-crash or Keyboard Interrupt (control-C) may fail to connect.  Dismissing
-the error box or Restart Shell on the Shell menu may fix a temporary problem.</p>
+Manager to check for one and stop it if there is.  Sometimes a restart
+initiated by a program crash or Keyboard Interrupt (control-C) may fail
+to connect.  Dismissing the error box or using Restart Shell on the Shell
+menu may fix a temporary problem.</p>
 <p>When IDLE first starts, it attempts to read user configuration files in
-~/.idlerc/ (~ is one’s home directory).  If there is a problem, an error
+<code class="docutils literal notranslate"><span class="pre">~/.idlerc/</span></code> (~ is one’s home directory).  If there is a problem, an error
 message should be displayed.  Leaving aside random disk glitches, this can
-be prevented by never editing the files by hand, using the configuration
-dialog, under Options, instead Options.  Once it happens, the solution may
-be to delete one or more of the configuration files.</p>
+be prevented by never editing the files by hand.  Instead, use the
+configuration dialog, under Options.  Once there is an error in a user
+configuration file, the best solution may be to delete it and start over
+with the settings dialog.</p>
 <p>If IDLE quits with no message, and it was not started from a console, try
-starting from a console (<code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">idlelib)</span></code> and see if a message appears.</p>
+starting it from a console or terminal (<code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">idlelib</span></code>) and see if
+this results in an error message.</p>
 </div>
 <div class="section" id="running-user-code">
 <h3>Running user code<a class="headerlink" href="#running-user-code" title="Permalink to this headline">¶</a></h3>
@@ -791,20 +797,20 @@ the scrollbar, or up and down arrow keys held down.
 Or click the TOC (Table of Contents) button and select a section
 header in the opened box.</p>
 <p>Help menu entry “Python Docs” opens the extensive sources of help,
-including tutorials, available at docs.python.org/x.y, where ‘x.y’
+including tutorials, available at <code class="docutils literal notranslate"><span class="pre">docs.python.org/x.y</span></code>, where ‘x.y’
 is the currently running Python version.  If your system
 has an off-line copy of the docs (this may be an installation option),
 that will be opened instead.</p>
 <p>Selected URLs can be added or removed from the help menu at any time using the
-General tab of the Configure IDLE dialog .</p>
+General tab of the Configure IDLE dialog.</p>
 </div>
 <div class="section" id="setting-preferences">
 <span id="preferences"></span><h3>Setting preferences<a class="headerlink" href="#setting-preferences" title="Permalink to this headline">¶</a></h3>
 <p>The font preferences, highlighting, keys, and general preferences can be
 changed via Configure IDLE on the Option menu.
-Non-default user settings are saved in a .idlerc directory in the user’s
+Non-default user settings are saved in a <code class="docutils literal notranslate"><span class="pre">.idlerc</span></code> directory in the user’s
 home directory.  Problems caused by bad user configuration files are solved
-by editing or deleting one or more of the files in .idlerc.</p>
+by editing or deleting one or more of the files in <code class="docutils literal notranslate"><span class="pre">.idlerc</span></code>.</p>
 <p>On the Font tab, see the text sample for the effect of font face and size
 on multiple characters in multiple languages.  Edit the sample to add
 other characters of personal interest.  Use the sample to select
@@ -929,7 +935,7 @@ also used for testing.</p>
 
 
     <li>
-      <a href="../index.html">3.9.0a1 Documentation</a> &#187;
+      <a href="../index.html">3.9.0a4 Documentation</a> &#187;
     </li>
 
           <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
@@ -952,7 +958,7 @@ also used for testing.</p>
       </ul>
     </div>
     <div class="footer">
-    &copy; <a href="../copyright.html">Copyright</a> 2001-2019, Python Software Foundation.
+    &copy; <a href="../copyright.html">Copyright</a> 2001-2020, Python Software Foundation.
     <br />
 
     The Python Software Foundation is a non-profit corporation.
@@ -960,7 +966,7 @@ also used for testing.</p>
 <br />
     <br />
 
-    Last updated on Nov 24, 2019.
+    Last updated on Mar 07, 2020.
     <a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
     <br />
 
index 886959b17074f6be9ae5108b111934c6ca3d17a7..d386b5cd8132124bc9c8f3b3fe38bb209baa6955 100644 (file)
@@ -219,20 +219,30 @@ bytes() -> empty bytes object''')
             with self.subTest(meth=meth, mtip=mtip):
                 self.assertEqual(get_spec(meth), mtip)
 
-    def test_attribute_exception(self):
+    def test_buggy_getattr_class(self):
         class NoCall:
-            def __getattr__(self, name):
-                raise BaseException
+            def __getattr__(self, name):  # Not invoked for class attribute.
+                raise IndexError  # Bug.
         class CallA(NoCall):
-            def __call__(oui, a, b, c):
+            def __call__(self, ci):  # Bug does not matter.
                 pass
         class CallB(NoCall):
-            def __call__(self, ci):
+            def __call__(oui, a, b, c):  # Non-standard 'self'.
                 pass
 
         for meth, mtip  in ((NoCall, default_tip), (CallA, default_tip),
-                            (NoCall(), ''), (CallA(), '(a, b, c)'),
-                            (CallB(), '(ci)')):
+                            (NoCall(), ''), (CallA(), '(ci)'),
+                            (CallB(), '(a, b, c)')):
+            with self.subTest(meth=meth, mtip=mtip):
+                self.assertEqual(get_spec(meth), mtip)
+
+    def test_metaclass_class(self):  # Failure case for issue 38689.
+        class Type(type):  # Type() requires 3 type args, returns class.
+            __class__ = property({}.__getitem__, {}.__setitem__)
+        class Object(metaclass=Type):
+            __slots__ = '__class__'
+        for meth, mtip  in ((Type, default_tip), (Object, default_tip),
+                            (Object(), '')):
             with self.subTest(meth=meth, mtip=mtip):
                 self.assertEqual(get_spec(meth), mtip)
 
index 3ec49e97af6f916c19111e09553ac096b65e306f..9578cc731a6f93aee4777e53c41e842818c04057 100644 (file)
@@ -332,6 +332,14 @@ class CodeContextTest(unittest.TestCase):
         jump()
         eq(cc.topvisible, 8)
 
+        # Context selection stops jump.
+        cc.text.yview('5.0')
+        cc.update_code_context()
+        cc.context.tag_add('sel', '1.0', '2.0')
+        cc.context.mark_set('insert', '1.0')
+        jump()  # Without selection, to line 2.
+        eq(cc.topvisible, 5)
+
     @mock.patch.object(codecontext.CodeContext, 'update_code_context')
     def test_timer_event(self, mock_update):
         # Ensure code context is not active.
index 1f14ed1f26473004c26c6bf74996c4caf3762a03..1fea6d41df811cc19e9c1e98dcae364a9f09035d 100644 (file)
@@ -8,7 +8,7 @@ requires('gui')
 import unittest
 from unittest import mock
 from idlelib.idle_test.mock_idle import Func
-from tkinter import Tk, StringVar, IntVar, BooleanVar, DISABLED, NORMAL
+from tkinter import (Tk, StringVar, IntVar, BooleanVar, DISABLED, NORMAL)
 from idlelib import config
 from idlelib.configdialog import idleConf, changes, tracers
 
@@ -30,6 +30,7 @@ highpage = changes['highlight']
 keyspage = changes['keys']
 extpage = changes['extensions']
 
+
 def setUpModule():
     global root, dialog
     idleConf.userCfg = testcfg
@@ -37,6 +38,7 @@ def setUpModule():
     # root.withdraw()    # Comment out, see issue 30870
     dialog = configdialog.ConfigDialog(root, 'Test', _utest=True)
 
+
 def tearDownModule():
     global root, dialog
     idleConf.userCfg = usercfg
@@ -48,6 +50,58 @@ def tearDownModule():
     root = dialog = None
 
 
+class ConfigDialogTest(unittest.TestCase):
+
+    def test_deactivate_current_config(self):
+        pass
+
+    def activate_config_changes(self):
+        pass
+
+
+class ButtonTest(unittest.TestCase):
+
+    def test_click_ok(self):
+        d = dialog
+        apply = d.apply = mock.Mock()
+        destroy = d.destroy = mock.Mock()
+        d.buttons['Ok'].invoke()
+        apply.assert_called_once()
+        destroy.assert_called_once()
+        del d.destroy, d.apply
+
+    def test_click_apply(self):
+        d = dialog
+        deactivate = d.deactivate_current_config = mock.Mock()
+        save_ext = d.save_all_changed_extensions = mock.Mock()
+        activate = d.activate_config_changes = mock.Mock()
+        d.buttons['Apply'].invoke()
+        deactivate.assert_called_once()
+        save_ext.assert_called_once()
+        activate.assert_called_once()
+        del d.save_all_changed_extensions
+        del d.activate_config_changes, d.deactivate_current_config
+
+    def test_click_cancel(self):
+        d = dialog
+        d.destroy = Func()
+        changes['main']['something'] = 1
+        d.buttons['Cancel'].invoke()
+        self.assertEqual(changes['main'], {})
+        self.assertEqual(d.destroy.called, 1)
+        del d.destroy
+
+    def test_click_help(self):
+        dialog.note.select(dialog.keyspage)
+        with mock.patch.object(configdialog, 'view_text',
+                               new_callable=Func) as view:
+            dialog.buttons['Help'].invoke()
+            title, contents = view.kwds['title'], view.kwds['contents']
+        self.assertEqual(title, 'Help for IDLE preferences')
+        self.assertTrue(contents.startswith('When you click') and
+                        contents.endswith('a different name.\n'))
+
+
 class FontPageTest(unittest.TestCase):
     """Test that font widgets enable users to make font changes.
 
@@ -420,6 +474,48 @@ class HighPageTest(unittest.TestCase):
                 eq(d.highlight_target.get(), elem[tag])
                 eq(d.set_highlight_target.called, count)
 
+    def test_highlight_sample_double_click(self):
+        # Test double click on highlight_sample.
+        eq = self.assertEqual
+        d = self.page
+
+        hs = d.highlight_sample
+        hs.focus_force()
+        hs.see(1.0)
+        hs.update_idletasks()
+
+        # Test binding from configdialog.
+        hs.event_generate('<Enter>', x=0, y=0)
+        hs.event_generate('<Motion>', x=0, y=0)
+        # Double click is a sequence of two clicks in a row.
+        for _ in range(2):
+            hs.event_generate('<ButtonPress-1>', x=0, y=0)
+            hs.event_generate('<ButtonRelease-1>', x=0, y=0)
+
+        eq(hs.tag_ranges('sel'), ())
+
+    def test_highlight_sample_b1_motion(self):
+        # Test button motion on highlight_sample.
+        eq = self.assertEqual
+        d = self.page
+
+        hs = d.highlight_sample
+        hs.focus_force()
+        hs.see(1.0)
+        hs.update_idletasks()
+
+        x, y, dx, dy, offset = hs.dlineinfo('1.0')
+
+        # Test binding from configdialog.
+        hs.event_generate('<Leave>')
+        hs.event_generate('<Enter>')
+        hs.event_generate('<Motion>', x=x, y=y)
+        hs.event_generate('<ButtonPress-1>', x=x, y=y)
+        hs.event_generate('<B1-Motion>', x=dx, y=dy)
+        hs.event_generate('<ButtonRelease-1>', x=dx, y=dy)
+
+        eq(hs.tag_ranges('sel'), ())
+
     def test_set_theme_type(self):
         eq = self.assertEqual
         d = self.page
@@ -648,8 +744,13 @@ class HighPageTest(unittest.TestCase):
         idleConf.userCfg['highlight'].SetOption(theme_name, 'name', 'value')
         highpage[theme_name] = {'option': 'True'}
 
+        theme_name2 = 'other theme'
+        idleConf.userCfg['highlight'].SetOption(theme_name2, 'name', 'value')
+        highpage[theme_name2] = {'option': 'False'}
+
         # Force custom theme.
-        d.theme_source.set(False)
+        d.custom_theme_on.state(('!disabled',))
+        d.custom_theme_on.invoke()
         d.custom_name.set(theme_name)
 
         # Cancel deletion.
@@ -657,7 +758,7 @@ class HighPageTest(unittest.TestCase):
         d.button_delete_custom.invoke()
         eq(yesno.called, 1)
         eq(highpage[theme_name], {'option': 'True'})
-        eq(idleConf.GetSectionList('user', 'highlight'), ['spam theme'])
+        eq(idleConf.GetSectionList('user', 'highlight'), [theme_name, theme_name2])
         eq(dialog.deactivate_current_config.called, 0)
         eq(dialog.activate_config_changes.called, 0)
         eq(d.set_theme_type.called, 0)
@@ -667,13 +768,26 @@ class HighPageTest(unittest.TestCase):
         d.button_delete_custom.invoke()
         eq(yesno.called, 2)
         self.assertNotIn(theme_name, highpage)
-        eq(idleConf.GetSectionList('user', 'highlight'), [])
-        eq(d.custom_theme_on.state(), ('disabled',))
-        eq(d.custom_name.get(), '- no custom themes -')
+        eq(idleConf.GetSectionList('user', 'highlight'), [theme_name2])
+        eq(d.custom_theme_on.state(), ())
+        eq(d.custom_name.get(), theme_name2)
         eq(dialog.deactivate_current_config.called, 1)
         eq(dialog.activate_config_changes.called, 1)
         eq(d.set_theme_type.called, 1)
 
+        # Confirm deletion of second theme - empties list.
+        d.custom_name.set(theme_name2)
+        yesno.result = True
+        d.button_delete_custom.invoke()
+        eq(yesno.called, 3)
+        self.assertNotIn(theme_name, highpage)
+        eq(idleConf.GetSectionList('user', 'highlight'), [])
+        eq(d.custom_theme_on.state(), ('disabled',))
+        eq(d.custom_name.get(), '- no custom themes -')
+        eq(dialog.deactivate_current_config.called, 2)
+        eq(dialog.activate_config_changes.called, 2)
+        eq(d.set_theme_type.called, 2)
+
         del dialog.activate_config_changes, dialog.deactivate_current_config
         del d.askyesno
 
@@ -1041,8 +1155,13 @@ class KeysPageTest(unittest.TestCase):
         idleConf.userCfg['keys'].SetOption(keyset_name, 'name', 'value')
         keyspage[keyset_name] = {'option': 'True'}
 
+        keyset_name2 = 'other key set'
+        idleConf.userCfg['keys'].SetOption(keyset_name2, 'name', 'value')
+        keyspage[keyset_name2] = {'option': 'False'}
+
         # Force custom keyset.
-        d.keyset_source.set(False)
+        d.custom_keyset_on.state(('!disabled',))
+        d.custom_keyset_on.invoke()
         d.custom_name.set(keyset_name)
 
         # Cancel deletion.
@@ -1050,7 +1169,7 @@ class KeysPageTest(unittest.TestCase):
         d.button_delete_custom_keys.invoke()
         eq(yesno.called, 1)
         eq(keyspage[keyset_name], {'option': 'True'})
-        eq(idleConf.GetSectionList('user', 'keys'), ['spam key set'])
+        eq(idleConf.GetSectionList('user', 'keys'), [keyset_name, keyset_name2])
         eq(dialog.deactivate_current_config.called, 0)
         eq(dialog.activate_config_changes.called, 0)
         eq(d.set_keys_type.called, 0)
@@ -1060,13 +1179,26 @@ class KeysPageTest(unittest.TestCase):
         d.button_delete_custom_keys.invoke()
         eq(yesno.called, 2)
         self.assertNotIn(keyset_name, keyspage)
-        eq(idleConf.GetSectionList('user', 'keys'), [])
-        eq(d.custom_keyset_on.state(), ('disabled',))
-        eq(d.custom_name.get(), '- no custom keys -')
+        eq(idleConf.GetSectionList('user', 'keys'), [keyset_name2])
+        eq(d.custom_keyset_on.state(), ())
+        eq(d.custom_name.get(), keyset_name2)
         eq(dialog.deactivate_current_config.called, 1)
         eq(dialog.activate_config_changes.called, 1)
         eq(d.set_keys_type.called, 1)
 
+        # Confirm deletion of second keyset - empties list.
+        d.custom_name.set(keyset_name2)
+        yesno.result = True
+        d.button_delete_custom_keys.invoke()
+        eq(yesno.called, 3)
+        self.assertNotIn(keyset_name, keyspage)
+        eq(idleConf.GetSectionList('user', 'keys'), [])
+        eq(d.custom_keyset_on.state(), ('disabled',))
+        eq(d.custom_name.get(), '- no custom keys -')
+        eq(dialog.deactivate_current_config.called, 2)
+        eq(dialog.activate_config_changes.called, 2)
+        eq(d.set_keys_type.called, 2)
+
         del dialog.activate_config_changes, dialog.deactivate_current_config
         del d.askyesno
 
index 240db71747a284f54bc040481577a4f75d59bff6..91e8ef89d1d72ae26eb8d85b8dee788e2a7543a8 100644 (file)
@@ -2,6 +2,7 @@
 
 from idlelib import editor
 import unittest
+from collections import namedtuple
 from test.support import requires
 from tkinter import Tk
 
@@ -91,5 +92,103 @@ class TestGetLineIndent(unittest.TestCase):
                 )
 
 
+class IndentAndNewlineTest(unittest.TestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        requires('gui')
+        cls.root = Tk()
+        cls.root.withdraw()
+        cls.window = Editor(root=cls.root)
+        cls.window.indentwidth = 2
+        cls.window.tabwidth = 2
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.window._close()
+        del cls.window
+        cls.root.update_idletasks()
+        for id in cls.root.tk.call('after', 'info'):
+            cls.root.after_cancel(id)
+        cls.root.destroy()
+        del cls.root
+
+    def insert(self, text):
+        t = self.window.text
+        t.delete('1.0', 'end')
+        t.insert('end', text)
+        # Force update for colorizer to finish.
+        t.update()
+
+    def test_indent_and_newline_event(self):
+        eq = self.assertEqual
+        w = self.window
+        text = w.text
+        get = text.get
+        nl = w.newline_and_indent_event
+
+        TestInfo = namedtuple('Tests', ['label', 'text', 'expected', 'mark'])
+
+        tests = (TestInfo('Empty line inserts with no indent.',
+                          '  \n  def __init__(self):',
+                          '\n  \n  def __init__(self):\n',
+                          '1.end'),
+                 TestInfo('Inside bracket before space, deletes space.',
+                          '  def f1(self, a, b):',
+                          '  def f1(self,\n         a, b):\n',
+                          '1.14'),
+                 TestInfo('Inside bracket after space, deletes space.',
+                          '  def f1(self, a, b):',
+                          '  def f1(self,\n         a, b):\n',
+                          '1.15'),
+                 TestInfo('Inside string with one line - no indent.',
+                          '  """Docstring."""',
+                          '  """Docstring.\n"""\n',
+                          '1.15'),
+                 TestInfo('Inside string with more than one line.',
+                          '  """Docstring.\n  Docstring Line 2"""',
+                          '  """Docstring.\n  Docstring Line 2\n  """\n',
+                          '2.18'),
+                 TestInfo('Backslash with one line.',
+                          'a =\\',
+                          'a =\\\n  \n',
+                          '1.end'),
+                 TestInfo('Backslash with more than one line.',
+                          'a =\\\n          multiline\\',
+                          'a =\\\n          multiline\\\n          \n',
+                          '2.end'),
+                 TestInfo('Block opener - indents +1 level.',
+                          '  def f1(self):\n    pass',
+                          '  def f1(self):\n    \n    pass\n',
+                          '1.end'),
+                 TestInfo('Block closer - dedents -1 level.',
+                          '  def f1(self):\n    pass',
+                          '  def f1(self):\n    pass\n  \n',
+                          '2.end'),
+                 )
+
+        w.prompt_last_line = ''
+        for test in tests:
+            with self.subTest(label=test.label):
+                self.insert(test.text)
+                text.mark_set('insert', test.mark)
+                nl(event=None)
+                eq(get('1.0', 'end'), test.expected)
+
+        # Selected text.
+        self.insert('  def f1(self, a, b):\n    return a + b')
+        text.tag_add('sel', '1.17', '1.end')
+        nl(None)
+        # Deletes selected text before adding new line.
+        eq(get('1.0', 'end'), '  def f1(self, a,\n         \n    return a + b\n')
+
+        # Preserves the whitespace in shell prompt.
+        w.prompt_last_line = '>>> '
+        self.insert('>>> \t\ta =')
+        text.mark_set('insert', '1.5')
+        nl(None)
+        eq(get('1.0', 'end'), '>>> \na =\n')
+
+
 if __name__ == '__main__':
     unittest.main(verbosity=2)
index f7154e6ded9574e14e9389f664090a3155de4514..f21baf7534420a9d014c9dde3920339e1ff14066 100644 (file)
@@ -18,7 +18,7 @@ class ParseMapTest(unittest.TestCase):
         # trans is the production instance of ParseMap, used in _study1
         parser = pyparse.Parser(4, 4)
         self.assertEqual('\t a([{b}])b"c\'d\n'.translate(pyparse.trans),
-                          'xxx(((x)))x"x\'x\n')
+                         'xxx(((x)))x"x\'x\n')
 
 
 class PyParseTest(unittest.TestCase):
@@ -58,17 +58,32 @@ class PyParseTest(unittest.TestCase):
         p = self.parser
         setcode = p.set_code
         start = p.find_good_parse_start
+        def char_in_string_false(index): return False
+
+        # First line starts with 'def' and ends with ':', then 0 is the pos.
+        setcode('def spam():\n')
+        eq(start(char_in_string_false), 0)
+
+        # First line begins with a keyword in the list and ends
+        # with an open brace, then 0 is the pos.  This is how
+        # hyperparser calls this function as the newline is not added
+        # in the editor, but rather on the call to setcode.
+        setcode('class spam( ' + ' \n')
+        eq(start(char_in_string_false), 0)
 
         # Split def across lines.
         setcode('"""This is a module docstring"""\n'
-               'class C():\n'
-               '    def __init__(self, a,\n'
-               '                 b=True):\n'
-               '        pass\n'
-               )
+                'class C():\n'
+                '    def __init__(self, a,\n'
+                '                 b=True):\n'
+                '        pass\n'
+                )
 
-        # No value sent for is_char_in_string().
-        self.assertIsNone(start())
+        # Passing no value or non-callable should fail (issue 32989).
+        with self.assertRaises(TypeError):
+            start()
+        with self.assertRaises(TypeError):
+            start(False)
 
         # Make text look like a string.  This returns pos as the start
         # position, but it's set to None.
@@ -76,7 +91,7 @@ class PyParseTest(unittest.TestCase):
 
         # Make all text look like it's not in a string.  This means that it
         # found a good start position.
-        eq(start(is_char_in_string=lambda index: False), 44)
+        eq(start(char_in_string_false), 44)
 
         # If the beginning of the def line is not in a string, then it
         # returns that as the index.
@@ -91,11 +106,11 @@ class PyParseTest(unittest.TestCase):
         # Code without extra line break in def line - mostly returns the same
         # values.
         setcode('"""This is a module docstring"""\n'
-               'class C():\n'
-               '    def __init__(self, a, b=True):\n'
-               '        pass\n'
-               )
-        eq(start(is_char_in_string=lambda index: False), 44)
+                'class C():\n'
+                '    def __init__(self, a, b=True):\n'
+                '        pass\n'
+                )
+        eq(start(char_in_string_false), 44)
         eq(start(is_char_in_string=lambda index: index > 44), 44)
         eq(start(is_char_in_string=lambda index: index >= 44), 33)
         # When the def line isn't split, this returns which doesn't match the
index f957585190dc83e3817448386ea63df7a08a14b0..6d026cb5320683e767f89c81d706ef7fc7a5dcfe 100644 (file)
@@ -138,6 +138,33 @@ class ModuleNameTest(unittest.TestCase):
         self.assertEqual(dialog.entry_error['text'], '')
 
 
+class GotoTest(unittest.TestCase):
+    "Test Goto subclass of Query."
+
+    class Dummy_ModuleName:
+        entry_ok = query.Goto.entry_ok  # Function being tested.
+        def __init__(self, dummy_entry):
+            self.entry = Var(value=dummy_entry)
+            self.entry_error = {'text': ''}
+        def showerror(self, message):
+            self.entry_error['text'] = message
+
+    def test_bogus_goto(self):
+        dialog = self.Dummy_ModuleName('a')
+        self.assertEqual(dialog.entry_ok(), None)
+        self.assertIn('not a base 10 integer', dialog.entry_error['text'])
+
+    def test_bad_goto(self):
+        dialog = self.Dummy_ModuleName('0')
+        self.assertEqual(dialog.entry_ok(), None)
+        self.assertIn('not a positive integer', dialog.entry_error['text'])
+
+    def test_good_goto(self):
+        dialog = self.Dummy_ModuleName('1')
+        self.assertEqual(dialog.entry_ok(), 1)
+        self.assertEqual(dialog.entry_error['text'], '')
+
+
 # 3 HelpSource test classes each test one method.
 
 class HelpsourceBrowsefileTest(unittest.TestCase):
@@ -363,6 +390,22 @@ class ModulenameGuiTest(unittest.TestCase):
         root.destroy()
 
 
+class GotoGuiTest(unittest.TestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        requires('gui')
+
+    def test_click_module_name(self):
+        root = Tk()
+        root.withdraw()
+        dialog =  query.Goto(root, 'T', 't', _utest=True)
+        dialog.entry.insert(0, '22')
+        dialog.button_ok.invoke()
+        self.assertEqual(dialog.result, 22)
+        root.destroy()
+
+
 class HelpsourceGuiTest(unittest.TestCase):
 
     @classmethod
index 0f5b4c71223240189e09b589f3e1d22a364a3449..2974a9a7b098744b02425d475157c4c363399331 100644 (file)
@@ -1,6 +1,5 @@
 """Test sidebar, coverage 93%"""
 import idlelib.sidebar
-from sys import platform
 from itertools import chain
 import unittest
 import unittest.mock
index 1af2ce832845cdaca1a70e96adf4b2f1364e80cd..e3912f4bbbec892cc6ee257440292f9192af9584 100644 (file)
@@ -1,6 +1,5 @@
 "Test squeezer, coverage 95%"
 
-from collections import namedtuple
 from textwrap import dedent
 from tkinter import Text, Tk
 import unittest
index feb57cbb74056410868c3e8a83457130c5468342..d34872b4396e1e2abdc399de1a9e91e76ceadd35 100644 (file)
@@ -133,8 +133,7 @@ class Parser:
         self.code = s
         self.study_level = 0
 
-    def find_good_parse_start(self, is_char_in_string=None,
-                              _synchre=_synchre):
+    def find_good_parse_start(self, is_char_in_string):
         """
         Return index of a good place to begin parsing, as close to the
         end of the string as possible.  This will be the start of some
@@ -149,10 +148,6 @@ class Parser:
         """
         code, pos = self.code, None
 
-        if not is_char_in_string:
-            # no clue -- make the caller pass everything
-            return None
-
         # Peek back from the end for a good place to start,
         # but don't try too often; pos will be left None, or
         # bumped to a legitimate synch point.
index 065122dec7a73d435b7d4a01217d47789c50e96a..66ae0f7435daba7df06a2d37bc9d4ff66ac382b7 100755 (executable)
@@ -16,7 +16,7 @@ except ImportError:
 if sys.platform == 'win32':
     try:
         import ctypes
-        PROCESS_SYSTEM_DPI_AWARE = 1
+        PROCESS_SYSTEM_DPI_AWARE = 1  # Int required.
         ctypes.OleDLL('shcore').SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
     except (ImportError, AttributeError, OSError):
         pass
@@ -676,7 +676,6 @@ class ModifiedInterpreter(InteractiveInterpreter):
     def runsource(self, source):
         "Extend base class method: Stuff the source in the line cache first"
         filename = self.stuffsource(source)
-        self.more = 0
         # at the moment, InteractiveInterpreter expects str
         assert isinstance(source, str)
         # InteractiveInterpreter.runsource() calls its runcode() method,
@@ -993,12 +992,12 @@ class PyShell(OutputWindow):
     def beginexecuting(self):
         "Helper for ModifiedInterpreter"
         self.resetoutput()
-        self.executing = 1
+        self.executing = True
 
     def endexecuting(self):
         "Helper for ModifiedInterpreter"
-        self.executing = 0
-        self.canceled = 0
+        self.executing = False
+        self.canceled = False
         self.showprompt()
 
     def close(self):
@@ -1075,7 +1074,7 @@ class PyShell(OutputWindow):
     def readline(self):
         save = self.reading
         try:
-            self.reading = 1
+            self.reading = True
             self.top.mainloop()  # nested mainloop()
         finally:
             self.reading = save
@@ -1087,11 +1086,11 @@ class PyShell(OutputWindow):
             line = "\n"
         self.resetoutput()
         if self.canceled:
-            self.canceled = 0
+            self.canceled = False
             if not use_subprocess:
                 raise KeyboardInterrupt
         if self.endoffile:
-            self.endoffile = 0
+            self.endoffile = False
             line = ""
         return line
 
@@ -1109,8 +1108,8 @@ class PyShell(OutputWindow):
             self.interp.write("KeyboardInterrupt\n")
             self.showprompt()
             return "break"
-        self.endoffile = 0
-        self.canceled = 1
+        self.endoffile = False
+        self.canceled = True
         if (self.executing and self.interp.rpcclt):
             if self.interp.getdebugger():
                 self.interp.restart_subprocess()
@@ -1130,8 +1129,8 @@ class PyShell(OutputWindow):
             self.resetoutput()
             self.close()
         else:
-            self.canceled = 0
-            self.endoffile = 1
+            self.canceled = False
+            self.endoffile = True
             self.top.quit()
         return "break"
 
@@ -1292,6 +1291,7 @@ class PyShell(OutputWindow):
             self.text.insert("end-1c", "\n")
         self.text.mark_set("iomark", "end-1c")
         self.set_line_and_column()
+        self.ctip.remove_calltip_window()
 
     def write(self, s, tags=()):
         try:
@@ -1302,7 +1302,7 @@ class PyShell(OutputWindow):
             raise ###pass  # ### 11Aug07 KBK if we are expecting exceptions
                            # let's find out what they are and be specific.
         if self.canceled:
-            self.canceled = 0
+            self.canceled = False
             if not use_subprocess:
                 raise KeyboardInterrupt
         return count
@@ -1485,9 +1485,14 @@ def main():
         iconfile = os.path.join(icondir, 'idle.ico')
         root.wm_iconbitmap(default=iconfile)
     elif not macosx.isAquaTk():
-        ext = '.png' if TkVersion >= 8.6 else '.gif'
+        if TkVersion >= 8.6:
+            ext = '.png'
+            sizes = (16, 32, 48, 256)
+        else:
+            ext = '.gif'
+            sizes = (16, 32, 48)
         iconfiles = [os.path.join(icondir, 'idle_%d%s' % (size, ext))
-                     for size in (16, 32, 48)]
+                     for size in sizes]
         icons = [PhotoImage(master=root, file=iconfile)
                  for iconfile in iconfiles]
         root.wm_iconphoto(True, *icons)
index 097e6e61e3569cf4ea2e78c7716390cc89fb9b5c..2a88530b4d082a51ce189327e76394c818c6608f 100644 (file)
@@ -108,6 +108,7 @@ class Query(Toplevel):
                                exists=True, root=self.parent)
         self.entry_error = Label(frame, text=' ', foreground='red',
                                  font=self.error_font)
+        # Display or blank error by setting ['text'] =.
         entrylabel.grid(column=0, row=0, columnspan=3, padx=5, sticky=W)
         self.entry.grid(column=0, row=1, columnspan=3, padx=5, sticky=W+E,
                         pady=[10,0])
@@ -132,7 +133,6 @@ class Query(Toplevel):
 
     def entry_ok(self):  # Example: usually replace.
         "Return non-blank entry or None."
-        self.entry_error['text'] = ''
         entry = self.entry.get().strip()
         if not entry:
             self.showerror('blank line.')
@@ -144,6 +144,7 @@ class Query(Toplevel):
 
         Otherwise leave dialog open for user to correct entry or cancel.
         '''
+        self.entry_error['text'] = ''
         entry = self.entry_ok()
         if entry is not None:
             self.result = entry
@@ -173,7 +174,6 @@ class SectionName(Query):
 
     def entry_ok(self):
         "Return sensible ConfigParser section name or None."
-        self.entry_error['text'] = ''
         name = self.entry.get().strip()
         if not name:
             self.showerror('no name specified.')
@@ -198,7 +198,6 @@ class ModuleName(Query):
 
     def entry_ok(self):
         "Return entered module name as file path or None."
-        self.entry_error['text'] = ''
         name = self.entry.get().strip()
         if not name:
             self.showerror('no name specified.')
@@ -224,6 +223,22 @@ class ModuleName(Query):
         return file_path
 
 
+class Goto(Query):
+    "Get a positive line number for editor Go To Line."
+    # Used in editor.EditorWindow.goto_line_event.
+
+    def entry_ok(self):
+        try:
+            lineno = int(self.entry.get())
+        except ValueError:
+            self.showerror('not a base 10 integer.')
+            return None
+        if lineno <= 0:
+            self.showerror('not a positive integer.')
+            return None
+        return lineno
+
+
 class HelpSource(Query):
     "Get menu name and help source for Help menu."
     # Used in ConfigDialog.HelpListItemAdd/Edit, (941/9)
@@ -311,7 +326,6 @@ class HelpSource(Query):
 
     def entry_ok(self):
         "Return apparently valid (name, path) or None"
-        self.entry_error['text'] = ''
         self.path_error['text'] = ''
         name = self.item_ok()
         path = self.path_ok()
@@ -362,7 +376,6 @@ class CustomRun(Query):
 
     def entry_ok(self):
         "Return apparently valid (cli_args, restart) or None"
-        self.entry_error['text'] = ''
         cli_args = self.cli_args_ok()
         restart = self.restartvar.get()
         return None if cli_args is None else (cli_args, restart)
index 808a2aefab4f71a3306413cad3abb024a85900fd..a66c1a4309a617f27812a2ed544fc430192450e0 100644 (file)
@@ -6,7 +6,6 @@ from tkinter import Toplevel, Text, TclError,\
 from tkinter.ttk import Frame, Scrollbar, Button
 from tkinter.messagebox import showerror
 
-from functools import update_wrapper
 from idlelib.colorizer import color_config
 
 
index 53f9fb5934668415345fb718e16afdabd19bc1ee..831f593277ccd478a0ec829e6a8462a21e6a5b5f 100644 (file)
@@ -10,6 +10,7 @@ import zipfile
 import operator
 import functools
 import itertools
+import posixpath
 import collections
 
 from configparser import ConfigParser
@@ -371,10 +372,6 @@ class DistributionFinder(MetaPathFinder):
             """
             return vars(self).get('path', sys.path)
 
-        @property
-        def pattern(self):
-            return '.*' if self.name is None else re.escape(self.name)
-
     @abc.abstractmethod
     def find_distributions(self, context=Context()):
         """
@@ -386,6 +383,75 @@ class DistributionFinder(MetaPathFinder):
         """
 
 
+class FastPath:
+    """
+    Micro-optimized class for searching a path for
+    children.
+    """
+
+    def __init__(self, root):
+        self.root = root
+        self.base = os.path.basename(root).lower()
+
+    def joinpath(self, child):
+        return pathlib.Path(self.root, child)
+
+    def children(self):
+        with suppress(Exception):
+            return os.listdir(self.root or '')
+        with suppress(Exception):
+            return self.zip_children()
+        return []
+
+    def zip_children(self):
+        zip_path = zipfile.Path(self.root)
+        names = zip_path.root.namelist()
+        self.joinpath = zip_path.joinpath
+
+        return (
+            posixpath.split(child)[0]
+            for child in names
+            )
+
+    def is_egg(self, search):
+        base = self.base
+        return (
+            base == search.versionless_egg_name
+            or base.startswith(search.prefix)
+            and base.endswith('.egg'))
+
+    def search(self, name):
+        for child in self.children():
+            n_low = child.lower()
+            if (n_low in name.exact_matches
+                    or n_low.startswith(name.prefix)
+                    and n_low.endswith(name.suffixes)
+                    # legacy case:
+                    or self.is_egg(name) and n_low == 'egg-info'):
+                yield self.joinpath(child)
+
+
+class Prepared:
+    """
+    A prepared search for metadata on a possibly-named package.
+    """
+    normalized = ''
+    prefix = ''
+    suffixes = '.dist-info', '.egg-info'
+    exact_matches = [''][:0]
+    versionless_egg_name = ''
+
+    def __init__(self, name):
+        self.name = name
+        if name is None:
+            return
+        self.normalized = name.lower().replace('-', '_')
+        self.prefix = self.normalized + '-'
+        self.exact_matches = [
+            self.normalized + suffix for suffix in self.suffixes]
+        self.versionless_egg_name = self.normalized + '.egg'
+
+
 class MetadataPathFinder(DistributionFinder):
     @classmethod
     def find_distributions(cls, context=DistributionFinder.Context()):
@@ -397,45 +463,17 @@ class MetadataPathFinder(DistributionFinder):
         (or all names if ``None`` indicated) along the paths in the list
         of directories ``context.path``.
         """
-        found = cls._search_paths(context.pattern, context.path)
+        found = cls._search_paths(context.name, context.path)
         return map(PathDistribution, found)
 
     @classmethod
-    def _search_paths(cls, pattern, paths):
+    def _search_paths(cls, name, paths):
         """Find metadata directories in paths heuristically."""
         return itertools.chain.from_iterable(
-            cls._search_path(path, pattern)
-            for path in map(cls._switch_path, paths)
+            path.search(Prepared(name))
+            for path in map(FastPath, paths)
             )
 
-    @staticmethod
-    def _switch_path(path):
-        PYPY_OPEN_BUG = False
-        if not PYPY_OPEN_BUG or os.path.isfile(path):  # pragma: no branch
-            with suppress(Exception):
-                return zipfile.Path(path)
-        return pathlib.Path(path)
-
-    @classmethod
-    def _matches_info(cls, normalized, item):
-        template = r'{pattern}(-.*)?\.(dist|egg)-info'
-        manifest = template.format(pattern=normalized)
-        return re.match(manifest, item.name, flags=re.IGNORECASE)
-
-    @classmethod
-    def _matches_legacy(cls, normalized, item):
-        template = r'{pattern}-.*\.egg[\\/]EGG-INFO'
-        manifest = template.format(pattern=normalized)
-        return re.search(manifest, str(item), flags=re.IGNORECASE)
-
-    @classmethod
-    def _search_path(cls, root, pattern):
-        if not root.is_dir():
-            return ()
-        normalized = pattern.replace('-', '_')
-        return (item for item in root.iterdir()
-                if cls._matches_info(normalized, item)
-                or cls._matches_legacy(normalized, item))
 
 
 class PathDistribution(Distribution):
index 3ff395ca33377863607846bd07b77bf713e670ec..e8ea8c221f8288abe750d27e5e69010f869aac80 100644 (file)
@@ -741,7 +741,7 @@ def getmodule(object, _filename=None):
         return sys.modules.get(modulesbyfile[file])
     # Update the filename to module name cache and check yet again
     # Copy sys.modules in order to cope with changes while iterating
-    for modname, module in list(sys.modules.items()):
+    for modname, module in sys.modules.copy().items():
         if ismodule(module) and hasattr(module, '__file__'):
             f = module.__file__
             if f == _filesbymodname.get(modname, None):
index 8db9ea40ad1b051d2f1c7dc84afaae78958bca89..c42138a05c05e7b6a136a490f7e7b1f43a2a85c5 100644 (file)
@@ -52,4 +52,7 @@ def main():
 
 
 if __name__ == '__main__':
-    main()
+    try:
+        main()
+    except BrokenPipeError as exc:
+        sys.exit(exc.errno)
index 68b73868b58282fce8ad32809c6350f587706090..8ce7fd8a89da67dade690e8c993c1d66d090bd0a 100644 (file)
@@ -67,8 +67,8 @@ assert_stmt: 'assert' test [',' test]
 
 compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt
 async_stmt: ASYNC (funcdef | with_stmt | for_stmt)
-if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
-while_stmt: 'while' test ':' suite ['else' ':' suite]
+if_stmt: 'if' namedexpr_test ':' suite ('elif' namedexpr_test ':' suite)* ['else' ':' suite]
+while_stmt: 'while' namedexpr_test ':' suite ['else' ':' suite]
 for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
 try_stmt: ('try' ':' suite
            ((except_clause ':' suite)+
@@ -91,6 +91,7 @@ testlist_safe: old_test [(',' old_test)+ [',']]
 old_test: or_test | old_lambdef
 old_lambdef: 'lambda' [varargslist] ':' old_test
 
+namedexpr_test: test [':=' test]
 test: or_test ['if' or_test 'else' test] | lambdef
 or_test: and_test ('or' and_test)*
 and_test: not_test ('and' not_test)*
@@ -111,8 +112,8 @@ atom: ('(' [yield_expr|testlist_gexp] ')' |
        '{' [dictsetmaker] '}' |
        '`' testlist1 '`' |
        NAME | NUMBER | STRING+ | '.' '.' '.')
-listmaker: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] )
-testlist_gexp: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] )
+listmaker: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] )
+testlist_gexp: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] )
 lambdef: 'lambda' [varargslist] ':' test
 trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
 subscriptlist: subscript (',' subscript)* [',']
@@ -137,6 +138,7 @@ arglist: argument (',' argument)* [',']
 # multiple (test comp_for) arguments are blocked; keyword unpackings
 # that precede iterable unpackings are blocked; etc.
 argument: ( test [comp_for] |
+            test ':=' test |
             test '=' test |
             '**' test |
                '*' test )
index a7a5a154f6fb113c5de5353b3a1dd425cad6687c..38e9078f11ac88f346b7ba2468c69dc5a4f74dd5 100644 (file)
@@ -17,7 +17,7 @@ Python 2.6 figure it out.
 from .. import fixer_base
 from ..pytree import Node
 from ..pygram import python_symbols as syms
-from ..fixer_util import Name, ArgList, ListComp, in_special_context
+from ..fixer_util import Name, ArgList, ListComp, in_special_context, parenthesize
 
 
 class FixFilter(fixer_base.ConditionalFix):
@@ -65,10 +65,14 @@ class FixFilter(fixer_base.ConditionalFix):
                 trailers.append(t.clone())
 
         if "filter_lambda" in results:
+            xp = results.get("xp").clone()
+            if xp.type == syms.test:
+                xp.prefix = ""
+                xp = parenthesize(xp)
+
             new = ListComp(results.get("fp").clone(),
                            results.get("fp").clone(),
-                           results.get("it").clone(),
-                           results.get("xp").clone())
+                           results.get("it").clone(), xp)
             new = Node(syms.power, [new] + trailers, prefix="")
 
         elif "none" in results:
index a1da546eee20e12fc29d442835d80bea6379e40c..6a4d575ac2ccfce410e1d9076d99df8eb740e8d6 100644 (file)
@@ -178,6 +178,7 @@ opmap_raw = """
 // DOUBLESLASH
 //= DOUBLESLASHEQUAL
 -> RARROW
+:= COLONEQUAL
 """
 
 opmap = {}
index 1a679554d2db4e86c8d56eaca49b85113c1cb312..5f6612f5b30681dab79e4f71800850202c43a9aa 100755 (executable)
@@ -65,7 +65,8 @@ RARROW = 55
 AWAIT = 56
 ASYNC = 57
 ERRORTOKEN = 58
-N_TOKENS = 59
+COLONEQUAL = 59
+N_TOKENS = 60
 NT_OFFSET = 256
 #--end constants--
 
index 7924ff3cd582fcca203cc695b08606fc48d421df..0e2685d40433d747b70865be6a2c9a936e26d136 100644 (file)
@@ -93,7 +93,7 @@ Operator = group(r"\*\*=?", r">>=?", r"<<=?", r"<>", r"!=",
                  r"~")
 
 Bracket = '[][(){}]'
-Special = group(r'\r?\n', r'[:;.,`@]')
+Special = group(r'\r?\n', r':=', r'[:;.,`@]')
 Funny = group(Operator, Bracket, Special)
 
 PlainToken = group(Number, Funny, String, Name)
index 3da5dd845c93c6632c26c64a9c7a9bbb32a68341..a28524198181333e37cae56676673b35665c178c 100644 (file)
@@ -2954,6 +2954,11 @@ class Test_filter(FixerTestCase):
         a = """x = [x for x in range(10) if x%2 == 0]"""
         self.check(b, a)
 
+        # bpo-38871
+        b = """filter(lambda x: True if x > 2 else False, [1, 2, 3])"""
+        a = """[x for x in [1, 2, 3] if (True if x > 2 else False)]"""
+        self.check(b, a)
+
     def test_filter_trailers(self):
         b = """x = filter(None, 'abc')[0]"""
         a = """x = [_f for _f in 'abc' if _f][0]"""
index 868ada71cda870cfeca4d2097802a6e807e6769d..3a0e7f435e6d78754066087fa5ca23b85e553642 100644 (file)
@@ -629,6 +629,21 @@ class TestLiterals(GrammarTest):
         self.validate(s)
 
 
+class TestNamedAssignments(GrammarTest):
+
+    def test_named_assignment_if(self):
+        driver.parse_string("if f := x(): pass\n")
+
+    def test_named_assignment_while(self):
+        driver.parse_string("while f := x(): pass\n")
+
+    def test_named_assignment_generator(self):
+        driver.parse_string("any((lastNum := num) == 1 for num in [1, 2, 3])\n")
+
+    def test_named_assignment_listcomp(self):
+        driver.parse_string("[(lastNum := num) == 1 for num in [1, 2, 3]]\n")
+
+
 class TestPickleableException(unittest.TestCase):
     def test_ParseError(self):
         err = ParseError('msg', 2, None, (1, 'context'))
index 16812ec8d556788bd161b796cbdfc01327fc8f8f..0cfaec84bac139a053cbb619ee5194771596a949 100644 (file)
@@ -1685,12 +1685,15 @@ class Logger(Filterer):
             return self._cache[level]
         except KeyError:
             _acquireLock()
-            if self.manager.disable >= level:
-                is_enabled = self._cache[level] = False
-            else:
-                is_enabled = self._cache[level] = level >= self.getEffectiveLevel()
-            _releaseLock()
-
+            try:
+                if self.manager.disable >= level:
+                    is_enabled = self._cache[level] = False
+                else:
+                    is_enabled = self._cache[level] = (
+                        level >= self.getEffectiveLevel()
+                    )
+            finally:
+                _releaseLock()
             return is_enabled
 
     def getChild(self, suffix):
index 9dd35e11aab3954ba4ba980e23145375b4852ad6..3cd5fea852449474a06fc5d009de8ff720ba18f8 100644 (file)
@@ -447,7 +447,7 @@ class BaseConfigurator(object):
             value = ConvertingList(value)
             value.configurator = self
         elif not isinstance(value, ConvertingTuple) and\
-                 isinstance(value, tuple):
+                 isinstance(value, tuple) and not hasattr(value, '_fields'):
             value = ConvertingTuple(value)
             value.configurator = self
         elif isinstance(value, str): # str for py3k
index 9b42bf6dd2ca74ad924969b4392df92c93cef5c0..f33b658f10e5eb07bb491bd57159c2c897700239 100644 (file)
@@ -563,7 +563,7 @@ def _default_mime_types():
 _default_mime_types()
 
 
-if __name__ == '__main__':
+def _main():
     import getopt
 
     USAGE = """\
@@ -607,3 +607,7 @@ More than one type argument may be given.
             guess, encoding = guess_type(gtype, strict)
             if not guess: print("I don't know anything about type", gtype)
             else: print('type:', guess, 'encoding:', encoding)
+
+
+if __name__ == '__main__':
+    _main()
index e0d29984f862cf84278612fa573ac47b26e95226..aadcd23edbaaa7c91eb28ffe56b4cd75ab4d418f 100644 (file)
@@ -5,6 +5,7 @@ import importlib._bootstrap_external
 import importlib.machinery
 import marshal
 import os
+import io
 import sys
 import types
 import warnings
@@ -80,23 +81,20 @@ def _find_module(name, path=None):
 
     if isinstance(spec.loader, importlib.machinery.SourceFileLoader):
         kind = _PY_SOURCE
-        mode = "r"
 
     elif isinstance(spec.loader, importlib.machinery.ExtensionFileLoader):
         kind = _C_EXTENSION
-        mode = "rb"
 
     elif isinstance(spec.loader, importlib.machinery.SourcelessFileLoader):
         kind = _PY_COMPILED
-        mode = "rb"
 
     else:  # Should never happen.
         return None, None, ("", "", _SEARCH_ERROR)
 
-    file = open(file_path, mode)
+    file = io.open_code(file_path)
     suffix = os.path.splitext(file_path)[-1]
 
-    return file, file_path, (suffix, mode, kind)
+    return file, file_path, (suffix, "rb", kind)
 
 
 class Module:
@@ -160,15 +158,15 @@ class ModuleFinder:
 
     def run_script(self, pathname):
         self.msg(2, "run_script", pathname)
-        with open(pathname) as fp:
-            stuff = ("", "r", _PY_SOURCE)
+        with io.open_code(pathname) as fp:
+            stuff = ("", "rb", _PY_SOURCE)
             self.load_module('__main__', fp, pathname, stuff)
 
     def load_file(self, pathname):
         dir, name = os.path.split(pathname)
         name, ext = os.path.splitext(name)
-        with open(pathname) as fp:
-            stuff = (ext, "r", _PY_SOURCE)
+        with io.open_code(pathname) as fp:
+            stuff = (ext, "rb", _PY_SOURCE)
             self.load_module(name, fp, pathname, stuff)
 
     def import_hook(self, name, caller=None, fromlist=None, level=-1):
@@ -322,6 +320,7 @@ class ModuleFinder:
         except ImportError:
             self.msgout(3, "import_module ->", None)
             return None
+
         try:
             m = self.load_module(fqname, fp, pathname, stuff)
         finally:
@@ -340,7 +339,7 @@ class ModuleFinder:
             self.msgout(2, "load_module ->", m)
             return m
         if type == _PY_SOURCE:
-            co = compile(fp.read()+'\n', pathname, 'exec')
+            co = compile(fp.read(), pathname, 'exec')
         elif type == _PY_COMPILED:
             try:
                 data = fp.read()
index c9f995e5fa7f57f1d1e058be0e2d3fba94025397..8e2facf92a94aa363a653a0032da4ea063f0162c 100644 (file)
@@ -102,7 +102,7 @@ def address_type(address):
         return 'AF_INET'
     elif type(address) is str and address.startswith('\\\\'):
         return 'AF_PIPE'
-    elif type(address) is str:
+    elif type(address) is str or util.is_abstract_socket_namespace(address):
         return 'AF_UNIX'
     else:
         raise ValueError('address type of %r unrecognized' % address)
@@ -597,7 +597,8 @@ class SocketListener(object):
         self._family = family
         self._last_accepted = None
 
-        if family == 'AF_UNIX':
+        if family == 'AF_UNIX' and not util.is_abstract_socket_namespace(address):
+            # Linux abstract socket namespaces do not need to be explicitly unlinked
             self._unlink = util.Finalize(
                 self, os.unlink, args=(address,), exitpriority=0
                 )
index 87ebef6588acd3db346224630c9e0cc8c560a12a..215ac39afcaa07988c907e5a60d4685b6da61512 100644 (file)
@@ -55,7 +55,8 @@ class ForkServer(object):
         os.waitpid(self._forkserver_pid, 0)
         self._forkserver_pid = None
 
-        os.unlink(self._forkserver_address)
+        if not util.is_abstract_socket_namespace(self._forkserver_address):
+            os.unlink(self._forkserver_address)
         self._forkserver_address = None
 
     def set_forkserver_preload(self, modules_names):
@@ -135,7 +136,8 @@ class ForkServer(object):
             with socket.socket(socket.AF_UNIX) as listener:
                 address = connection.arbitrary_address('AF_UNIX')
                 listener.bind(address)
-                os.chmod(address, 0o600)
+                if not util.is_abstract_socket_namespace(address):
+                    os.chmod(address, 0o600)
                 listener.listen()
 
                 # all client processes own the write end of the "alive" pipe;
index 7e1818bb0996857a7efedd1b673249c6c2e035e7..85e0d886f56474dd00cc318bafef7b49ae633b75 100644 (file)
@@ -59,7 +59,7 @@ if view_types[0] is not list:       # only needed in Py3.0
 
 class Token(object):
     '''
-    Type to uniquely indentify a shared object
+    Type to uniquely identify a shared object
     '''
     __slots__ = ('typeid', 'address', 'id')
 
@@ -821,7 +821,7 @@ class BaseProxy(object):
 
     def _callmethod(self, methodname, args=(), kwds={}):
         '''
-        Try to call a method of the referrent and return a copy of the result
+        Try to call a method of the referent and return a copy of the result
         '''
         try:
             conn = self._tls.connection
@@ -1289,8 +1289,12 @@ if HAS_SHMEM:
 
         def __init__(self, *args, **kwargs):
             Server.__init__(self, *args, **kwargs)
+            address = self.address
+            # The address of Linux abstract namespaces can be bytes
+            if isinstance(address, bytes):
+                address = os.fsdecode(address)
             self.shared_memory_context = \
-                _SharedMemoryTracker(f"shmm_{self.address}_{getpid()}")
+                _SharedMemoryTracker(f"shm_{address}_{getpid()}")
             util.debug(f"SharedMemoryServer started by pid {getpid()}")
 
         def create(*args, **kwargs):
index b223d6aa724bb63e0fe5e8e19786d64c6359b96d..41dd923d4f9740716ede9323556dfa133d2eef6d 100644 (file)
@@ -651,8 +651,6 @@ class Pool(object):
     def terminate(self):
         util.debug('terminating pool')
         self._state = TERMINATE
-        self._worker_handler._state = TERMINATE
-        self._change_notifier.put(None)
         self._terminate()
 
     def join(self):
@@ -682,7 +680,12 @@ class Pool(object):
         # this is guaranteed to only be called once
         util.debug('finalizing pool')
 
+        # Notify that the worker_handler state has been changed so the
+        # _handle_workers loop can be unblocked (and exited) in order to
+        # send the finalization sentinel all the workers.
         worker_handler._state = TERMINATE
+        change_notifier.put(None)
+
         task_handler._state = TERMINATE
 
         util.debug('helping task handler/workers to finish')
index 184e36704baaeba95cc36a9030a2ff819a77c2e2..f92eb012c83160e2e10a23e8c7c9741da3e53b9d 100644 (file)
@@ -433,9 +433,12 @@ class ShareableList:
 
         if not isinstance(value, (str, bytes)):
             new_format = self._types_mapping[type(value)]
+            encoded_value = value
         else:
-            if len(value) > self._allocated_bytes[position]:
-                raise ValueError("exceeds available storage for existing str")
+            encoded_value = (value.encode(_encoding)
+                             if isinstance(value, str) else value)
+            if len(encoded_value) > self._allocated_bytes[position]:
+                raise ValueError("bytes/str item exceeds available storage")
             if current_format[-1] == "s":
                 new_format = current_format
             else:
@@ -448,8 +451,7 @@ class ShareableList:
             new_format,
             value
         )
-        value = value.encode(_encoding) if isinstance(value, str) else value
-        struct.pack_into(new_format, self.shm.buf, offset, value)
+        struct.pack_into(new_format, self.shm.buf, offset, encoded_value)
 
     def __reduce__(self):
         return partial(self.__class__, name=self.shm.name), ()
index 075f3455478b52ab84579cdd5d0eab9d3fccf70a..7cc129e2610761f3868523030ea4fa60ec9d844b 100644 (file)
@@ -36,7 +36,7 @@ else:
 if WINSERVICE:
     _python_exe = os.path.join(sys.exec_prefix, 'python.exe')
 else:
-    _python_exe = sys._base_executable
+    _python_exe = sys.executable
 
 def set_executable(exe):
     global _python_exe
index 745f2b2651b11fbea8ec86d1d47bb32c24e697c4..44abfe529fc784c85a723342b74ab9893065f0b5 100644 (file)
@@ -102,6 +102,29 @@ def log_to_stderr(level=None):
     _log_to_stderr = True
     return _logger
 
+
+# Abstract socket support
+
+def _platform_supports_abstract_sockets():
+    if sys.platform == "linux":
+        return True
+    if hasattr(sys, 'getandroidapilevel'):
+        return True
+    return False
+
+
+def is_abstract_socket_namespace(address):
+    if not address:
+        return False
+    if isinstance(address, bytes):
+        return address[0] == 0
+    elif isinstance(address, str):
+        return address[0] == "\0"
+    raise TypeError('address type of {address!r} unrecognized')
+
+
+abstract_sockets_supported = _platform_supports_abstract_sockets()
+
 #
 # Function returning a temp directory which will be removed on exit
 #
index 1b7e83af01ad003ff5f8158b6638d423d43d5170..9036f361b5fb6b9e631b713016f1d341baed8a7b 100644 (file)
@@ -1107,7 +1107,7 @@ if __name__ == '__main__':
         nntplib built-in demo - display the latest articles in a newsgroup""")
     parser.add_argument('-g', '--group', default='gmane.comp.python.general',
                         help='group to fetch messages from (default: %(default)s)')
-    parser.add_argument('-s', '--server', default='news.gmane.org',
+    parser.add_argument('-s', '--server', default='news.gmane.io',
                         help='NNTP server hostname (default: %(default)s)')
     parser.add_argument('-p', '--port', default=-1, type=int,
                         help='NNTP port number (default: %s / %s)' % (NNTP_PORT, NNTP_SSL_PORT))
index 52d3f1d7415854e7baf7f5ac564ef4629c648449..253cad1a59f35ad40950ae1040cb9542456d90a5 100644 (file)
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -26,6 +26,8 @@ import abc
 import sys
 import stat as st
 
+from _collections_abc import _check_methods
+
 _names = sys.builtin_module_names
 
 # Note:  more names are added to __all__ later.
@@ -1070,7 +1072,9 @@ class PathLike(abc.ABC):
 
     @classmethod
     def __subclasshook__(cls, subclass):
-        return hasattr(subclass, '__fspath__')
+        if cls is PathLike:
+            return _check_methods(subclass, '__fspath__')
+        return NotImplemented
 
 
 if name == 'nt':
index 8ed3c883c60067dfe7af85c3edb9586009c153b0..ff8bac94bc0bea2edbd078a616812708e77ce796 100644 (file)
@@ -253,9 +253,7 @@ class _WindowsFlavour(_Flavour):
             return 'file:' + urlquote_from_bytes(path.as_posix().encode('utf-8'))
 
     def gethomedir(self, username):
-        if 'HOME' in os.environ:
-            userhome = os.environ['HOME']
-        elif 'USERPROFILE' in os.environ:
+        if 'USERPROFILE' in os.environ:
             userhome = os.environ['USERPROFILE']
         elif 'HOMEPATH' in os.environ:
             try:
@@ -529,25 +527,29 @@ class _WildcardSelector(_Selector):
 
     def _select_from(self, parent_path, is_dir, exists, scandir):
         try:
-            entries = list(scandir(parent_path))
+            with scandir(parent_path) as scandir_it:
+                entries = list(scandir_it)
             for entry in entries:
-                entry_is_dir = False
-                try:
-                    entry_is_dir = entry.is_dir()
-                except OSError as e:
-                    if not _ignore_error(e):
-                        raise
-                if not self.dironly or entry_is_dir:
-                    name = entry.name
-                    if self.match(name):
-                        path = parent_path._make_child_relpath(name)
-                        for p in self.successor._select_from(path, is_dir, exists, scandir):
-                            yield p
+                if self.dironly:
+                    try:
+                        # "entry.is_dir()" can raise PermissionError
+                        # in some cases (see bpo-38894), which is not
+                        # among the errors ignored by _ignore_error()
+                        if not entry.is_dir():
+                            continue
+                    except OSError as e:
+                        if not _ignore_error(e):
+                            raise
+                        continue
+                name = entry.name
+                if self.match(name):
+                    path = parent_path._make_child_relpath(name)
+                    for p in self.successor._select_from(path, is_dir, exists, scandir):
+                        yield p
         except PermissionError:
             return
 
 
-
 class _RecursiveWildcardSelector(_Selector):
 
     def __init__(self, pat, child_parts, flavour):
@@ -556,7 +558,8 @@ class _RecursiveWildcardSelector(_Selector):
     def _iterate_directories(self, parent_path, is_dir, scandir):
         yield parent_path
         try:
-            entries = list(scandir(parent_path))
+            with scandir(parent_path) as scandir_it:
+                entries = list(scandir_it)
             for entry in entries:
                 entry_is_dir = False
                 try:
index 71aa57d500ecce76f3d3e70791c9c31b2cc7e509..515cb8a0bb3f1a28f15cdfd428996eee943a3dcf 100644 (file)
@@ -409,9 +409,9 @@ class _Pickler:
         """This takes a binary file for writing a pickle data stream.
 
         The optional *protocol* argument tells the pickler to use the
-        given protocol; supported protocols are 0, 1, 2, 3 and 4.  The
-        default protocol is 4. It was introduced in Python 3.4, it is
-        incompatible with previous versions.
+        given protocol; supported protocols are 0, 1, 2, 3, 4 and 5.
+        The default protocol is 4. It was introduced in Python 3.4, and
+        is incompatible with previous versions.
 
         Specifying a negative protocol version selects the highest
         protocol version supported.  The higher the protocol used, the
index 6fbb7b08c598e3d1782479ab492e4d8c964604ef..994d892c5e6166921b05e9aeaee4d95c0a579c7a 100755 (executable)
@@ -395,9 +395,9 @@ def win32_ver(release='', version='', csd='', ptype=''):
     else:
         try:
             cvkey = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
-            with winreg.OpenKeyEx(HKEY_LOCAL_MACHINE, cvkey) as key:
-                ptype = QueryValueEx(key, 'CurrentType')[0]
-        except:
+            with winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, cvkey) as key:
+                ptype = winreg.QueryValueEx(key, 'CurrentType')[0]
+        except OSError:
             pass
 
     return release, version, csd, ptype
index e841f12f3edb9b85cc34891e2a441943f85f6759..a32432041fa1dbe18d0e1f78283559b13e7ca5d1 100644 (file)
@@ -8,6 +8,7 @@
 
 from select import select
 import os
+import sys
 import tty
 
 __all__ = ["openpty","fork","spawn"]
@@ -151,6 +152,7 @@ def spawn(argv, master_read=_read, stdin_read=_read):
     """Create a spawned process."""
     if type(argv) == type(''):
         argv = (argv,)
+    sys.audit('pty.spawn', argv)
     pid, master_fd = fork()
     if pid == CHILD:
         os.execlp(argv[0], *argv)
index 9a22e56686f618822050da56867a07841fb12788..dc3377d68f8caa4e6ddb31c77465791e0fe891b4 100644 (file)
@@ -66,6 +66,7 @@ import pkgutil
 import platform
 import re
 import sys
+import sysconfig
 import time
 import tokenize
 import urllib.parse
@@ -392,9 +393,7 @@ class Doc:
 
     docmodule = docclass = docroutine = docother = docproperty = docdata = fail
 
-    def getdocloc(self, object,
-                  basedir=os.path.join(sys.base_exec_prefix, "lib",
-                                       "python%d.%d" %  sys.version_info[:2])):
+    def getdocloc(self, object, basedir=sysconfig.get_path('stdlib')):
         """Return the location of module docs or None"""
 
         try:
index 9d779d1e69f23b2ffc8ccf7f9d1a832987d461d5..06f0e781772f857e9df1a8ec81b287d76d93bf6d 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Autogenerated by Sphinx on Wed Dec 18 18:17:58 2019
+# Autogenerated by Sphinx on Wed May 13 19:29:27 2020
 topics = {'assert': 'The "assert" statement\n'
            '**********************\n'
            '\n'
@@ -470,24 +470,25 @@ topics = {'assert': 'The "assert" statement\n'
           'The following code:\n'
           '\n'
           '   async for TARGET in ITER:\n'
-          '       BLOCK\n'
+          '       SUITE\n'
           '   else:\n'
-          '       BLOCK2\n'
+          '       SUITE2\n'
           '\n'
           'Is semantically equivalent to:\n'
           '\n'
           '   iter = (ITER)\n'
           '   iter = type(iter).__aiter__(iter)\n'
           '   running = True\n'
+          '\n'
           '   while running:\n'
           '       try:\n'
           '           TARGET = await type(iter).__anext__(iter)\n'
           '       except StopAsyncIteration:\n'
           '           running = False\n'
           '       else:\n'
-          '           BLOCK\n'
+          '           SUITE\n'
           '   else:\n'
-          '       BLOCK2\n'
+          '       SUITE2\n'
           '\n'
           'See also "__aiter__()" and "__anext__()" for details.\n'
           '\n'
@@ -507,23 +508,27 @@ topics = {'assert': 'The "assert" statement\n'
           '\n'
           'The following code:\n'
           '\n'
-          '   async with EXPR as VAR:\n'
-          '       BLOCK\n'
+          '   async with EXPRESSION as TARGET:\n'
+          '       SUITE\n'
           '\n'
-          'Is semantically equivalent to:\n'
+          'is semantically equivalent to:\n'
           '\n'
-          '   mgr = (EXPR)\n'
-          '   aexit = type(mgr).__aexit__\n'
-          '   aenter = type(mgr).__aenter__(mgr)\n'
+          '   manager = (EXPRESSION)\n'
+          '   aexit = type(manager).__aexit__\n'
+          '   aenter = type(manager).__aenter__\n'
+          '   value = await aenter(manager)\n'
+          '   hit_except = False\n'
           '\n'
-          '   VAR = await aenter\n'
           '   try:\n'
-          '       BLOCK\n'
+          '       TARGET = value\n'
+          '       SUITE\n'
           '   except:\n'
-          '       if not await aexit(mgr, *sys.exc_info()):\n'
+          '       hit_except = True\n'
+          '       if not await aexit(manager, *sys.exc_info()):\n'
           '           raise\n'
-          '   else:\n'
-          '       await aexit(mgr, None, None, None)\n'
+          '   finally:\n'
+          '       if not hit_except:\n'
+          '           await aexit(manager, None, None, None)\n'
           '\n'
           'See also "__aenter__()" and "__aexit__()" for details.\n'
           '\n'
@@ -1470,8 +1475,8 @@ topics = {'assert': 'The "assert" statement\n'
           '                     | starred_and_keywords ["," '
           'keywords_arguments]\n'
           '                     | keywords_arguments\n'
-          '   positional_arguments ::= ["*"] expression ("," ["*"] '
-          'expression)*\n'
+          '   positional_arguments ::= positional_item ("," positional_item)*\n'
+          '   positional_item      ::= assignment_expression | "*" expression\n'
           '   starred_and_keywords ::= ("*" expression | keyword_item)\n'
           '                            ("," "*" expression | "," '
           'keyword_item)*\n'
@@ -1867,9 +1872,9 @@ topics = {'assert': 'The "assert" statement\n'
                 '  value is false. A counter-intuitive implication is that '
                 'not-a-number\n'
                 '  values are not equal to themselves.  For example, if "x =\n'
-                '  float(\'NaN\')", "3 < x", "x < 3", "x == x", "x != x" are '
-                'all false.\n'
-                '  This behavior is compliant with IEEE 754.\n'
+                '  float(\'NaN\')", "3 < x", "x < 3" and "x == x" are all '
+                'false, while "x\n'
+                '  != x" is true.  This behavior is compliant with IEEE 754.\n'
                 '\n'
                 '* "None" and "NotImplemented" are singletons.  **PEP 8** '
                 'advises\n'
@@ -2181,8 +2186,8 @@ topics = {'assert': 'The "assert" statement\n'
              '\n'
              'The "if" statement is used for conditional execution:\n'
              '\n'
-             '   if_stmt ::= "if" expression ":" suite\n'
-             '               ("elif" expression ":" suite)*\n'
+             '   if_stmt ::= "if" assignment_expression ":" suite\n'
+             '               ("elif" assignment_expression ":" suite)*\n'
              '               ["else" ":" suite]\n'
              '\n'
              'It selects exactly one of the suites by evaluating the '
@@ -2205,7 +2210,7 @@ topics = {'assert': 'The "assert" statement\n'
              'an\n'
              'expression is true:\n'
              '\n'
-             '   while_stmt ::= "while" expression ":" suite\n'
+             '   while_stmt ::= "while" assignment_expression ":" suite\n'
              '                  ["else" ":" suite]\n'
              '\n'
              'This repeatedly tests the expression and, if it is true, '
@@ -2518,11 +2523,13 @@ topics = {'assert': 'The "assert" statement\n'
              '"with_item")\n'
              '   is evaluated to obtain a context manager.\n'
              '\n'
-             '2. The context manager’s "__exit__()" is loaded for later use.\n'
+             '2. The context manager’s "__enter__()" is loaded for later use.\n'
+             '\n'
+             '3. The context manager’s "__exit__()" is loaded for later use.\n'
              '\n'
-             '3. The context manager’s "__enter__()" method is invoked.\n'
+             '4. The context manager’s "__enter__()" method is invoked.\n'
              '\n'
-             '4. If a target was included in the "with" statement, the return\n'
+             '5. 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 '
@@ -2535,9 +2542,9 @@ topics = {'assert': 'The "assert" statement\n'
              'occurring\n'
              '     within the suite would be. See step 6 below.\n'
              '\n'
-             '5. The suite is executed.\n'
+             '6. The suite is executed.\n'
              '\n'
-             '6. The context manager’s "__exit__()" method is invoked.  If an\n'
+             '7. 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, '
@@ -2559,18 +2566,42 @@ topics = {'assert': 'The "assert" statement\n'
              'proceeds\n'
              '   at the normal location for the kind of exit that was taken.\n'
              '\n'
+             'The following code:\n'
+             '\n'
+             '   with EXPRESSION as TARGET:\n'
+             '       SUITE\n'
+             '\n'
+             'is semantically equivalent to:\n'
+             '\n'
+             '   manager = (EXPRESSION)\n'
+             '   enter = type(manager).__enter__\n'
+             '   exit = type(manager).__exit__\n'
+             '   value = enter(manager)\n'
+             '   hit_except = False\n'
+             '\n'
+             '   try:\n'
+             '       TARGET = value\n'
+             '       SUITE\n'
+             '   except:\n'
+             '       hit_except = True\n'
+             '       if not exit(manager, *sys.exc_info()):\n'
+             '           raise\n'
+             '   finally:\n'
+             '       if not hit_except:\n'
+             '           exit(manager, None, None, None)\n'
+             '\n'
              'With more than one item, the context managers are processed as '
              'if\n'
              'multiple "with" statements were nested:\n'
              '\n'
              '   with A() as a, B() as b:\n'
-             '       suite\n'
+             '       SUITE\n'
              '\n'
-             'is equivalent to\n'
+             'is semantically equivalent to:\n'
              '\n'
              '   with A() as a:\n'
              '       with B() as b:\n'
-             '           suite\n'
+             '           SUITE\n'
              '\n'
              'Changed in version 3.1: Support for multiple context '
              'expressions.\n'
@@ -2934,24 +2965,25 @@ topics = {'assert': 'The "assert" statement\n'
              'The following code:\n'
              '\n'
              '   async for TARGET in ITER:\n'
-             '       BLOCK\n'
+             '       SUITE\n'
              '   else:\n'
-             '       BLOCK2\n'
+             '       SUITE2\n'
              '\n'
              'Is semantically equivalent to:\n'
              '\n'
              '   iter = (ITER)\n'
              '   iter = type(iter).__aiter__(iter)\n'
              '   running = True\n'
+             '\n'
              '   while running:\n'
              '       try:\n'
              '           TARGET = await type(iter).__anext__(iter)\n'
              '       except StopAsyncIteration:\n'
              '           running = False\n'
              '       else:\n'
-             '           BLOCK\n'
+             '           SUITE\n'
              '   else:\n'
-             '       BLOCK2\n'
+             '       SUITE2\n'
              '\n'
              'See also "__aiter__()" and "__anext__()" for details.\n'
              '\n'
@@ -2971,23 +3003,27 @@ topics = {'assert': 'The "assert" statement\n'
              '\n'
              'The following code:\n'
              '\n'
-             '   async with EXPR as VAR:\n'
-             '       BLOCK\n'
+             '   async with EXPRESSION as TARGET:\n'
+             '       SUITE\n'
              '\n'
-             'Is semantically equivalent to:\n'
+             'is semantically equivalent to:\n'
              '\n'
-             '   mgr = (EXPR)\n'
-             '   aexit = type(mgr).__aexit__\n'
-             '   aenter = type(mgr).__aenter__(mgr)\n'
+             '   manager = (EXPRESSION)\n'
+             '   aexit = type(manager).__aexit__\n'
+             '   aenter = type(manager).__aenter__\n'
+             '   value = await aenter(manager)\n'
+             '   hit_except = False\n'
              '\n'
-             '   VAR = await aenter\n'
              '   try:\n'
-             '       BLOCK\n'
+             '       TARGET = value\n'
+             '       SUITE\n'
              '   except:\n'
-             '       if not await aexit(mgr, *sys.exc_info()):\n'
+             '       hit_except = True\n'
+             '       if not await aexit(manager, *sys.exc_info()):\n'
              '           raise\n'
-             '   else:\n'
-             '       await aexit(mgr, None, None, None)\n'
+             '   finally:\n'
+             '       if not hit_except:\n'
+             '           await aexit(manager, None, None, None)\n'
              '\n'
              'See also "__aenter__()" and "__aexit__()" for details.\n'
              '\n'
@@ -3100,7 +3136,7 @@ topics = {'assert': 'The "assert" statement\n'
                 '\n'
                 'When a description of an arithmetic operator below uses the '
                 'phrase\n'
-                '“the numeric arguments are converted to a common type,” this '
+                '“the numeric arguments are converted to a common type”, this '
                 'means\n'
                 'that the operator implementation for built-in types works as '
                 'follows:\n'
@@ -4366,8 +4402,8 @@ topics = {'assert': 'The "assert" statement\n'
          '\n'
          'The "if" statement is used for conditional execution:\n'
          '\n'
-         '   if_stmt ::= "if" expression ":" suite\n'
-         '               ("elif" expression ":" suite)*\n'
+         '   if_stmt ::= "if" assignment_expression ":" suite\n'
+         '               ("elif" assignment_expression ":" suite)*\n'
          '               ["else" ":" suite]\n'
          '\n'
          'It selects exactly one of the suites by evaluating the expressions '
@@ -4783,7 +4819,7 @@ topics = {'assert': 'The "assert" statement\n'
               '[","]\n'
               '   starred_expression ::= expression | (starred_item ",")* '
               '[starred_item]\n'
-              '   starred_item       ::= expression | "*" or_expr\n'
+              '   starred_item       ::= assignment_expression | "*" or_expr\n'
               '\n'
               'Except when part of a list or set display, an expression list\n'
               'containing at least one comma yields a tuple.  The length of '
@@ -5093,11 +5129,11 @@ topics = {'assert': 'The "assert" statement\n'
                   'only\n'
                   'supported by the numeric types.\n'
                   '\n'
-                  'A general convention is that an empty format string ("""") '
+                  'A general convention is that an empty format specification '
                   'produces\n'
                   'the same result as if you had called "str()" on the value. '
                   'A non-empty\n'
-                  'format string typically modifies the result.\n'
+                  'format specification typically modifies the result.\n'
                   '\n'
                   'The general form of a *standard format specifier* is:\n'
                   '\n'
@@ -5250,9 +5286,12 @@ topics = {'assert': 'The "assert" statement\n'
                   'Changed in version 3.6: Added the "\'_\'" option (see also '
                   '**PEP 515**).\n'
                   '\n'
-                  '*width* is a decimal integer defining the minimum field '
-                  'width.  If not\n'
-                  'specified, then the field width will be determined by the '
+                  '*width* is a decimal integer defining the minimum total '
+                  'field width,\n'
+                  'including any prefixes, separators, and other formatting '
+                  'characters.\n'
+                  'If not specified, then the field width will be determined '
+                  'by the\n'
                   'content.\n'
                   '\n'
                   'When no explicit alignment is given, preceding the *width* '
@@ -5900,19 +5939,18 @@ topics = {'assert': 'The "assert" statement\n'
                '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 and\n'
-               '   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'
+               '   System-defined names, informally known as “dunder” names. '
+               'These\n'
+               '   names are defined by the interpreter and its '
+               'implementation\n'
+               '   (including the standard library). Current system names are\n'
+               '   discussed in the Special method names section and '
+               'elsewhere. More\n'
+               '   will likely be defined in future versions of Python.  *Any* '
+               'use of\n'
+               '   "__*__" names, in any context, that does not follow '
+               'explicitly\n'
+               '   documented use, is subject to breakage without warning.\n'
                '\n'
                '"__*"\n'
                '   Class-private names.  Names in this category, when used '
@@ -6048,19 +6086,19 @@ topics = {'assert': 'The "assert" statement\n'
                 '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 and\n'
-                '   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'
+                '   System-defined names, informally known as “dunder” names. '
+                'These\n'
+                '   names are defined by the interpreter and its '
+                'implementation\n'
+                '   (including the standard library). Current system names '
+                'are\n'
+                '   discussed in the Special method names section and '
+                'elsewhere. More\n'
+                '   will likely be defined in future versions of Python.  '
+                '*Any* use of\n'
+                '   "__*__" names, in any context, that does not follow '
+                'explicitly\n'
+                '   documented use, is subject to breakage without warning.\n'
                 '\n'
                 '"__*"\n'
                 '   Class-private names.  Names in this category, when used '
@@ -6075,8 +6113,8 @@ topics = {'assert': 'The "assert" statement\n'
        '\n'
        'The "if" statement is used for conditional execution:\n'
        '\n'
-       '   if_stmt ::= "if" expression ":" suite\n'
-       '               ("elif" expression ":" suite)*\n'
+       '   if_stmt ::= "if" assignment_expression ":" suite\n'
+       '               ("elif" assignment_expression ":" suite)*\n'
        '               ["else" ":" suite]\n'
        '\n'
        'It selects exactly one of the suites by evaluating the expressions '
@@ -6803,7 +6841,7 @@ topics = {'assert': 'The "assert" statement\n'
                   'object.__rfloordiv__(self, other)\n'
                   'object.__rmod__(self, other)\n'
                   'object.__rdivmod__(self, other)\n'
-                  'object.__rpow__(self, other)\n'
+                  'object.__rpow__(self, other[, modulo])\n'
                   'object.__rlshift__(self, other)\n'
                   'object.__rrshift__(self, other)\n'
                   'object.__rand__(self, other)\n'
@@ -6945,7 +6983,7 @@ topics = {'assert': 'The "assert" statement\n'
             'program is represented by objects or by relations between '
             'objects. (In\n'
             'a sense, and in conformance to Von Neumann’s model of a “stored\n'
-            'program computer,” code is also represented by objects.)\n'
+            'program computer”, code is also represented by objects.)\n'
             '\n'
             'Every object has an identity, a type and a value.  An object’s\n'
             '*identity* never changes once it has been created; you may think '
@@ -8963,7 +9001,13 @@ topics = {'assert': 'The "assert" statement\n'
                  'bases,\n'
                  '**kwds)" (where the additional keyword arguments, if any, '
                  'come from\n'
-                 'the class definition).\n'
+                 'the class definition). The "__prepare__" method should be '
+                 'implemented\n'
+                 'as a "classmethod()". The namespace returned by '
+                 '"__prepare__" is\n'
+                 'passed in to "__new__", but when the final class object is '
+                 'created the\n'
+                 'namespace is copied into a new "dict".\n'
                  '\n'
                  'If the metaclass has no "__prepare__" attribute, then the '
                  'class\n'
@@ -9477,7 +9521,7 @@ topics = {'assert': 'The "assert" statement\n'
                  'object.__rfloordiv__(self, other)\n'
                  'object.__rmod__(self, other)\n'
                  'object.__rdivmod__(self, other)\n'
-                 'object.__rpow__(self, other)\n'
+                 'object.__rpow__(self, other[, modulo])\n'
                  'object.__rlshift__(self, other)\n'
                  'object.__rrshift__(self, other)\n'
                  'object.__rand__(self, other)\n'
@@ -11387,6 +11431,16 @@ topics = {'assert': 'The "assert" statement\n'
           '      then they can be used interchangeably to index the same\n'
           '      dictionary entry.\n'
           '\n'
+          '      Dictionaries preserve insertion order, meaning that keys will '
+          'be\n'
+          '      produced in the same order they were added sequentially over '
+          'the\n'
+          '      dictionary. Replacing an existing key does not change the '
+          'order,\n'
+          '      however removing a key and re-inserting it will add it to '
+          'the\n'
+          '      end instead of keeping its old place.\n'
+          '\n'
           '      Dictionaries are mutable; they can be created by the "{...}"\n'
           '      notation (see section Dictionary displays).\n'
           '\n'
@@ -11395,6 +11449,13 @@ topics = {'assert': 'The "assert" statement\n'
           '"collections"\n'
           '      module.\n'
           '\n'
+          '      Changed in version 3.7: Dictionaries did not preserve '
+          'insertion\n'
+          '      order in versions of Python before 3.6. In CPython 3.6,\n'
+          '      insertion order was preserved, but it was considered an\n'
+          '      implementation detail at that time rather than a language\n'
+          '      guarantee.\n'
+          '\n'
           'Callable types\n'
           '   These are the types to which the function call operation (see\n'
           '   section Calls) can be applied:\n'
@@ -11918,8 +11979,9 @@ topics = {'assert': 'The "assert" statement\n'
           '      bytecode offsets to line numbers (for details see the source\n'
           '      code of the interpreter); "co_stacksize" is the required '
           'stack\n'
-          '      size (including local variables); "co_flags" is an integer\n'
-          '      encoding a number of flags for the interpreter.\n'
+          '      size; "co_flags" is an integer encoding a number of flags '
+          'for\n'
+          '      the interpreter.\n'
           '\n'
           '      The following flag bits are defined for "co_flags": bit '
           '"0x04"\n'
@@ -12372,6 +12434,8 @@ topics = {'assert': 'The "assert" statement\n'
                  'dictionary. This\n'
                  '      is a shortcut for "reversed(d.keys())".\n'
                  '\n'
+                 '      New in version 3.8.\n'
+                 '\n'
                  '   setdefault(key[, default])\n'
                  '\n'
                  '      If *key* is in the dictionary, return its value.  If '
@@ -13541,7 +13605,7 @@ topics = {'assert': 'The "assert" statement\n'
           'The "while" statement is used for repeated execution as long as an\n'
           'expression is true:\n'
           '\n'
-          '   while_stmt ::= "while" expression ":" suite\n'
+          '   while_stmt ::= "while" assignment_expression ":" suite\n'
           '                  ["else" ":" suite]\n'
           '\n'
           'This repeatedly tests the expression and, if it is true, executes '
@@ -13577,11 +13641,13 @@ topics = {'assert': 'The "assert" statement\n'
          '1. The context expression (the expression given in the "with_item")\n'
          '   is evaluated to obtain a context manager.\n'
          '\n'
-         '2. The context manager’s "__exit__()" is loaded for later use.\n'
+         '2. The context manager’s "__enter__()" is loaded for later use.\n'
          '\n'
-         '3. The context manager’s "__enter__()" method is invoked.\n'
+         '3. The context manager’s "__exit__()" is loaded for later use.\n'
          '\n'
-         '4. If a target was included in the "with" statement, the return\n'
+         '4. The context manager’s "__enter__()" method is invoked.\n'
+         '\n'
+         '5. 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'
@@ -13591,9 +13657,9 @@ topics = {'assert': 'The "assert" statement\n'
          '     target list, it will be treated the same as an error occurring\n'
          '     within the suite would be. See step 6 below.\n'
          '\n'
-         '5. The suite is executed.\n'
+         '6. The suite is executed.\n'
          '\n'
-         '6. The context manager’s "__exit__()" method is invoked.  If an\n'
+         '7. 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'
@@ -13613,17 +13679,41 @@ topics = {'assert': 'The "assert" statement\n'
          'proceeds\n'
          '   at the normal location for the kind of exit that was taken.\n'
          '\n'
+         'The following code:\n'
+         '\n'
+         '   with EXPRESSION as TARGET:\n'
+         '       SUITE\n'
+         '\n'
+         'is semantically equivalent to:\n'
+         '\n'
+         '   manager = (EXPRESSION)\n'
+         '   enter = type(manager).__enter__\n'
+         '   exit = type(manager).__exit__\n'
+         '   value = enter(manager)\n'
+         '   hit_except = False\n'
+         '\n'
+         '   try:\n'
+         '       TARGET = value\n'
+         '       SUITE\n'
+         '   except:\n'
+         '       hit_except = True\n'
+         '       if not exit(manager, *sys.exc_info()):\n'
+         '           raise\n'
+         '   finally:\n'
+         '       if not hit_except:\n'
+         '           exit(manager, None, None, None)\n'
+         '\n'
          'With more than one item, the context managers are processed as if\n'
          'multiple "with" statements were nested:\n'
          '\n'
          '   with A() as a, B() as b:\n'
-         '       suite\n'
+         '       SUITE\n'
          '\n'
-         'is equivalent to\n'
+         'is semantically equivalent to:\n'
          '\n'
          '   with A() as a:\n'
          '       with B() as b:\n'
-         '           suite\n'
+         '           SUITE\n'
          '\n'
          'Changed in version 3.1: Support for multiple context expressions.\n'
          '\n'
index 8f1d55ddf7d69d67bbfffc828057040ed6b31e98..bfb7b1ccd93466687fe5fd56887e6c68eb182f18 100644 (file)
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -44,7 +44,7 @@ The special characters are:
     "|"      A|B, creates an RE that will match either A or B.
     (...)    Matches the RE inside the parentheses.
              The contents can be retrieved or matched later in the string.
-    (?aiLmsux) Set the A, I, L, M, S, U, or X flag for the RE (see below).
+    (?aiLmsux) The letters set the corresponding flags defined below.
     (?:...)  Non-grouping version of regular parentheses.
     (?P<name>...) The substring matched by the group is accessible by name.
     (?P=name)     Matches the text matched earlier by the group named name.
@@ -97,7 +97,9 @@ This module exports the following functions:
     purge     Clear the regular expression cache.
     escape    Backslash all non-alphanumerics in a string.
 
-Some of the functions in this module takes flags as optional parameters:
+Each function other than purge and escape can take an optional 'flags' argument
+consisting of one or more of the following module constants, joined by "|".
+A, L, and U are mutually exclusive.
     A  ASCII       For string patterns, make \w, \W, \b, \B, \d, \D
                    match the corresponding ASCII character categories
                    (rather than the whole Unicode categories, which is the
index 8adc91e32f319e734bc419d2a9299f767c4b9730..0f54f3e71b6fe8ba9922e6d77dab607fd08073a1 100644 (file)
@@ -15,6 +15,7 @@ import importlib.machinery # importlib first so we can test #15386 via -m
 import importlib.util
 import io
 import types
+import os
 from pkgutil import read_code, get_importer
 
 __all__ = [
@@ -229,11 +230,12 @@ def _get_main_module_details(error=ImportError):
 
 def _get_code_from_file(run_name, fname):
     # Check for a compiled file first
-    with io.open_code(fname) as f:
+    decoded_path = os.path.abspath(os.fsdecode(fname))
+    with io.open_code(decoded_path) as f:
         code = read_code(f)
     if code is None:
         # That didn't work, so try it as normal source code
-        with io.open_code(fname) as f:
+        with io.open_code(decoded_path) as f:
             code = compile(f.read(), fname, 'exec')
     return code, fname
 
index 755ce392e6d9ae09f8f8a311f12b6414159687b2..1f05d80f32a8fcb8a3895d4cb8f27c1c8dafa3b6 100644 (file)
@@ -235,6 +235,8 @@ def copyfile(src, dst, *, follow_symlinks=True):
     symlink will be created instead of copying the file it points to.
 
     """
+    sys.audit("shutil.copyfile", src, dst)
+
     if _samefile(src, dst):
         raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
 
@@ -289,6 +291,8 @@ def copymode(src, dst, *, follow_symlinks=True):
     (e.g. Linux) this method does nothing.
 
     """
+    sys.audit("shutil.copymode", src, dst)
+
     if not follow_symlinks and _islink(src) and os.path.islink(dst):
         if hasattr(os, 'lchmod'):
             stat_func, chmod_func = os.lstat, os.lchmod
@@ -340,6 +344,8 @@ def copystat(src, dst, *, follow_symlinks=True):
     If the optional flag `follow_symlinks` is not set, symlinks aren't
     followed if and only if both `src` and `dst` are symlinks.
     """
+    sys.audit("shutil.copystat", src, dst)
+
     def _nop(*args, ns=None, follow_symlinks=None):
         pass
 
@@ -442,7 +448,7 @@ def ignore_patterns(*patterns):
 def _copytree(entries, src, dst, symlinks, ignore, copy_function,
               ignore_dangling_symlinks, dirs_exist_ok=False):
     if ignore is not None:
-        ignored_names = ignore(src, {x.name for x in entries})
+        ignored_names = ignore(os.fspath(src), [x.name for x in entries])
     else:
         ignored_names = set()
 
@@ -766,6 +772,7 @@ def move(src, dst, copy_function=copy2):
     the issues this implementation glosses over.
 
     """
+    sys.audit("shutil.move", src, dst)
     real_dst = dst
     if os.path.isdir(dst):
         if _samefile(src, dst):
@@ -1193,6 +1200,8 @@ def unpack_archive(filename, extract_dir=None, format=None):
 
     In case none is found, a ValueError is raised.
     """
+    sys.audit("shutil.unpack_archive", filename, extract_dir, format)
+
     if extract_dir is None:
         extract_dir = os.getcwd()
 
@@ -1260,6 +1269,7 @@ def chown(path, user=None, group=None):
     user and group can be the uid/gid or the user/group names, and in that case,
     they are converted to their respective uid/gid.
     """
+    sys.audit('shutil.chown', path, user, group)
 
     if user is None and group is None:
         raise ValueError("user and/or group must be set")
index 5b17906ef479a12ebaddfa4696fc9b3adc464c1b..f83f36d0ada55c71dc9397709153c06298b7c0cf 100644 (file)
@@ -843,7 +843,7 @@ def create_server(address, *, family=AF_INET, backlog=None, reuse_port=False,
     connections. When false it will explicitly disable this option on
     platforms that enable it by default (e.g. Linux).
 
-    >>> with create_server((None, 8000)) as server:
+    >>> with create_server(('', 8000)) as server:
     ...     while True:
     ...         conn, addr = server.accept()
     ...         # handle new connection
index dd5aec50d1867c8f7cb0484735edc5baaefe0896..ce97655c66be8754c65b64e34358b15175650254 100644 (file)
@@ -68,7 +68,7 @@ class RegressionTests(unittest.TestCase):
     def CheckColumnNameWithSpaces(self):
         cur = self.con.cursor()
         cur.execute('select 1 as "foo bar [datetime]"')
-        self.assertEqual(cur.description[0][0], "foo bar")
+        self.assertEqual(cur.description[0][0], "foo bar [datetime]")
 
         cur.execute('select 1 as "foo baz"')
         self.assertEqual(cur.description[0][0], "foo baz")
index 19ecd07500fec504461ac46fc89da39b56da235e..d26a9cb93f0888235ecfe26f55d9ecb321c592da 100644 (file)
@@ -275,13 +275,13 @@ class ColNamesTests(unittest.TestCase):
 
     def CheckColName(self):
         self.cur.execute("insert into test(x) values (?)", ("xxx",))
-        self.cur.execute('select x as "x [bar]" from test')
+        self.cur.execute('select x as "x [bar]" from test')
         val = self.cur.fetchone()[0]
         self.assertEqual(val, "<xxx>")
 
         # Check if the stripping of colnames works. Everything after the first
-        # whitespace should be stripped.
-        self.assertEqual(self.cur.description[0][0], "x")
+        # '[' (and the preceeding space) should be stripped.
+        self.assertEqual(self.cur.description[0][0], "x y")
 
     def CheckCaseInConverterName(self):
         self.cur.execute("select 'other' as \"x [b1b1]\"")
index 85b9ea07854669a61322920663d4d22272dbb6e8..5c2c2f05093f7e3a71aa1f6cde8abd2f336dbac5 100644 (file)
@@ -1848,9 +1848,9 @@ class Popen(object):
             with _PopenSelector() as selector:
                 if self.stdin and input:
                     selector.register(self.stdin, selectors.EVENT_WRITE)
-                if self.stdout:
+                if self.stdout and not self.stdout.closed:
                     selector.register(self.stdout, selectors.EVENT_READ)
-                if self.stderr:
+                if self.stderr and not self.stderr.closed:
                     selector.register(self.stderr, selectors.EVENT_READ)
 
                 while selector.get_map():
index 5bea7cf6155486907c532af2aab26ae1dc339bfa..ac0a64ff58f795ad1a50aa750f2703136e01bf64 100644 (file)
@@ -197,7 +197,7 @@ class Symbol(object):
         return bool(self.__scope == GLOBAL_EXPLICIT)
 
     def is_local(self):
-        return bool(self.__flags & DEF_BOUND)
+        return bool(self.__scope in (LOCAL, CELL))
 
     def is_annotated(self):
         return bool(self.__flags & DEF_ANNOT)
index 2c06f9160c658a745d7de251e9e928f74a4c6d5a..d31b9cbb51d654631672b10baf650bb9bbc38fd5 100755 (executable)
@@ -1655,13 +1655,12 @@ class TarFile(object):
             raise ValueError("mode must be 'r', 'w' or 'x'")
 
         try:
-            import gzip
-            gzip.GzipFile
-        except (ImportError, AttributeError):
+            from gzip import GzipFile
+        except ImportError:
             raise CompressionError("gzip module is not available")
 
         try:
-            fileobj = gzip.GzipFile(name, mode + "b", compresslevel, fileobj)
+            fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
         except OSError:
             if fileobj is not None and mode == 'r':
                 raise ReadError("not a gzip file")
@@ -1689,12 +1688,11 @@ class TarFile(object):
             raise ValueError("mode must be 'r', 'w' or 'x'")
 
         try:
-            import bz2
+            from bz2 import BZ2File
         except ImportError:
             raise CompressionError("bz2 module is not available")
 
-        fileobj = bz2.BZ2File(fileobj or name, mode,
-                              compresslevel=compresslevel)
+        fileobj = BZ2File(fileobj or name, mode, compresslevel=compresslevel)
 
         try:
             t = cls.taropen(name, mode, fileobj, **kwargs)
@@ -1718,15 +1716,15 @@ class TarFile(object):
             raise ValueError("mode must be 'r', 'w' or 'x'")
 
         try:
-            import lzma
+            from lzma import LZMAFile, LZMAError
         except ImportError:
             raise CompressionError("lzma module is not available")
 
-        fileobj = lzma.LZMAFile(fileobj or name, mode, preset=preset)
+        fileobj = LZMAFile(fileobj or name, mode, preset=preset)
 
         try:
             t = cls.taropen(name, mode, fileobj, **kwargs)
-        except (lzma.LZMAError, EOFError):
+        except (LZMAError, EOFError):
             fileobj.close()
             if mode == 'r':
                 raise ReadError("not an lzma file")
index 62875540f8b92041446e7213d6debdf8fbee0fc6..5b990e067f23a540827fd20dbb8c9c51f18fa0bb 100644 (file)
@@ -735,7 +735,7 @@ class SpooledTemporaryFile:
         return self._file.readlines(*args)
 
     def seek(self, *args):
-        self._file.seek(*args)
+        return self._file.seek(*args)
 
     @property
     def softspace(self):
index 983770f35761d0048eac697d76dcda96d733477a..ff58481f00314d1dc08f84b7c46db17fe01948f3 100644 (file)
@@ -2778,6 +2778,24 @@ class _TestPoolWorkerLifetime(BaseTestCase):
         for (j, res) in enumerate(results):
             self.assertEqual(res.get(), sqr(j))
 
+    def test_worker_finalization_via_atexit_handler_of_multiprocessing(self):
+        # tests cases against bpo-38744 and bpo-39360
+        cmd = '''if 1:
+            from multiprocessing import Pool
+            problem = None
+            class A:
+                def __init__(self):
+                    self.pool = Pool(processes=1)
+            def test():
+                global problem
+                problem = A()
+                problem.pool.map(float, tuple(range(10)))
+            if __name__ == "__main__":
+                test()
+        '''
+        rc, out, err = test.support.script_helper.assert_python_ok('-c', cmd)
+        self.assertEqual(rc, 0)
+
 #
 # Test of creating a customized manager class
 #
@@ -3272,6 +3290,19 @@ class _TestListener(BaseTestCase):
         if self.TYPE == 'processes':
             self.assertRaises(OSError, l.accept)
 
+    @unittest.skipUnless(util.abstract_sockets_supported,
+                         "test needs abstract socket support")
+    def test_abstract_socket(self):
+        with self.connection.Listener("\0something") as listener:
+            with self.connection.Client(listener.address) as client:
+                with listener.accept() as d:
+                    client.send(1729)
+                    self.assertEqual(d.recv(), 1729)
+
+        if self.TYPE == 'processes':
+            self.assertRaises(OSError, listener.accept)
+
+
 class _TestListenerClient(BaseTestCase):
 
     ALLOWED_TYPES = ('processes', 'threads')
@@ -3797,7 +3828,9 @@ class _TestSharedMemory(BaseTestCase):
         sms.close()
 
     def test_shared_memory_across_processes(self):
-        sms = shared_memory.SharedMemory('test02_tsmap', True, size=512)
+        # bpo-40135: don't define shared memory block's name in case of
+        # the failure when we run multiprocessing tests in parallel.
+        sms = shared_memory.SharedMemory(create=True, size=512)
         self.addCleanup(sms.unlink)
 
         # Verify remote attachment to existing block by name is working.
@@ -3933,9 +3966,21 @@ class _TestSharedMemory(BaseTestCase):
         sl[4] = 'some'  # Change type at a given position.
         self.assertEqual(sl[4], 'some')
         self.assertEqual(sl.format, '8s8sdq8sxxxxxxx?q')
-        with self.assertRaises(ValueError):
-            sl[4] = 'far too many'  # Exceeds available storage.
+        with self.assertRaisesRegex(ValueError,
+                                    "exceeds available storage"):
+            sl[4] = 'far too many'
         self.assertEqual(sl[4], 'some')
+        sl[0] = 'encodés'  # Exactly 8 bytes of UTF-8 data
+        self.assertEqual(sl[0], 'encodés')
+        self.assertEqual(sl[1], b'HoWdY')  # no spillage
+        with self.assertRaisesRegex(ValueError,
+                                    "exceeds available storage"):
+            sl[0] = 'encodées'  # Exactly 9 bytes of UTF-8 data
+        self.assertEqual(sl[1], b'HoWdY')
+        with self.assertRaisesRegex(ValueError,
+                                    "exceeds available storage"):
+            sl[1] = b'123456789'
+        self.assertEqual(sl[1], b'HoWdY')
 
         # Exercise count().
         with warnings.catch_warnings():
@@ -5267,10 +5312,9 @@ class TestSyncManagerTypes(unittest.TestCase):
             dt = time.monotonic() - start_time
             if dt >= 5.0:
                 test.support.environment_altered = True
-                print("Warning -- multiprocessing.Manager still has %s active "
-                      "children after %s seconds"
-                      % (multiprocessing.active_children(), dt),
-                      file=sys.stderr)
+                support.print_warning(f"multiprocessing.Manager still has "
+                                      f"{multiprocessing.active_children()} "
+                                      f"active children after {dt} seconds")
                 break
 
     def run_worker(self, worker, obj):
@@ -5470,15 +5514,13 @@ class BaseMixin(object):
         processes = set(multiprocessing.process._dangling) - set(cls.dangling[0])
         if processes:
             test.support.environment_altered = True
-            print('Warning -- Dangling processes: %s' % processes,
-                  file=sys.stderr)
+            support.print_warning(f'Dangling processes: {processes}')
         processes = None
 
         threads = set(threading._dangling) - set(cls.dangling[1])
         if threads:
             test.support.environment_altered = True
-            print('Warning -- Dangling threads: %s' % threads,
-                  file=sys.stderr)
+            support.print_warning(f'Dangling threads: {threads}')
         threads = None
 
 
@@ -5546,10 +5588,9 @@ class ManagerMixin(BaseMixin):
             dt = time.monotonic() - start_time
             if dt >= 5.0:
                 test.support.environment_altered = True
-                print("Warning -- multiprocessing.Manager still has %s active "
-                      "children after %s seconds"
-                      % (multiprocessing.active_children(), dt),
-                      file=sys.stderr)
+                support.print_warning(f"multiprocessing.Manager still has "
+                                      f"{multiprocessing.active_children()} "
+                                      f"active children after {dt} seconds")
                 break
 
         gc.collect()                       # do garbage collection
@@ -5558,9 +5599,9 @@ class ManagerMixin(BaseMixin):
             # ensure that all processes which hold a reference to a
             # managed object have been joined.
             test.support.environment_altered = True
-            print('Warning -- Shared objects which still exist at manager '
-                  'shutdown:')
-            print(cls.manager._debug_info())
+            support.print_warning('Shared objects which still exist '
+                                  'at manager shutdown:')
+            support.print_warning(cls.manager._debug_info())
         cls.manager.shutdown()
         cls.manager.join()
         cls.manager = None
@@ -5657,16 +5698,14 @@ def install_tests_in_module_dict(remote_globs, start_method):
         if processes:
             need_sleep = True
             test.support.environment_altered = True
-            print('Warning -- Dangling processes: %s' % processes,
-                  file=sys.stderr)
+            support.print_warning(f'Dangling processes: {processes}')
         processes = None
 
         threads = set(threading._dangling) - set(dangling[1])
         if threads:
             need_sleep = True
             test.support.environment_altered = True
-            print('Warning -- Dangling threads: %s' % threads,
-                  file=sys.stderr)
+            support.print_warning(f'Dangling threads: {threads}')
         threads = None
 
         # Sleep 500 ms to give time to child processes to complete.
index 33f320992bb23f4833712867ea633279cbecc8e9..b90c4b8f75794d39a61da68d065437c380553414 100644 (file)
@@ -327,6 +327,28 @@ def test_winreg():
     CloseKey(kv)
 
 
+def test_socket():
+    import socket
+
+    def hook(event, args):
+        if event.startswith("socket."):
+            print(event, *args)
+
+    sys.addaudithook(hook)
+
+    socket.gethostname()
+
+    # Don't care if this fails, we just want the audit message
+    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+    try:
+        # Don't care if this fails, we just want the audit message
+        sock.bind(('127.0.0.1', 8080))
+    except Exception:
+        pass
+    finally:
+        sock.close()
+
+
 if __name__ == "__main__":
     from test.libregrtest.setup import suppress_msvcrt_asserts
 
index 0d84d5ef5359ad4fab7ed96f9b22fbbf3f60b3af..845b165a9ed3c1c6bb6d015c6bc35b153504773d 100644 (file)
@@ -3260,3 +3260,108 @@ exit:
 static PyObject *
 test_keyword_only_parameter_impl(PyObject *module, PyBytesObject *co_lnotab)
 /*[clinic end generated code: output=f25914b402039493 input=303df5046c7e37a3]*/
+
+
+/*[clinic input]
+output push
+output preset buffer
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=5bff3376ee0df0b5]*/
+
+#ifdef CONDITION_A
+/*[clinic input]
+test_preprocessor_guarded_condition_a
+[clinic start generated code]*/
+
+static PyObject *
+test_preprocessor_guarded_condition_a_impl(PyObject *module)
+/*[clinic end generated code: output=ad012af18085add6 input=8edb8706a98cda7e]*/
+#elif CONDITION_B
+/*[clinic input]
+test_preprocessor_guarded_elif_condition_b
+[clinic start generated code]*/
+
+static PyObject *
+test_preprocessor_guarded_elif_condition_b_impl(PyObject *module)
+/*[clinic end generated code: output=615f2dee82b138d1 input=53777cebbf7fee32]*/
+#else
+/*[clinic input]
+test_preprocessor_guarded_else
+[clinic start generated code]*/
+
+static PyObject *
+test_preprocessor_guarded_else_impl(PyObject *module)
+/*[clinic end generated code: output=13af7670aac51b12 input=6657ab31d74c29fc]*/
+#endif
+
+/*[clinic input]
+dump buffer
+output pop
+[clinic start generated code]*/
+
+#if defined(CONDITION_A)
+
+PyDoc_STRVAR(test_preprocessor_guarded_condition_a__doc__,
+"test_preprocessor_guarded_condition_a($module, /)\n"
+"--\n"
+"\n");
+
+#define TEST_PREPROCESSOR_GUARDED_CONDITION_A_METHODDEF    \
+    {"test_preprocessor_guarded_condition_a", (PyCFunction)test_preprocessor_guarded_condition_a, METH_NOARGS, test_preprocessor_guarded_condition_a__doc__},
+
+static PyObject *
+test_preprocessor_guarded_condition_a(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return test_preprocessor_guarded_condition_a_impl(module);
+}
+
+#endif /* defined(CONDITION_A) */
+
+#if !defined(CONDITION_A) && (CONDITION_B)
+
+PyDoc_STRVAR(test_preprocessor_guarded_elif_condition_b__doc__,
+"test_preprocessor_guarded_elif_condition_b($module, /)\n"
+"--\n"
+"\n");
+
+#define TEST_PREPROCESSOR_GUARDED_ELIF_CONDITION_B_METHODDEF    \
+    {"test_preprocessor_guarded_elif_condition_b", (PyCFunction)test_preprocessor_guarded_elif_condition_b, METH_NOARGS, test_preprocessor_guarded_elif_condition_b__doc__},
+
+static PyObject *
+test_preprocessor_guarded_elif_condition_b(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return test_preprocessor_guarded_elif_condition_b_impl(module);
+}
+
+#endif /* !defined(CONDITION_A) && (CONDITION_B) */
+
+#if !defined(CONDITION_A) && !(CONDITION_B)
+
+PyDoc_STRVAR(test_preprocessor_guarded_else__doc__,
+"test_preprocessor_guarded_else($module, /)\n"
+"--\n"
+"\n");
+
+#define TEST_PREPROCESSOR_GUARDED_ELSE_METHODDEF    \
+    {"test_preprocessor_guarded_else", (PyCFunction)test_preprocessor_guarded_else, METH_NOARGS, test_preprocessor_guarded_else__doc__},
+
+static PyObject *
+test_preprocessor_guarded_else(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return test_preprocessor_guarded_else_impl(module);
+}
+
+#endif /* !defined(CONDITION_A) && !(CONDITION_B) */
+
+#ifndef TEST_PREPROCESSOR_GUARDED_CONDITION_A_METHODDEF
+    #define TEST_PREPROCESSOR_GUARDED_CONDITION_A_METHODDEF
+#endif /* !defined(TEST_PREPROCESSOR_GUARDED_CONDITION_A_METHODDEF) */
+
+#ifndef TEST_PREPROCESSOR_GUARDED_ELIF_CONDITION_B_METHODDEF
+    #define TEST_PREPROCESSOR_GUARDED_ELIF_CONDITION_B_METHODDEF
+#endif /* !defined(TEST_PREPROCESSOR_GUARDED_ELIF_CONDITION_B_METHODDEF) */
+
+#ifndef TEST_PREPROCESSOR_GUARDED_ELSE_METHODDEF
+    #define TEST_PREPROCESSOR_GUARDED_ELSE_METHODDEF
+#endif /* !defined(TEST_PREPROCESSOR_GUARDED_ELSE_METHODDEF) */
+/*[clinic end generated code: output=3804bb18d454038c input=3fc80c9989d2f2e1]*/
index c8fedc7ad329bd5080857ab2764f3b1b5e6264ec..c0bb051bd078324f01820e59117c8400c07af867 100644 (file)
@@ -207,10 +207,17 @@ def _create_parser():
     group.add_argument('-m', '--match', metavar='PAT',
                        dest='match_tests', action='append',
                        help='match test cases and methods with glob pattern PAT')
+    group.add_argument('-i', '--ignore', metavar='PAT',
+                       dest='ignore_tests', action='append',
+                       help='ignore 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('--ignorefile', metavar='FILENAME',
+                       dest='ignore_filename',
+                       help='similar to --matchfile but it receives patterns '
+                            'from text file to ignore')
     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,...',
@@ -317,7 +324,8 @@ def _parse_args(args, **kwargs):
          findleaks=1, 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, ignore_tests=None,
+         pgo=False)
     for k, v in kwargs.items():
         if not hasattr(ns, k):
             raise TypeError('%r is an invalid keyword argument '
@@ -395,6 +403,12 @@ def _parse_args(args, **kwargs):
         with open(ns.match_filename) as fp:
             for line in fp:
                 ns.match_tests.append(line.strip())
+    if ns.ignore_filename:
+        if ns.ignore_tests is None:
+            ns.ignore_tests = []
+        with open(ns.ignore_filename) as fp:
+            for line in fp:
+                ns.ignore_tests.append(line.strip())
     if ns.forever:
         # --forever implies --failfast
         ns.failfast = True
index 76ad3359f2d7ac3a99fe387ac254d807ade71c64..95b4856c8bed7d7aefdf14ccea026ff56124d793 100644 (file)
@@ -287,7 +287,7 @@ class Regrtest:
 
     def list_cases(self):
         support.verbose = False
-        support.set_match_tests(self.ns.match_tests)
+        support.set_match_tests(self.ns.match_tests, self.ns.ignore_tests)
 
         for test_name in self.selected:
             abstest = get_abs_module(self.ns, test_name)
@@ -394,7 +394,10 @@ class Regrtest:
 
         save_modules = sys.modules.keys()
 
-        self.log("Run tests sequentially")
+        msg = "Run tests sequentially"
+        if self.ns.timeout:
+            msg += " (timeout: %s)" % format_duration(self.ns.timeout)
+        self.log(msg)
 
         previous_test = None
         for test_index, test_name in enumerate(self.tests, 1):
index eeb108bb44739476ac73e3a2637a2ce13e40355a..9338b28047954e0b4632d2869f263442c87efaac 100644 (file)
@@ -123,7 +123,7 @@ def _runtest(ns, test_name):
 
     start_time = time.perf_counter()
     try:
-        support.set_match_tests(ns.match_tests)
+        support.set_match_tests(ns.match_tests, ns.ignore_tests)
         support.junit_xml_list = xml_list = [] if ns.xmlpath else None
         if ns.failfast:
             support.failfast = True
@@ -327,7 +327,7 @@ def cleanup_test_droppings(test_name, verbose):
                                f"directory nor file")
 
         if verbose:
-            print_warning("%r left behind %s %r" % (test_name, kind, name))
+            print_warning(f"{test_name} left behind {kind} {name!r}")
             support.environment_altered = True
 
         try:
index 71db8d69668599483704cec4609eb06f3c8a0069..7a18e45434bb46bc049a7960d0d45edecf81bf5b 100644 (file)
@@ -3,6 +3,7 @@ import faulthandler
 import json
 import os
 import queue
+import signal
 import subprocess
 import sys
 import threading
@@ -31,6 +32,8 @@ assert MAIN_PROCESS_TIMEOUT >= PROGRESS_UPDATE
 # Time to wait until a worker completes: should be immediate
 JOIN_TIMEOUT = 30.0   # seconds
 
+USE_PROCESS_GROUP = (hasattr(os, "setsid") and hasattr(os, "killpg"))
+
 
 def must_stop(result, ns):
     if result.result == INTERRUPTED:
@@ -59,12 +62,16 @@ def run_test_in_subprocess(testname, ns):
     # 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.
+    kw = {}
+    if USE_PROCESS_GROUP:
+        kw['start_new_session'] = True
     return subprocess.Popen(cmd,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE,
                             universal_newlines=True,
                             close_fds=(os.name != 'nt'),
-                            cwd=support.SAVEDCWD)
+                            cwd=support.SAVEDCWD,
+                            **kw)
 
 
 def run_tests_worker(ns, test_name):
@@ -149,11 +156,24 @@ class TestWorkerProcess(threading.Thread):
             return
         self._killed = True
 
-        print(f"Kill {self}", file=sys.stderr, flush=True)
+        if USE_PROCESS_GROUP:
+            what = f"{self} process group"
+        else:
+            what = f"{self}"
+
+        print(f"Kill {what}", file=sys.stderr, flush=True)
         try:
-            popen.kill()
+            if USE_PROCESS_GROUP:
+                os.killpg(popen.pid, signal.SIGKILL)
+            else:
+                popen.kill()
+        except ProcessLookupError:
+            # popen.kill(): the process completed, the TestWorkerProcess thread
+            # read its exit status, but Popen.send_signal() read the returncode
+            # just before Popen.wait() set returncode.
+            pass
         except OSError as exc:
-            print_warning(f"Failed to kill {self}: {exc!r}")
+            print_warning(f"Failed to kill {what}: {exc!r}")
 
     def stop(self):
         # Method called from a different thread to stop this thread
@@ -332,7 +352,11 @@ class MultiprocessTestRunner:
         self.output = queue.Queue()
         self.pending = MultiprocessIterator(self.regrtest.tests)
         if self.ns.timeout is not None:
-            self.worker_timeout = self.ns.timeout * 1.5
+            # Rely on faulthandler to kill a worker process. This timouet is
+            # when faulthandler fails to kill a worker process. Give a maximum
+            # of 5 minutes to faulthandler to kill the worker.
+            self.worker_timeout = min(self.ns.timeout * 1.5,
+                                      self.ns.timeout + 5 * 60)
         else:
             self.worker_timeout = None
         self.workers = None
@@ -340,8 +364,12 @@ class MultiprocessTestRunner:
     def start_workers(self):
         self.workers = [TestWorkerProcess(index, self)
                         for index in range(1, self.ns.use_mp + 1)]
-        self.log("Run tests in parallel using %s child processes"
-                 % len(self.workers))
+        msg = f"Run tests in parallel using {len(self.workers)} child processes"
+        if self.ns.timeout:
+            msg += (" (timeout: %s, worker timeout: %s)"
+                    % (format_duration(self.ns.timeout),
+                       format_duration(self.worker_timeout)))
+        self.log(msg)
         for worker in self.workers:
             worker.start()
 
index 98a60f7a747d9296831b7c1bb56390c167ec6cda..0467c8f8f56b6a1f40bdf7bef3a2f928b0f6ef1b 100644 (file)
@@ -2,6 +2,7 @@ import math
 import os.path
 import sys
 import textwrap
+from test import support
 
 
 def format_duration(seconds):
@@ -61,4 +62,4 @@ def printlist(x, width=70, indent=4, file=None):
 
 
 def print_warning(msg):
-    print(f"Warning -- {msg}", file=sys.stderr, flush=True)
+    support.print_warning(msg)
index c9f374678ae35a57336e9aef0c806b488e8bd9fe..7c8383f3eaac921196fc933404b19dabb4e49710 100644 (file)
@@ -73,6 +73,18 @@ class UnseekableIO(io.BytesIO):
         raise io.UnsupportedOperation
 
 
+class MinimalIO(object):
+    """
+    A file-like object that doesn't support readinto().
+    """
+    def __init__(self, *args):
+        self._bio = io.BytesIO(*args)
+        self.getvalue = self._bio.getvalue
+        self.read = self._bio.read
+        self.readline = self._bio.readline
+        self.write = self._bio.write
+
+
 # We can't very well test the extension registry without putting known stuff
 # in it, but we have to be careful to restore its original state.  Code
 # should do this:
@@ -3361,7 +3373,7 @@ class AbstractPicklerUnpicklerObjectTests(unittest.TestCase):
         f.seek(0)
         self.assertEqual(unpickler.load(), data2)
 
-    def _check_multiple_unpicklings(self, ioclass):
+    def _check_multiple_unpicklings(self, ioclass, *, seekable=True):
         for proto in protocols:
             with self.subTest(proto=proto):
                 data1 = [(x, str(x)) for x in range(2000)] + [b"abcde", len]
@@ -3374,10 +3386,10 @@ class AbstractPicklerUnpicklerObjectTests(unittest.TestCase):
                 f = ioclass(pickled * N)
                 unpickler = self.unpickler_class(f)
                 for i in range(N):
-                    if f.seekable():
+                    if seekable:
                         pos = f.tell()
                     self.assertEqual(unpickler.load(), data1)
-                    if f.seekable():
+                    if seekable:
                         self.assertEqual(f.tell(), pos + len(pickled))
                 self.assertRaises(EOFError, unpickler.load)
 
@@ -3385,7 +3397,12 @@ class AbstractPicklerUnpicklerObjectTests(unittest.TestCase):
         self._check_multiple_unpicklings(io.BytesIO)
 
     def test_multiple_unpicklings_unseekable(self):
-        self._check_multiple_unpicklings(UnseekableIO)
+        self._check_multiple_unpicklings(UnseekableIO, seekable=False)
+
+    def test_multiple_unpicklings_minimal(self):
+        # File-like object that doesn't support peek() and readinto()
+        # (bpo-39681)
+        self._check_multiple_unpicklings(MinimalIO, seekable=False)
 
     def test_unpickling_buffering_readline(self):
         # Issue #12687: the unpickler's buffering logic could fail with
@@ -3497,6 +3514,30 @@ class AbstractHookTests(unittest.TestCase):
                         ValueError, 'The reducer just failed'):
                     p.dump(h)
 
+    @support.cpython_only
+    def test_reducer_override_no_reference_cycle(self):
+        # bpo-39492: reducer_override used to induce a spurious reference cycle
+        # inside the Pickler object, that could prevent all serialized objects
+        # from being garbage-collected without explicity invoking gc.collect.
+
+        for proto in range(0, pickle.HIGHEST_PROTOCOL + 1):
+            with self.subTest(proto=proto):
+                def f():
+                    pass
+
+                wr = weakref.ref(f)
+
+                bio = io.BytesIO()
+                p = self.pickler_class(bio, proto)
+                p.dump(f)
+                new_f = pickle.loads(bio.getvalue())
+                assert new_f == 5
+
+                del p
+                del f
+
+                self.assertIsNone(wr())
+
 
 class AbstractDispatchTableTests(unittest.TestCase):
 
index 797b3af7d3085faaac6874bde902550dd59a4f7e..9f3e79fb784db25009f50a387bd65b0f6cf483f0 100644 (file)
@@ -371,6 +371,9 @@ def collect_gdb(info_add):
                                 stderr=subprocess.PIPE,
                                 universal_newlines=True)
         version = proc.communicate()[0]
+        if proc.returncode:
+            # ignore gdb failure: test_gdb will log the error
+            return
     except OSError:
         return
 
index 171e5cef5e29fddc69e376203245cdd5e6dbe931..14a9d827ed57c56ca5cfa2946fe07a52e8d5fc02 100644 (file)
@@ -134,7 +134,7 @@ def tabulate(r):
         L = list(range(half - 1, -1, -1))
         L.extend(range(half))
         # Force to float, so that the timings are comparable.  This is
-        # significantly faster if we leave tham as ints.
+        # significantly faster if we leave them as ints.
         L = list(map(float, L))
         doit(L) # !sort
         print()
index d6a7819cb01398eac961bf5abe6251fc7df19499..400eebc521454e2a14f1e400552a54e6cf79abaa 100644 (file)
@@ -2047,7 +2047,9 @@ def _run_suite(suite):
 
 # By default, don't filter tests
 _match_test_func = None
-_match_test_patterns = None
+
+_accept_test_patterns = None
+_ignore_test_patterns = None
 
 
 def match_test(test):
@@ -2063,18 +2065,45 @@ def _is_full_match_test(pattern):
     # as a full test identifier.
     # Example: 'test.test_os.FileTests.test_access'.
     #
-    # Reject patterns which contain fnmatch patterns: '*', '?', '[...]'
-    # or '[!...]'. For example, reject 'test_access*'.
+    # ignore patterns which contain fnmatch patterns: '*', '?', '[...]'
+    # or '[!...]'. For example, ignore 'test_access*'.
     return ('.' in pattern) and (not re.search(r'[?*\[\]]', pattern))
 
 
-def set_match_tests(patterns):
-    global _match_test_func, _match_test_patterns
+def set_match_tests(accept_patterns=None, ignore_patterns=None):
+    global _match_test_func, _accept_test_patterns, _ignore_test_patterns
 
-    if patterns == _match_test_patterns:
-        # No change: no need to recompile patterns.
-        return
 
+    if accept_patterns is None:
+        accept_patterns = ()
+    if ignore_patterns is None:
+        ignore_patterns = ()
+
+    accept_func = ignore_func = None
+
+    if accept_patterns != _accept_test_patterns:
+        accept_patterns, accept_func = _compile_match_function(accept_patterns)
+    if ignore_patterns != _ignore_test_patterns:
+        ignore_patterns, ignore_func = _compile_match_function(ignore_patterns)
+
+    # Create a copy since patterns can be mutable and so modified later
+    _accept_test_patterns = tuple(accept_patterns)
+    _ignore_test_patterns = tuple(ignore_patterns)
+
+    if accept_func is not None or ignore_func is not None:
+        def match_function(test_id):
+            accept = True
+            ignore = False
+            if accept_func:
+                accept = accept_func(test_id)
+            if ignore_func:
+                ignore = ignore_func(test_id)
+            return accept and not ignore
+
+        _match_test_func = match_function
+
+
+def _compile_match_function(patterns):
     if not patterns:
         func = None
         # set_match_tests(None) behaves as set_match_tests(())
@@ -2102,10 +2131,7 @@ def set_match_tests(patterns):
 
         func = match_test_regex
 
-    # Create a copy since patterns can be mutable and so modified later
-    _match_test_patterns = tuple(patterns)
-    _match_test_func = func
-
+    return patterns, func
 
 
 def run_unittest(*classes):
@@ -2175,6 +2201,12 @@ def run_doctest(module, verbosity=None, optionflags=0):
 #=======================================================================
 # Support for saving and restoring the imported modules.
 
+def print_warning(msg):
+    # bpo-39983: Print into sys.__stderr__ to display the warning even
+    # when sys.stderr is captured temporarily by a test
+    for line in msg.splitlines():
+        print(f"Warning -- {line}", file=sys.__stderr__, flush=True)
+
 def modules_setup():
     return sys.modules.copy(),
 
@@ -2230,14 +2262,12 @@ def threading_cleanup(*original_values):
             # Display a warning at the first iteration
             environment_altered = True
             dangling_threads = values[1]
-            print("Warning -- threading_cleanup() failed to cleanup "
-                  "%s threads (count: %s, dangling: %s)"
-                  % (values[0] - original_values[0],
-                     values[0], len(dangling_threads)),
-                  file=sys.stderr)
+            print_warning(f"threading_cleanup() failed to cleanup "
+                          f"{values[0] - original_values[0]} threads "
+                          f"(count: {values[0]}, "
+                          f"dangling: {len(dangling_threads)})")
             for thread in dangling_threads:
-                print(f"Dangling thread: {thread!r}", file=sys.stderr)
-            sys.stderr.flush()
+                print_warning(f"Dangling thread: {thread!r}")
 
             # Don't hold references to threads
             dangling_threads = None
@@ -2330,8 +2360,7 @@ def reap_children():
         if pid == 0:
             break
 
-        print("Warning -- reap_children() reaped child process %s"
-              % pid, file=sys.stderr)
+        print_warning(f"reap_children() reaped child process {pid}")
         environment_altered = True
 
 
index 388a2b1a84b17c664d2cb13c27d2de81322ff4c7..1a5d649b40f5315177b8bc73268e9b65e54b2a1d 100644 (file)
@@ -174,6 +174,29 @@ class Test_OSXSupport(unittest.TestCase):
                             _osx_support._remove_universal_flags(
                                     config_vars))
 
+    def test__remove_universal_flags_alternate(self):
+        # bpo-38360: also test the alternate single-argument form of -isysroot
+        config_vars = {
+        'CFLAGS': '-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  ',
+        'LDFLAGS': '-arch ppc -arch i386   -g',
+        'CPPFLAGS': '-I. -isysroot/Developer/SDKs/MacOSX10.4u.sdk',
+        'BLDSHARED': 'gcc-4.0 -bundle  -arch ppc -arch i386 -g',
+        'LDSHARED': 'gcc-4.0 -bundle  -arch ppc -arch i386 '
+                        '-isysroot/Developer/SDKs/MacOSX10.4u.sdk -g',
+        }
+        expected_vars = {
+        'CFLAGS': '-fno-strict-aliasing  -g -O3    ',
+        'LDFLAGS': '    -g',
+        'CPPFLAGS': '-I.  ',
+        'BLDSHARED': 'gcc-4.0 -bundle    -g',
+        'LDSHARED': 'gcc-4.0 -bundle      -g',
+        }
+        self.add_expected_saved_initial_values(config_vars, expected_vars)
+
+        self.assertEqual(expected_vars,
+                            _osx_support._remove_universal_flags(
+                                    config_vars))
+
     def test__remove_unsupported_archs(self):
         config_vars = {
         'CC': 'clang',
@@ -261,6 +284,34 @@ class Test_OSXSupport(unittest.TestCase):
                             _osx_support._check_for_unavailable_sdk(
                                     config_vars))
 
+    def test__check_for_unavailable_sdk_alternate(self):
+        # bpo-38360: also test the alternate single-argument form of -isysroot
+        config_vars = {
+        'CC': 'clang',
+        'CFLAGS': '-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  '
+                        '-isysroot/Developer/SDKs/MacOSX10.1.sdk',
+        'LDFLAGS': '-arch ppc -arch i386   -g',
+        'CPPFLAGS': '-I. -isysroot/Developer/SDKs/MacOSX10.1.sdk',
+        'BLDSHARED': 'gcc-4.0 -bundle  -arch ppc -arch i386 -g',
+        'LDSHARED': 'gcc-4.0 -bundle  -arch ppc -arch i386 '
+                        '-isysroot/Developer/SDKs/MacOSX10.1.sdk -g',
+        }
+        expected_vars = {
+        'CC': 'clang',
+        'CFLAGS': '-fno-strict-aliasing  -g -O3 -arch ppc -arch i386  '
+                        ' ',
+        'LDFLAGS': '-arch ppc -arch i386   -g',
+        'CPPFLAGS': '-I.  ',
+        'BLDSHARED': 'gcc-4.0 -bundle  -arch ppc -arch i386 -g',
+        'LDSHARED': 'gcc-4.0 -bundle  -arch ppc -arch i386 '
+                        ' -g',
+        }
+        self.add_expected_saved_initial_values(config_vars, expected_vars)
+
+        self.assertEqual(expected_vars,
+                            _osx_support._check_for_unavailable_sdk(
+                                    config_vars))
+
     def test_get_platform_osx(self):
         # Note, get_platform_osx is currently tested more extensively
         # indirectly by test_sysconfig and test_distutils
index 207b5db5d8fb9be0b5f21568ff72301490b64ad4..30f8f98acc9dd3232d2f314d8a7cb197c1f03c44 100644 (file)
@@ -759,7 +759,11 @@ class DestroyTests(TestBase):
         main, = interpreters.list_all()
         interp = interpreters.create()
         with _running(interp):
-            with self.assertRaises(RuntimeError):
+            self.assertTrue(interpreters.is_running(interp),
+                            msg=f"Interp {interp} should be running before destruction.")
+
+            with self.assertRaises(RuntimeError,
+                                   msg=f"Should not be able to destroy interp {interp} while it's still running."):
                 interpreters.destroy(interp)
             self.assertTrue(interpreters.is_running(interp))
 
index 86ec6cca51acc4f17c58f30dbe03a1b5d6c188d2..0753a4b59652dd339e2546f473249db1359e4dbe 100644 (file)
@@ -786,6 +786,23 @@ class TestOptionalsDisallowLongAbbreviation(ParserTestCase):
     ]
 
 
+class TestOptionalsDisallowLongAbbreviationPrefixChars(ParserTestCase):
+    """Disallowing abbreviations works with alternative prefix characters"""
+
+    parser_signature = Sig(prefix_chars='+', allow_abbrev=False)
+    argument_signatures = [
+        Sig('++foo'),
+        Sig('++foodle', action='store_true'),
+        Sig('++foonly'),
+    ]
+    failures = ['+foon 3', '++foon 3', '++food', '++food ++foo 2']
+    successes = [
+        ('', NS(foo=None, foodle=False, foonly=None)),
+        ('++foo 3', NS(foo='3', foodle=False, foonly=None)),
+        ('++foonly 7 ++foodle ++foo 2', NS(foo='2', foodle=True, foonly='7')),
+    ]
+
+
 class TestDisallowLongAbbreviationAllowsShortGrouping(ParserTestCase):
     """Do not allow abbreviations of long options at all"""
 
@@ -804,6 +821,26 @@ class TestDisallowLongAbbreviationAllowsShortGrouping(ParserTestCase):
         ('-ccrcc', NS(r='cc', c=2)),
     ]
 
+
+class TestDisallowLongAbbreviationAllowsShortGroupingPrefix(ParserTestCase):
+    """Short option grouping works with custom prefix and allow_abbrev=False"""
+
+    parser_signature = Sig(prefix_chars='+', allow_abbrev=False)
+    argument_signatures = [
+        Sig('+r'),
+        Sig('+c', action='count'),
+    ]
+    failures = ['+r', '+c +r']
+    successes = [
+        ('', NS(r=None, c=None)),
+        ('+ra', NS(r='a', c=None)),
+        ('+rcc', NS(r='cc', c=None)),
+        ('+cc', NS(r=None, c=2)),
+        ('+cc +ra', NS(r='a', c=2)),
+        ('+ccrcc', NS(r='cc', c=2)),
+    ]
+
+
 # ================
 # Positional tests
 # ================
index 69ed83cd8b68b68719b36728d555d26cffac9b32..8887558ce4c31a35158c1bed36248227eec023c5 100644 (file)
@@ -140,6 +140,8 @@ exec_tests = [
     "@deco1\n@deco2()\n@deco3(1)\nclass C: pass",
     # Decorator with generator argument
     "@deco(a for a in b)\ndef f(): pass",
+    # Decorator with attribute
+    "@a.b.c\ndef f(): pass",
     # Simple assignment expression
     "(a := 1)",
     # Positional-only arguments
@@ -614,6 +616,11 @@ class AST_Tests(unittest.TestCase):
         self.assertEqual(grandchild_binop.end_col_offset, 3)
         self.assertEqual(grandchild_binop.end_lineno, 1)
 
+    def test_issue39579_dotted_name_end_col_offset(self):
+        tree = ast.parse('@a.b.c\ndef f(): pass')
+        attr_b = tree.body[0].decorator_list[0].value
+        self.assertEqual(attr_b.end_col_offset, 4)
+
 class ASTHelpers_Test(unittest.TestCase):
     maxDiff = None
 
@@ -862,6 +869,12 @@ class ASTHelpers_Test(unittest.TestCase):
         self.assertRaises(ValueError, ast.literal_eval, '3+(0+6j)')
         self.assertRaises(ValueError, ast.literal_eval, '-(3+6j)')
 
+    def test_literal_eval_malformed_dict_nodes(self):
+        malformed = ast.Dict(keys=[ast.Constant(1), ast.Constant(2)], values=[ast.Constant(3)])
+        self.assertRaises(ValueError, ast.literal_eval, malformed)
+        malformed = ast.Dict(keys=[ast.Constant(1)], values=[ast.Constant(2), ast.Constant(3)])
+        self.assertRaises(ValueError, ast.literal_eval, malformed)
+
     def test_bad_integer(self):
         # issue13436: Bad error message with invalid numeric values
         body = [ast.ImportFrom(module='time',
@@ -1635,6 +1648,33 @@ class EndPositionTests(unittest.TestCase):
         self._check_content(s, call, s)
         self._check_content(s, call.args[0], 'x. y .z')
 
+    def test_redundant_parenthesis(self):
+        s = '( ( ( a + b ) ) )'
+        v = ast.parse(s).body[0].value
+        self.assertEqual(type(v).__name__, 'BinOp')
+        self._check_content(s, v, 'a + b')
+        s2 = 'await ' + s
+        v = ast.parse(s2).body[0].value.value
+        self.assertEqual(type(v).__name__, 'BinOp')
+        self._check_content(s2, v, 'a + b')
+
+    def test_trailers_with_redundant_parenthesis(self):
+        tests = (
+            ('( ( ( a ) ) ) ( )', 'Call'),
+            ('( ( ( a ) ) ) ( b )', 'Call'),
+            ('( ( ( a ) ) ) [ b ]', 'Subscript'),
+            ('( ( ( a ) ) ) . b', 'Attribute'),
+        )
+        for s, t in tests:
+            with self.subTest(s):
+                v = ast.parse(s).body[0].value
+                self.assertEqual(type(v).__name__, t)
+                self._check_content(s, v, s)
+                s2 = 'await ' + s
+                v = ast.parse(s2).body[0].value.value
+                self.assertEqual(type(v).__name__, t)
+                self._check_content(s2, v, s)
+
     def test_displays(self):
         s1 = '[{}, {1, }, {1, 2,} ]'
         s2 = '{a: b, f (): g () ,}'
@@ -1838,6 +1878,7 @@ exec_results = [
 ('Module', [('AsyncFunctionDef', (4, 0), 'f', ('arguments', [], [], None, [], [], None, []), [('Pass', (4, 15))], [('Name', (1, 1), 'deco1', ('Load',)), ('Call', (2, 1), ('Name', (2, 1), 'deco2', ('Load',)), [], []), ('Call', (3, 1), ('Name', (3, 1), 'deco3', ('Load',)), [('Constant', (3, 7), 1, None)], [])], None, None)], []),
 ('Module', [('ClassDef', (4, 0), 'C', [], [], [('Pass', (4, 9))], [('Name', (1, 1), 'deco1', ('Load',)), ('Call', (2, 1), ('Name', (2, 1), 'deco2', ('Load',)), [], []), ('Call', (3, 1), ('Name', (3, 1), 'deco3', ('Load',)), [('Constant', (3, 7), 1, None)], [])])], []),
 ('Module', [('FunctionDef', (2, 0), 'f', ('arguments', [], [], None, [], [], None, []), [('Pass', (2, 9))], [('Call', (1, 1), ('Name', (1, 1), 'deco', ('Load',)), [('GeneratorExp', (1, 5), ('Name', (1, 6), 'a', ('Load',)), [('comprehension', ('Name', (1, 12), 'a', ('Store',)), ('Name', (1, 17), 'b', ('Load',)), [], 0)])], [])], None, None)], []),
+('Module', [('FunctionDef', (2, 0), 'f', ('arguments', [], [], None, [], [], None, []), [('Pass', (2, 9))], [('Attribute', (1, 1), ('Attribute', (1, 1), ('Name', (1, 1), 'a', ('Load',)), 'b', ('Load',)), 'c', ('Load',))], None, None)], []),
 ('Module', [('Expr', (1, 0), ('NamedExpr', (1, 1), ('Name', (1, 1), 'a', ('Store',)), ('Constant', (1, 6), 1, None)))], []),
 ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None, None)], [], None, [], [], None, []), [('Pass', (1, 14))], [], None, None)], []),
 ('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [('arg', (1, 6), 'a', None, None)], [('arg', (1, 12), 'c', None, None), ('arg', (1, 15), 'd', None, None), ('arg', (1, 18), 'e', None, None)], None, [], [], None, []), [('Pass', (1, 22))], [], None, None)], []),
index 58d8aee19adac6ac085d273ebbab200b3e26e693..62bf8774166529a430d98cb699476ad2ec639fff 100644 (file)
@@ -1128,6 +1128,83 @@ class AsyncGenAsyncioTest(unittest.TestCase):
 
         self.assertEqual([], messages)
 
+    def test_async_gen_await_same_anext_coro_twice(self):
+        async def async_iterate():
+            yield 1
+            yield 2
+
+        async def run():
+            it = async_iterate()
+            nxt = it.__anext__()
+            await nxt
+            with self.assertRaisesRegex(
+                    RuntimeError,
+                    r"cannot reuse already awaited __anext__\(\)/asend\(\)"
+            ):
+                await nxt
+
+            await it.aclose()  # prevent unfinished iterator warning
+
+        self.loop.run_until_complete(run())
+
+    def test_async_gen_await_same_aclose_coro_twice(self):
+        async def async_iterate():
+            yield 1
+            yield 2
+
+        async def run():
+            it = async_iterate()
+            nxt = it.aclose()
+            await nxt
+            with self.assertRaisesRegex(
+                    RuntimeError,
+                    r"cannot reuse already awaited aclose\(\)/athrow\(\)"
+            ):
+                await nxt
+
+        self.loop.run_until_complete(run())
+
+    def test_async_gen_aclose_twice_with_different_coros(self):
+        # Regression test for https://bugs.python.org/issue39606
+        async def async_iterate():
+            yield 1
+            yield 2
+
+        async def run():
+            it = async_iterate()
+            await it.aclose()
+            await it.aclose()
+
+        self.loop.run_until_complete(run())
+
+    def test_async_gen_aclose_after_exhaustion(self):
+        # Regression test for https://bugs.python.org/issue39606
+        async def async_iterate():
+            yield 1
+            yield 2
+
+        async def run():
+            it = async_iterate()
+            async for _ in it:
+                pass
+            await it.aclose()
+
+        self.loop.run_until_complete(run())
+
+    def test_async_gen_aclose_compatible_with_get_stack(self):
+        async def async_generator():
+            yield object()
+
+        async def run():
+            ag = async_generator()
+            asyncio.create_task(ag.aclose())
+            tasks = asyncio.all_tasks()
+            for task in tasks:
+                # No AttributeError raised
+                task.get_stack()
+
+        self.loop.run_until_complete(run())
+
 
 if __name__ == "__main__":
     unittest.main()
index c309faa90062e1e8ee05bbf5ec9f5cb438e69f2d..63b1eb320ce16b7b749c40fd33ac1969bc10dcef 100644 (file)
@@ -7,6 +7,7 @@ def tearDownModule():
     asyncio.set_event_loop_policy(None)
 
 
+@unittest.skipUnless(decimal.HAVE_CONTEXTVAR, "decimal is built with a thread-local context")
 class DecimalContextTest(unittest.TestCase):
 
     def test_asyncio_task_decimal_context(self):
index b0ade1ed3ba1bb2b99b54dcb07c8219951f6f963..aec56da8e22504812f9f5ef5d2b0115cbd854922 100644 (file)
@@ -258,8 +258,12 @@ class EventLoopTestsMixin:
             self.assertTrue(self.loop.is_running())
             self.loop.run_until_complete(coro1())
 
-        self.assertRaises(
-            RuntimeError, self.loop.run_until_complete, coro2())
+        with self.assertWarnsRegex(
+            RuntimeWarning,
+            r"coroutine \S+ was never awaited"
+        ):
+            self.assertRaises(
+                RuntimeError, self.loop.run_until_complete, coro2())
 
     # Note: because of the default Windows timing granularity of
     # 15.6 msec, we use fairly long sleep times here (~100 msec).
index 73dd5c5b7db30cf5224fda9a490c00382fc59cb7..f405c6923979ca16d85c90b5e01879deac47fecb 100644 (file)
@@ -118,6 +118,18 @@ class AuditTest(unittest.TestCase):
         self.assertSequenceEqual(["winreg.EnumKey", " ", f"{expected} 10000"], events[3])
         self.assertSequenceEqual(["winreg.PyHKEY.Detach", " ", expected], events[4])
 
+    def test_socket(self):
+        support.import_module("socket")
+        returncode, events, stderr = self.run_python("test_socket")
+        if returncode:
+            self.fail(stderr)
+
+        if support.verbose:
+            print(*events, sep='\n')
+        self.assertEqual(events[0][0], "socket.gethostname")
+        self.assertEqual(events[1][0], "socket.__new__")
+        self.assertEqual(events[2][0], "socket.bind")
+        self.assertTrue(events[2][2].endswith("('127.0.0.1', 8080)"))
 
 if __name__ == "__main__":
     unittest.main()
index 2a4cc2acad24b1b32c6d91aca27db9748edeee90..7dba6635d4eae7bffa79d41c66d96298b0d837bf 100644 (file)
@@ -250,6 +250,7 @@ class BaseXYTestCase(unittest.TestCase):
                  (b'3d}==', b'\xdd'),
                  (b'@@', b''),
                  (b'!', b''),
+                 (b"YWJj\n", b"abc"),
                  (b'YWJj\nYWI=', b'abcab'))
         funcs = (
             base64.b64decode,
index 47413c03d6630ec72b473d5c365cc5bd324e3191..dcea2063215040445a80549ef89675553c559ff6 100644 (file)
@@ -10,6 +10,8 @@
 # the same way as the original. Thus, a substantial part of the
 # memoryview tests is now in this module.
 #
+# Written and designed by Stefan Krah for Python 3.3.
+#
 
 import contextlib
 import unittest
@@ -2749,6 +2751,10 @@ class TestBufferProtocol(unittest.TestCase):
         # be 1D, at least one format must be 'c', 'b' or 'B'.
         for _tshape in gencastshapes():
             for char in fmtdict['@']:
+                # Casts to _Bool are undefined if the source contains values
+                # other than 0 or 1.
+                if char == "?":
+                    continue
                 tfmt = ('', '@')[randrange(2)] + char
                 tsize = struct.calcsize(tfmt)
                 n = prod(_tshape) * tsize
index cc20551b0dc2e12f62d8c17d35c173a5b6cebc5c..48b0e33af59edce2bd4a4024d9425f1d7e21292d 100644 (file)
@@ -390,7 +390,14 @@ class BuiltinTest(unittest.TestCase):
             '''async for i in arange(1):
                    a = 1''',
             '''async with asyncio.Lock() as l:
-                   a = 1'''
+                   a = 1''',
+            '''a = [x async for x in arange(2)][1]''',
+            '''a = 1 in {x async for x in arange(2)}''',
+            '''a = {x:1 async for x in arange(1)}[0]''',
+            '''a = [x async for x in arange(2) async for x in arange(2)][1]''',
+            '''a = [x async for x in (x async for x in arange(5))][1]''',
+            '''a, = [1 for x in {x async for x in arange(1)}]''',
+            '''a = [await asyncio.sleep(0, x) async for x in arange(2)][1]'''
         ]
         policy = maybe_get_event_loop_policy()
         try:
@@ -421,6 +428,44 @@ class BuiltinTest(unittest.TestCase):
         finally:
             asyncio.set_event_loop_policy(policy)
 
+    def test_compile_top_level_await_invalid_cases(self):
+         # helper function just to check we can run top=level async-for
+        async def arange(n):
+            for i in range(n):
+                yield i
+
+        modes = ('single', 'exec')
+        code_samples = [
+            '''def f():  await arange(10)\n''',
+            '''def f():  [x async for x in arange(10)]\n''',
+            '''def f():  [await x async for x in arange(10)]\n''',
+            '''def f():
+                   async for i in arange(1):
+                       a = 1
+            ''',
+            '''def f():
+                   async with asyncio.Lock() as l:
+                       a = 1
+            '''
+        ]
+        policy = maybe_get_event_loop_policy()
+        try:
+            for mode, code_sample in product(modes, code_samples):
+                source = dedent(code_sample)
+                with self.assertRaises(
+                        SyntaxError, msg=f"source={source} mode={mode}"):
+                    compile(source, '?', mode)
+
+                with self.assertRaises(
+                        SyntaxError, msg=f"source={source} mode={mode}"):
+                    co = compile(source,
+                             '?',
+                             mode,
+                             flags=ast.PyCF_ALLOW_TOP_LEVEL_AWAIT)
+        finally:
+            asyncio.set_event_loop_policy(policy)
+
+
     def test_compile_async_generator(self):
         """
         With the PyCF_ALLOW_TOP_LEVEL_AWAIT flag added in 3.8, we want to
@@ -1745,7 +1790,21 @@ class PtyTests(unittest.TestCase):
     """Tests that use a pseudo terminal to guarantee stdin and stdout are
     terminals in the test environment"""
 
+    @staticmethod
+    def handle_sighup(signum, frame):
+        # bpo-40140: if the process is the session leader, os.close(fd)
+        # of "pid, fd = pty.fork()" can raise SIGHUP signal:
+        # just ignore the signal.
+        pass
+
     def run_child(self, child, terminal_input):
+        old_sighup = signal.signal(signal.SIGHUP, self.handle_sighup)
+        try:
+            return self._run_child(child, terminal_input)
+        finally:
+            signal.signal(signal.SIGHUP, old_sighup)
+
+    def _run_child(self, child, terminal_input):
         r, w = os.pipe()  # Pipe test results from child back to parent
         try:
             pid, fd = pty.fork()
@@ -1796,6 +1855,9 @@ class PtyTests(unittest.TestCase):
             child_output = child_output.decode("ascii", "ignore")
             self.fail("got %d lines in pipe but expected 2, child output was:\n%s"
                       % (len(lines), child_output))
+
+        # bpo-40155: Close the PTY before waiting for the child process
+        # completion, otherwise the child process hangs on AIX.
         os.close(fd)
 
         # Wait until the child process completes
index 2761ab3f2095dba500b8a547bbacbfa62d4b0578..584c1046450311a48f67d25bda5ce7faf784624f 100644 (file)
@@ -473,6 +473,20 @@ class CAPITest(unittest.TestCase):
         # Test that subtype_dealloc decref the newly assigned __class__ only once
         self.assertEqual(new_type_refcnt, sys.getrefcount(_testcapi.HeapCTypeSubclass))
 
+    def test_pynumber_tobase(self):
+        from _testcapi import pynumber_tobase
+        self.assertEqual(pynumber_tobase(123, 2), '0b1111011')
+        self.assertEqual(pynumber_tobase(123, 8), '0o173')
+        self.assertEqual(pynumber_tobase(123, 10), '123')
+        self.assertEqual(pynumber_tobase(123, 16), '0x7b')
+        self.assertEqual(pynumber_tobase(-123, 2), '-0b1111011')
+        self.assertEqual(pynumber_tobase(-123, 8), '-0o173')
+        self.assertEqual(pynumber_tobase(-123, 10), '-123')
+        self.assertEqual(pynumber_tobase(-123, 16), '-0x7b')
+        self.assertRaises(TypeError, pynumber_tobase, 123.0, 10)
+        self.assertRaises(TypeError, pynumber_tobase, '123', 10)
+        self.assertRaises(SystemError, pynumber_tobase, 123, 0)
+
 
 class TestPendingCalls(unittest.TestCase):
 
index 497bfa9eb89de4eb2fbefd5008c64d32c10378c6..5fc5bff6603e22e757b0d0eb9816ed7da286a21c 100644 (file)
@@ -740,6 +740,17 @@ class CmdLineTest(unittest.TestCase):
         self.assertEqual(proc.returncode, 0, proc)
         self.assertEqual(proc.stdout.strip(), b'0')
 
+    def test_parsing_error(self):
+        args = [sys.executable, '-I', '--unknown-option']
+        proc = subprocess.run(args,
+                              stdout=subprocess.PIPE,
+                              stderr=subprocess.PIPE,
+                              text=True)
+        err_msg = "unknown option --unknown-option\nusage: "
+        self.assertTrue(proc.stderr.startswith(err_msg), proc.stderr)
+        self.assertNotEqual(proc.returncode, 0)
+
+
 @unittest.skipIf(interpreter_requires_environment(),
                  'Cannot run -I tests when PYTHON env vars are required.')
 class IgnoreEnvironmentTest(unittest.TestCase):
index b37525bf660430414f419fa9329c928255999f5c..0fd258ca8abf6fe20afd6984c4d2cb5e34deeeee 100644 (file)
@@ -1142,6 +1142,7 @@ class UTF8SigTest(UTF8Test, unittest.TestCase):
             got = ostream.getvalue()
             self.assertEqual(got, unistring)
 
+
 class EscapeDecodeTest(unittest.TestCase):
     def test_empty(self):
         self.assertEqual(codecs.escape_decode(b""), (b"", 0))
@@ -1331,6 +1332,18 @@ class PunycodeTest(unittest.TestCase):
             puny = puny.decode("ascii").encode("ascii")
             self.assertEqual(uni, puny.decode("punycode"))
 
+    def test_decode_invalid(self):
+        testcases = [
+            (b"xn--w&", "strict", UnicodeError()),
+            (b"xn--w&", "ignore", "xn-"),
+        ]
+        for puny, errors, expected in testcases:
+            with self.subTest(puny=puny, errors=errors):
+                if isinstance(expected, Exception):
+                    self.assertRaises(UnicodeError, puny.decode, "punycode", errors)
+                else:
+                    self.assertEqual(puny.decode("punycode", errors), expected)
+
 
 # From http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html
 nameprep_tests = [
@@ -1701,6 +1714,14 @@ class CodecsModuleTest(unittest.TestCase):
             self.assertRaises(UnicodeError,
                 codecs.decode, b'abc', 'undefined', errors)
 
+    def test_file_closes_if_lookup_error_raised(self):
+        mock_open = mock.mock_open()
+        with mock.patch('builtins.open', mock_open) as file:
+            with self.assertRaises(LookupError):
+                codecs.open(support.TESTFN, 'wt', 'invalid-encoding')
+
+            file().close.assert_called()
+
 
 class StreamReaderTest(unittest.TestCase):
 
index 04f6e1e049dde1a446014400068945862688d8aa..64f092b53b5000808a537fea99696c04c4a59fa4 100644 (file)
@@ -577,6 +577,47 @@ class CommandLineTestsBase:
             self.assertTrue(compile_dir.called)
             self.assertEqual(compile_dir.call_args[-1]['workers'], 0)
 
+    def _test_ddir_only(self, *, ddir, parallel=True):
+        """Recursive compile_dir ddir must contain package paths; bpo39769."""
+        fullpath = ["test", "foo"]
+        path = self.directory
+        mods = []
+        for subdir in fullpath:
+            path = os.path.join(path, subdir)
+            os.mkdir(path)
+            script_helper.make_script(path, "__init__", "")
+            mods.append(script_helper.make_script(path, "mod",
+                                                  "def fn(): 1/0\nfn()\n"))
+        compileall.compile_dir(
+                self.directory, quiet=True, ddir=ddir,
+                workers=2 if parallel else 1)
+        self.assertTrue(mods)
+        for mod in mods:
+            self.assertTrue(mod.startswith(self.directory), mod)
+            modcode = importlib.util.cache_from_source(mod)
+            modpath = mod[len(self.directory+os.sep):]
+            _, _, err = script_helper.assert_python_failure(modcode)
+            expected_in = os.path.join(ddir, modpath)
+            mod_code_obj = test.test_importlib.util._get_code_from_pyc(modcode)
+            self.assertEqual(mod_code_obj.co_filename, expected_in)
+            self.assertIn(f'"{expected_in}"', os.fsdecode(err))
+
+    def test_ddir_only_one_worker(self):
+        """Recursive compile_dir ddir= contains package paths; bpo39769."""
+        return self._test_ddir_only(ddir="<a prefix>", parallel=False)
+
+    def test_ddir_multiple_workers(self):
+        """Recursive compile_dir ddir= contains package paths; bpo39769."""
+        return self._test_ddir_only(ddir="<a prefix>", parallel=True)
+
+    def test_ddir_empty_only_one_worker(self):
+        """Recursive compile_dir ddir='' contains package paths; bpo39769."""
+        return self._test_ddir_only(ddir="", parallel=False)
+
+    def test_ddir_empty_multiple_workers(self):
+        """Recursive compile_dir ddir='' contains package paths; bpo39769."""
+        return self._test_ddir_only(ddir="", parallel=True)
+
 
 class CommmandLineTestsWithSourceEpoch(CommandLineTestsBase,
                                        unittest.TestCase,
index e01f2e4b78759e24650cbaedb1d66918bbaf86f7..ac722981659d33cbe26cf55ee1240d880277c4e5 100644 (file)
@@ -87,8 +87,7 @@ class MyObject(object):
 
 
 class EventfulGCObj():
-    def __init__(self, ctx):
-        mgr = get_context(ctx).Manager()
+    def __init__(self, mgr):
         self.event = mgr.Event()
 
     def __del__(self):
@@ -848,12 +847,21 @@ class ProcessPoolExecutorTest(ExecutorTest):
     def test_ressources_gced_in_workers(self):
         # Ensure that argument for a job are correctly gc-ed after the job
         # is finished
-        obj = EventfulGCObj(self.ctx)
+        mgr = get_context(self.ctx).Manager()
+        obj = EventfulGCObj(mgr)
         future = self.executor.submit(id, obj)
         future.result()
 
         self.assertTrue(obj.event.wait(timeout=1))
 
+        # explicitly destroy the object to ensure that EventfulGCObj.__del__()
+        # is called while manager is still running.
+        obj = None
+        test.support.gc_collect()
+
+        mgr.shutdown()
+        mgr.join()
+
 
 create_executor_tests(ProcessPoolExecutorTest,
                       executor_mixins=(ProcessPoolForkMixin,
index 45a692022f29bc09019dcd99ab4a77ce01acdd47..35f72fb216b64a79cfce45e39b48f35e79b44514 100644 (file)
@@ -99,7 +99,7 @@ class TestCopy(unittest.TestCase):
                  42, 2**100, 3.14, True, False, 1j,
                  "hello", "hello\u1234", f.__code__,
                  b"world", bytes(range(256)), range(10), slice(1, 10, 2),
-                 NewStyle, Classic, max, WithMetaclass]
+                 NewStyle, Classic, max, WithMetaclass, property()]
         for x in tests:
             self.assertIs(copy.copy(x), x)
 
@@ -357,7 +357,7 @@ class TestCopy(unittest.TestCase):
             pass
         tests = [None, 42, 2**100, 3.14, True, False, 1j,
                  "hello", "hello\u1234", f.__code__,
-                 NewStyle, Classic, max]
+                 NewStyle, Classic, max, property()]
         for x in tests:
             self.assertIs(copy.deepcopy(x), x)
 
index d29e005fdad50670f4a27d78b201d2b832257489..5dc83b4ecbfa008d78d41ef2d51bd1784ba2d111 100644 (file)
@@ -6,20 +6,21 @@ try:
     import crypt
     IMPORT_ERROR = None
 except ImportError as ex:
+    if sys.platform != 'win32':
+        raise unittest.SkipTest(str(ex))
     crypt = None
     IMPORT_ERROR = str(ex)
 
 
-@unittest.skipIf(crypt, 'This should only run on windows')
+@unittest.skipUnless(sys.platform == 'win32', 'This should only run on windows')
+@unittest.skipIf(crypt, 'import succeeded')
 class TestWhyCryptDidNotImport(unittest.TestCase):
-    def test_failure_only_for_windows(self):
-        self.assertEqual(sys.platform, 'win32')
 
     def test_import_failure_message(self):
         self.assertIn('not supported', IMPORT_ERROR)
 
 
-@unittest.skipUnless(crypt, 'Not supported on Windows')
+@unittest.skipUnless(crypt, 'crypt module is required')
 class CryptTestCase(unittest.TestCase):
 
     def test_crypt(self):
index 2f3c531fc208ad6ff1271395fde38623880f8f85..21a7d7ec3fe3912debd585a17465f519eb3ca100 100755 (executable)
@@ -45,6 +45,25 @@ class TestCase(unittest.TestCase):
         o = C(42)
         self.assertEqual(o.x, 42)
 
+    def test_field_default_default_factory_error(self):
+        msg = "cannot specify both default and default_factory"
+        with self.assertRaisesRegex(ValueError, msg):
+            @dataclass
+            class C:
+                x: int = field(default=1, default_factory=int)
+
+    def test_field_repr(self):
+        int_field = field(default=1, init=True, repr=False)
+        int_field.name = "id"
+        repr_output = repr(int_field)
+        expected_output = "Field(name='id',type=None," \
+                           f"default=1,default_factory={MISSING!r}," \
+                           "init=True,repr=False,hash=None," \
+                           "compare=True,metadata=mappingproxy({})," \
+                           "_field_type=None)"
+
+        self.assertEqual(repr_output, expected_output)
+
     def test_named_init_params(self):
         @dataclass
         class C:
index 1f37b5372a3e7e2be9e2a92309e22a96dbdd082f..0e9cd3095c85edd1adde38b9725cb87075764bd6 100644 (file)
@@ -5476,6 +5476,41 @@ class CWhitebox(unittest.TestCase):
             self.assertEqual(Decimal.from_float(cls(101.1)),
                              Decimal.from_float(101.1))
 
+    def test_maxcontext_exact_arith(self):
+
+        # Make sure that exact operations do not raise MemoryError due
+        # to huge intermediate values when the context precision is very
+        # large.
+
+        # The following functions fill the available precision and are
+        # therefore not suitable for large precisions (by design of the
+        # specification).
+        MaxContextSkip = ['logical_invert', 'next_minus', 'next_plus',
+                          'logical_and', 'logical_or', 'logical_xor',
+                          'next_toward', 'rotate', 'shift']
+
+        Decimal = C.Decimal
+        Context = C.Context
+        localcontext = C.localcontext
+
+        # Here only some functions that are likely candidates for triggering a
+        # MemoryError are tested.  deccheck.py has an exhaustive test.
+        maxcontext = Context(prec=C.MAX_PREC, Emin=C.MIN_EMIN, Emax=C.MAX_EMAX)
+        with localcontext(maxcontext):
+            self.assertEqual(Decimal(0).exp(), 1)
+            self.assertEqual(Decimal(1).ln(), 0)
+            self.assertEqual(Decimal(1).log10(), 0)
+            self.assertEqual(Decimal(10**2).log10(), 2)
+            self.assertEqual(Decimal(10**223).log10(), 223)
+            self.assertEqual(Decimal(10**19).logb(), 19)
+            self.assertEqual(Decimal(4).sqrt(), 2)
+            self.assertEqual(Decimal("40E9").sqrt(), Decimal('2.0E+5'))
+            self.assertEqual(divmod(Decimal(10), 3), (3, 1))
+            self.assertEqual(Decimal(10) // 3, 3)
+            self.assertEqual(Decimal(4) / 2, 2)
+            self.assertEqual(Decimal(400) ** -1, Decimal('0.0025'))
+
+
 @requires_docstrings
 @unittest.skipUnless(C, "test requires C version")
 class SignatureTest(unittest.TestCase):
index 51b66b76aca91d03540db2e05aa80e7fc55af073..c0f7138254f3f6f493314fd1fcbccc80a0c74a64 100644 (file)
@@ -183,6 +183,18 @@ class TestBasic(unittest.TestCase):
         with self.assertRaises(RuntimeError):
             n in d
 
+    def test_contains_count_stop_crashes(self):
+        class A:
+            def __eq__(self, other):
+                d.clear()
+                return NotImplemented
+        d = deque([A(), A()])
+        with self.assertRaises(RuntimeError):
+            _ = 3 in d
+        d = deque([A(), A()])
+        with self.assertRaises(RuntimeError):
+            _ = d.count(3)
+
     def test_extend(self):
         d = deque('a')
         self.assertRaises(TypeError, d.extend, 1)
index 5b513765f7b08af3a822c7d8398105784578ea71..de483ab552155a53c34b200cddd6529f9023d36b 100644 (file)
@@ -1221,7 +1221,7 @@ class DictTest(unittest.TestCase):
         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.
+        # test fix for seg fault reported in bpo-27945 part 3.
         class X():
             def __del__(self):
                 dict_b.clear()
@@ -1237,6 +1237,16 @@ class DictTest(unittest.TestCase):
         dict_b = {X(): X()}
         self.assertTrue(dict_a == dict_b)
 
+        # test fix for seg fault reported in bpo-38588 part 1.
+        class Y:
+            def __eq__(self, other):
+                dict_d.clear()
+                return True
+
+        dict_c = {0: Y()}
+        dict_d = {0: set()}
+        self.assertTrue(dict_c == dict_d)
+
     def test_fromkeys_operator_modifying_dict_operand(self):
         # test fix for seg fault reported in issue 27945 part 4a.
         class X(int):
index e37d842e37ad0a9fafa6735f647f3ad1ec285f1f..502b90e7ed21ce7b2f16c853f5c9e1b96fb64fd8 100644 (file)
@@ -8,8 +8,12 @@ import functools
 import os
 import sys
 import importlib
+import importlib.abc
+import importlib.util
 import unittest
 import tempfile
+import shutil
+import contextlib
 
 # NOTE: There are some additional tests relating to interaction with
 #       zipimport in the test_zipimport_support test module.
@@ -437,7 +441,7 @@ We'll simulate a __file__ attr that ends in pyc:
     >>> tests = finder.find(sample_func)
 
     >>> print(tests)  # doctest: +ELLIPSIS
-    [<DocTest sample_func from ...:21 (1 example)>]
+    [<DocTest sample_func from ...:25 (1 example)>]
 
 The exact name depends on how test_doctest was invoked, so allow for
 leading path components.
@@ -2663,12 +2667,52 @@ Test the verbose output:
     >>> sys.argv = save_argv
 """
 
+class TestImporter(importlib.abc.MetaPathFinder, importlib.abc.ResourceLoader):
+
+    def find_spec(self, fullname, path, target=None):
+        return importlib.util.spec_from_file_location(fullname, path, loader=self)
+
+    def get_data(self, path):
+        with open(path, mode='rb') as f:
+            return f.read()
+
+class TestHook:
+
+    def __init__(self, pathdir):
+        self.sys_path = sys.path[:]
+        self.meta_path = sys.meta_path[:]
+        self.path_hooks = sys.path_hooks[:]
+        sys.path.append(pathdir)
+        sys.path_importer_cache.clear()
+        self.modules_before = sys.modules.copy()
+        self.importer = TestImporter()
+        sys.meta_path.append(self.importer)
+
+    def remove(self):
+        sys.path[:] = self.sys_path
+        sys.meta_path[:] = self.meta_path
+        sys.path_hooks[:] = self.path_hooks
+        sys.path_importer_cache.clear()
+        sys.modules.clear()
+        sys.modules.update(self.modules_before)
+
+
+@contextlib.contextmanager
+def test_hook(pathdir):
+    hook = TestHook(pathdir)
+    try:
+        yield hook
+    finally:
+        hook.remove()
+
+
 def test_lineendings(): r"""
-*nix systems use \n line endings, while Windows systems use \r\n.  Python
+*nix systems use \n line endings, while Windows systems use \r\n, and
+old Mac systems used \r, which Python still recognizes as a line ending.  Python
 handles this using universal newline mode for reading files.  Let's make
 sure doctest does so (issue 8473) by creating temporary test files using each
-of the two line disciplines.  One of the two will be the "wrong" one for the
-platform the test is run on.
+of the three line disciplines.  At least one will not match either the universal
+newline \n or os.linesep for the platform the test is run on.
 
 Windows line endings first:
 
@@ -2691,6 +2735,47 @@ And now *nix line endings:
     TestResults(failed=0, attempted=1)
     >>> os.remove(fn)
 
+And finally old Mac line endings:
+
+    >>> fn = tempfile.mktemp()
+    >>> with open(fn, 'wb') as f:
+    ...     f.write(b'Test:\r\r  >>> x = 1 + 1\r\rDone.\r')
+    30
+    >>> doctest.testfile(fn, module_relative=False, verbose=False)
+    TestResults(failed=0, attempted=1)
+    >>> os.remove(fn)
+
+Now we test with a package loader that has a get_data method, since that
+bypasses the standard universal newline handling so doctest has to do the
+newline conversion itself; let's make sure it does so correctly (issue 1812).
+We'll write a file inside the package that has all three kinds of line endings
+in it, and use a package hook to install a custom loader; on any platform,
+at least one of the line endings will raise a ValueError for inconsistent
+whitespace if doctest does not correctly do the newline conversion.
+
+    >>> dn = tempfile.mkdtemp()
+    >>> pkg = os.path.join(dn, "doctest_testpkg")
+    >>> os.mkdir(pkg)
+    >>> support.create_empty_file(os.path.join(pkg, "__init__.py"))
+    >>> fn = os.path.join(pkg, "doctest_testfile.txt")
+    >>> with open(fn, 'wb') as f:
+    ...     f.write(
+    ...         b'Test:\r\n\r\n'
+    ...         b'  >>> x = 1 + 1\r\n\r\n'
+    ...         b'Done.\r\n'
+    ...         b'Test:\n\n'
+    ...         b'  >>> x = 1 + 1\n\n'
+    ...         b'Done.\n'
+    ...         b'Test:\r\r'
+    ...         b'  >>> x = 1 + 1\r\r'
+    ...         b'Done.\r'
+    ...     )
+    95
+    >>> with test_hook(dn):
+    ...     doctest.testfile("doctest_testfile.txt", package="doctest_testpkg", verbose=False)
+    TestResults(failed=0, attempted=3)
+    >>> shutil.rmtree(dn)
+
 """
 
 def test_testmod(): r"""
index 5414cf070cc12fc9cf736dc4918d0e72c2b00ac2..9e5c6adca835d947eb577b1c949a8c38da6e0e72 100644 (file)
@@ -11,8 +11,8 @@ import textwrap
 from io import StringIO, BytesIO
 from itertools import chain
 from random import choice
-from socket import getfqdn
 from threading import Thread
+from unittest.mock import patch
 
 import email
 import email.policy
@@ -3342,9 +3342,11 @@ multipart/report
             '.test-idstring@testdomain-string>')
 
     def test_make_msgid_default_domain(self):
-        self.assertTrue(
-            email.utils.make_msgid().endswith(
-                '@' + getfqdn() + '>'))
+        with patch('socket.getfqdn') as mock_getfqdn:
+            mock_getfqdn.return_value = domain = 'pythontest.example.com'
+            self.assertTrue(
+                email.utils.make_msgid().endswith(
+                    '@' + domain + '>'))
 
     def test_Generator_linend(self):
         # Issue 14645.
index a091ceaa25bc4fc2b67a76c1fbd38951e5b5c658..9ef8eb1187486f34905c0210ac8756a85460f3f8 100644 (file)
@@ -27,7 +27,7 @@ class EOFTestCase(unittest.TestCase):
             raise support.TestFailed
 
     def test_line_continuation_EOF(self):
-        """A contination at the end of input must be an error; bpo2180."""
+        """A continuation at the end of input must be an error; bpo2180."""
         expect = 'unexpected EOF while parsing (<string>, line 1)'
         with self.assertRaises(SyntaxError) as excinfo:
             exec('x = 5\\')
index 10c1e076464e2c097bc1f1b21d23b5427a0455ba..3a32253157369365ed8a1acf5d1ef494831483e0 100644 (file)
@@ -179,17 +179,25 @@ class ExceptionTests(unittest.TestCase):
         ckmsg(s, "inconsistent use of tabs and spaces in indentation", TabError)
 
     def testSyntaxErrorOffset(self):
-        def check(src, lineno, offset):
+        def check(src, lineno, offset, encoding='utf-8'):
             with self.assertRaises(SyntaxError) as cm:
                 compile(src, '<fragment>', 'exec')
             self.assertEqual(cm.exception.lineno, lineno)
             self.assertEqual(cm.exception.offset, offset)
+            if cm.exception.text is not None:
+                if not isinstance(src, str):
+                    src = src.decode(encoding, 'replace')
+                line = src.split('\n')[lineno-1]
+                self.assertEqual(cm.exception.text.rstrip('\n'), line)
 
         check('def fact(x):\n\treturn x!\n', 2, 10)
         check('1 +\n', 1, 4)
         check('def spam():\n  print(1)\n print(2)', 3, 10)
         check('Python = "Python" +', 1, 20)
         check('Python = "\u1e54\xfd\u0163\u0125\xf2\xf1" +', 1, 20)
+        check(b'# -*- coding: cp1251 -*-\nPython = "\xcf\xb3\xf2\xee\xed" +',
+              2, 19, encoding='cp1251')
+        check(b'Python = "\xcf\xb3\xf2\xee\xed" +', 1, 18)
         check('x = "a', 1, 7)
         check('lambda x: x = 2', 1, 1)
 
@@ -205,6 +213,10 @@ class ExceptionTests(unittest.TestCase):
         check('0010 + 2', 1, 4)
         check('x = 32e-+4', 1, 8)
         check('x = 0o9', 1, 6)
+        check('\u03b1 = 0xI', 1, 6)
+        check(b'\xce\xb1 = 0xI', 1, 6)
+        check(b'# -*- coding: iso8859-7 -*-\n\xe1 = 0xI', 2, 6,
+              encoding='iso8859-7')
 
         # Errors thrown by symtable.c
         check('x = [(yield i) for i in range(3)]', 1, 5)
index 18ab28cfebe0c8f099fedaafb3f04fdb8ed2d952..86b49f30f549fb6a3ea1c7ce27fc31f685faf205 100644 (file)
@@ -6,6 +6,7 @@ import math
 import numbers
 import operator
 import fractions
+import functools
 import sys
 import unittest
 import warnings
@@ -346,6 +347,42 @@ class FractionTest(unittest.TestCase):
 
         self.assertTypedEquals(0.1+0j, complex(F(1,10)))
 
+    def testBoolGuarateesBoolReturn(self):
+        # Ensure that __bool__ is used on numerator which guarantees a bool
+        # return.  See also bpo-39274.
+        @functools.total_ordering
+        class CustomValue:
+            denominator = 1
+
+            def __init__(self, value):
+                self.value = value
+
+            def __bool__(self):
+                return bool(self.value)
+
+            @property
+            def numerator(self):
+                # required to preserve `self` during instantiation
+                return self
+
+            def __eq__(self, other):
+                raise AssertionError("Avoid comparisons in Fraction.__bool__")
+
+            __lt__ = __eq__
+
+        # We did not implement all abstract methods, so register:
+        numbers.Rational.register(CustomValue)
+
+        numerator = CustomValue(1)
+        r = F(numerator)
+        # ensure the numerator was not lost during instantiation:
+        self.assertIs(r.numerator, numerator)
+        self.assertIs(bool(r), True)
+
+        numerator = CustomValue(0)
+        r = F(numerator)
+        self.assertIs(bool(r), False)
+
     def testRound(self):
         self.assertTypedEquals(F(-200), round(F(-150), -2))
         self.assertTypedEquals(F(-200), round(F(-250), -2))
index fd468b57b477e912f9d3b131ab5d36f0144dc549..ea13533b5143dedebe6a31d259d4c8753fa4560b 100644 (file)
@@ -1,5 +1,7 @@
 # Test various flavors of legal and illegal future statements
 
+import __future__
+import ast
 import unittest
 from test import support
 from textwrap import dedent
@@ -74,6 +76,21 @@ class FutureTest(unittest.TestCase):
             from test import badsyntax_future10
         self.check_syntax_error(cm.exception, "badsyntax_future10", 3)
 
+    def test_ensure_flags_dont_clash(self):
+        # bpo-39562: test that future flags and compiler flags doesn't clash
+
+        # obtain future flags (CO_FUTURE_***) from the __future__ module
+        flags = {
+            f"CO_FUTURE_{future.upper()}": getattr(__future__, future).compiler_flag
+            for future in __future__.all_feature_names
+        }
+        # obtain some of the exported compiler flags (PyCF_***) from the ast module
+        flags.update({
+            flag: getattr(ast, flag)
+            for flag in dir(ast) if flag.startswith("PyCF_")
+        })
+        self.assertCountEqual(set(flags.values()), flags.values())
+
     def test_parserhack(self):
         # test that the parser.c::future_hack function works as expected
         # Note: although this test must pass, it's not testing the original
@@ -256,6 +273,11 @@ class AnnotationsFutureTestCase(unittest.TestCase):
         eq("slice[:-1]")
         eq("slice[1:]")
         eq("slice[::-1]")
+        eq("slice[:,]")
+        eq("slice[1:2,]")
+        eq("slice[1:2:3,]")
+        eq("slice[1:2, 1]")
+        eq("slice[1:2, 2, 3]")
         eq("slice[()]")
         eq("slice[a, b:c, d:e:f]")
         eq("slice[(x for x in a)]")
index e1060330550e3453da9420e1839370fcb0c07d56..f043c9256e02fd7a905706c420c296275d3172c0 100644 (file)
@@ -17,12 +17,18 @@ from test.support import run_unittest, findfile, python_is_optimized
 
 def get_gdb_version():
     try:
-        proc = subprocess.Popen(["gdb", "-nx", "--version"],
+        cmd = ["gdb", "-nx", "--version"]
+        proc = subprocess.Popen(cmd,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,
                                 universal_newlines=True)
         with proc:
-            version = proc.communicate()[0]
+            version, stderr = proc.communicate()
+
+        if proc.returncode:
+            raise Exception(f"Command {' '.join(cmd)!r} failed "
+                            f"with exit code {proc.returncode}: "
+                            f"stdout={version!r} stderr={stderr!r}")
     except OSError:
         # This is what "no gdb" looks like.  There may, however, be other
         # errors that manifest this way too.
@@ -230,6 +236,15 @@ class DebuggerTests(unittest.TestCase):
                                     " because the Program Counter is"
                                     " not present")
 
+        # bpo-40019: Skip the test if gdb failed to read debug information
+        # because the Python binary is optimized.
+        for pattern in (
+            '(frame information optimized out)',
+            'Unable to read information on python frame',
+        ):
+            if pattern in out:
+                raise unittest.SkipTest(f"{pattern!r} found in gdb output")
+
         return out
 
     def get_gdb_repr(self, source,
index 48a36a30913f6ad66d30cd991daa89f60df1e06f..646828621a53c871c12fc94df65bb712646328af 100644 (file)
@@ -358,6 +358,26 @@ class TestGzip(BaseTest):
             isizeBytes = fRead.read(4)
             self.assertEqual(isizeBytes, struct.pack('<i', len(data1)))
 
+    def test_compresslevel_metadata(self):
+        # see RFC 1952: http://www.faqs.org/rfcs/rfc1952.html
+        # specifically, discussion of XFL in section 2.3.1
+        cases = [
+            ('fast', 1, b'\x04'),
+            ('best', 9, b'\x02'),
+            ('tradeoff', 6, b'\x00'),
+        ]
+        xflOffset = 8
+
+        for (name, level, expectedXflByte) in cases:
+            with self.subTest(name):
+                fWrite = gzip.GzipFile(self.filename, 'w', compresslevel=level)
+                with fWrite:
+                    fWrite.write(data1)
+                with open(self.filename, 'rb') as fRead:
+                    fRead.seek(xflOffset)
+                    xflByte = fRead.read(1)
+                    self.assertEqual(xflByte, expectedXflByte)
+
     def test_with_open(self):
         # GzipFile supports the context management protocol
         with gzip.GzipFile(self.filename, "wb") as f:
index 861ba7540df2bcbe860b41ff85c3f9918cf8389c..6902573e8fa85a7e68bc7a302ec074eaf516f628 100644 (file)
@@ -432,6 +432,37 @@ class TestErrorHandling:
         with self.assertRaises((IndexError, RuntimeError)):
             self.module.heappop(heap)
 
+    def test_comparison_operator_modifiying_heap(self):
+        # See bpo-39421: Strong references need to be taken
+        # when comparing objects as they can alter the heap
+        class EvilClass(int):
+            def __lt__(self, o):
+                heap.clear()
+                return NotImplemented
+
+        heap = []
+        self.module.heappush(heap, EvilClass(0))
+        self.assertRaises(IndexError, self.module.heappushpop, heap, 1)
+
+    def test_comparison_operator_modifiying_heap_two_heaps(self):
+
+        class h(int):
+            def __lt__(self, o):
+                list2.clear()
+                return NotImplemented
+
+        class g(int):
+            def __lt__(self, o):
+                list1.clear()
+                return NotImplemented
+
+        list1, list2 = [], []
+
+        self.module.heappush(list1, h(0))
+        self.module.heappush(list2, g(0))
+
+        self.assertRaises((IndexError, RuntimeError), self.module.heappush, list1, g(1))
+        self.assertRaises((IndexError, RuntimeError), self.module.heappush, list2, h(1))
 
 class TestErrorHandlingPython(TestErrorHandling, TestCase):
     module = py_heapq
index e1aa41421febf4eb5a99c187971d498dc31b223f..8f0e27a1fb83685b73298702ab53a4c57accfd5b 100644 (file)
@@ -1155,7 +1155,7 @@ class BasicTest(TestCase):
         thread.join()
         self.assertEqual(result, b"proxied data\n")
 
-    def test_putrequest_override_validation(self):
+    def test_putrequest_override_domain_validation(self):
         """
         It should be possible to override the default validation
         behavior in putrequest (bpo-38216).
@@ -1168,6 +1168,17 @@ class BasicTest(TestCase):
         conn.sock = FakeSocket('')
         conn.putrequest('GET', '/\x00')
 
+    def test_putrequest_override_host_validation(self):
+        class UnsafeHTTPConnection(client.HTTPConnection):
+            def _validate_host(self, url):
+                pass
+
+        conn = UnsafeHTTPConnection('example.com\r\n')
+        conn.sock = FakeSocket('')
+        # set skip_host so a ValueError is not raised upon adding the
+        # invalid URL as the value of the "Host:" header
+        conn.putrequest('GET', '/', skip_host=1)
+
     def test_putrequest_override_encoding(self):
         """
         It should be possible to override the default encoding
index 0b4ce18d5a6cd7e18b8542f655e442ee2b94c4a7..695c92a786cb0b4f7491f9f0f57915c05b31924d 100644 (file)
@@ -47,14 +47,28 @@ def tempdir_as_cwd():
             yield tmp
 
 
-class SiteDir:
+@contextlib.contextmanager
+def install_finder(finder):
+    sys.meta_path.append(finder)
+    try:
+        yield
+    finally:
+        sys.meta_path.remove(finder)
+
+
+class Fixtures:
     def setUp(self):
         self.fixtures = ExitStack()
         self.addCleanup(self.fixtures.close)
+
+
+class SiteDir(Fixtures):
+    def setUp(self):
+        super(SiteDir, self).setUp()
         self.site_dir = self.fixtures.enter_context(tempdir())
 
 
-class OnSysPath:
+class OnSysPath(Fixtures):
     @staticmethod
     @contextlib.contextmanager
     def add_sys_path(dir):
@@ -198,3 +212,8 @@ def build_files(file_defs, prefix=pathlib.Path()):
 def DALS(str):
     "Dedent and left-strip"
     return textwrap.dedent(str).lstrip()
+
+
+class NullFinder:
+    def find_module(self, name):
+        pass
diff --git a/Lib/test/test_importlib/stubs.py b/Lib/test/test_importlib/stubs.py
new file mode 100644 (file)
index 0000000..e5b011c
--- /dev/null
@@ -0,0 +1,10 @@
+import unittest
+
+
+class fake_filesystem_unittest:
+    """
+    Stubbed version of the pyfakefs module
+    """
+    class TestCase(unittest.TestCase):
+        def setUpPyfakefs(self):
+            self.skipTest("pyfakefs not available")
index c5f1dbbae325ed049a32ff0d349ec24b07249cda..42a79992ecc8c08179ab8d2326f4969c713c9655 100644 (file)
@@ -7,6 +7,11 @@ import textwrap
 import unittest
 import importlib.metadata
 
+try:
+    import pyfakefs.fake_filesystem_unittest as ffs
+except ImportError:
+    from .stubs import fake_filesystem_unittest as ffs
+
 from . import fixtures
 from importlib.metadata import (
     Distribution, EntryPoint,
@@ -185,6 +190,33 @@ class DirectoryTest(fixtures.OnSysPath, fixtures.SiteDir, unittest.TestCase):
                 version('foo')
 
 
+class MissingSysPath(fixtures.OnSysPath, unittest.TestCase):
+    site_dir = '/does-not-exist'
+
+    def test_discovery(self):
+        """
+        Discovering distributions should succeed even if
+        there is an invalid path on sys.path.
+        """
+        importlib.metadata.distributions()
+
+
+class InaccessibleSysPath(fixtures.OnSysPath, ffs.TestCase):
+    site_dir = '/access-denied'
+
+    def setUp(self):
+        super(InaccessibleSysPath, self).setUp()
+        self.setUpPyfakefs()
+        self.fs.create_dir(self.site_dir, perm_bits=000)
+
+    def test_discovery(self):
+        """
+        Discovering distributions should succeed even if
+        there is an invalid path on sys.path.
+        """
+        list(importlib.metadata.distributions())
+
+
 class TestEntryPoints(unittest.TestCase):
     def __init__(self, *args):
         super(TestEntryPoints, self).__init__(*args)
index e016ea49119ae94ec4d8b0e402ac623b78b28b84..e6a1476875b5e31725005aab765f031fd9a82ee3 100644 (file)
@@ -7,6 +7,7 @@ import importlib
 from importlib import machinery, util, invalidate_caches
 from importlib.abc import ResourceReader
 import io
+import marshal
 import os
 import os.path
 from pathlib import Path, PurePath
@@ -118,6 +119,16 @@ def submodule(parent, name, pkg_dir, content=''):
     return '{}.{}'.format(parent, name), path
 
 
+def _get_code_from_pyc(pyc_path):
+    """Reads a pyc file and returns the unmarshalled code object within.
+
+    No header validation is performed.
+    """
+    with open(pyc_path, 'rb') as pyc_f:
+        pyc_f.seek(16)
+        return marshal.load(pyc_f)
+
+
 @contextlib.contextmanager
 def uncache(*names):
     """Uncache a module from sys.modules.
index 50459e079296224eb9fbbd8c9439cb3bd30e4131..bea4342e7f0f9eb7be957e0d6eba503631981e1c 100644 (file)
@@ -735,6 +735,11 @@ class IOTest(unittest.TestCase):
             file.seek(0)
             file.close()
             self.assertRaises(ValueError, file.read)
+        with self.open(support.TESTFN, "rb") as f:
+            file = self.open(f.fileno(), "rb", closefd=False)
+            self.assertEqual(file.read()[:3], b"egg")
+            file.close()
+            self.assertRaises(ValueError, file.readinto, bytearray(1))
 
     def test_no_closefd_with_filename(self):
         # can't use closefd in combination with a file name
index 65751ab91685503ae4d8b9baf533c06e0c4374b3..53639e984e48a784cff38339c725ee1b9711be4e 100644 (file)
@@ -251,6 +251,27 @@ class TestIsInstanceIsSubclass(unittest.TestCase):
         # blown
         self.assertRaises(RecursionError, blowstack, isinstance, '', str)
 
+    def test_issubclass_refcount_handling(self):
+        # bpo-39382: abstract_issubclass() didn't hold item reference while
+        # peeking in the bases tuple, in the single inheritance case.
+        class A:
+            @property
+            def __bases__(self):
+                return (int, )
+
+        class B:
+            def __init__(self):
+                # setting this here increases the chances of exhibiting the bug,
+                # probably due to memory layout changes.
+                self.x = 1
+
+            @property
+            def __bases__(self):
+                return (A(), )
+
+        self.assertEqual(True, issubclass(B(), int))
+
+
 def blowstack(fxn, arg, compare_to):
     # Make sure that calling isinstance with a deeply nested tuple for its
     # argument will raise RecursionError eventually.
index f362f1b13a253e7cd5a39fb6231a59fb04ea3a56..a62a5d4084a23cb0329a9bb219e3ed42bd9a4f89 100644 (file)
@@ -1,7 +1,9 @@
+import errno
 import os
 import sys
 import textwrap
 import unittest
+
 from subprocess import Popen, PIPE
 from test import support
 from test.support.script_helper import assert_python_ok
@@ -149,3 +151,12 @@ class TestTool(unittest.TestCase):
         self.assertEqual(out.splitlines(),
                          self.expect_without_sort_keys.encode().splitlines())
         self.assertEqual(err, b'')
+
+    @unittest.skipIf(sys.platform =="win32", "The test is failed with ValueError on Windows")
+    def test_broken_pipe_error(self):
+        cmd = [sys.executable, '-m', 'json.tool']
+        proc = Popen(cmd, stdout=PIPE, stdin=PIPE)
+        # bpo-39828: Closing before json.tool attempts to write into stdout.
+        proc.stdout.close()
+        proc.communicate(b'"{}"')
+        self.assertEqual(proc.returncode, errno.EPIPE)
index c5002b12732c9876829da8cc7a4e42271578454e..105ef650eee99e9d2686b4372298963b8fdb59c3 100644 (file)
@@ -158,6 +158,31 @@ class ListTest(list_tests.CommonTest):
         with self.assertRaises(TypeError):
             (3,) + L([1,2])
 
+    def test_equal_operator_modifying_operand(self):
+        # test fix for seg fault reported in bpo-38588 part 2.
+        class X:
+            def __eq__(self,other) :
+                list2.clear()
+                return NotImplemented
+
+        class Y:
+            def __eq__(self, other):
+                list1.clear()
+                return NotImplemented
+
+        class Z:
+            def __eq__(self, other):
+                list3.clear()
+                return NotImplemented
+
+        list1 = [X()]
+        list2 = [Y()]
+        self.assertTrue(list1 == list2)
+
+        list3 = [Z()]
+        list4 = [1]
+        self.assertFalse(list3 == list4)
+
     @cpython_only
     def test_preallocation(self):
         iterable = [0] * 10
@@ -166,5 +191,38 @@ class ListTest(list_tests.CommonTest):
         self.assertEqual(iter_size, sys.getsizeof(list([0] * 10)))
         self.assertEqual(iter_size, sys.getsizeof(list(range(10))))
 
+    def test_count_index_remove_crashes(self):
+        # bpo-38610: The count(), index(), and remove() methods were not
+        # holding strong references to list elements while calling
+        # PyObject_RichCompareBool().
+        class X:
+            def __eq__(self, other):
+                lst.clear()
+                return NotImplemented
+
+        lst = [X()]
+        with self.assertRaises(ValueError):
+            lst.index(lst)
+
+        class L(list):
+            def __eq__(self, other):
+                str(other)
+                return NotImplemented
+
+        lst = L([X()])
+        lst.count(lst)
+
+        lst = L([X()])
+        with self.assertRaises(ValueError):
+            lst.remove(lst)
+
+        # bpo-39453: list.__contains__ was not holding strong references
+        # to list elements while calling PyObject_RichCompareBool().
+        lst = [X(), X()]
+        3 in lst
+        lst = [X(), X()]
+        X() in lst
+
+
 if __name__ == "__main__":
     unittest.main()
index 37655a5ccc40c6e4534cb0cd94bd4d15b5655064..90bf2a4d3ac06f9b869ba2331d9ead42b852d928 100644 (file)
@@ -3361,6 +3361,37 @@ class ConfigDictTest(BaseTest):
         self.assertRaises(ValueError, bc.convert, 'cfg://!')
         self.assertRaises(KeyError, bc.convert, 'cfg://adict[2]')
 
+    def test_namedtuple(self):
+        # see bpo-39142
+        from collections import namedtuple
+
+        class MyHandler(logging.StreamHandler):
+            def __init__(self, resource, *args, **kwargs):
+                super().__init__(*args, **kwargs)
+                self.resource: namedtuple = resource
+
+            def emit(self, record):
+                record.msg += f' {self.resource.type}'
+                return super().emit(record)
+
+        Resource = namedtuple('Resource', ['type', 'labels'])
+        resource = Resource(type='my_type', labels=['a'])
+
+        config = {
+            'version': 1,
+            'handlers': {
+                'myhandler': {
+                    '()': MyHandler,
+                    'resource': resource
+                }
+            },
+            'root':  {'level': 'INFO', 'handlers': ['myhandler']},
+        }
+        with support.captured_stderr() as stderr:
+            self.apply_config(config)
+            logging.info('some log')
+        self.assertEqual(stderr.getvalue(), 'some log my_type\n')
+
 class ManagerTest(BaseTest):
     def test_manager_loggerclass(self):
         logged = []
index ac978247fc917f7c5ce73d51d6626b3b1f0e50f7..4a1ba830c98d6428367b858c1f35638a26e76c1e 100644 (file)
@@ -1744,135 +1744,6 @@ class MathTests(unittest.TestCase):
         self.assertEqual(type(prod([1, decimal.Decimal(2.0), 3, 4, 5, 6])),
                          decimal.Decimal)
 
-    # Custom assertions.
-
-    def assertIsNaN(self, value):
-        if not math.isnan(value):
-            self.fail("Expected a NaN, got {!r}.".format(value))
-
-
-class IsCloseTests(unittest.TestCase):
-    isclose = math.isclose  # subclasses should override this
-
-    def assertIsClose(self, a, b, *args, **kwargs):
-        self.assertTrue(self.isclose(a, b, *args, **kwargs),
-                        msg="%s and %s should be close!" % (a, b))
-
-    def assertIsNotClose(self, a, b, *args, **kwargs):
-        self.assertFalse(self.isclose(a, b, *args, **kwargs),
-                         msg="%s and %s should not be close!" % (a, b))
-
-    def assertAllClose(self, examples, *args, **kwargs):
-        for a, b in examples:
-            self.assertIsClose(a, b, *args, **kwargs)
-
-    def assertAllNotClose(self, examples, *args, **kwargs):
-        for a, b in examples:
-            self.assertIsNotClose(a, b, *args, **kwargs)
-
-    def test_negative_tolerances(self):
-        # ValueError should be raised if either tolerance is less than zero
-        with self.assertRaises(ValueError):
-            self.assertIsClose(1, 1, rel_tol=-1e-100)
-        with self.assertRaises(ValueError):
-            self.assertIsClose(1, 1, rel_tol=1e-100, abs_tol=-1e10)
-
-    def test_identical(self):
-        # identical values must test as close
-        identical_examples = [(2.0, 2.0),
-                              (0.1e200, 0.1e200),
-                              (1.123e-300, 1.123e-300),
-                              (12345, 12345.0),
-                              (0.0, -0.0),
-                              (345678, 345678)]
-        self.assertAllClose(identical_examples, rel_tol=0.0, abs_tol=0.0)
-
-    def test_eight_decimal_places(self):
-        # examples that are close to 1e-8, but not 1e-9
-        eight_decimal_places_examples = [(1e8, 1e8 + 1),
-                                         (-1e-8, -1.000000009e-8),
-                                         (1.12345678, 1.12345679)]
-        self.assertAllClose(eight_decimal_places_examples, rel_tol=1e-8)
-        self.assertAllNotClose(eight_decimal_places_examples, rel_tol=1e-9)
-
-    def test_near_zero(self):
-        # values close to zero
-        near_zero_examples = [(1e-9, 0.0),
-                              (-1e-9, 0.0),
-                              (-1e-150, 0.0)]
-        # these should not be close to any rel_tol
-        self.assertAllNotClose(near_zero_examples, rel_tol=0.9)
-        # these should be close to abs_tol=1e-8
-        self.assertAllClose(near_zero_examples, abs_tol=1e-8)
-
-    def test_identical_infinite(self):
-        # these are close regardless of tolerance -- i.e. they are equal
-        self.assertIsClose(INF, INF)
-        self.assertIsClose(INF, INF, abs_tol=0.0)
-        self.assertIsClose(NINF, NINF)
-        self.assertIsClose(NINF, NINF, abs_tol=0.0)
-
-    def test_inf_ninf_nan(self):
-        # these should never be close (following IEEE 754 rules for equality)
-        not_close_examples = [(NAN, NAN),
-                              (NAN, 1e-100),
-                              (1e-100, NAN),
-                              (INF, NAN),
-                              (NAN, INF),
-                              (INF, NINF),
-                              (INF, 1.0),
-                              (1.0, INF),
-                              (INF, 1e308),
-                              (1e308, INF)]
-        # use largest reasonable tolerance
-        self.assertAllNotClose(not_close_examples, abs_tol=0.999999999999999)
-
-    def test_zero_tolerance(self):
-        # test with zero tolerance
-        zero_tolerance_close_examples = [(1.0, 1.0),
-                                         (-3.4, -3.4),
-                                         (-1e-300, -1e-300)]
-        self.assertAllClose(zero_tolerance_close_examples, rel_tol=0.0)
-
-        zero_tolerance_not_close_examples = [(1.0, 1.000000000000001),
-                                             (0.99999999999999, 1.0),
-                                             (1.0e200, .999999999999999e200)]
-        self.assertAllNotClose(zero_tolerance_not_close_examples, rel_tol=0.0)
-
-    def test_asymmetry(self):
-        # test the asymmetry example from PEP 485
-        self.assertAllClose([(9, 10), (10, 9)], rel_tol=0.1)
-
-    def test_integers(self):
-        # test with integer values
-        integer_examples = [(100000001, 100000000),
-                            (123456789, 123456788)]
-
-        self.assertAllClose(integer_examples, rel_tol=1e-8)
-        self.assertAllNotClose(integer_examples, rel_tol=1e-9)
-
-    def test_decimals(self):
-        # test with Decimal values
-        from decimal import Decimal
-
-        decimal_examples = [(Decimal('1.00000001'), Decimal('1.0')),
-                            (Decimal('1.00000001e-20'), Decimal('1.0e-20')),
-                            (Decimal('1.00000001e-100'), Decimal('1.0e-100')),
-                            (Decimal('1.00000001e20'), Decimal('1.0e20'))]
-        self.assertAllClose(decimal_examples, rel_tol=1e-8)
-        self.assertAllNotClose(decimal_examples, rel_tol=1e-9)
-
-    def test_fractions(self):
-        # test with Fraction values
-        from fractions import Fraction
-
-        fraction_examples = [
-            (Fraction(1, 100000000) + 1, Fraction(1)),
-            (Fraction(100000001), Fraction(100000000)),
-            (Fraction(10**8 + 1, 10**28), Fraction(1, 10**20))]
-        self.assertAllClose(fraction_examples, rel_tol=1e-8)
-        self.assertAllNotClose(fraction_examples, rel_tol=1e-9)
-
     def testPerm(self):
         perm = math.perm
         factorial = math.factorial
@@ -2007,6 +1878,151 @@ class IsCloseTests(unittest.TestCase):
             self.assertIs(type(comb(IntSubclass(5), IntSubclass(k))), int)
             self.assertIs(type(comb(MyIndexable(5), MyIndexable(k))), int)
 
+    def test_issue39871(self):
+        # A SystemError should not be raised if the first arg to atan2(),
+        # copysign(), or remainder() cannot be converted to a float.
+        class F:
+            def __float__(self):
+                self.converted = True
+                1/0
+        for func in math.atan2, math.copysign, math.remainder:
+            y = F()
+            with self.assertRaises(TypeError):
+                func("not a number", y)
+
+            # There should not have been any attempt to convert the second
+            # argument to a float.
+            self.assertFalse(getattr(y, "converted", False))
+
+    # Custom assertions.
+
+    def assertIsNaN(self, value):
+        if not math.isnan(value):
+            self.fail("Expected a NaN, got {!r}.".format(value))
+
+
+class IsCloseTests(unittest.TestCase):
+    isclose = math.isclose  # subclasses should override this
+
+    def assertIsClose(self, a, b, *args, **kwargs):
+        self.assertTrue(self.isclose(a, b, *args, **kwargs),
+                        msg="%s and %s should be close!" % (a, b))
+
+    def assertIsNotClose(self, a, b, *args, **kwargs):
+        self.assertFalse(self.isclose(a, b, *args, **kwargs),
+                         msg="%s and %s should not be close!" % (a, b))
+
+    def assertAllClose(self, examples, *args, **kwargs):
+        for a, b in examples:
+            self.assertIsClose(a, b, *args, **kwargs)
+
+    def assertAllNotClose(self, examples, *args, **kwargs):
+        for a, b in examples:
+            self.assertIsNotClose(a, b, *args, **kwargs)
+
+    def test_negative_tolerances(self):
+        # ValueError should be raised if either tolerance is less than zero
+        with self.assertRaises(ValueError):
+            self.assertIsClose(1, 1, rel_tol=-1e-100)
+        with self.assertRaises(ValueError):
+            self.assertIsClose(1, 1, rel_tol=1e-100, abs_tol=-1e10)
+
+    def test_identical(self):
+        # identical values must test as close
+        identical_examples = [(2.0, 2.0),
+                              (0.1e200, 0.1e200),
+                              (1.123e-300, 1.123e-300),
+                              (12345, 12345.0),
+                              (0.0, -0.0),
+                              (345678, 345678)]
+        self.assertAllClose(identical_examples, rel_tol=0.0, abs_tol=0.0)
+
+    def test_eight_decimal_places(self):
+        # examples that are close to 1e-8, but not 1e-9
+        eight_decimal_places_examples = [(1e8, 1e8 + 1),
+                                         (-1e-8, -1.000000009e-8),
+                                         (1.12345678, 1.12345679)]
+        self.assertAllClose(eight_decimal_places_examples, rel_tol=1e-8)
+        self.assertAllNotClose(eight_decimal_places_examples, rel_tol=1e-9)
+
+    def test_near_zero(self):
+        # values close to zero
+        near_zero_examples = [(1e-9, 0.0),
+                              (-1e-9, 0.0),
+                              (-1e-150, 0.0)]
+        # these should not be close to any rel_tol
+        self.assertAllNotClose(near_zero_examples, rel_tol=0.9)
+        # these should be close to abs_tol=1e-8
+        self.assertAllClose(near_zero_examples, abs_tol=1e-8)
+
+    def test_identical_infinite(self):
+        # these are close regardless of tolerance -- i.e. they are equal
+        self.assertIsClose(INF, INF)
+        self.assertIsClose(INF, INF, abs_tol=0.0)
+        self.assertIsClose(NINF, NINF)
+        self.assertIsClose(NINF, NINF, abs_tol=0.0)
+
+    def test_inf_ninf_nan(self):
+        # these should never be close (following IEEE 754 rules for equality)
+        not_close_examples = [(NAN, NAN),
+                              (NAN, 1e-100),
+                              (1e-100, NAN),
+                              (INF, NAN),
+                              (NAN, INF),
+                              (INF, NINF),
+                              (INF, 1.0),
+                              (1.0, INF),
+                              (INF, 1e308),
+                              (1e308, INF)]
+        # use largest reasonable tolerance
+        self.assertAllNotClose(not_close_examples, abs_tol=0.999999999999999)
+
+    def test_zero_tolerance(self):
+        # test with zero tolerance
+        zero_tolerance_close_examples = [(1.0, 1.0),
+                                         (-3.4, -3.4),
+                                         (-1e-300, -1e-300)]
+        self.assertAllClose(zero_tolerance_close_examples, rel_tol=0.0)
+
+        zero_tolerance_not_close_examples = [(1.0, 1.000000000000001),
+                                             (0.99999999999999, 1.0),
+                                             (1.0e200, .999999999999999e200)]
+        self.assertAllNotClose(zero_tolerance_not_close_examples, rel_tol=0.0)
+
+    def test_asymmetry(self):
+        # test the asymmetry example from PEP 485
+        self.assertAllClose([(9, 10), (10, 9)], rel_tol=0.1)
+
+    def test_integers(self):
+        # test with integer values
+        integer_examples = [(100000001, 100000000),
+                            (123456789, 123456788)]
+
+        self.assertAllClose(integer_examples, rel_tol=1e-8)
+        self.assertAllNotClose(integer_examples, rel_tol=1e-9)
+
+    def test_decimals(self):
+        # test with Decimal values
+        from decimal import Decimal
+
+        decimal_examples = [(Decimal('1.00000001'), Decimal('1.0')),
+                            (Decimal('1.00000001e-20'), Decimal('1.0e-20')),
+                            (Decimal('1.00000001e-100'), Decimal('1.0e-100')),
+                            (Decimal('1.00000001e20'), Decimal('1.0e20'))]
+        self.assertAllClose(decimal_examples, rel_tol=1e-8)
+        self.assertAllNotClose(decimal_examples, rel_tol=1e-9)
+
+    def test_fractions(self):
+        # test with Fraction values
+        from fractions import Fraction
+
+        fraction_examples = [
+            (Fraction(1, 100000000) + 1, Fraction(1)),
+            (Fraction(100000001), Fraction(100000000)),
+            (Fraction(10**8 + 1, 10**28), Fraction(1, 10**20))]
+        self.assertAllClose(fraction_examples, rel_tol=1e-8)
+        self.assertAllNotClose(fraction_examples, rel_tol=1e-9)
+
 
 def test_main():
     from doctest import DocFileSuite
index a5a06b189dec4f088cb6535f07c9031216cea1e3..9cac6ce0225e1cd900b908ad05a3fa9f2d431b15 100644 (file)
@@ -8,10 +8,20 @@ import unittest
 from test import support
 from platform import win32_edition
 
-# Tell it we don't know about external files:
-mimetypes.knownfiles = []
-mimetypes.inited = False
-mimetypes._default_mime_types()
+
+def setUpModule():
+    global knownfiles
+    knownfiles = mimetypes.knownfiles
+
+    # Tell it we don't know about external files:
+    mimetypes.knownfiles = []
+    mimetypes.inited = False
+    mimetypes._default_mime_types()
+
+
+def tearDownModule():
+    # Restore knownfiles to its initial state
+    mimetypes.knownfiles = knownfiles
 
 
 class MimeTypesTestCase(unittest.TestCase):
@@ -21,6 +31,7 @@ class MimeTypesTestCase(unittest.TestCase):
     def test_default_data(self):
         eq = self.assertEqual
         eq(self.db.guess_type("foo.html"), ("text/html", None))
+        eq(self.db.guess_type("foo.HTML"), ("text/html", None))
         eq(self.db.guess_type("foo.tgz"), ("application/x-tar", "gzip"))
         eq(self.db.guess_type("foo.tar.gz"), ("application/x-tar", "gzip"))
         eq(self.db.guess_type("foo.tar.Z"), ("application/x-tar", "compress"))
@@ -30,6 +41,7 @@ class MimeTypesTestCase(unittest.TestCase):
     def test_data_urls(self):
         eq = self.assertEqual
         guess_type = self.db.guess_type
+        eq(guess_type("data:invalidDataWithoutComma"), (None, None))
         eq(guess_type("data:,thisIsTextPlain"), ("text/plain", None))
         eq(guess_type("data:;base64,thisIsTextPlain"), ("text/plain", None))
         eq(guess_type("data:text/x-foo,thisIsTextXFoo"), ("text/x-foo", None))
@@ -42,6 +54,19 @@ class MimeTypesTestCase(unittest.TestCase):
            ("x-application/x-unittest", None))
         eq(self.db.guess_extension("x-application/x-unittest"), ".pyunit")
 
+    def test_read_mime_types(self):
+        eq = self.assertEqual
+
+        # Unreadable file returns None
+        self.assertIsNone(mimetypes.read_mime_types("non-existent"))
+
+        with support.temp_dir() as directory:
+            data = "x-application/x-unittest pyunit\n"
+            file = pathlib.Path(directory, "sample.mimetype")
+            file.write_text(data)
+            mime_dict = mimetypes.read_mime_types(file)
+            eq(mime_dict[".pyunit"], "x-application/x-unittest")
+
     def test_non_standard_types(self):
         eq = self.assertEqual
         # First try strict
@@ -49,7 +74,10 @@ class MimeTypesTestCase(unittest.TestCase):
         eq(self.db.guess_extension('image/jpg', strict=True), None)
         # And then non-strict
         eq(self.db.guess_type('foo.xul', strict=False), ('text/xul', None))
+        eq(self.db.guess_type('foo.XUL', strict=False), ('text/xul', None))
+        eq(self.db.guess_type('foo.invalid', strict=False), (None, None))
         eq(self.db.guess_extension('image/jpg', strict=False), '.jpg')
+        eq(self.db.guess_extension('image/JPG', strict=False), '.jpg')
 
     def test_filename_with_url_delimiters(self):
         # bpo-38449: URL delimiters cases should be handled also.
@@ -200,5 +228,53 @@ class MiscTestCase(unittest.TestCase):
         support.check__all__(self, mimetypes)
 
 
+class MimetypesCliTestCase(unittest.TestCase):
+
+    def mimetypes_cmd(self, *args, **kwargs):
+        support.patch(self, sys, "argv", [sys.executable, *args])
+        with support.captured_stdout() as output:
+            mimetypes._main()
+            return output.getvalue().strip()
+
+    def test_help_option(self):
+        support.patch(self, sys, "argv", [sys.executable, "-h"])
+        with support.captured_stdout() as output:
+            with self.assertRaises(SystemExit) as cm:
+                mimetypes._main()
+
+        self.assertIn("Usage: mimetypes.py", output.getvalue())
+        self.assertEqual(cm.exception.code, 0)
+
+    def test_invalid_option(self):
+        support.patch(self, sys, "argv", [sys.executable, "--invalid"])
+        with support.captured_stdout() as output:
+            with self.assertRaises(SystemExit) as cm:
+                mimetypes._main()
+
+        self.assertIn("Usage: mimetypes.py", output.getvalue())
+        self.assertEqual(cm.exception.code, 1)
+
+    def test_guess_extension(self):
+        eq = self.assertEqual
+
+        extension = self.mimetypes_cmd("-l", "-e", "image/jpg")
+        eq(extension, ".jpg")
+
+        extension = self.mimetypes_cmd("-e", "image/jpg")
+        eq(extension, "I don't know anything about type image/jpg")
+
+        extension = self.mimetypes_cmd("-e", "image/jpeg")
+        eq(extension, ".jpg")
+
+    def test_guess_type(self):
+        eq = self.assertEqual
+
+        type_info = self.mimetypes_cmd("-l", "foo.pic")
+        eq(type_info, "type: image/pict encoding: None")
+
+        type_info = self.mimetypes_cmd("foo.pic")
+        eq(type_info, "I don't know anything about type foo.pic")
+
+
 if __name__ == "__main__":
     unittest.main()
index ebd96e1c8a2dd0c6eeeeed30a365ec723f0cf644..23c7e5fb0f5631c443f04189de7b5723a00d7870 100644 (file)
@@ -40,7 +40,8 @@ a/module.py
                                 from c import something
 b/__init__.py
                                 from sys import *
-"""]
+""",
+]
 
 maybe_test_new = [
     "a.module",
@@ -245,6 +246,48 @@ b/__init__.py
 b/c.py
 """]
 
+coding_default_utf8_test = [
+    "a_utf8",
+    ["a_utf8", "b_utf8"],
+    [], [],
+    """\
+a_utf8.py
+                                # use the default of utf8
+                                print('Unicode test A code point 2090 \u2090 that is not valid in cp1252')
+                                import b_utf8
+b_utf8.py
+                                # use the default of utf8
+                                print('Unicode test B code point 2090 \u2090 that is not valid in cp1252')
+"""]
+
+coding_explicit_utf8_test = [
+    "a_utf8",
+    ["a_utf8", "b_utf8"],
+    [], [],
+    """\
+a_utf8.py
+                                # coding=utf8
+                                print('Unicode test A code point 2090 \u2090 that is not valid in cp1252')
+                                import b_utf8
+b_utf8.py
+                                # use the default of utf8
+                                print('Unicode test B code point 2090 \u2090 that is not valid in cp1252')
+"""]
+
+coding_explicit_cp1252_test = [
+    "a_cp1252",
+    ["a_cp1252", "b_utf8"],
+    [], [],
+    b"""\
+a_cp1252.py
+                                # coding=cp1252
+                                # 0xe2 is not allowed in utf8
+                                print('CP1252 test P\xe2t\xe9')
+                                import b_utf8
+b_utf8.py
+                                # use the default of utf8
+                                print('Unicode test A code point 2090 \u2090 that is not valid in cp1252')
+"""]
 
 def open_file(path):
     dirname = os.path.dirname(path)
@@ -253,30 +296,33 @@ def open_file(path):
     except OSError as e:
         if e.errno != errno.EEXIST:
             raise
-    return open(path, "w")
+    return open(path, 'wb')
 
 
 def create_package(source):
     ofi = None
     try:
         for line in source.splitlines():
-            if line.startswith(" ") or line.startswith("\t"):
-                ofi.write(line.strip() + "\n")
+            if type(line) != bytes:
+                line = line.encode('utf-8')
+            if line.startswith(b' ') or line.startswith(b'\t'):
+                ofi.write(line.strip() + b'\n')
             else:
                 if ofi:
                     ofi.close()
+                if type(line) == bytes:
+                    line = line.decode('utf-8')
                 ofi = open_file(os.path.join(TEST_DIR, line.strip()))
     finally:
         if ofi:
             ofi.close()
 
-
 class ModuleFinderTest(unittest.TestCase):
-    def _do_test(self, info, report=False, debug=0, replace_paths=[]):
+    def _do_test(self, info, report=False, debug=0, replace_paths=[], modulefinder_class=modulefinder.ModuleFinder):
         import_this, modules, missing, maybe_missing, source = info
         create_package(source)
         try:
-            mf = modulefinder.ModuleFinder(path=TEST_PATH, debug=debug,
+            mf = modulefinder_class(path=TEST_PATH, debug=debug,
                                            replace_paths=replace_paths)
             mf.import_hook(import_this)
             if report:
@@ -337,7 +383,7 @@ class ModuleFinderTest(unittest.TestCase):
         source_path = base_path + importlib.machinery.SOURCE_SUFFIXES[0]
         bytecode_path = base_path + importlib.machinery.BYTECODE_SUFFIXES[0]
         with open_file(source_path) as file:
-            file.write('testing_modulefinder = True\n')
+            file.write('testing_modulefinder = True\n'.encode('utf-8'))
         py_compile.compile(source_path, cfile=bytecode_path)
         os.remove(source_path)
         self._do_test(bytecode_test)
@@ -365,6 +411,26 @@ b.py
 """ % list(range(2**16))]  # 2**16 constants
         self._do_test(extended_opargs_test)
 
+    def test_coding_default_utf8(self):
+        self._do_test(coding_default_utf8_test)
+
+    def test_coding_explicit_utf8(self):
+        self._do_test(coding_explicit_utf8_test)
+
+    def test_coding_explicit_cp1252(self):
+        self._do_test(coding_explicit_cp1252_test)
+
+    def test_load_module_api(self):
+        class CheckLoadModuleApi(modulefinder.ModuleFinder):
+            def __init__(self, *args, **kwds):
+                super().__init__(*args, **kwds)
+
+            def load_module(self, fqname, fp, pathname, file_info):
+                # confirm that the fileinfo is a tuple of 3 elements
+                suffix, mode, type = file_info
+                return super().load_module(fqname, fp, pathname, file_info)
+
+        self._do_test(absolute_import_test, modulefinder_class=CheckLoadModuleApi)
 
 if __name__ == "__main__":
     unittest.main()
index 01e26c8dfaf259c37c70b61d6a8f506467cc9392..3ae557f78d273a31ab03dffc05d53a8e4f24eee4 100644 (file)
@@ -32,7 +32,7 @@ class NamedExpressionInvalidTest(unittest.TestCase):
     def test_named_expression_invalid_06(self):
         code = """((a, b) := (1, 2))"""
 
-        with self.assertRaisesRegex(SyntaxError, "cannot use named assignment with tuple"):
+        with self.assertRaisesRegex(SyntaxError, "cannot use assignment expressions with tuple"):
             exec(code, {}, {})
 
     def test_named_expression_invalid_07(self):
@@ -90,7 +90,7 @@ class NamedExpressionInvalidTest(unittest.TestCase):
         code = """(lambda: x := 1)"""
 
         with self.assertRaisesRegex(SyntaxError,
-            "cannot use named assignment with lambda"):
+            "cannot use assignment expressions with lambda"):
             exec(code, {}, {})
 
     def test_named_expression_invalid_16(self):
index 618b403bfb5bd33546613332858af39e3824cd95..fbd7db03defb1dee59ebbd935ee0138996bd7fa5 100644 (file)
@@ -633,7 +633,7 @@ class NNTPv1Handler:
                     "\tSat, 19 Jun 2010 18:04:08 -0400"
                     "\t<4FD05F05-F98B-44DC-8111-C6009C925F0C@gmail.com>"
                     "\t<hvalf7$ort$1@dough.gmane.org>\t7103\t16"
-                    "\tXref: news.gmane.org gmane.comp.python.authors:57"
+                    "\tXref: news.gmane.io gmane.comp.python.authors:57"
                     "\n"
                 "58\tLooking for a few good bloggers"
                     "\tDoug Hellmann <doug.hellmann-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>"
@@ -1119,7 +1119,7 @@ class NNTPv1v2TestsMixin:
             "references": "<hvalf7$ort$1@dough.gmane.org>",
             ":bytes": "7103",
             ":lines": "16",
-            "xref": "news.gmane.org gmane.comp.python.authors:57"
+            "xref": "news.gmane.io gmane.comp.python.authors:57"
             })
         art_num, over = overviews[1]
         self.assertEqual(over["xref"], None)
index 148a9bdc35ee3e58e798b0cb819f51b154db6898..085e5f60ed93b6e50b423f822f13a4d7e1a5dad9 100644 (file)
@@ -753,6 +753,26 @@ class CPythonOrderedDictTests(OrderedDictTests, unittest.TestCase):
                     self.assertEqual(list(unpickled), expected)
                     self.assertEqual(list(it), expected)
 
+    @support.cpython_only
+    def test_weakref_list_is_not_traversed(self):
+        # Check that the weakref list is not traversed when collecting
+        # OrderedDict objects. See bpo-39778 for more information.
+
+        gc.collect()
+
+        x = self.OrderedDict()
+        x.cycle = x
+
+        cycle = []
+        cycle.append(cycle)
+
+        x_ref = weakref.ref(x)
+        cycle.append(x_ref)
+
+        del x, cycle, x_ref
+
+        gc.collect()
+
 
 class PurePythonOrderedDictSubclassTests(PurePythonOrderedDictTests):
 
index 4a076e3bbf5426bbf1ef0522938e3457b8e428c0..2a4ae1573ef59927c64b751ca8d9cf4685d4b147 100644 (file)
@@ -2675,12 +2675,37 @@ class PidTests(unittest.TestCase):
         # We are the parent of our subprocess
         self.assertEqual(int(stdout), os.getpid())
 
+    def check_waitpid(self, code, exitcode):
+        if sys.platform == 'win32':
+            # On Windows, os.spawnv() simply joins arguments with spaces:
+            # arguments need to be quoted
+            args = [f'"{sys.executable}"', '-c', f'"{code}"']
+        else:
+            args = [sys.executable, '-c', code]
+        pid = os.spawnv(os.P_NOWAIT, sys.executable, args)
+
+        pid2, status = os.waitpid(pid, 0)
+        if sys.platform == 'win32':
+            self.assertEqual(status, exitcode << 8)
+        else:
+            self.assertTrue(os.WIFEXITED(status), status)
+            self.assertEqual(os.WEXITSTATUS(status), exitcode)
+        self.assertEqual(pid2, pid)
+
     def test_waitpid(self):
-        args = [sys.executable, '-c', 'pass']
-        # Add an implicit test for PyUnicode_FSConverter().
-        pid = os.spawnv(os.P_NOWAIT, FakePath(args[0]), args)
-        status = os.waitpid(pid, 0)
-        self.assertEqual(status, (pid, 0))
+        self.check_waitpid(code='pass', exitcode=0)
+
+    def test_waitpid_exitcode(self):
+        exitcode = 23
+        code = f'import sys; sys.exit({exitcode})'
+        self.check_waitpid(code, exitcode=exitcode)
+
+    @unittest.skipUnless(sys.platform == 'win32', 'win32-specific test')
+    def test_waitpid_windows(self):
+        # bpo-40138: test os.waitpid() with exit code larger than INT_MAX.
+        STATUS_CONTROL_C_EXIT = 0xC000013A
+        code = f'import _winapi; _winapi.ExitProcess({STATUS_CONTROL_C_EXIT})'
+        self.check_waitpid(code, exitcode=STATUS_CONTROL_C_EXIT)
 
 
 class SpawnTests(unittest.TestCase):
@@ -4017,6 +4042,14 @@ class TestPEP519(unittest.TestCase):
         self.assertRaises(ZeroDivisionError, self.fspath,
                           FakePath(ZeroDivisionError()))
 
+    def test_pathlike_subclasshook(self):
+        # bpo-38878: subclasshook causes subclass checks
+        # true on abstract implementation.
+        class A(os.PathLike):
+            pass
+        self.assertFalse(issubclass(FakePath, A))
+        self.assertTrue(issubclass(FakePath, os.PathLike))
+
 
 class TimesTests(unittest.TestCase):
     def test_times(self):
index b127343982ca9aef0c1c2d1f7e7ac43b60b9c321..36226948222d642b1cdbcb20ba88ac757ba62c2e 100644 (file)
@@ -1296,8 +1296,16 @@ class _BasePathTest(object):
         self.assertTrue(p.is_absolute())
 
     def test_home(self):
-        p = self.cls.home()
-        self._test_home(p)
+        with support.EnvironmentVarGuard() as env:
+            self._test_home(self.cls.home())
+
+            env.clear()
+            env['USERPROFILE'] = os.path.join(BASE, 'userprofile')
+            self._test_home(self.cls.home())
+
+            # bpo-38883: ignore `HOME` when set on windows
+            env['HOME'] = os.path.join(BASE, 'home')
+            self._test_home(self.cls.home())
 
     def test_samefile(self):
         fileA_path = os.path.join(BASE, 'fileA')
@@ -1500,6 +1508,42 @@ class _BasePathTest(object):
         self.assertEqual(set(p.glob("dirA/../file*")), { P(BASE, "dirA/../fileA") })
         self.assertEqual(set(p.glob("../xyzzy")), set())
 
+    @support.skip_unless_symlink
+    def test_glob_permissions(self):
+        # See bpo-38894
+        P = self.cls
+        base = P(BASE) / 'permissions'
+        base.mkdir()
+
+        file1 = base / "file1"
+        file1.touch()
+        file2 = base / "file2"
+        file2.touch()
+
+        subdir = base / "subdir"
+
+        file3 = base / "file3"
+        file3.symlink_to(subdir / "other")
+
+        # Patching is needed to avoid relying on the filesystem
+        # to return the order of the files as the error will not
+        # happen if the symlink is the last item.
+
+        with mock.patch("os.scandir") as scandir:
+            scandir.return_value = sorted(os.scandir(base))
+            self.assertEqual(len(set(base.glob("*"))), 3)
+
+        subdir.mkdir()
+
+        with mock.patch("os.scandir") as scandir:
+            scandir.return_value = sorted(os.scandir(base))
+            self.assertEqual(len(set(base.glob("*"))), 4)
+
+        subdir.chmod(000)
+
+        with mock.patch("os.scandir") as scandir:
+            scandir.return_value = sorted(os.scandir(base))
+            self.assertEqual(len(set(base.glob("*"))), 4)
 
     def _check_resolve(self, p, expected, strict=True):
         q = p.resolve(strict)
@@ -2348,12 +2392,6 @@ class WindowsPathTest(_BasePathTest, unittest.TestCase):
                 self.assertEqual(p5.expanduser(), p5)
                 self.assertEqual(p6.expanduser(), p6)
 
-            # Test the first lookup key in the env vars.
-            env['HOME'] = 'C:\\Users\\alice'
-            check()
-
-            # Test that HOMEPATH is available instead.
-            env.pop('HOME', None)
             env['HOMEPATH'] = 'C:\\Users\\alice'
             check()
 
@@ -2366,6 +2404,10 @@ class WindowsPathTest(_BasePathTest, unittest.TestCase):
             env['USERPROFILE'] = 'C:\\Users\\alice'
             check()
 
+            # bpo-38883: ignore `HOME` when set on windows
+            env['HOME'] = 'C:\\Users\\eve'
+            check()
+
 
 class CompatiblePathTest(unittest.TestCase):
     """
index 59b0b8fb55621c4dabe8de88e7476cae7c967f47..2ef40e3a5a1138d7df1fbc9c596a64f5ef563582 100644 (file)
@@ -1,5 +1,6 @@
 """Unit tests for the positional only argument syntax specified in PEP 570."""
 
+import dis
 import pickle
 import unittest
 
@@ -15,6 +16,10 @@ def global_pos_only_and_normal(a, /, b):
 def global_pos_only_defaults(a=1, /, b=2):
     return a, b
 
+def global_inner_has_pos_only():
+    def f(x: int, /): ...
+    return f
+
 
 class PositionalOnlyTestCase(unittest.TestCase):
 
@@ -412,6 +417,20 @@ class PositionalOnlyTestCase(unittest.TestCase):
 
         self.assertEqual(C().method(), sentinel)
 
+    def test_annotations(self):
+        assert global_inner_has_pos_only().__annotations__ == {'x': int}
+
+    def test_annotations_constant_fold(self):
+        def g():
+            def f(x: not (int is int), /): ...
+
+        # without constant folding we end up with
+        # COMPARE_OP(is), UNARY_NOT
+        # with constant folding we should expect a COMPARE_OP(is not)
+        codes = [(i.opname, i.argval) for i in dis.get_instructions(g)]
+        self.assertNotIn(('UNARY_NOT', None), codes)
+        self.assertIn(('COMPARE_OP', 'is not'), codes)
+
 
 if __name__ == "__main__":
     unittest.main()
index ce85f575a0830816749358ca857943928d4cb32d..dfb3a3fc32644a5aa9cc2eb26cf326e084919a59 100644 (file)
@@ -70,7 +70,7 @@ class PtyTest(unittest.TestCase):
         self.addCleanup(signal.signal, signal.SIGALRM, old_alarm)
 
         old_sighup = signal.signal(signal.SIGHUP, self.handle_sighup)
-        self.addCleanup(signal.signal, signal.SIGHUP, old_alarm)
+        self.addCleanup(signal.signal, signal.SIGHUP, old_sighup)
 
         # isatty() and close() can hang on some platforms. Set an alarm
         # before running the test to make sure we don't hang forever.
@@ -81,8 +81,8 @@ class PtyTest(unittest.TestCase):
         self.fail("isatty hung")
 
     @staticmethod
-    def handle_sighup(sig, frame):
-        # if the process is the session leader, os.close(master_fd)
+    def handle_sighup(signum, frame):
+        # bpo-38547: if the process is the session leader, os.close(master_fd)
         # of "master_fd, slave_name = pty.master_open()" raises SIGHUP
         # signal: just ignore the signal.
         pass
index c13a7c9294f983d2ecd3037cf8f1803370172cbe..85740cecd82294596b05ab5544415e0cbf1ba8db 100644 (file)
@@ -21,7 +21,7 @@ class PwdTest(unittest.TestCase):
             self.assertEqual(e[3], e.pw_gid)
             self.assertIsInstance(e.pw_gid, int)
             self.assertEqual(e[4], e.pw_gecos)
-            self.assertIsInstance(e.pw_gecos, str)
+            self.assertIn(type(e.pw_gecos), (str, type(None)))
             self.assertEqual(e[5], e.pw_dir)
             self.assertIsInstance(e.pw_dir, str)
             self.assertEqual(e[6], e.pw_shell)
index d2221b3448fa320cfcf33ecb4d2f0b5aa85617c0..e2fa1977ba6c7ffdbb761782793b59b22e115120 100644 (file)
@@ -157,6 +157,24 @@ class ParseArgsTestCase(unittest.TestCase):
                 self.assertTrue(ns.single)
                 self.checkError([opt, '-f', 'foo'], "don't go together")
 
+    def test_ignore(self):
+        for opt in '-i', '--ignore':
+            with self.subTest(opt=opt):
+                ns = libregrtest._parse_args([opt, 'pattern'])
+                self.assertEqual(ns.ignore_tests, ['pattern'])
+                self.checkError([opt], 'expected one argument')
+
+        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 = libregrtest._parse_args(['-m', 'match',
+                                      '--ignorefile', filename])
+        self.assertEqual(ns.ignore_tests,
+                         ['matchfile1', 'matchfile2'])
+
     def test_match(self):
         for opt in '-m', '--match':
             with self.subTest(opt=opt):
@@ -960,6 +978,42 @@ class ArgsTestCase(BaseTestCase):
         regex = re.compile("^(test[^ ]+).*ok$", flags=re.MULTILINE)
         return [match.group(1) for match in regex.finditer(output)]
 
+    def test_ignorefile(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)
+
+        # only run a subset
+        filename = support.TESTFN
+        self.addCleanup(support.unlink, filename)
+
+        subset = [
+            # only ignore the method name
+            'test_method1',
+            # ignore 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", "--ignorefile", filename, testname)
+        methods = self.parse_methods(output)
+        subset = ['test_method2', 'test_method4']
+        self.assertEqual(methods, subset)
+
     def test_matchfile(self):
         code = textwrap.dedent("""
             import unittest
index 9efd459a6f0763eee1451b16f67030524049bcdc..71f192f90d9a1db33dd4648fda6da23278e348a2 100644 (file)
@@ -58,5 +58,41 @@ class TestInteractiveInterpreter(unittest.TestCase):
         # Exit code 120: Py_FinalizeEx() failed to flush stdout and stderr.
         self.assertIn(p.returncode, (1, 120))
 
+    @cpython_only
+    def test_multiline_string_parsing(self):
+        # bpo-39209: Multiline string tokens need to be handled in the tokenizer
+        # in two places: the interactive path and the non-interactive path.
+        user_input = '''\
+        x = """<?xml version="1.0" encoding="iso-8859-1"?>
+        <test>
+            <Users>
+                <fun25>
+                    <limits>
+                        <total>0KiB</total>
+                        <kbps>0</kbps>
+                        <rps>1.3</rps>
+                        <connections>0</connections>
+                    </limits>
+                    <usages>
+                        <total>16738211KiB</total>
+                        <kbps>237.15</kbps>
+                        <rps>1.3</rps>
+                        <connections>0</connections>
+                    </usages>
+                    <time_to_refresh>never</time_to_refresh>
+                    <limit_exceeded_URL>none</limit_exceeded_URL>
+                </fun25>
+            </Users>
+        </test>"""
+        '''
+        user_input = dedent(user_input)
+        user_input = user_input.encode()
+        p = spawn_repl()
+        with SuppressCrashReport():
+            p.stdin.write(user_input)
+        output = kill_python(p)
+        self.assertEqual(p.returncode, 0)
+
+
 if __name__ == "__main__":
     unittest.main()
index f00308611163972598f27fd09535cdfef76d02de..84834d39b1c216e821bf54cf4d2c0e847489e6c9 100644 (file)
@@ -8,6 +8,7 @@ import tempfile
 import importlib, importlib.machinery, importlib.util
 import py_compile
 import warnings
+import pathlib
 from test.support import (
     forget, make_legacy_pyc, unload, verbose, no_tracing,
     create_empty_file, temp_dir)
@@ -652,6 +653,14 @@ class RunPathTestCase(unittest.TestCase, CodeExecutionMixin):
             self._check_script(script_name, "<run_path>", script_name,
                                script_name, expect_spec=False)
 
+    def test_basic_script_with_path_object(self):
+        with temp_dir() as script_dir:
+            mod_name = 'script'
+            script_name = pathlib.Path(self._make_test_script(script_dir,
+                                                              mod_name))
+            self._check_script(script_name, "<run_path>", script_name,
+                               script_name, expect_spec=False)
+
     def test_basic_script_no_suffix(self):
         with temp_dir() as script_dir:
             mod_name = 'script'
index 286e333a8aa9cdfe8a9265bcf727fe76a3aea452..bcb7e498e198e25479cec743624cf34bba2c8033 100644 (file)
@@ -880,6 +880,48 @@ class TestShutil(unittest.TestCase):
             shutil.rmtree(src_dir)
             shutil.rmtree(os.path.dirname(dst_dir))
 
+    def test_copytree_arg_types_of_ignore(self):
+        join = os.path.join
+        exists = os.path.exists
+
+        tmp_dir = self.mkdtemp()
+        src_dir = join(tmp_dir, "source")
+
+        os.mkdir(join(src_dir))
+        os.mkdir(join(src_dir, 'test_dir'))
+        os.mkdir(os.path.join(src_dir, 'test_dir', 'subdir'))
+        write_file((src_dir, 'test_dir', 'subdir', 'test.txt'), '456')
+
+        invokations = []
+
+        def _ignore(src, names):
+            invokations.append(src)
+            self.assertIsInstance(src, str)
+            self.assertIsInstance(names, list)
+            self.assertEqual(len(names), len(set(names)))
+            for name in names:
+                self.assertIsInstance(name, str)
+            return []
+
+        dst_dir = join(self.mkdtemp(), 'destination')
+        shutil.copytree(src_dir, dst_dir, ignore=_ignore)
+        self.assertTrue(exists(join(dst_dir, 'test_dir', 'subdir',
+                                    'test.txt')))
+
+        dst_dir = join(self.mkdtemp(), 'destination')
+        shutil.copytree(pathlib.Path(src_dir), dst_dir, ignore=_ignore)
+        self.assertTrue(exists(join(dst_dir, 'test_dir', 'subdir',
+                                    'test.txt')))
+
+        dst_dir = join(self.mkdtemp(), 'destination')
+        src_dir_entry = list(os.scandir(tmp_dir))[0]
+        self.assertIsInstance(src_dir_entry, os.DirEntry)
+        shutil.copytree(src_dir_entry, dst_dir, ignore=_ignore)
+        self.assertTrue(exists(join(dst_dir, 'test_dir', 'subdir',
+                                    'test.txt')))
+
+        self.assertEqual(len(invokations), 9)
+
     def test_copytree_retains_permissions(self):
         tmp_dir = tempfile.mkdtemp()
         src_dir = os.path.join(tmp_dir, 'source')
index 41c4229919507b52d0c0e76639918bd70f91ba7d..1bbc6979368db3089420b00984b7e6c6fadd4a34 100644 (file)
@@ -10,6 +10,7 @@ from test import support
 from test.support import (captured_stderr, TESTFN, EnvironmentVarGuard,
                           change_cwd)
 import builtins
+import glob
 import os
 import sys
 import re
@@ -512,6 +513,23 @@ class ImportSideEffectTests(unittest.TestCase):
 class StartupImportTests(unittest.TestCase):
 
     def test_startup_imports(self):
+        # Get sys.path in isolated mode (python3 -I)
+        popen = subprocess.Popen([sys.executable, '-I', '-c',
+                                  'import sys; print(repr(sys.path))'],
+                                 stdout=subprocess.PIPE,
+                                 encoding='utf-8')
+        stdout = popen.communicate()[0]
+        self.assertEqual(popen.returncode, 0, repr(stdout))
+        isolated_paths = eval(stdout)
+
+        # bpo-27807: Even with -I, the site module executes all .pth files
+        # found in sys.path (see site.addpackage()). Skip the test if at least
+        # one .pth file is found.
+        for path in isolated_paths:
+            pth_files = glob.glob(os.path.join(path, "*.pth"))
+            if pth_files:
+                self.skipTest(f"found {len(pth_files)} .pth files in: {path}")
+
         # This tests checks which modules are loaded by Python when it
         # initially starts upon startup.
         popen = subprocess.Popen([sys.executable, '-I', '-v', '-c',
@@ -520,6 +538,7 @@ class StartupImportTests(unittest.TestCase):
                                  stderr=subprocess.PIPE,
                                  encoding='utf-8')
         stdout, stderr = popen.communicate()
+        self.assertEqual(popen.returncode, 0, (stdout, stderr))
         modules = eval(stdout)
 
         self.assertIn('site', modules)
index 1bf562a03d556cad202a53bcbee6108cf58201ff..f9370d8e52dca17faa1b275f6e24e855c3ff581d 100644 (file)
@@ -50,6 +50,8 @@ except ImportError:
 def get_cid():
     if fcntl is None:
         return None
+    if not hasattr(socket, 'IOCTL_VM_SOCKETS_GET_LOCAL_CID'):
+        return None
     try:
         with open("/dev/vsock", "rb") as f:
             r = fcntl.ioctl(f, socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID, "    ")
index b2afd127dfed87794e0dc01f450899998a59c8a9..f8fee3687136f20141c21f4b5116bdf960d03a06 100644 (file)
@@ -682,7 +682,6 @@ class ProcessTestCase(BaseTestCase):
             # on adding even when the environment in exec is empty.
             # Gentoo sandboxes also force LD_PRELOAD and SANDBOX_* to exist.
             return ('VERSIONER' in n or '__CF' in n or  # MacOS
-                    '__PYVENV_LAUNCHER__' in n or # MacOS framework build
                     n == 'LD_PRELOAD' or n.startswith('SANDBOX') or # Gentoo
                     n == 'LC_CTYPE') # Locale coercion triggered
 
@@ -2910,6 +2909,17 @@ class POSIXProcessTestCase(BaseTestCase):
 
         self.assertEqual(returncode, -3)
 
+    def test_communicate_repeated_call_after_stdout_close(self):
+        proc = subprocess.Popen([sys.executable, '-c',
+                                 'import os, time; os.close(1), time.sleep(2)'],
+                                stdout=subprocess.PIPE)
+        while True:
+            try:
+                proc.communicate(timeout=0.1)
+                return
+            except subprocess.TimeoutExpired:
+                pass
+
 
 @unittest.skipUnless(mswindows, "Windows specific tests")
 class Win32ProcessTestCase(BaseTestCase):
index 8f0746aed8299aaa30fa3b4a867cce80fbc2d0c5..80e652d7005fc6135861cdbf887e52a992312081 100644 (file)
@@ -433,8 +433,12 @@ class TestSupport(unittest.TestCase):
                 if time.monotonic() > deadline:
                     self.fail("timeout")
 
-                with contextlib.redirect_stderr(stderr):
+                old_stderr = sys.__stderr__
+                try:
+                    sys.__stderr__ = stderr
                     support.reap_children()
+                finally:
+                    sys.__stderr__ = old_stderr
 
                 # Use environment_altered to check if reap_children() found
                 # the child process
@@ -527,6 +531,7 @@ class TestSupport(unittest.TestCase):
         test_access = Test('test.test_os.FileTests.test_access')
         test_chdir = Test('test.test_os.Win32ErrorTests.test_chdir')
 
+        # Test acceptance
         with support.swap_attr(support, '_match_test_func', None):
             # match all
             support.set_match_tests([])
@@ -534,45 +539,92 @@ class TestSupport(unittest.TestCase):
             self.assertTrue(support.match_test(test_chdir))
 
             # match all using None
-            support.set_match_tests(None)
+            support.set_match_tests(None, None)
             self.assertTrue(support.match_test(test_access))
             self.assertTrue(support.match_test(test_chdir))
 
             # match the full test identifier
-            support.set_match_tests([test_access.id()])
+            support.set_match_tests([test_access.id()], None)
             self.assertTrue(support.match_test(test_access))
             self.assertFalse(support.match_test(test_chdir))
 
             # match the module name
-            support.set_match_tests(['test_os'])
+            support.set_match_tests(['test_os'], None)
             self.assertTrue(support.match_test(test_access))
             self.assertTrue(support.match_test(test_chdir))
 
             # Test '*' pattern
-            support.set_match_tests(['test_*'])
+            support.set_match_tests(['test_*'], None)
             self.assertTrue(support.match_test(test_access))
             self.assertTrue(support.match_test(test_chdir))
 
             # Test case sensitivity
-            support.set_match_tests(['filetests'])
+            support.set_match_tests(['filetests'], None)
             self.assertFalse(support.match_test(test_access))
-            support.set_match_tests(['FileTests'])
+            support.set_match_tests(['FileTests'], None)
             self.assertTrue(support.match_test(test_access))
 
             # Test pattern containing '.' and a '*' metacharacter
-            support.set_match_tests(['*test_os.*.test_*'])
+            support.set_match_tests(['*test_os.*.test_*'], None)
             self.assertTrue(support.match_test(test_access))
             self.assertTrue(support.match_test(test_chdir))
 
             # Multiple patterns
-            support.set_match_tests([test_access.id(), test_chdir.id()])
+            support.set_match_tests([test_access.id(), test_chdir.id()], None)
             self.assertTrue(support.match_test(test_access))
             self.assertTrue(support.match_test(test_chdir))
 
-            support.set_match_tests(['test_access', 'DONTMATCH'])
+            support.set_match_tests(['test_access', 'DONTMATCH'], None)
             self.assertTrue(support.match_test(test_access))
             self.assertFalse(support.match_test(test_chdir))
 
+        # Test rejection
+        with support.swap_attr(support, '_match_test_func', None):
+            # match all
+            support.set_match_tests(ignore_patterns=[])
+            self.assertTrue(support.match_test(test_access))
+            self.assertTrue(support.match_test(test_chdir))
+
+            # match all using None
+            support.set_match_tests(None, None)
+            self.assertTrue(support.match_test(test_access))
+            self.assertTrue(support.match_test(test_chdir))
+
+            # match the full test identifier
+            support.set_match_tests(None, [test_access.id()])
+            self.assertFalse(support.match_test(test_access))
+            self.assertTrue(support.match_test(test_chdir))
+
+            # match the module name
+            support.set_match_tests(None, ['test_os'])
+            self.assertFalse(support.match_test(test_access))
+            self.assertFalse(support.match_test(test_chdir))
+
+            # Test '*' pattern
+            support.set_match_tests(None, ['test_*'])
+            self.assertFalse(support.match_test(test_access))
+            self.assertFalse(support.match_test(test_chdir))
+
+            # Test case sensitivity
+            support.set_match_tests(None, ['filetests'])
+            self.assertTrue(support.match_test(test_access))
+            support.set_match_tests(None, ['FileTests'])
+            self.assertFalse(support.match_test(test_access))
+
+            # Test pattern containing '.' and a '*' metacharacter
+            support.set_match_tests(None, ['*test_os.*.test_*'])
+            self.assertFalse(support.match_test(test_access))
+            self.assertFalse(support.match_test(test_chdir))
+
+            # Multiple patterns
+            support.set_match_tests(None, [test_access.id(), test_chdir.id()])
+            self.assertFalse(support.match_test(test_access))
+            self.assertFalse(support.match_test(test_chdir))
+
+            support.set_match_tests(None, ['test_access', 'DONTMATCH'])
+            self.assertFalse(support.match_test(test_access))
+            self.assertTrue(support.match_test(test_chdir))
+
     def test_fd_count(self):
         # We cannot test the absolute value of fd_count(): on old Linux
         # kernel or glibc versions, os.urandom() keeps a FD open on
@@ -585,6 +637,24 @@ class TestSupport(unittest.TestCase):
             os.close(fd)
         self.assertEqual(more - start, 1)
 
+    def check_print_warning(self, msg, expected):
+        stderr = io.StringIO()
+
+        old_stderr = sys.__stderr__
+        try:
+            sys.__stderr__ = stderr
+            support.print_warning(msg)
+        finally:
+            sys.__stderr__ = old_stderr
+
+        self.assertEqual(stderr.getvalue(), expected)
+
+    def test_print_warning(self):
+        self.check_print_warning("msg",
+                                 "Warning -- msg\n")
+        self.check_print_warning("a\nb",
+                                 'Warning -- a\nWarning -- b\n')
+
     # XXX -follows a list of untested API
     # make_legacy_pyc
     # is_resource_enabled
index bea2ce120ca96b43400068506bbcc9f8e07bcc02..98d718c8ab1b1efe9471639a432b7c55ca6ec8c6 100644 (file)
@@ -99,6 +99,7 @@ class SymtableTest(unittest.TestCase):
         self.assertTrue(self.spam.lookup("bar").is_declared_global())
         self.assertFalse(self.internal.lookup("x").is_global())
         self.assertFalse(self.Mine.lookup("instance_var").is_global())
+        self.assertTrue(self.spam.lookup("bar").is_global())
 
     def test_nonlocal(self):
         self.assertFalse(self.spam.lookup("some_var").is_nonlocal())
@@ -108,7 +109,10 @@ class SymtableTest(unittest.TestCase):
 
     def test_local(self):
         self.assertTrue(self.spam.lookup("x").is_local())
-        self.assertFalse(self.internal.lookup("x").is_local())
+        self.assertFalse(self.spam.lookup("bar").is_local())
+
+    def test_free(self):
+        self.assertTrue(self.internal.lookup("x").is_free())
 
     def test_referenced(self):
         self.assertTrue(self.internal.lookup("x").is_referenced())
index 3829746f1799a2211416d22abbc40731d6108045..128c4da14384143f8d133705e6b2807ab7864a89 100644 (file)
@@ -45,7 +45,7 @@ SyntaxError: cannot assign to True
 
 >>> (True := 1)
 Traceback (most recent call last):
-SyntaxError: cannot use named assignment with True
+SyntaxError: cannot use assignment expressions with True
 
 >>> obj.__debug__ = 1
 Traceback (most recent call last):
index 232c5dae10fdf494be5e84f41cc110e70f82b0ed..f129454f4c33eea3d26df07234b75ab133f4ce9e 100644 (file)
@@ -1025,7 +1025,8 @@ class TestSpooledTemporaryFile(BaseTestCase):
         # Verify writelines with a SpooledTemporaryFile
         f = self.do_create()
         f.writelines((b'x', b'y', b'z'))
-        f.seek(0)
+        pos = f.seek(0)
+        self.assertEqual(pos, 0)
         buf = f.read()
         self.assertEqual(buf, b'xyz')
 
@@ -1043,7 +1044,8 @@ class TestSpooledTemporaryFile(BaseTestCase):
         # when that occurs
         f = self.do_create(max_size=30)
         self.assertFalse(f._rolled)
-        f.seek(100, 0)
+        pos = f.seek(100, 0)
+        self.assertEqual(pos, 100)
         self.assertFalse(f._rolled)
         f.write(b'x')
         self.assertTrue(f._rolled)
index a958ebb51cc3d27974e78901bda8b24b6f5e8619..d89cb09776756bfa86c5a12498a9481bb02f6f7e 100644 (file)
@@ -265,6 +265,20 @@ class UnparseTestCase(ASTTestCase):
         self.check_roundtrip(r"""{**{'y': 2}, 'x': 1}""")
         self.check_roundtrip(r"""{**{'y': 2}, **{'x': 1}}""")
 
+    def test_subscript(self):
+        self.check_roundtrip("a[i]")
+        self.check_roundtrip("a[i,]")
+        self.check_roundtrip("a[i, j]")
+        self.check_roundtrip("a[()]")
+        self.check_roundtrip("a[i:j]")
+        self.check_roundtrip("a[:j]")
+        self.check_roundtrip("a[i:]")
+        self.check_roundtrip("a[i:j:k]")
+        self.check_roundtrip("a[:j:k]")
+        self.check_roundtrip("a[i::k]")
+        self.check_roundtrip("a[i:j,]")
+        self.check_roundtrip("a[i:j, k]")
+
 
 class DirectoryTestCase(ASTTestCase):
     """Test roundtrip behaviour on all files in Lib and Lib/test."""
index ded5a8b39db3eeda770fc11451462752b9b7fd08..83bfef14dfb9663c9697ce96d55f1c95d5c884f3 100644 (file)
@@ -220,6 +220,13 @@ class TypeVarTests(BaseTestCase):
         with self.assertRaises(TypeError):
             TypeVar('X', str, float, bound=Employee)
 
+    def test_missing__name__(self):
+        # See bpo-39942
+        code = ("import typing\n"
+                "T = typing.TypeVar('T')\n"
+                )
+        exec(code, {})
+
     def test_no_bivariant(self):
         with self.assertRaises(ValueError):
             TypeVar('T', covariant=True, contravariant=True)
@@ -2906,6 +2913,9 @@ class GetUtilitiesTestCase(TestCase):
         self.assertIs(get_origin(Generic), Generic)
         self.assertIs(get_origin(Generic[T]), Generic)
         self.assertIs(get_origin(List[Tuple[T, T]][int]), list)
+        self.assertIs(get_origin(List), list)
+        self.assertIs(get_origin(Tuple), tuple)
+        self.assertIs(get_origin(Callable), collections.abc.Callable)
 
     def test_get_args(self):
         T = TypeVar('T')
@@ -2921,11 +2931,15 @@ class GetUtilitiesTestCase(TestCase):
                          (int, Tuple[str, int]))
         self.assertEqual(get_args(typing.Dict[int, Tuple[T, T]][Optional[int]]),
                          (int, Tuple[Optional[int], Optional[int]]))
-        self.assertEqual(get_args(Callable[[], T][int]), ([], int,))
+        self.assertEqual(get_args(Callable[[], T][int]), ([], int))
+        self.assertEqual(get_args(Callable[..., int]), (..., int))
         self.assertEqual(get_args(Union[int, Callable[[Tuple[T, ...]], str]]),
                          (int, Callable[[Tuple[T, ...]], str]))
         self.assertEqual(get_args(Tuple[int, ...]), (int, ...))
         self.assertEqual(get_args(Tuple[()]), ((),))
+        self.assertEqual(get_args(List), ())
+        self.assertEqual(get_args(Tuple), ())
+        self.assertEqual(get_args(Callable), ())
 
 
 class CollectionsAbcTests(BaseTestCase):
index 801f0fd647f4abeafae21ceece2fb11007106ceb..1c247c5d1543a20cadb99235572b1d50b9e935a8 100644 (file)
@@ -261,14 +261,36 @@ class ProxyTests(unittest.TestCase):
         self.assertTrue(bypass('localhost'))
         self.assertTrue(bypass('LocalHost'))                 # MixedCase
         self.assertTrue(bypass('LOCALHOST'))                 # UPPERCASE
+        self.assertTrue(bypass('.localhost'))
         self.assertTrue(bypass('newdomain.com:1234'))
+        self.assertTrue(bypass('.newdomain.com:1234'))
         self.assertTrue(bypass('foo.d.o.t'))                 # issue 29142
+        self.assertTrue(bypass('d.o.t'))
         self.assertTrue(bypass('anotherdomain.com:8888'))
+        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
 
+    def test_proxy_bypass_environment_always_match(self):
+        bypass = urllib.request.proxy_bypass_environment
+        self.env.set('NO_PROXY', '*')
+        self.assertTrue(bypass('newdomain.com'))
+        self.assertTrue(bypass('newdomain.com:1234'))
+        self.env.set('NO_PROXY', '*, anotherdomain.com')
+        self.assertTrue(bypass('anotherdomain.com'))
+        self.assertFalse(bypass('newdomain.com'))
+        self.assertFalse(bypass('newdomain.com:1234'))
+
+    def test_proxy_bypass_environment_newline(self):
+        bypass = urllib.request.proxy_bypass_environment
+        self.env.set('NO_PROXY',
+                     'localhost, anotherdomain.com, newdomain.com:1234')
+        self.assertFalse(bypass('localhost\n'))
+        self.assertFalse(bypass('anotherdomain.com:8888\n'))
+        self.assertFalse(bypass('newdomain.com:1234\n'))
+
 
 class ProxyTests_withOrderedEnv(unittest.TestCase):
 
@@ -339,7 +361,7 @@ class urlopen_HttpTests(unittest.TestCase, FakeHTTPMixin, FakeFTPMixin):
             self.unfakehttp()
 
     @unittest.skipUnless(ssl, "ssl module required")
-    def test_url_with_control_char_rejected(self):
+    def test_url_path_with_control_char_rejected(self):
         for char_no in list(range(0, 0x21)) + [0x7f]:
             char = chr(char_no)
             schemeless_url = f"//localhost:7777/test{char}/"
@@ -366,7 +388,7 @@ class urlopen_HttpTests(unittest.TestCase, FakeHTTPMixin, FakeFTPMixin):
                 self.unfakehttp()
 
     @unittest.skipUnless(ssl, "ssl module required")
-    def test_url_with_newline_header_injection_rejected(self):
+    def test_url_path_with_newline_header_injection_rejected(self):
         self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
         host = "localhost:7777?a=1 HTTP/1.1\r\nX-injected: header\r\nTEST: 123"
         schemeless_url = "//" + host + ":8080/test/?test=a"
@@ -391,6 +413,38 @@ class urlopen_HttpTests(unittest.TestCase, FakeHTTPMixin, FakeFTPMixin):
         finally:
             self.unfakehttp()
 
+    @unittest.skipUnless(ssl, "ssl module required")
+    def test_url_host_with_control_char_rejected(self):
+        for char_no in list(range(0, 0x21)) + [0x7f]:
+            char = chr(char_no)
+            schemeless_url = f"//localhost{char}/test/"
+            self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
+            try:
+                escaped_char_repr = repr(char).replace('\\', r'\\')
+                InvalidURL = http.client.InvalidURL
+                with self.assertRaisesRegex(
+                    InvalidURL, f"contain control.*{escaped_char_repr}"):
+                    urlopen(f"http:{schemeless_url}")
+                with self.assertRaisesRegex(InvalidURL, f"contain control.*{escaped_char_repr}"):
+                    urlopen(f"https:{schemeless_url}")
+            finally:
+                self.unfakehttp()
+
+    @unittest.skipUnless(ssl, "ssl module required")
+    def test_url_host_with_newline_header_injection_rejected(self):
+        self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
+        host = "localhost\r\nX-injected: header\r\n"
+        schemeless_url = "//" + host + ":8080/test/?test=a"
+        try:
+            InvalidURL = http.client.InvalidURL
+            with self.assertRaisesRegex(
+                InvalidURL, r"contain control.*\\r"):
+                urlopen(f"http:{schemeless_url}")
+            with self.assertRaisesRegex(InvalidURL, r"contain control.*\\n"):
+                urlopen(f"https:{schemeless_url}")
+        finally:
+            self.unfakehttp()
+
     def test_read_0_9(self):
         # "0.9" response accepted (but not "simple responses" without
         # a status line)
index 61e3ecc612d6c99d773c7d6b833fce307af21af8..091b3979aa680c3a8cddf10b3ec3ba0fbd9cce5a 100644 (file)
@@ -1444,40 +1444,64 @@ class HandlerTests(unittest.TestCase):
         bypass = {'exclude_simple': True, 'exceptions': []}
         self.assertTrue(_proxy_bypass_macosx_sysconf('test', bypass))
 
-    def test_basic_auth(self, quote_char='"'):
-        opener = OpenerDirector()
-        password_manager = MockPasswordManager()
-        auth_handler = urllib.request.HTTPBasicAuthHandler(password_manager)
-        realm = "ACME Widget Store"
-        http_handler = MockHTTPHandler(
-            401, 'WWW-Authenticate: Basic realm=%s%s%s\r\n\r\n' %
-            (quote_char, realm, quote_char))
-        opener.add_handler(auth_handler)
-        opener.add_handler(http_handler)
-        self._test_basic_auth(opener, auth_handler, "Authorization",
-                              realm, http_handler, password_manager,
-                              "http://acme.example.com/protected",
-                              "http://acme.example.com/protected",
-                              )
-
-    def test_basic_auth_with_single_quoted_realm(self):
-        self.test_basic_auth(quote_char="'")
-
-    def test_basic_auth_with_unquoted_realm(self):
-        opener = OpenerDirector()
-        password_manager = MockPasswordManager()
-        auth_handler = urllib.request.HTTPBasicAuthHandler(password_manager)
-        realm = "ACME Widget Store"
-        http_handler = MockHTTPHandler(
-            401, 'WWW-Authenticate: Basic realm=%s\r\n\r\n' % realm)
-        opener.add_handler(auth_handler)
-        opener.add_handler(http_handler)
-        with self.assertWarns(UserWarning):
+    def check_basic_auth(self, headers, realm):
+        with self.subTest(realm=realm, headers=headers):
+            opener = OpenerDirector()
+            password_manager = MockPasswordManager()
+            auth_handler = urllib.request.HTTPBasicAuthHandler(password_manager)
+            body = '\r\n'.join(headers) + '\r\n\r\n'
+            http_handler = MockHTTPHandler(401, body)
+            opener.add_handler(auth_handler)
+            opener.add_handler(http_handler)
             self._test_basic_auth(opener, auth_handler, "Authorization",
-                                realm, http_handler, password_manager,
-                                "http://acme.example.com/protected",
-                                "http://acme.example.com/protected",
-                                )
+                                  realm, http_handler, password_manager,
+                                  "http://acme.example.com/protected",
+                                  "http://acme.example.com/protected")
+
+    def test_basic_auth(self):
+        realm = "realm2@example.com"
+        realm2 = "realm2@example.com"
+        basic = f'Basic realm="{realm}"'
+        basic2 = f'Basic realm="{realm2}"'
+        other_no_realm = 'Otherscheme xxx'
+        digest = (f'Digest realm="{realm2}", '
+                  f'qop="auth, auth-int", '
+                  f'nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", '
+                  f'opaque="5ccc069c403ebaf9f0171e9517f40e41"')
+        for realm_str in (
+            # test "quote" and 'quote'
+            f'Basic realm="{realm}"',
+            f"Basic realm='{realm}'",
+
+            # charset is ignored
+            f'Basic realm="{realm}", charset="UTF-8"',
+
+            # Multiple challenges per header
+            f'{basic}, {basic2}',
+            f'{basic}, {other_no_realm}',
+            f'{other_no_realm}, {basic}',
+            f'{basic}, {digest}',
+            f'{digest}, {basic}',
+        ):
+            headers = [f'WWW-Authenticate: {realm_str}']
+            self.check_basic_auth(headers, realm)
+
+        # no quote: expect a warning
+        with support.check_warnings(("Basic Auth Realm was unquoted",
+                                     UserWarning)):
+            headers = [f'WWW-Authenticate: Basic realm={realm}']
+            self.check_basic_auth(headers, realm)
+
+        # Multiple headers: one challenge per header.
+        # Use the first Basic realm.
+        for challenges in (
+            [basic,  basic2],
+            [basic,  digest],
+            [digest, basic],
+        ):
+            headers = [f'WWW-Authenticate: {challenge}'
+                       for challenge in challenges]
+            self.check_basic_auth(headers, realm)
 
     def test_proxy_basic_auth(self):
         opener = OpenerDirector()
index 762500789f73acfd4ee38d77ce82188f08e894fc..4ae6ed33858ce225bcf6c9d133e6de08859ec831 100644 (file)
@@ -709,17 +709,15 @@ class UrlParseTestCase(unittest.TestCase):
 
     def test_portseparator(self):
         # Issue 754016 makes changes for port separator ':' from scheme separator
-        self.assertEqual(urllib.parse.urlparse("http:80"), ('http','','80','','',''))
-        self.assertEqual(urllib.parse.urlparse("https:80"), ('https','','80','','',''))
-        self.assertEqual(urllib.parse.urlparse("path:80"), ('path','','80','','',''))
+        self.assertEqual(urllib.parse.urlparse("path:80"),
+                ('','','path:80','','',''))
         self.assertEqual(urllib.parse.urlparse("http:"),('http','','','','',''))
         self.assertEqual(urllib.parse.urlparse("https:"),('https','','','','',''))
         self.assertEqual(urllib.parse.urlparse("http://www.python.org:80"),
                 ('http','www.python.org:80','','','',''))
         # As usual, need to check bytes input as well
-        self.assertEqual(urllib.parse.urlparse(b"http:80"), (b'http',b'',b'80',b'',b'',b''))
-        self.assertEqual(urllib.parse.urlparse(b"https:80"), (b'https',b'',b'80',b'',b'',b''))
-        self.assertEqual(urllib.parse.urlparse(b"path:80"), (b'path',b'',b'80',b'',b'',b''))
+        self.assertEqual(urllib.parse.urlparse(b"path:80"),
+                (b'',b'',b'path:80',b'',b'',b''))
         self.assertEqual(urllib.parse.urlparse(b"http:"),(b'http',b'',b'',b'',b'',b''))
         self.assertEqual(urllib.parse.urlparse(b"https:"),(b'https',b'',b'',b'',b'',b''))
         self.assertEqual(urllib.parse.urlparse(b"http://www.python.org:80"),
index ede65935b650bb6acc4c63ed944543c0d3c2a43f..bc4e95f2b1ecb1ad94058bb620dbb66f14f11c19 100644 (file)
@@ -358,6 +358,18 @@ class BasicTest(BaseTest):
         self.assertEqual(err, "".encode())
 
 
+    @unittest.skipUnless(sys.platform == 'darwin', 'only relevant on macOS')
+    def test_macos_env(self):
+        rmtree(self.env_dir)
+        builder = venv.EnvBuilder()
+        builder.create(self.env_dir)
+
+        envpy = os.path.join(os.path.realpath(self.env_dir),
+                             self.bindir, self.exe)
+        out, err = check_output([envpy, '-c',
+            'import os; print("__PYVENV_LAUNCHER__" in os.environ)'])
+        self.assertEqual(out.strip(), 'False'.encode())
+
 @requireVenvCreate
 class EnsurePipTest(BaseTest):
     """Test venv module installation of pip."""
index fc3f8f6fe7f0c2a6c14253e9f1f9c359d3503176..985adc1cda781c7d6219c345bba3a053b67e8b38 100644 (file)
@@ -43,6 +43,10 @@ def warnings_state(module):
         module.filters = original_filters
 
 
+class TestWarning(Warning):
+    pass
+
+
 class BaseTest:
 
     """Basic bookkeeping required for testing."""
@@ -566,9 +570,28 @@ class WCmdLineTests(BaseTest):
                               self.module._setoption, 'bogus::Warning')
             self.assertRaises(self.module._OptionError,
                               self.module._setoption, 'ignore:2::4:-5')
+            with self.assertRaises(self.module._OptionError):
+                self.module._setoption('ignore::123')
+            with self.assertRaises(self.module._OptionError):
+                self.module._setoption('ignore::123abc')
+            with self.assertRaises(self.module._OptionError):
+                self.module._setoption('ignore::===')
+            with self.assertRaisesRegex(self.module._OptionError, 'Wärning'):
+                self.module._setoption('ignore::Wärning')
             self.module._setoption('error::Warning::0')
             self.assertRaises(UserWarning, self.module.warn, 'convert to error')
 
+    def test_import_from_module(self):
+        with original_warnings.catch_warnings(module=self.module):
+            self.module._setoption('ignore::Warning')
+            with self.assertRaises(self.module._OptionError):
+                self.module._setoption('ignore::TestWarning')
+            with self.assertRaises(self.module._OptionError):
+                self.module._setoption('ignore::test.test_warnings.bogus')
+            self.module._setoption('error::test.test_warnings.TestWarning')
+            with self.assertRaises(TestWarning):
+                self.module.warn('test warning', TestWarning)
+
 
 class CWCmdLineTests(WCmdLineTests, unittest.TestCase):
     module = c_warnings
index 2144d203e1e95ce1cc8716154c1ca76830546580..e26e1714a540bdb6647caaf671d9e63646b83105 100644 (file)
@@ -118,6 +118,21 @@ class MiscTests(unittest.TestCase):
         elem.tail = X()
         elem.__setstate__({'tag': 42})  # shouldn't cause an assertion failure
 
+    @support.cpython_only
+    def test_uninitialized_parser(self):
+        # The interpreter shouldn't crash in case of calling methods or
+        # accessing attributes of uninitialized XMLParser objects.
+        parser = cET.XMLParser.__new__(cET.XMLParser)
+        self.assertRaises(ValueError, parser.close)
+        self.assertRaises(ValueError, parser.feed, 'foo')
+        class MockFile:
+            def read(*args):
+                return ''
+        self.assertRaises(ValueError, parser._parse_whole, MockFile())
+        self.assertRaises(ValueError, parser._setevents, None)
+        self.assertIsNone(parser.entity)
+        self.assertIsNone(parser.target)
+
     def test_setstate_leaks(self):
         # Test reference leaks
         elem = cET.Element.__new__(cET.Element)
index f03c044eae3a6027df5adea3532ea17f3a1f915b..28e62dc5c61c503dda70f37295858da7b6e5eeec 100644 (file)
@@ -5,6 +5,7 @@ import itertools
 import os
 import pathlib
 import posixpath
+import string
 import struct
 import subprocess
 import sys
@@ -597,11 +598,28 @@ class StoredTestsWithSourceFile(AbstractTestsWithSourceFile,
 
     def test_add_file_after_2107(self):
         # Set atime and mtime to 2108-12-30
+        ts = 4386268800
         try:
-            os.utime(TESTFN, (4386268800, 4386268800))
+            time.localtime(ts)
+        except OverflowError:
+            self.skipTest(f'time.localtime({ts}) raises OverflowError')
+        try:
+            os.utime(TESTFN, (ts, ts))
         except OverflowError:
             self.skipTest('Host fs cannot set timestamp to required value.')
 
+        mtime_ns = os.stat(TESTFN).st_mtime_ns
+        if mtime_ns != (4386268800 * 10**9):
+            # XFS filesystem is limited to 32-bit timestamp, but the syscall
+            # didn't fail. Moreover, there is a VFS bug which returns
+            # a cached timestamp which is different than the value on disk.
+            #
+            # Test st_mtime_ns rather than st_mtime to avoid rounding issues.
+            #
+            # https://bugzilla.redhat.com/show_bug.cgi?id=1795576
+            # https://bugs.python.org/issue39460#msg360952
+            self.skipTest(f"Linux VFS/XFS kernel bug detected: {mtime_ns=}")
+
         with zipfile.ZipFile(TESTFN2, "w") as zipfp:
             self.assertRaises(struct.error, zipfp.write, TESTFN)
 
@@ -2666,16 +2684,71 @@ class CommandLineTest(unittest.TestCase):
                                 self.assertEqual(f.read(), zf.read(zi))
 
 
+class TestExecutablePrependedZip(unittest.TestCase):
+    """Test our ability to open zip files with an executable prepended."""
+
+    def setUp(self):
+        self.exe_zip = findfile('exe_with_zip', subdir='ziptestdata')
+        self.exe_zip64 = findfile('exe_with_z64', subdir='ziptestdata')
+
+    def _test_zip_works(self, name):
+        # bpo28494 sanity check: ensure is_zipfile works on these.
+        self.assertTrue(zipfile.is_zipfile(name),
+                        f'is_zipfile failed on {name}')
+        # Ensure we can operate on these via ZipFile.
+        with zipfile.ZipFile(name) as zipfp:
+            for n in zipfp.namelist():
+                data = zipfp.read(n)
+                self.assertIn(b'FAVORITE_NUMBER', data)
+
+    def test_read_zip_with_exe_prepended(self):
+        self._test_zip_works(self.exe_zip)
+
+    def test_read_zip64_with_exe_prepended(self):
+        self._test_zip_works(self.exe_zip64)
+
+    @unittest.skipUnless(sys.executable, 'sys.executable required.')
+    @unittest.skipUnless(os.access('/bin/bash', os.X_OK),
+                         'Test relies on #!/bin/bash working.')
+    def test_execute_zip2(self):
+        output = subprocess.check_output([self.exe_zip, sys.executable])
+        self.assertIn(b'number in executable: 5', output)
+
+    @unittest.skipUnless(sys.executable, 'sys.executable required.')
+    @unittest.skipUnless(os.access('/bin/bash', os.X_OK),
+                         'Test relies on #!/bin/bash working.')
+    def test_execute_zip64(self):
+        output = subprocess.check_output([self.exe_zip64, sys.executable])
+        self.assertIn(b'number in executable: 5', output)
+
+
 # Poor man's technique to consume a (smallish) iterable.
 consume = tuple
 
 
+# from jaraco.itertools 5.0
+class jaraco:
+    class itertools:
+        class Counter:
+            def __init__(self, i):
+                self.count = 0
+                self._orig_iter = iter(i)
+
+            def __iter__(self):
+                return self
+
+            def __next__(self):
+                result = next(self._orig_iter)
+                self.count += 1
+                return result
+
+
 def add_dirs(zf):
     """
     Given a writable zip file zf, inject directory entries for
     any directories implied by the presence of children.
     """
-    for name in zipfile.Path._implied_dirs(zf.namelist()):
+    for name in zipfile.CompleteDirs._implied_dirs(zf.namelist()):
         zf.writestr(name, b"")
     return zf
 
@@ -2716,44 +2789,6 @@ def build_alpharep_fixture():
     return zf
 
 
-class TestExecutablePrependedZip(unittest.TestCase):
-    """Test our ability to open zip files with an executable prepended."""
-
-    def setUp(self):
-        self.exe_zip = findfile('exe_with_zip', subdir='ziptestdata')
-        self.exe_zip64 = findfile('exe_with_z64', subdir='ziptestdata')
-
-    def _test_zip_works(self, name):
-        # bpo-28494 sanity check: ensure is_zipfile works on these.
-        self.assertTrue(zipfile.is_zipfile(name),
-                        f'is_zipfile failed on {name}')
-        # Ensure we can operate on these via ZipFile.
-        with zipfile.ZipFile(name) as zipfp:
-            for n in zipfp.namelist():
-                data = zipfp.read(n)
-                self.assertIn(b'FAVORITE_NUMBER', data)
-
-    def test_read_zip_with_exe_prepended(self):
-        self._test_zip_works(self.exe_zip)
-
-    def test_read_zip64_with_exe_prepended(self):
-        self._test_zip_works(self.exe_zip64)
-
-    @unittest.skipUnless(sys.executable, 'sys.executable required.')
-    @unittest.skipUnless(os.access('/bin/bash', os.X_OK),
-                         'Test relies on #!/bin/bash working.')
-    def test_execute_zip2(self):
-        output = subprocess.check_output([self.exe_zip, sys.executable])
-        self.assertIn(b'number in executable: 5', output)
-
-    @unittest.skipUnless(sys.executable, 'sys.executable required.')
-    @unittest.skipUnless(os.access('/bin/bash', os.X_OK),
-                         'Test relies on #!/bin/bash working.')
-    def test_execute_zip64(self):
-        output = subprocess.check_output([self.exe_zip64, sys.executable])
-        self.assertIn(b'number in executable: 5', output)
-
-
 class TestPath(unittest.TestCase):
     def setUp(self):
         self.fixtures = contextlib.ExitStack()
@@ -2791,6 +2826,14 @@ class TestPath(unittest.TestCase):
             i, = h.iterdir()
             assert i.is_file()
 
+    def test_subdir_is_dir(self):
+        for alpharep in self.zipfile_alpharep():
+            root = zipfile.Path(alpharep)
+            assert (root / 'b').is_dir()
+            assert (root / 'b/').is_dir()
+            assert (root / 'g').is_dir()
+            assert (root / 'g/').is_dir()
+
     def test_open(self):
         for alpharep in self.zipfile_alpharep():
             root = zipfile.Path(alpharep)
@@ -2852,6 +2895,50 @@ class TestPath(unittest.TestCase):
             root = zipfile.Path(alpharep)
             assert (root / 'missing dir/').parent.at == ''
 
+    def test_mutability(self):
+        """
+        If the underlying zipfile is changed, the Path object should
+        reflect that change.
+        """
+        for alpharep in self.zipfile_alpharep():
+            root = zipfile.Path(alpharep)
+            a, b, g = root.iterdir()
+            alpharep.writestr('foo.txt', 'foo')
+            alpharep.writestr('bar/baz.txt', 'baz')
+            assert any(
+                child.name == 'foo.txt'
+                for child in root.iterdir())
+            assert (root / 'foo.txt').read_text() == 'foo'
+            baz, = (root / 'bar').iterdir()
+            assert baz.read_text() == 'baz'
+
+    HUGE_ZIPFILE_NUM_ENTRIES = 2 ** 13
+
+    def huge_zipfile(self):
+        """Create a read-only zipfile with a huge number of entries entries."""
+        strm = io.BytesIO()
+        zf = zipfile.ZipFile(strm, "w")
+        for entry in map(str, range(self.HUGE_ZIPFILE_NUM_ENTRIES)):
+            zf.writestr(entry, entry)
+        zf.mode = 'r'
+        return zf
+
+    def test_joinpath_constant_time(self):
+        """
+        Ensure joinpath on items in zipfile is linear time.
+        """
+        root = zipfile.Path(self.huge_zipfile())
+        entries = jaraco.itertools.Counter(root.iterdir())
+        for entry in entries:
+            entry.joinpath('suffix')
+        # Check the file iterated all items
+        assert entries.count == self.HUGE_ZIPFILE_NUM_ENTRIES
+
+    # @func_timeout.func_set_timeout(3)
+    def test_implied_dirs_performance(self):
+        data = ['/'.join(string.ascii_lowercase + str(n)) for n in range(10000)]
+        zipfile.CompleteDirs._implied_dirs(data)
+
 
 if __name__ == "__main__":
     unittest.main()
index d4f619e9acdb9b7b4f9f6987a80238a60fb1b24e..2af8689c1d2cb200df007654f8f81da0c33c3477 100644 (file)
@@ -6,6 +6,7 @@ import importlib.util
 import struct
 import time
 import unittest
+import unittest.mock
 
 from test import support
 
@@ -204,6 +205,21 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
             self.assertEqual(mod.state, 'old')
         self.doTest(None, files, TESTMOD, call=check)
 
+    @unittest.mock.patch('_imp.check_hash_based_pycs', 'always')
+    def test_checked_hash_based_change_pyc(self):
+        source = b"state = 'old'"
+        source_hash = importlib.util.source_hash(source)
+        bytecode = importlib._bootstrap_external._code_to_hash_pyc(
+            compile(source, "???", "exec"),
+            source_hash,
+            False,
+        )
+        files = {TESTMOD + ".py": (NOW, "state = 'new'"),
+                 TESTMOD + ".pyc": (NOW - 20, bytecode)}
+        def check(mod):
+            self.assertEqual(mod.state, 'new')
+        self.doTest(None, files, TESTMOD, call=check)
+
     def testEmptyPy(self):
         files = {TESTMOD + ".py": (NOW, "")}
         self.doTest(None, files, TESTMOD)
index 2f6ac7036f5f62ca357164aefa51ab2e2ba430c2..813dae2aa9f8e5d3b565482f033394ba3cbb9bc7 100644 (file)
@@ -1421,7 +1421,15 @@ def _after_fork():
 
     # fork() only copied the current thread; clear references to others.
     new_active = {}
-    current = current_thread()
+
+    try:
+        current = _active[get_ident()]
+    except KeyError:
+        # fork() was called in a thread which was not spawned
+        # by threading.Thread. For example, a thread spawned
+        # by thread.start_new_thread().
+        current = _MainThread()
+
     _main_thread = current
 
     # reset _shutdown() locks: threads re-register their _tstate_lock below
index c0362bcc5f3e2483e56e428a58448ce74cbec198..6c3ec01067f2d415a87eda572b8727be383d0141 100755 (executable)
@@ -29,7 +29,8 @@ argument in quotes and using leading spaces.  Multiple -s options are
 treated similarly.
 
 If -n is not given, a suitable number of loops is calculated by trying
-successive powers of 10 until the total time is at least 0.2 seconds.
+increasing numbers from the sequence 1, 2, 5, 10, 20, 50, ... until the
+total time is at least 0.2 seconds.
 
 Note: there is a certain baseline overhead associated with executing a
 pass statement.  It differs between versions.  The code here doesn't try
index 75a068fbbf26b6a8b337597fc71430530276d068..b42ff52178f29e7c585febcb916871dcc1b7574d 100644 (file)
@@ -3,7 +3,6 @@
 import unittest
 import sys
 import tkinter
-from tkinter.ttk import Scale
 from tkinter.test.support import (AbstractTkTest, tcl_version, requires_tcl,
                                   get_tk_patchlevel, pixels_conv, tcl_obj_eq)
 import test.support
@@ -63,11 +62,9 @@ class AbstractWidgetTest(AbstractTkTest):
             eq = tcl_obj_eq
         self.assertEqual2(widget[name], expected, eq=eq)
         self.assertEqual2(widget.cget(name), expected, eq=eq)
-        # XXX
-        if not isinstance(widget, Scale):
-            t = widget.configure(name)
-            self.assertEqual(len(t), 5)
-            self.assertEqual2(t[4], expected, eq=eq)
+        t = widget.configure(name)
+        self.assertEqual(len(t), 5)
+        self.assertEqual2(t[4], expected, eq=eq)
 
     def checkInvalidParam(self, widget, name, value, errmsg=None, *,
                           keep_orig=True):
@@ -209,9 +206,7 @@ class AbstractWidgetTest(AbstractTkTest):
     def test_keys(self):
         widget = self.create()
         keys = widget.keys()
-        # XXX
-        if not isinstance(widget, Scale):
-            self.assertEqual(sorted(keys), sorted(widget.configure()))
+        self.assertEqual(sorted(keys), sorted(widget.configure()))
         for k in keys:
             widget[k]
         # Test if OPTIONS contains all keys
index d9c097a77cdd186dec775405c1b36d7b6ee64766..ac545502e45c30b22395de366f2f18e0f8f614b5 100644 (file)
@@ -1890,7 +1890,7 @@ class Grid(TixWidget, XView, YView):
         containing the current size setting of the given column.  When
         option-value pairs are given, the corresponding options of the
         size setting of the given column are changed. Options may be one
-        of the follwing:
+        of the following:
               pad0 pixels
                      Specifies the paddings to the left of a column.
               pad1 pixels
@@ -1915,7 +1915,7 @@ class Grid(TixWidget, XView, YView):
         When no option-value pair is given, this command returns a list con-
         taining the current size setting of the given row . When option-value
         pairs are given, the corresponding options of the size setting of the
-        given row are changed. Options may be one of the follwing:
+        given row are changed. Options may be one of the following:
               pad0 pixels
                      Specifies the paddings to the top of a row.
               pad1 pixels
index 573544dd84a390215d878953af91d8b011790ef4..c7c71cd5a559cf610c50bfac57457cfedac770c5 100644 (file)
@@ -1084,11 +1084,12 @@ class Scale(Widget, tkinter.Scale):
 
         Setting a value for any of the "from", "from_" or "to" options
         generates a <<RangeChanged>> event."""
-        if cnf:
+        retval = Widget.configure(self, cnf, **kw)
+        if not isinstance(cnf, (type(None), str)):
             kw.update(cnf)
-        Widget.configure(self, **kw)
         if any(['from' in kw, 'from_' in kw, 'to' in kw]):
             self.event_generate('<<RangeChanged>>')
+        return retval
 
 
     def get(self, x=None, y=None):
index 62325d3f238ad61fff6984a10da9aa58e146db67..a44735761df4207651581a32d7862a13ceecc385 100755 (executable)
@@ -52,6 +52,7 @@ __all__ = ['Trace', 'CoverageResults']
 import linecache
 import os
 import sys
+import sysconfig
 import token
 import tokenize
 import inspect
@@ -676,9 +677,8 @@ def main():
     opts = parser.parse_args()
 
     if opts.ignore_dir:
-        rel_path = 'lib', 'python{0.major}.{0.minor}'.format(sys.version_info)
-        _prefix = os.path.join(sys.base_prefix, *rel_path)
-        _exec_prefix = os.path.join(sys.base_exec_prefix, *rel_path)
+        _prefix = sysconfig.get_path("stdlib")
+        _exec_prefix = sysconfig.get_path("platstdlib")
 
     def parse_ignore_dir(s):
         s = os.path.expanduser(os.path.expandvars(s))
index ab35da94b51eabe297a12185762e4076c59fd46b..5ef3be74be74ab342dd9896056cab363f3fe803f 100644 (file)
@@ -549,7 +549,7 @@ class TracebackException:
         The return value is a generator of strings, each ending in a newline.
 
         Normally, the generator emits a single string; however, for
-        SyntaxError exceptions, it emites several lines that (when
+        SyntaxError exceptions, it emits several lines that (when
         printed) display detailed information about where the syntax
         error occurred.
 
index 17fe9a75e1c5ea93f9394de40ab28844c44c00f4..12be5098dad274a6c08b2b20728d0ff086867a1c 100644 (file)
@@ -272,7 +272,7 @@ class DemoWindow(object):
         self.stop_btn.config(state=stop,
                              bg="#d00" if stop == NORMAL else "#fca")
         self.clear_btn.config(state=clear,
-                              bg="#d00" if clear == NORMAL else"#fca")
+                              bg="#d00" if clear == NORMAL else "#fca")
         self.output_lbl.config(text=txt, fg=color)
 
     def makeLoadDemoMenu(self, master):
index 69f6d9873490a9323cec684fcfbe3d0c54ee17e8..589eea98ad31c6ffd2affc179166069646172345 100644 (file)
@@ -13,7 +13,7 @@ At large scale, the structure of the module is following:
 * Public helper functions: get_type_hints, overload, cast, no_type_check,
   no_type_check_decorator.
 * Generic aliases for collections.abc ABCs and few additional protocols.
-* Special types: NewType, NamedTuple, TypedDict (may be added soon).
+* Special types: NewType, NamedTuple, TypedDict.
 * Wrapper submodules for re and io related types.
 """
 
@@ -600,7 +600,10 @@ class TypeVar(_Final, _Immutable, _root=True):
             self.__bound__ = _type_check(bound, "Bound must be a type.")
         else:
             self.__bound__ = None
-        def_mod = sys._getframe(1).f_globals['__name__']  # for pickling
+        try:
+            def_mod = sys._getframe(1).f_globals.get('__name__', '__main__')  # for pickling
+        except (AttributeError, ValueError):
+            def_mod = None
         if def_mod != 'typing':
             self.__module__ = def_mod
 
@@ -1297,7 +1300,7 @@ def get_args(tp):
         get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
         get_args(Callable[[], T][int]) == ([], int)
     """
-    if isinstance(tp, _GenericAlias):
+    if isinstance(tp, _GenericAlias) and not tp._special:
         res = tp.__args__
         if get_origin(tp) is collections.abc.Callable and res[0] is not Ellipsis:
             res = (list(res[:-1]), res[-1])
@@ -1779,6 +1782,19 @@ class TypedDict(dict, metaclass=_TypedDictMeta):
         Point2D = TypedDict('Point2D', x=int, y=int, label=str)
         Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
 
+    By default, all keys must be present in a TypedDict. It is possible
+    to override this by specifying totality.
+    Usage::
+
+        class point2D(TypedDict, total=False):
+            x: int
+            y: int
+
+    This means that a point2D TypedDict can have any of the keys omitted.A type
+    checker is only expected to support a literal False or True as the value of
+    the total argument. True is the default, and makes all items defined in the
+    class body be required.
+
     The class syntax is only supported in Python 3.6+, while two other
     syntax forms work for Python 2.7 and 3.2+
     """
@@ -1848,6 +1864,7 @@ class IO(Generic[AnyStr]):
     def close(self) -> None:
         pass
 
+    @property
     @abstractmethod
     def closed(self) -> bool:
         pass
index b639c64d02a7aac4c2d292c194a2df71f4858414..e5734b6b7a298bd60338d5e599047d1de3cf00b1 100644 (file)
@@ -529,7 +529,7 @@ class TestCase(object):
         the specified test method's docstring.
         """
         doc = self._testMethodDoc
-        return doc and doc.split("\n")[0].strip() or None
+        return doc.strip().split("\n")[0].strip() if doc else None
 
 
     def id(self):
index e92ccf168dbbde88b96ac7ce40166fb273197912..3629cf61098f63b7d8a22793325dd30c70d0c969 100644 (file)
@@ -48,6 +48,8 @@ _safe_super = super
 def _is_async_obj(obj):
     if _is_instance_mock(obj) and not isinstance(obj, AsyncMock):
         return False
+    if hasattr(obj, '__func__'):
+        obj = getattr(obj, '__func__')
     return asyncio.iscoroutinefunction(obj) or inspect.isawaitable(obj)
 
 
@@ -825,6 +827,10 @@ class NonCallableMock(Base):
             if child is None or isinstance(child, _SpecState):
                 break
             else:
+                # If an autospecced object is attached using attach_mock the
+                # child would be a function with mock object as attribute from
+                # which signature has to be derived.
+                child = _extract_mock(child)
                 children = child._mock_children
                 sig = child._spec_signature
 
@@ -1223,11 +1229,6 @@ def _importer(target):
     return thing
 
 
-def _is_started(patcher):
-    # XXXX horrible
-    return hasattr(patcher, 'is_local')
-
-
 class _patch(object):
 
     attribute_name = None
@@ -1298,14 +1299,9 @@ class _patch(object):
     @contextlib.contextmanager
     def decoration_helper(self, patched, args, keywargs):
         extra_args = []
-        entered_patchers = []
-        patching = None
-
-        exc_info = tuple()
-        try:
+        with contextlib.ExitStack() as exit_stack:
             for patching in patched.patchings:
-                arg = patching.__enter__()
-                entered_patchers.append(patching)
+                arg = exit_stack.enter_context(patching)
                 if patching.attribute_name is not None:
                     keywargs.update(arg)
                 elif patching.new is DEFAULT:
@@ -1313,19 +1309,6 @@ class _patch(object):
 
             args += tuple(extra_args)
             yield (args, keywargs)
-        except:
-            if (patching not in entered_patchers and
-                _is_started(patching)):
-                # the patcher may have been started, but an exception
-                # raised whilst entering one of its additional_patchers
-                entered_patchers.append(patching)
-            # Pass the exception to __exit__
-            exc_info = sys.exc_info()
-            # re-raise the exception
-            raise
-        finally:
-            for patching in reversed(entered_patchers):
-                patching.__exit__(*exc_info)
 
 
     def decorate_callable(self, func):
@@ -1502,25 +1485,26 @@ class _patch(object):
 
         self.temp_original = original
         self.is_local = local
-        setattr(self.target, self.attribute, new_attr)
-        if self.attribute_name is not None:
-            extra_args = {}
-            if self.new is DEFAULT:
-                extra_args[self.attribute_name] =  new
-            for patching in self.additional_patchers:
-                arg = patching.__enter__()
-                if patching.new is DEFAULT:
-                    extra_args.update(arg)
-            return extra_args
-
-        return new
-
+        self._exit_stack = contextlib.ExitStack()
+        try:
+            setattr(self.target, self.attribute, new_attr)
+            if self.attribute_name is not None:
+                extra_args = {}
+                if self.new is DEFAULT:
+                    extra_args[self.attribute_name] =  new
+                for patching in self.additional_patchers:
+                    arg = self._exit_stack.enter_context(patching)
+                    if patching.new is DEFAULT:
+                        extra_args.update(arg)
+                return extra_args
+
+            return new
+        except:
+            if not self.__exit__(*sys.exc_info()):
+                raise
 
     def __exit__(self, *exc_info):
         """Undo the patch."""
-        if not _is_started(self):
-            return
-
         if self.is_local and self.temp_original is not DEFAULT:
             setattr(self.target, self.attribute, self.temp_original)
         else:
@@ -1535,9 +1519,9 @@ class _patch(object):
         del self.temp_original
         del self.is_local
         del self.target
-        for patcher in reversed(self.additional_patchers):
-            if _is_started(patcher):
-                patcher.__exit__(*exc_info)
+        exit_stack = self._exit_stack
+        del self._exit_stack
+        return exit_stack.__exit__(*exc_info)
 
 
     def start(self):
@@ -1553,9 +1537,9 @@ class _patch(object):
             self._active_patches.remove(self)
         except ValueError:
             # If the patch hasn't been started this will fail
-            pass
+            return None
 
-        return self.__exit__()
+        return self.__exit__(None, None, None)
 
 
 
@@ -2130,7 +2114,7 @@ class AsyncMockMixin(Base):
         # This is nearly just like super(), except for sepcial handling
         # of coroutines
 
-        _call = self.call_args
+        _call = _Call((args, kwargs), two=True)
         self.await_count += 1
         self.await_args = _call
         self.await_args_list.append(_call)
@@ -2709,7 +2693,7 @@ def _must_skip(spec, entry, is_type):
             continue
         if isinstance(result, (staticmethod, classmethod)):
             return False
-        elif isinstance(getattr(result, '__get__', None), MethodWrapperTypes):
+        elif isinstance(result, FunctionTypes):
             # Normal method => skip if looked up on type
             # (if looked up on instance, self is already skipped)
             return is_type
@@ -2739,10 +2723,6 @@ FunctionTypes = (
     type(ANY.__eq__),
 )
 
-MethodWrapperTypes = (
-    type(ANY.__eq__.__get__),
-)
-
 
 file_spec = None
 
index c2401c39b917e30f591b19669d8c762dba97ac7d..f855c4dc00b316ee90b0d750e5f2a614fae6f5d4 100644 (file)
@@ -610,6 +610,15 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
                  'Tests shortDescription() for a method with a longer '
                  'docstring.')
 
+    def testShortDescriptionWhitespaceTrimming(self):
+        """
+            Tests shortDescription() whitespace is trimmed, so that the first
+            line of nonwhite-space text becomes the docstring.
+        """
+        self.assertEqual(
+            self.shortDescription(),
+            'Tests shortDescription() whitespace is trimmed, so that the first')
+
     def testAddTypeEqualityFunc(self):
         class SadSnake(object):
             """Dummy class for test_addTypeEqualityFunc."""
index be8e3117c466b3496c488a3f143aaaba2e7a3ab0..e84c66c0bdd05e5a00e446840fc4e50e173527c6 100644 (file)
@@ -19,6 +19,15 @@ class AsyncClass:
     def normal_method(self):
         pass
 
+    @classmethod
+    async def async_class_method(cls):
+        pass
+
+    @staticmethod
+    async def async_static_method():
+        pass
+
+
 class AwaitableClass:
     def __await__(self):
         yield
@@ -71,10 +80,32 @@ class AsyncPatchDecoratorTest(unittest.TestCase):
 
         test_async()
 
+    def test_is_AsyncMock_patch_staticmethod(self):
+        @patch.object(AsyncClass, 'async_static_method')
+        def test_async(mock_method):
+            self.assertIsInstance(mock_method, AsyncMock)
+
+        test_async()
+
+    def test_is_AsyncMock_patch_classmethod(self):
+        @patch.object(AsyncClass, 'async_class_method')
+        def test_async(mock_method):
+            self.assertIsInstance(mock_method, AsyncMock)
+
+        test_async()
+
     def test_async_def_patch(self):
-        @patch(f"{__name__}.async_func", AsyncMock())
-        async def test_async():
+        @patch(f"{__name__}.async_func", return_value=1)
+        @patch(f"{__name__}.async_func_args", return_value=2)
+        async def test_async(func_args_mock, func_mock):
+            self.assertEqual(func_args_mock._mock_name, "async_func_args")
+            self.assertEqual(func_mock._mock_name, "async_func")
+
             self.assertIsInstance(async_func, AsyncMock)
+            self.assertIsInstance(async_func_args, AsyncMock)
+
+            self.assertEqual(await async_func(), 1)
+            self.assertEqual(await async_func_args(1, 2, c=3), 2)
 
         asyncio.run(test_async())
         self.assertTrue(inspect.iscoroutinefunction(async_func))
@@ -370,22 +401,40 @@ class AsyncArguments(unittest.IsolatedAsyncioTestCase):
         with self.assertRaises(Exception):
             await mock(5)
 
-    async def test_add_side_effect_function(self):
+    async def test_add_side_effect_coroutine(self):
         async def addition(var):
             return var + 1
         mock = AsyncMock(side_effect=addition)
         result = await mock(5)
         self.assertEqual(result, 6)
 
+    async def test_add_side_effect_normal_function(self):
+        def addition(var):
+            return var + 1
+        mock = AsyncMock(side_effect=addition)
+        result = await mock(5)
+        self.assertEqual(result, 6)
+
     async def test_add_side_effect_iterable(self):
         vals = [1, 2, 3]
         mock = AsyncMock(side_effect=vals)
         for item in vals:
-            self.assertEqual(item, await mock())
+            self.assertEqual(await mock(), item)
 
         with self.assertRaises(StopAsyncIteration) as e:
             await mock()
 
+    async def test_add_side_effect_exception_iterable(self):
+        class SampleException(Exception):
+            pass
+
+        vals = [1, SampleException("foo")]
+        mock = AsyncMock(side_effect=vals)
+        self.assertEqual(await mock(), 1)
+
+        with self.assertRaises(SampleException) as e:
+            await mock()
+
     async def test_return_value_AsyncMock(self):
         value = AsyncMock(return_value=10)
         mock = AsyncMock(return_value=value)
@@ -432,6 +481,32 @@ class AsyncArguments(unittest.IsolatedAsyncioTestCase):
         mock.assert_awaited()
         self.assertTrue(ran)
 
+    async def test_wraps_normal_function(self):
+        value = 1
+
+        ran = False
+        def inner():
+            nonlocal ran
+            ran = True
+            return value
+
+        mock = AsyncMock(wraps=inner)
+        result = await mock()
+        self.assertEqual(result, value)
+        mock.assert_awaited()
+        self.assertTrue(ran)
+
+    async def test_await_args_list_order(self):
+        async_mock = AsyncMock()
+        mock2 = async_mock(2)
+        mock1 = async_mock(1)
+        await mock1
+        await mock2
+        async_mock.assert_has_awaits([call(1), call(2)])
+        self.assertEqual(async_mock.await_args_list, [call(1), call(2)])
+        self.assertEqual(async_mock.call_args_list, [call(2), call(1)])
+
+
 class AsyncMagicMethods(unittest.TestCase):
     def test_async_magic_methods_return_async_mocks(self):
         m_mock = MagicMock()
@@ -854,6 +929,10 @@ class AsyncMockAssert(unittest.TestCase):
             self.mock.assert_awaited_once()
 
     def test_assert_awaited_with(self):
+        msg = 'Not awaited'
+        with self.assertRaisesRegex(AssertionError, msg):
+            self.mock.assert_awaited_with('foo')
+
         asyncio.run(self._runnable_test())
         msg = 'expected await not found'
         with self.assertRaisesRegex(AssertionError, msg):
index 6dc2725427ec56b5f8879909ae33c6a51608bbec..1cde45e9aea5550b42c2150306842552b902ef79 100644 (file)
@@ -1914,6 +1914,35 @@ class MockTest(unittest.TestCase):
             self.assertEqual(mock_func.mock._extract_mock_name(), 'mock.child')
 
 
+    def test_attach_mock_patch_autospec_signature(self):
+        with mock.patch(f'{__name__}.Something.meth', autospec=True) as mocked:
+            manager = Mock()
+            manager.attach_mock(mocked, 'attach_meth')
+            obj = Something()
+            obj.meth(1, 2, 3, d=4)
+            manager.assert_has_calls([call.attach_meth(mock.ANY, 1, 2, 3, d=4)])
+            obj.meth.assert_has_calls([call(mock.ANY, 1, 2, 3, d=4)])
+            mocked.assert_has_calls([call(mock.ANY, 1, 2, 3, d=4)])
+
+        with mock.patch(f'{__name__}.something', autospec=True) as mocked:
+            manager = Mock()
+            manager.attach_mock(mocked, 'attach_func')
+            something(1)
+            manager.assert_has_calls([call.attach_func(1)])
+            something.assert_has_calls([call(1)])
+            mocked.assert_has_calls([call(1)])
+
+        with mock.patch(f'{__name__}.Something', autospec=True) as mocked:
+            manager = Mock()
+            manager.attach_mock(mocked, 'attach_obj')
+            obj = Something()
+            obj.meth(1, 2, 3, d=4)
+            manager.assert_has_calls([call.attach_obj(),
+                                      call.attach_obj().meth(1, 2, 3, d=4)])
+            obj.meth.assert_has_calls([call(1, 2, 3, d=4)])
+            mocked.assert_has_calls([call(), call().meth(1, 2, 3, d=4)])
+
+
     def test_attribute_deletion(self):
         for mock in (Mock(), MagicMock(), NonCallableMagicMock(),
                      NonCallableMock()):
index d497925b943f44d86b3b7f84db53a97c78050720..e2b6f133e1cd9c7478a28e71fa8630051eb4bae4 100644 (file)
@@ -431,11 +431,31 @@ def urlsplit(url, scheme='', allow_fragments=True):
     netloc = query = fragment = ''
     i = url.find(':')
     if i > 0:
+        if url[:i] == 'http': # optimize the common case
+            url = url[i+1:]
+            if url[:2] == '//':
+                netloc, url = _splitnetloc(url, 2)
+                if (('[' in netloc and ']' not in netloc) or
+                        (']' in netloc and '[' not in netloc)):
+                    raise ValueError("Invalid IPv6 URL")
+            if allow_fragments and '#' in url:
+                url, fragment = url.split('#', 1)
+            if '?' in url:
+                url, query = url.split('?', 1)
+            _checknetloc(netloc)
+            v = SplitResult('http', netloc, url, query, fragment)
+            _parse_cache[key] = v
+            return _coerce_result(v)
         for c in url[:i]:
             if c not in scheme_chars:
                 break
         else:
-            scheme, url = url[:i].lower(), url[i+1:]
+            # make sure "url" is not actually a port number (in which case
+            # "scheme" is really part of the path)
+            rest = url[i+1:]
+            if not rest or any(c not in '0123456789' for c in rest):
+                # not a port number
+                scheme, url = url[:i].lower(), rest
 
     if url[:2] == '//':
         netloc, url = _splitnetloc(url, 2)
@@ -1054,9 +1074,9 @@ def _splitport(host):
     """splitport('host:port') --> 'host', 'port'."""
     global _portprog
     if _portprog is None:
-        _portprog = re.compile('(.*):([0-9]*)$', re.DOTALL)
+        _portprog = re.compile('(.*):([0-9]*)', re.DOTALL)
 
-    match = _portprog.match(host)
+    match = _portprog.fullmatch(host)
     if match:
         host, port = match.groups()
         if port:
index 51c4759629fd1ff9fb5d277eeeced8aa4ec7182d..e44073886a6cd94be262291b1c02f8504134a2ee 100644 (file)
@@ -945,8 +945,15 @@ class AbstractBasicAuthHandler:
 
     # allow for double- and single-quoted realm values
     # (single quotes are a violation of the RFC, but appear in the wild)
-    rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+'
-                    'realm=(["\']?)([^"\']*)\\2', re.I)
+    rx = re.compile('(?:^|,)'   # start of the string or ','
+                    '[ \t]*'    # optional whitespaces
+                    '([^ \t]+)' # scheme like "Basic"
+                    '[ \t]+'    # mandatory whitespaces
+                    # realm=xxx
+                    # realm='xxx'
+                    # realm="xxx"
+                    'realm=(["\']?)([^"\']*)\\2',
+                    re.I)
 
     # XXX could pre-emptively send auth info already accepted (RFC 2617,
     # end of section 2, and section 1.2 immediately after "credentials"
@@ -958,27 +965,51 @@ class AbstractBasicAuthHandler:
         self.passwd = password_mgr
         self.add_password = self.passwd.add_password
 
+    def _parse_realm(self, header):
+        # parse WWW-Authenticate header: accept multiple challenges per header
+        found_challenge = False
+        for mo in AbstractBasicAuthHandler.rx.finditer(header):
+            scheme, quote, realm = mo.groups()
+            if quote not in ['"', "'"]:
+                warnings.warn("Basic Auth Realm was unquoted",
+                              UserWarning, 3)
+
+            yield (scheme, realm)
+
+            found_challenge = True
+
+        if not found_challenge:
+            if header:
+                scheme = header.split()[0]
+            else:
+                scheme = ''
+            yield (scheme, None)
+
     def http_error_auth_reqed(self, authreq, host, req, headers):
         # host may be an authority (without userinfo) or a URL with an
         # authority
-        # XXX could be multiple headers
-        authreq = headers.get(authreq, None)
+        headers = headers.get_all(authreq)
+        if not headers:
+            # no header found
+            return
 
-        if authreq:
-            scheme = authreq.split()[0]
-            if scheme.lower() != 'basic':
-                raise ValueError("AbstractBasicAuthHandler does not"
-                                 " support the following scheme: '%s'" %
-                                 scheme)
-            else:
-                mo = AbstractBasicAuthHandler.rx.search(authreq)
-                if mo:
-                    scheme, quote, realm = mo.groups()
-                    if quote not in ['"',"'"]:
-                        warnings.warn("Basic Auth Realm was unquoted",
-                                      UserWarning, 2)
-                    if scheme.lower() == 'basic':
-                        return self.retry_http_basic_auth(host, req, realm)
+        unsupported = None
+        for header in headers:
+            for scheme, realm in self._parse_realm(header):
+                if scheme.lower() != 'basic':
+                    unsupported = scheme
+                    continue
+
+                if realm is not None:
+                    # Use the first matching Basic challenge.
+                    # Ignore following challenges even if they use the Basic
+                    # scheme.
+                    return self.retry_http_basic_auth(host, req, realm)
+
+        if unsupported is not None:
+            raise ValueError("AbstractBasicAuthHandler does not "
+                             "support the following scheme: %r"
+                             % (scheme,))
 
     def retry_http_basic_auth(self, host, req, realm):
         user, pw = self.passwd.find_user_password(realm, host)
@@ -1146,7 +1177,9 @@ class AbstractDigestAuthHandler:
                         req.selector)
         # NOTE: As per  RFC 2617, when server sends "auth,auth-int", the client could use either `auth`
         #     or `auth-int` to the response back. we use `auth` to send the response back.
-        if 'auth' in qop.split(','):
+        if qop is None:
+            respdig = KD(H(A1), "%s:%s" % (nonce, H(A2)))
+        elif 'auth' in qop.split(','):
             if nonce == self.last_nonce:
                 self.nonce_count += 1
             else:
@@ -1156,8 +1189,6 @@ class AbstractDigestAuthHandler:
             cnonce = self.get_cnonce(nonce)
             noncebit = "%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, 'auth', H(A2))
             respdig = KD(H(A1), noncebit)
-        elif qop is None:
-            respdig = KD(H(A1), "%s:%s" % (nonce, H(A2)))
         else:
             # XXX handle auth-int.
             raise URLError("qop '%s' is not supported." % qop)
@@ -2500,24 +2531,26 @@ def proxy_bypass_environment(host, proxies=None):
     try:
         no_proxy = proxies['no']
     except KeyError:
-        return 0
+        return False
     # '*' is special case for always bypass
     if no_proxy == '*':
-        return 1
+        return True
+    host = host.lower()
     # strip port off host
     hostonly, port = _splitport(host)
     # check if the host ends with any of the DNS suffixes
-    no_proxy_list = [proxy.strip() for proxy in no_proxy.split(',')]
-    for name in no_proxy_list:
+    for name in no_proxy.split(','):
+        name = name.strip()
         if name:
             name = name.lstrip('.')  # ignore leading dots
-            name = re.escape(name)
-            pattern = r'(.+\.)?%s$' % name
-            if (re.match(pattern, hostonly, re.I)
-                    or re.match(pattern, host, re.I)):
-                return 1
+            name = name.lower()
+            if hostonly == name or host == name:
+                return True
+            name = '.' + name
+            if hostonly.endswith(name) or host.endswith(name):
+                return True
     # otherwise, don't bypass
-    return 0
+    return False
 
 
 # This code tests an OSX specific data structure but is testable on all
@@ -2643,7 +2676,7 @@ elif os.name == 'nt':
                     for p in proxyServer.split(';'):
                         protocol, address = p.split('=', 1)
                         # See if address has a type:// prefix
-                        if not re.match('^([^/:]+)://', address):
+                        if not re.match('(?:[^/:]+)://', address):
                             address = '%s://%s' % (protocol, address)
                         proxies[protocol] = address
                 else:
index 5b9adb2b70c30bec228491822bdfba90f5f13a85..90af274d6c2bb2566bfbef7fbc6e887f78a57402 100644 (file)
@@ -1,6 +1,6 @@
 <#\r
 .Synopsis\r
-Activate a Python virtual environment for the current Powershell session.\r
+Activate a Python virtual environment for the current PowerShell session.\r
 \r
 .Description\r
 Pushes the python executable for a virtual environment to the front of the\r
@@ -37,6 +37,15 @@ Activates the Python virtual environment that contains the Activate.ps1 script,
 and prefixes the current prompt with the specified string (surrounded in\r
 parentheses) while the virtual environment is active.\r
 \r
+.Notes\r
+On Windows, it may be required to enable this Activate.ps1 script by setting the\r
+execution policy for the user. You can do this by issuing the following PowerShell\r
+command:\r
+\r
+PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser\r
+\r
+For more information on Execution Policies: \r
+ttps:/go.microsoft.com/fwlink/?LinkID=135170\r
 \r
 #>\r
 Param(\r
@@ -137,7 +146,7 @@ function Get-PyVenvConfig(
                 $val = $keyval[1]\r
 \r
                 # Remove extraneous quotations around a string value.\r
-                if ("'""".Contains($val.Substring(0,1))) {\r
+                if ("'""".Contains($val.Substring(0, 1))) {\r
                     $val = $val.Substring(1, $val.Length - 2)\r
                 }\r
 \r
@@ -165,10 +174,10 @@ Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
 # VenvExecDir if specified on the command line.\r
 if ($VenvDir) {\r
     Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"\r
-} else {\r
+}\r
+else {\r
     Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."\r
     $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")\r
-    $VenvDir = $VenvDir.Insert($VenvDir.Length, "/")\r
     Write-Verbose "VenvDir=$VenvDir"\r
 }\r
 \r
@@ -180,7 +189,8 @@ $pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
 # just use the name of the virtual environment folder.\r
 if ($Prompt) {\r
     Write-Verbose "Prompt specified as argument, using '$Prompt'"\r
-} else {\r
+}\r
+else {\r
     Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"\r
     if ($pyvenvCfg -and $pyvenvCfg['prompt']) {\r
         Write-Verbose "  Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"\r
index 00f740ca3a95baaeca5b50a4810c59e956d7629f..691ccddfa450ad242e45458e693dbdead2d56bf4 100644 (file)
@@ -211,7 +211,6 @@ def _processoptions(args):
 
 # Helper for _processoptions()
 def _setoption(arg):
-    import re
     parts = arg.split(':')
     if len(parts) > 5:
         raise _OptionError("too many fields (max 5): %r" % (arg,))
@@ -220,11 +219,13 @@ def _setoption(arg):
     action, message, category, module, lineno = [s.strip()
                                                  for s in parts]
     action = _getaction(action)
-    message = re.escape(message)
     category = _getcategory(category)
-    module = re.escape(module)
+    if message or module:
+        import re
+    if message:
+        message = re.escape(message)
     if module:
-        module = module + '$'
+        module = re.escape(module) + r'\Z'
     if lineno:
         try:
             lineno = int(lineno)
@@ -248,26 +249,21 @@ def _getaction(action):
 
 # Helper for _setoption()
 def _getcategory(category):
-    import re
     if not category:
         return Warning
-    if re.match("^[a-zA-Z0-9_]+$", category):
-        try:
-            cat = eval(category)
-        except NameError:
-            raise _OptionError("unknown warning category: %r" % (category,)) from None
+    if '.' not in category:
+        import builtins as m
+        klass = category
     else:
-        i = category.rfind(".")
-        module = category[:i]
-        klass = category[i+1:]
+        module, _, klass = category.rpartition('.')
         try:
             m = __import__(module, None, None, [klass])
         except ImportError:
             raise _OptionError("invalid module name: %r" % (module,)) from None
-        try:
-            cat = getattr(m, klass)
-        except AttributeError:
-            raise _OptionError("unknown warning category: %r" % (category,)) from None
+    try:
+        cat = getattr(m, klass)
+    except AttributeError:
+        raise _OptionError("unknown warning category: %r" % (category,)) from None
     if not issubclass(cat, Warning):
         raise _OptionError("invalid warning category: %r" % (category,))
     return cat
index 0af36c4301d798a4b7c09bcdc1858556365ea1b2..9c73bcfb44ae81b27d081d9f9a82c08885e1f15f 100755 (executable)
@@ -69,6 +69,14 @@ def get(using=None):
 # instead of "from webbrowser import *".
 
 def open(url, new=0, autoraise=True):
+    """Display url using the default browser.
+
+    If possible, open url in a location determined by new.
+    - 0: the same browser window (the default).
+    - 1: a new browser window.
+    - 2: a new browser page ("tab").
+    If possible, autoraise raises the window (the default) or not.
+    """
     if _tryorder is None:
         with _lock:
             if _tryorder is None:
@@ -80,14 +88,22 @@ def open(url, new=0, autoraise=True):
     return False
 
 def open_new(url):
+    """Open url in a new window of the default browser.
+
+    If not possible, then open url in the only browser window.
+    """
     return open(url, 1)
 
 def open_new_tab(url):
+    """Open url in a new page ("tab") of the default browser.
+
+    If not possible, then the behavior becomes equivalent to open_new().
+    """
     return open(url, 2)
 
 
 def _synthesize(browser, *, preferred=False):
-    """Attempt to synthesize a controller base on existing controllers.
+    """Attempt to synthesize a controller based on existing controllers.
 
     This is useful to create a controller when a user specifies a path to
     an entry in the BROWSER environment variable -- we can copy a general
index 8b99c1189baa8fe4c88b42f751d48e43f1279a8b..07faaccac9226174d82794ba7d332f9b8429b347 100644 (file)
@@ -16,6 +16,7 @@ import struct
 import sys
 import threading
 import time
+import contextlib
 
 try:
     import zlib # We may need its compression method
@@ -2123,24 +2124,6 @@ class PyZipFile(ZipFile):
         return (fname, archivename)
 
 
-def _unique_everseen(iterable, key=None):
-    "List unique elements, preserving order. Remember all elements ever seen."
-    # unique_everseen('AAAABBBCCDAABBB') --> A B C D
-    # unique_everseen('ABBCcAD', str.lower) --> A B C D
-    seen = set()
-    seen_add = seen.add
-    if key is None:
-        for element in itertools.filterfalse(seen.__contains__, iterable):
-            seen_add(element)
-            yield element
-    else:
-        for element in iterable:
-            k = key(element)
-            if k not in seen:
-                seen_add(k)
-                yield element
-
-
 def _parents(path):
     """
     Given a path with elements separated by
@@ -2182,6 +2165,86 @@ def _ancestry(path):
         path, tail = posixpath.split(path)
 
 
+_dedupe = dict.fromkeys
+"""Deduplicate an iterable in original order"""
+
+
+def _difference(minuend, subtrahend):
+    """
+    Return items in minuend not in subtrahend, retaining order
+    with O(1) lookup.
+    """
+    return itertools.filterfalse(set(subtrahend).__contains__, minuend)
+
+
+class CompleteDirs(ZipFile):
+    """
+    A ZipFile subclass that ensures that implied directories
+    are always included in the namelist.
+    """
+
+    @staticmethod
+    def _implied_dirs(names):
+        parents = itertools.chain.from_iterable(map(_parents, names))
+        as_dirs = (p + posixpath.sep for p in parents)
+        return _dedupe(_difference(as_dirs, names))
+
+    def namelist(self):
+        names = super(CompleteDirs, self).namelist()
+        return names + list(self._implied_dirs(names))
+
+    def _name_set(self):
+        return set(self.namelist())
+
+    def resolve_dir(self, name):
+        """
+        If the name represents a directory, return that name
+        as a directory (with the trailing slash).
+        """
+        names = self._name_set()
+        dirname = name + '/'
+        dir_match = name not in names and dirname in names
+        return dirname if dir_match else name
+
+    @classmethod
+    def make(cls, source):
+        """
+        Given a source (filename or zipfile), return an
+        appropriate CompleteDirs subclass.
+        """
+        if isinstance(source, CompleteDirs):
+            return source
+
+        if not isinstance(source, ZipFile):
+            return cls(source)
+
+        # Only allow for FastPath when supplied zipfile is read-only
+        if 'r' not in source.mode:
+            cls = CompleteDirs
+
+        res = cls.__new__(cls)
+        vars(res).update(vars(source))
+        return res
+
+
+class FastLookup(CompleteDirs):
+    """
+    ZipFile subclass to ensure implicit
+    dirs exist and are resolved rapidly.
+    """
+    def namelist(self):
+        with contextlib.suppress(AttributeError):
+            return self.__names
+        self.__names = super(FastLookup, self).namelist()
+        return self.__names
+
+    def _name_set(self):
+        with contextlib.suppress(AttributeError):
+            return self.__lookup
+        self.__lookup = super(FastLookup, self)._name_set()
+        return self.__lookup
+
+
 class Path:
     """
     A pathlib-compatible interface for zip files.
@@ -2250,7 +2313,7 @@ class Path:
     __repr = "{self.__class__.__name__}({self.root.filename!r}, {self.at!r})"
 
     def __init__(self, root, at=""):
-        self.root = root if isinstance(root, ZipFile) else ZipFile(root)
+        self.root = FastLookup.make(root)
         self.at = at
 
     @property
@@ -2282,12 +2345,12 @@ class Path:
         return not self.is_dir()
 
     def exists(self):
-        return self.at in self._names()
+        return self.at in self.root._name_set()
 
     def iterdir(self):
         if not self.is_dir():
             raise ValueError("Can't listdir a file")
-        subs = map(self._next, self._names())
+        subs = map(self._next, self.root.namelist())
         return filter(self._is_child, subs)
 
     def __str__(self):
@@ -2298,25 +2361,10 @@ class Path:
 
     def joinpath(self, add):
         next = posixpath.join(self.at, add)
-        next_dir = posixpath.join(self.at, add, "")
-        names = self._names()
-        return self._next(next_dir if next not in names and next_dir in names else next)
+        return self._next(self.root.resolve_dir(next))
 
     __truediv__ = joinpath
 
-    @staticmethod
-    def _implied_dirs(names):
-        return _unique_everseen(
-            parent + "/"
-            for name in names
-            for parent in _parents(name)
-            if parent + "/" not in names
-        )
-
-    @classmethod
-    def _add_implied_dirs(cls, names):
-        return names + list(cls._implied_dirs(names))
-
     @property
     def parent(self):
         parent_at = posixpath.dirname(self.at.rstrip('/'))
@@ -2324,9 +2372,6 @@ class Path:
             parent_at += '/'
         return self._next(parent_at)
 
-    def _names(self):
-        return self._add_implied_dirs(self.root.namelist())
-
 
 def main(args=None):
     import argparse
@@ -2388,5 +2433,6 @@ def main(args=None):
                     zippath = ''
                 addToZip(zf, path, zippath)
 
+
 if __name__ == "__main__":
     main()
index fd917c16b01535e0a1503033fbddb681e6570a0e..5ef0a17c2a5ed2369167fb0c800565290271681f 100644 (file)
@@ -608,7 +608,7 @@ def _unmarshal_code(self, pathname, fullpath, fullname, data):
                 )
 
                 try:
-                    _boostrap_external._validate_hash_pyc(
+                    _bootstrap_external._validate_hash_pyc(
                         data, source_hash, fullname, exc_details)
                 except ImportError:
                     return None
index 0dd53647dd33e3f8e0c0ccf322fd82b98e875aea..0ad7298e982422a9661ee69cd315d63be014ce22 100755 (executable)
@@ -215,9 +215,9 @@ def library_recipes():
 
     result.extend([
           dict(
-              name="OpenSSL 1.1.1d",
-              url="https://www.openssl.org/source/openssl-1.1.1d.tar.gz",
-              checksum='3be209000dbc7e1b95bcdf47980a3baa',
+              name="OpenSSL 1.1.1g",
+              url="https://www.openssl.org/source/openssl-1.1.1g.tar.gz",
+              checksum='76766e98997660138cdaf13a187bd234',
               buildrecipe=build_universal_openssl,
               configure=None,
               install=None,
@@ -313,9 +313,9 @@ def library_recipes():
                   ),
           ),
           dict(
-              name="SQLite 3.28.0",
-              url="https://www.sqlite.org/2019/sqlite-autoconf-3280000.tar.gz",
-              checksum='3c68eb400f8354605736cd55400e1572',
+              name="SQLite 3.31.1",
+              url="https://sqlite.org/2020/sqlite-autoconf-3310100.tar.gz",
+              checksum='2d0a553534c521504e3ac3ad3b90f125',
               extra_cflags=('-Os '
                             '-DSQLITE_ENABLE_FTS5 '
                             '-DSQLITE_ENABLE_FTS4 '
index 7566cf3b44618adb3cdffeeaeb66a662503b9b35..25d53386da01a5671921a50604b7fbd464d73866 100644 (file)
@@ -1,5 +1,5 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
-{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
+{\rtf1\ansi\ansicpg1252\cocoartf2511
+\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 CourierNewPS-BoldMT;
 \f3\fmodern\fcharset0 CourierNewPSMT;}
 {\colortbl;\red255\green255\blue255;}
 {\*\expandedcolortbl;;}
@@ -55,7 +55,7 @@ Thanks to the many outside volunteers who have worked under Guido's direction to
 \f1\b0 \
 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and its associated documentation.\
 \
-2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
+2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright \'a9 2001-2020 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.\
 \
 3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python.\
 \
index d321fcd80c2eb8b06015083a2161c9d563305e7c..4cb0111d83a530a4caa589d1a9707fe3d59fe6a1 100644 (file)
@@ -1,5 +1,5 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600
-{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 Helvetica-Bold;\f2\fswiss\fcharset0 Helvetica-Oblique;
+{\rtf1\ansi\ansicpg1252\cocoartf2511
+\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 Helvetica-Bold;\f2\fswiss\fcharset0 Helvetica-Oblique;
 \f3\fmodern\fcharset0 CourierNewPSMT;}
 {\colortbl;\red255\green255\blue255;}
 {\*\expandedcolortbl;;}
@@ -36,8 +36,7 @@ The bundled
 \f0\b0 \ulnone \
 \
 This package includes its own private version of Tcl/Tk 8.6. It does not use any system-supplied or third-party supplied versions of Tcl/Tk.\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
-\cf0 \
+\
 Due to new security checks on macOS 10.15 Catalina, when launching IDLE macOS may open a window with a message 
 \f1\b "Python" would like to access files in your Documents folder
 \f0\b0 .  This is normal as IDLE uses your 
@@ -49,9 +48,14 @@ Due to new security checks on macOS 10.15 Catalina, when launching IDLE macOS ma
 \f0\b0  file dialog windows.  Click on the 
 \f1\b OK
 \f0\b0  button to proceed.\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
 
-\f1\b \cf0 \ul \ulc0 \
+\f1\b \ul \
+macOS 10.15 (Catalina) Gatekeeper Requirements [changed in 3.8.2]\
+
+\f0\b0 \ulnone \
+As of 2020-02-03, Apple has changed how third-party installer packages, like those provided by python.org, are notarized for verification by Gatekeeper and begun enforcing additional requirements such as code signing and use of the hardened runtime.  As of 3.8.2, python.org installer packages now meet those additional notarization requirements.  The necessary changes in packaging should be transparent to your use of Python but, in the unlikely event that you encounter changes in behavior between 3.8.1 and 3.8.2 in areas like ctypes, importlib, or mmap, please check bugs.python.org for existing reports and, if necessary, open a new issue.\
+
+\f1\b \ul \
 Other changes\
 
 \f0\b0 \ulnone \
index 04a0a08c836395ddeeed0858c147af61fc29cc6d..dcc48abdd2a395aa7605170c0b3cf71c18af8635 100644 (file)
@@ -36,7 +36,7 @@
        <key>CFBundleExecutable</key>
        <string>IDLE</string>
        <key>CFBundleGetInfoString</key>
-       <string>%version%, © 2001-2019 Python Software Foundation</string>
+       <string>%version%, © 2001-2020 Python Software Foundation</string>
        <key>CFBundleIconFile</key>
        <string>IDLE.icns</string>
        <key>CFBundleIdentifier</key>
index 9fb4e0affd9c43288af7a0403ab3dbba8715e0a7..21a051535fb92523a37a2cc92ebc52e79f28eb20 100644 (file)
@@ -40,7 +40,7 @@
        <key>CFBundleExecutable</key>
        <string>Python Launcher</string>
        <key>CFBundleGetInfoString</key>
-       <string>%VERSION%, © 2001-2019 Python Software Foundation</string>
+       <string>%VERSION%, © 2001-2020 Python Software Foundation</string>
        <key>CFBundleIconFile</key>
        <string>PythonLauncher.icns</string>
        <key>CFBundleIdentifier</key>
index 4f2e2ce6623df78114540cd26e28501977408502..ec7d873df277d7eadb6bff4a4d03359180e40fe8 100644 (file)
@@ -49,7 +49,7 @@ macOS specific arguments to configure
   system header files in their traditional locations, like ``/usr/include`` and
   ``/System/Library/Frameworks``; instead they are found within a MacOSX SDK.
   The Apple-supplied build tools handle this transparently and current
-  versiona of Python now handle this as well.  So it is no longer necessary,
+  versions of Python now handle this as well.  So it is no longer necessary,
   and since macOS 10.14, no longer possible to force the installation of system
   headers with ``xcode-select``.
 
index b7581984dd6764e5a86eb324d652ed185244de5c..66b5e764c54b0b21e3c7ffe3953cb35dca83c42e 100644 (file)
@@ -37,7 +37,7 @@
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleLongVersionString</key>
-       <string>%version%, (c) 2001-2019 Python Software Foundation.</string>
+       <string>%version%, (c) 2001-2020 Python Software Foundation.</string>
        <key>CFBundleName</key>
        <string>Python</string>
        <key>CFBundlePackageType</key>
index 1d2db383f943cc70d896fb26488e041abe326866..c8bd3ba8d68c1531310d2152a1e38efb7ce1aefb 100644 (file)
@@ -196,6 +196,15 @@ main(int argc, char **argv) {
             }
         }
 
+        /*
+         * The environment variable is used to pass the value of real_path
+         * to the actual python interpreter, and is read by code in
+         * Python/coreconfig.c.
+         *
+         * This way the real interpreter knows how the user invoked the
+         * interpreter and can behave as if this launcher is the real
+         * interpreter (looking for pyvenv configuration, ...)
+         */
         setenv("__PYVENV_LAUNCHER__", real_path, 1);
     }
 
index 502317aa0c783a8b29395676b2b46f9919d90872..a914a9c70f6794e21b24dd9ddd4abae8507f9bfe 100644 (file)
@@ -1725,6 +1725,7 @@ tags::
        ctags -w $(srcdir)/Include/*.h $(srcdir)/Include/cpython/*.h $(srcdir)/Include/internal/*.h
        for i in $(SRCDIRS); do ctags -f tags -w -a $(srcdir)/$$i/*.[ch]; done
        ctags -f tags -w -a $(srcdir)/Modules/_ctypes/*.[ch]
+       find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | ctags -f tags -w -a -L -
        LC_ALL=C sort -o tags tags
 
 # Create a tags file for GNU Emacs
@@ -1732,6 +1733,8 @@ TAGS::
        cd $(srcdir); \
        etags Include/*.h Include/cpython/*.h Include/internal/*.h; \
        for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
+       etags -a $(srcdir)/Modules/_ctypes/*.[ch]
+       find $(srcdir)/Lib -type f -name "*.py" -not -name "test_*.py" -not -path "*/test/*" -not -path "*/tests/*" -not -path "*/*_test/*" | etags - -a
 
 # Sanitation targets -- clean leaves libraries, executables and tags
 # files, which clobber removes as well
index a17db456576318e69bf1e5bd10e8326f1db37e74..34a6fc439e89c15bc4ed3e88b17838b3e09c9447 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -12,6 +12,7 @@ PS: In the standard Python distribution, this file is encoded in UTF-8
 and the list is in rough alphabetical order by last names.
 
 Aahz
+Edison Abahurire
 Michael Abbott
 Rajiv Abraham
 David Abrahams
@@ -37,6 +38,7 @@ Ray Allen
 Billy G. Allie
 Jamiel Almeida
 Kevin Altis
+Samy Lahfa
 Skyler Leigh Amador
 Joe Amenta
 Rose Ames
@@ -82,6 +84,7 @@ Marcin Bachry
 Alfonso Baciero
 Dwayne Bailey
 Stig Bakken
+Aleksandr Balezin
 Greg Ball
 Luigi Ballabio
 Thomas Ballinger
@@ -360,6 +363,7 @@ Tom Culliton
 Raúl Cumplido
 Antonio Cuni
 Brian Curtin
+Hakan Celik
 Paul Dagnelie
 Lisandro Dalcin
 Darren Dale
@@ -408,6 +412,7 @@ Walter Dörwald
 Jaromir Dolecek
 Zsolt Dollenstein
 Brendan Donegan
+Peter Donis
 Ismail Donmez
 Ray Donnelly
 Robert Donohue
@@ -551,6 +556,7 @@ Fred Gansevles
 Lars Marius Garshol
 Jake Garver
 Dan Gass
+Tim Gates
 Andrew Gaul
 Matthieu Gautier
 Stephen M. Gava
@@ -581,6 +587,7 @@ Karan Goel
 Jeroen Van Goey
 Christoph Gohlke
 Tim Golden
+Yonatan Goldschmidt
 Mark Gollahon
 Guilherme Gonçalves
 Tiago Gonçalves
@@ -762,6 +769,7 @@ Manuel Jacob
 David Jacobs
 Kevin Jacobs
 Kjetil Jacobsen
+Shantanu Jain
 Bertrand Janin
 Geert Jansen
 Jack Jansen
@@ -856,6 +864,7 @@ Kamil Kisiel
 Akira Kitada
 Ron Klatchko
 Reid Kleckner
+Carsten Klein
 Bastian Kleineidam
 Bob Kline
 Matthias Klose
@@ -948,6 +957,7 @@ Inyeol Lee
 James Lee
 John J. Lee
 Thomas Lee
+Robert Leenders
 Cooper Ry Lees
 Yaron de Leeuw
 Tennessee Leeuwenburg
@@ -979,6 +989,7 @@ Akira Li
 Robert Li
 Xuanji Li
 Zekun Li
+Zheao Li
 Robert van Liere
 Ross Light
 Shawn Ligocki
@@ -1090,6 +1101,7 @@ Brian Merrell
 Alexis Métaireau
 Luke Mewburn
 Carl Meyer
+Kyle Meyer
 Mike Meyer
 Piotr Meyer
 Steven Miale
@@ -1397,6 +1409,7 @@ Giampaolo Rodola
 Mauro S. M. Rodrigues
 Elson Rodriguez
 Adi Roiban
+Diego Rojas
 Luis Rojas
 Mike Romberg
 Armin Ronacher
@@ -1506,6 +1519,7 @@ Dmitry Shachnev
 Anish Shah
 Daniel Shahaf
 Hui Shang
+Geoff Shannon
 Mark Shannon
 Ha Shao
 Richard Shapiro
@@ -1537,8 +1551,8 @@ Kirill Simonov
 Nathan Paul Simons
 Guilherme Simões
 Adam Simpkins
-Ravi Sinha
 Mandeep Singh
+Ravi Sinha
 Janne Sinkkonen
 Ng Pheng Siong
 Yann Sionneau
@@ -1641,6 +1655,7 @@ Musashi Tamura
 William Tanksley
 Christian Tanzer
 Steven Taschuk
+Batuhan Taskaya
 Amy Taylor
 Julian Taylor
 Monty Taylor
@@ -1876,13 +1891,5 @@ Jelle Zijlstra
 Gennadiy Zlobin
 Doug Zongker
 Peter Åstrand
-Zheao Li
-Carsten Klein
-Diego Rojas
-Edison Abahurire
-Geoff Shannon
-Batuhan Taskaya
-Aleksandr Balezin
-Robert Leenders
-Ngalim Siregar
-Tim Gates
+
+(Entries should be added in rough alphabetical order by last names)
index 5693e33694d5bf88a4f2644bc21b29605d7eceed..1637f20b6d614970ae0a78c49a24fb527850c62c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -2,6 +2,718 @@
 Python News
 +++++++++++
 
+What's New in Python 3.8.3 final?
+=================================
+
+*Release date: 2020-05-13*
+
+Core and Builtins
+-----------------
+
+- bpo-40527: Fix command line argument parsing: no longer write errors
+  multiple times into stderr.
+
+- bpo-40417: Fix imp module deprecation warning when PyImport_ReloadModule
+  is called. Patch by Robert Rouhani.
+
+- bpo-39562: The constant values of future flags in the :mod:`__future__`
+  module are updated in order to prevent collision with compiler flags.
+  Previously ``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with
+  ``CO_FUTURE_DIVISION``.
+
+Library
+-------
+
+- bpo-40559: Fix possible memory leak in the C implementation of
+  :class:`asyncio.Task`.
+
+- bpo-40355: Improve error reporting in :func:`ast.literal_eval` in the
+  presence of malformed :class:`ast.Dict` nodes instead of silently ignoring
+  any non-conforming elements. Patch by Curtis Bucher.
+
+- bpo-40459: :func:`platform.win32_ver` now produces correct *ptype* strings
+  instead of empty strings.
+
+- bpo-40398: :func:`typing.get_args` now always returns an empty tuple for
+  special generic aliases.
+
+Documentation
+-------------
+
+- bpo-40561: Provide docstrings for webbrowser open functions.
+
+- bpo-39435: Fix an incorrect signature for :func:`pickle.loads` in the docs
+
+Windows
+-------
+
+- bpo-40458: Increase reserved stack space to prevent overflow crash on
+  Windows.
+
+C API
+-----
+
+- bpo-40412: Nullify inittab_copy during finalization, preventing future
+  interpreter initializations in an embedded situation from crashing. Patch
+  by Gregory Szorc.
+
+
+What's New in Python 3.8.3 release candidate 1?
+===============================================
+
+*Release date: 2020-04-29*
+
+Security
+--------
+
+- bpo-40121: Fixes audit events raised on creating a new socket.
+
+- bpo-38576: Disallow control characters in hostnames in http.client,
+  addressing CVE-2019-18348. Such potentially malicious header injection
+  URLs now cause a InvalidURL to be raised.
+
+- bpo-39503: CVE-2020-8492: The
+  :class:`~urllib.request.AbstractBasicAuthHandler` class of the
+  :mod:`urllib.request` module uses an inefficient regular expression which
+  can be exploited by an attacker to cause a denial of service. Fix the
+  regex to prevent the catastrophic backtracking. Vulnerability reported by
+  Ben Caller and Matt Schwager.
+
+Core and Builtins
+-----------------
+
+- bpo-20526: Fix :c:func:`PyThreadState_Clear()`. ``PyThreadState.frame`` is
+  a borrowed reference, not a strong reference: ``PyThreadState_Clear()``
+  must not call ``Py_CLEAR(tstate->frame)``.
+
+- bpo-39965: Correctly raise ``SyntaxError`` if *await* is used inside
+  non-async functions and ``PyCF_ALLOW_TOP_LEVEL_AWAIT`` is set (like in the
+  asyncio REPL). Patch by Pablo Galindo.
+
+- bpo-39562: Allow executing asynchronous comprehensions on the top level
+  when the ``PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag is given. Patch by Batuhan
+  Taskaya.
+
+- bpo-38894: Fix a bug that was causing incomplete results when calling
+  ``pathlib.Path.glob`` in the presence of symlinks that point to files
+  where the user does not have read access. Patch by Pablo Galindo and Matt
+  Wozniski.
+
+- bpo-39871: Fix a possible :exc:`SystemError` in
+  ``math.{atan2,copysign,remainder}()`` when the first argument cannot be
+  converted to a :class:`float`. Patch by Zachary Spytz.
+
+- bpo-39776: Fix race condition where threads created by PyGILState_Ensure()
+  could get a duplicate id.
+
+  This affects consumers of tstate->id like the contextvar caching
+  machinery, which could return invalid cached objects under heavy thread
+  load (observed in embedded scenarios).
+
+- bpo-39778: Fixed a crash due to incorrect handling of weak references in
+  ``collections.OrderedDict`` classes. Patch by Pablo Galindo.
+
+- bpo-39520: Fix unparsing of ext slices with no items (``foo[:,]``). Patch
+  by Batuhan Taskaya.
+
+- bpo-22490: Don't leak environment variable ``__PYVENV_LAUNCHER__`` into
+  the interpreter session on macOS.
+
+Library
+-------
+
+- bpo-40138: Fix the Windows implementation of :func:`os.waitpid` for exit
+  code larger than ``INT_MAX >> 8``. The exit status is now interpreted as
+  an unsigned number.
+
+- bpo-39942: Set "__main__" as the default module name when "__name__" is
+  missing in :class:`typing.TypeVar`. Patch by Weipeng Hong.
+
+- bpo-40330: In :meth:`ShareableList.__setitem__`, check the size of a new
+  string item after encoding it to utf-8, not before.
+
+- bpo-40287: Fixed ``SpooledTemporaryFile.seek()`` to return the position.
+
+- bpo-40260: Ensure :mod:`modulefinder` uses :func:`io.open_code` and
+  respects coding comments.
+
+- bpo-40196: Fix a bug in the :mod:`symtable` module that was causing
+  incorrectly report global variables as local. Patch by Pablo Galindo.
+
+- bpo-40126: Fixed reverting multiple patches in unittest.mock. Patcher's
+  ``__exit__()`` is now never called if its ``__enter__()`` is failed.
+  Returning true from ``__exit__()`` silences now the exception.
+
+- bpo-40089: Fix threading._after_fork(): if fork was not called by a thread
+  spawned by threading.Thread, threading._after_fork() now creates a
+  _MainThread instance for _main_thread, instead of a _DummyThread instance.
+
+- bpo-39503: :class:`~urllib.request.AbstractBasicAuthHandler` of
+  :mod:`urllib.request` now parses all WWW-Authenticate HTTP headers and
+  accepts multiple challenges per header: use the realm of the first Basic
+  challenge.
+
+- bpo-40014: Fix ``os.getgrouplist()``: if ``getgrouplist()`` function fails
+  because the group list is too small, retry with a larger group list. On
+  failure, the glibc implementation of ``getgrouplist()`` sets ``ngroups``
+  to the total number of groups. For other implementations, double the group
+  list size.
+
+- bpo-40016: In re docstring, clarify the relationship between inline and
+  argument compile flags.
+
+- bpo-39953: Update internal table of OpenSSL error codes in the ``ssl``
+  module.
+
+- bpo-39360: Ensure all workers exit when finalizing a
+  :class:`multiprocessing.Pool` implicitly via the module finalization
+  handlers of multiprocessing. This fixes a deadlock situation that can be
+  experienced when the Pool is not properly finalized via the context
+  manager or a call to ``multiprocessing.Pool.terminate``. Patch by Batuhan
+  Taskaya and Pablo Galindo.
+
+- bpo-39652: The column name found in ``sqlite3.Cursor.description`` is now
+  truncated on the first '[' only if the PARSE_COLNAMES option is set.
+
+- bpo-39915: Ensure :attr:`unittest.mock.AsyncMock.await_args_list` has call
+  objects in the order of awaited arguments instead of using
+  :attr:`unittest.mock.Mock.call_args` which has the last value of the call.
+  Patch by Karthikeyan Singaravelan.
+
+- bpo-38662: The ``ensurepip`` module now invokes ``pip`` via the ``runpy``
+  module. Hence it is no longer tightly coupled with the internal API of the
+  bundled ``pip`` version, allowing easier updates to a newer ``pip``
+  version both internally and for distributors.
+
+- bpo-39916: More reliable use of ``os.scandir()`` in ``Path.glob()``. It no
+  longer emits a ResourceWarning when interrupted.
+
+- bpo-39850: :mod:`multiprocessing` now supports abstract socket addresses
+  (if abstract sockets are supported in the running platform). Patch by
+  Pablo Galindo.
+
+- bpo-39828: Fix :mod:`json.tool` to catch :exc:`BrokenPipeError`. Patch by
+  Dong-hee Na.
+
+- bpo-13487: Avoid a possible *"RuntimeError: dictionary changed size during
+  iteration"* from :func:`inspect.getmodule` when it tried to loop through
+  :attr:`sys.modules`.
+
+- bpo-39794: Add --without-decimal-contextvar build option.  This enables a
+  thread-local rather than a coroutine local context.
+
+- bpo-39769: The :func:`compileall.compile_dir` function's *ddir* parameter
+  and the compileall command line flag `-d` no longer write the wrong
+  pathname to the generated pyc file for submodules beneath the root of the
+  directory tree being compiled.  This fixes a regression introduced with
+  Python 3.5.
+
+- bpo-39517: Fix runpy.run_path() when using pathlike objects
+
+- bpo-39764: Fix AttributeError when calling get_stack on a PyAsyncGenObject
+  Task
+
+- bpo-30566: Fix :exc:`IndexError` when trying to decode an invalid string
+  with punycode codec.
+
+- bpo-39667: Correct performance degradation in ``zipfile.Path`` as found in
+  zipp 3.0. While retaining compatibility, this change discourages the use
+  of ``zipfile.Path.open`` due to the signature change in Python 3.9. For
+  compatibility across Python 3.8 and later versions, consider using
+  ``zipp.Path`` on Python 3.8.x and earlier.
+
+- bpo-39548: Fix handling of header in
+  :class:`urllib.request.AbstractDigestAuthHandler` when the optional
+  ``qop`` parameter is not present.
+
+- bpo-38971: Open issue in the BPO indicated a desire to make the
+  implementation of codecs.open() at parity with io.open(), which implements
+  a try/except to assure file stream gets closed before an exception is
+  raised.
+
+- bpo-38410: Properly handle :func:`sys.audit` failures in
+  :func:`sys.set_asyncgen_hooks`. Based on patch by Zackery Spytz.
+
+- bpo-36541: lib2to3 now recognizes named assignment expressions (the walrus
+  operator, ``:=``)
+
+- bpo-31758: Prevent crashes when using an uninitialized
+  ``_elementtree.XMLParser`` object. Patch by Oren Milman.
+
+Documentation
+-------------
+
+- bpo-27635: The pickle documentation incorrectly claimed that ``__new__``
+  isn't called by default when unpickling.
+
+- bpo-39879: Updated :ref:`datamodel` docs to include :func:`dict` insertion
+  order preservation. Patch by Furkan Onder and Samy Lahfa.
+
+- bpo-39868: Updated the Language Reference for :pep:`572`.
+
+- bpo-13790: Change 'string' to 'specification' in format doc.
+
+- bpo-17422: The language reference no longer restricts default class
+  namespaces to dicts only.
+
+- bpo-39530: Fix misleading documentation about mixed-type numeric
+  comparisons.
+
+- bpo-39718: Update :mod:`token` documentation to reflect additions in
+  Python 3.8
+
+- bpo-39677: Changed operand name of **MAKE_FUNCTION** from *argc* to
+  *flags* for module :mod:`dis`
+
+- bpo-38387: Document :c:macro:`PyDoc_STRVAR` macro in the C-API reference.
+
+Tests
+-----
+
+- bpo-40436: test_gdb and test.pythoninfo now check gdb command exit code.
+
+- bpo-40162: Update Travis CI configuration to OpenSSL 1.1.1f.
+
+- bpo-40146: Update OpenSSL to 1.1.1f in Azure Pipelines.
+
+- bpo-40019: test_gdb now skips tests if it detects that gdb failed to read
+  debug information because the Python binary is optimized.
+
+- bpo-27807: ``test_site.test_startup_imports()`` is now skipped if a path
+  of :data:`sys.path` contains a ``.pth`` file.
+
+- bpo-39793: Use the same domain when testing ``make_msgid``. Patch by
+  Batuhan Taskaya.
+
+- bpo-1812: Fix newline handling in doctest.testfile when loading from a
+  package whose loader has a get_data method. Patch by Peter Donis.
+
+- bpo-37957: test.regrtest now can receive a list of test patterns to ignore
+  (using the -i/--ignore argument) or a file with a list of patterns to
+  ignore (using the --ignore-file argument). Patch by Pablo Galindo.
+
+- bpo-38502: test.regrtest now uses process groups in the multiprocessing
+  mode (-jN command line option) if process groups are available: if
+  :func:`os.setsid` and :func:`os.killpg` functions are available.
+
+Build
+-----
+
+- bpo-38360: Support single-argument form of macOS -isysroot flag.
+
+- bpo-40204: Pin Sphinx version to 1.8.2 in ``Doc/Makefile``.
+
+- bpo-40158: Fix CPython MSBuild Properties in NuGet Package
+  (build/native/python.props)
+
+- bpo-38527: Fix configure check on Solaris for "float word ordering":
+  sometimes, the correct "grep" command was not being used. Patch by Arnon
+  Yaari.
+
+Windows
+-------
+
+- bpo-40164: Updates Windows to OpenSSL 1.1.1f
+
+- bpo-39930: Ensures the required :file:`vcruntime140.dll` is included in
+  install packages.
+
+- bpo-39847: Avoid hang when computer is hibernated whilst waiting for a
+  mutex (for lock-related objects from :mod:`threading`) around 49-day
+  uptime.
+
+- bpo-38597: :mod:`distutils` will no longer statically link
+  :file:`vcruntime140.dll` when a redistributable version is unavailable.
+  All future releases of CPython will include a copy of this DLL to ensure
+  distributed extensions can continue to load.
+
+- bpo-38380: Update Windows builds to use SQLite 3.31.1
+
+- bpo-39789: Update Windows release build machines to Visual Studio 2019
+  (MSVC 14.2).
+
+- bpo-34803: Package for nuget.org now includes repository reference and
+  bundled icon image.
+
+macOS
+-----
+
+- bpo-40164: Update macOS installer builds to use OpenSSL 1.1.1g.
+
+- bpo-38380: Update macOS builds to use SQLite 3.31.1
+
+IDLE
+----
+
+- bpo-27115: For 'Go to Line', use a Query box subclass with IDLE standard
+  behavior and improved error checking.
+
+- bpo-39885: Since clicking to get an IDLE context menu moves the cursor,
+  any text selection should be and now is cleared.
+
+- bpo-39852: Edit "Go to line" now clears any selection, preventing
+  accidental deletion. It also updates Ln and Col on the status bar.
+
+- bpo-39781: Selecting code context lines no longer causes a jump.
+
+- bpo-38439: Add a 256×256 pixel IDLE icon to support more modern
+  environments. Created by Andrew Clover. Delete the unused macOS idle.icns
+  icon file.
+
+- bpo-38689: IDLE will no longer freeze when inspect.signature fails when
+  fetching a calltip.
+
+Tools/Demos
+-----------
+
+- bpo-40179: Fixed translation of ``#elif`` in Argument Clinic.
+
+- bpo-36184: Port python-gdb.py to FreeBSD. python-gdb.py now checks for
+  "take_gil" function name to check if a frame tries to acquire the GIL,
+  instead of checking for "pthread_cond_timedwait" which is specific to
+  Linux and can be a different condition than the GIL.
+
+- bpo-39889: Fixed ``unparse.py`` for extended slices containing a single
+  element (e.g. ``a[i:j,]``). Remove redundant tuples when index with a
+  tuple (e.g. ``a[i, j]``).
+
+C API
+-----
+
+- bpo-35370: If :c:func:`PySys_Audit` fails in :c:func:`PyEval_SetProfile`
+  or :c:func:`PyEval_SetTrace`, log the error as an unraisable exception.
+
+- bpo-39884: :c:func:`PyDescr_NewMethod` and :c:func:`PyCFunction_NewEx` now
+  include the method name in the SystemError "bad call flags" error message
+  to ease debug.
+
+- bpo-38643: :c:func:`PyNumber_ToBase` now raises a :exc:`SystemError`
+  instead of crashing when called with invalid base.
+
+- bpo-38913: Fixed segfault in ``Py_BuildValue()`` called with a format
+  containing "#" and undefined PY_SSIZE_T_CLEAN whwn an exception is set.
+
+
+What's New in Python 3.8.2 final?
+=================================
+
+*Release date: 2020-02-24*
+
+Core and Builtins
+-----------------
+
+- bpo-39382: Fix a use-after-free in the single inheritance path of
+  ``issubclass()``, when the ``__bases__`` of an object has a single
+  reference, and so does its first item. Patch by Yonatan Goldschmidt.
+
+- bpo-39427: Document all possibilities for the ``-X`` options in the
+  command line help section. Patch by Pablo Galindo.
+
+Library
+-------
+
+- bpo-39649: Remove obsolete check for `__args__` in
+  bdb.Bdb.format_stack_entry.
+
+- bpo-39681: Fix a regression where the C pickle module wouldn't allow
+  unpickling from a file-like object that doesn't expose a readinto()
+  method.
+
+- bpo-39546: Fix a regression in :class:`~argparse.ArgumentParser` where
+  ``allow_abbrev=False`` was ignored for long options that used a prefix
+  character other than "-".
+
+- bpo-39432: Implement PEP-489 algorithm for non-ascii "PyInit\_..." symbol
+  names in distutils to make it export the correct init symbol also on
+  Windows.
+
+Documentation
+-------------
+
+- bpo-17422: The language reference now specifies restrictions on class
+  namespaces. Adapted from a patch by Ethan Furman.
+
+- bpo-39572: Updated documentation of ``total`` flag of TypeDict.
+
+- bpo-39654: In pyclbr doc, update 'class' to 'module' where appropriate and
+  add readmodule comment. Patch by Hakan Çelik.
+
+IDLE
+----
+
+- bpo-39663: Add tests for pyparse find_good_parse_start().
+
+
+What's New in Python 3.8.2 release candidate 2?
+===============================================
+
+*Release date: 2020-02-17*
+
+Security
+--------
+
+- bpo-39184: Add audit events to functions in `fcntl`, `msvcrt`, `os`,
+  `resource`, `shutil`, `signal` and `syslog`.
+
+Core and Builtins
+-----------------
+
+- bpo-39619: Enable use of :func:`os.chroot` on HP-UX systems.
+
+- bpo-39606: Fix regression caused by fix for bpo-39386, that prevented
+  calling ``aclose`` on an async generator that had already been closed or
+  exhausted.
+
+- bpo-39453: Fixed a possible crash in :meth:`list.__contains__` when a list
+  is changed during comparing items. Patch by Dong-hee Na.
+
+- bpo-39219: Syntax errors raised in the tokenizer now always set correct
+  "text" and "offset" attributes.
+
+Library
+-------
+
+- bpo-27657: The original fix for bpo-27657, "Fix urlparse() with numeric
+  paths" (GH-16839) included in 3.8.1, inadvertently introduced a behavior
+  change that broke several third-party packages relying on the original
+  undefined parsing behavior. The change is reverted in 3.8.2, restoring the
+  behavior of 3.8.0 and earlier releases.
+
+- bpo-39474: Fixed starting position of AST for expressions like ``(a)(b)``,
+  ``(a)[b]`` and ``(a).b``.
+
+- bpo-21016: The :mod:`pydoc` and :mod:`trace` modules now use the
+  :mod:`sysconfig` module to get the path to the Python standard library, to
+  support uncommon installation path like ``/usr/lib64/python3.9/`` on
+  Fedora. Patch by Jan Matějek.
+
+- bpo-39595: Improved performance of zipfile.Path for files with a large
+  number of entries. Also improved performance and fixed minor issue as
+  published with `importlib_metadata 1.5
+  <https://importlib-metadata.readthedocs.io/en/latest/changelog%20(links).html#v1-5-0>`_.
+
+IDLE
+----
+
+- bpo-39600: In the font configuration window, remove duplicated font names.
+
+
+What's New in Python 3.8.2 release candidate 1?
+===============================================
+
+*Release date: 2020-02-10*
+
+Security
+--------
+
+- bpo-39401: Avoid unsafe load of ``api-ms-win-core-path-l1-1-0.dll`` at
+  startup on Windows 7.
+
+- bpo-39184: Add audit events to command execution functions in os and pty
+  modules.
+
+Core and Builtins
+-----------------
+
+- bpo-39579: Change the ending column offset of `Attribute` nodes
+  constructed in `ast_for_dotted_name` to point at the end of the current
+  node and not at the end of the last `NAME` node.
+
+- bpo-39510: Fix segfault in ``readinto()`` method on closed BufferedReader.
+
+- bpo-39492: Fix a reference cycle in the C Pickler that was preventing the
+  garbage collection of deleted, pickled objects.
+
+- bpo-39421: Fix possible crashes when operating with the functions in the
+  :mod:`heapq` module and custom comparison operators.
+
+- bpo-39386: Prevent double awaiting of async iterator.
+
+- bpo-39235: Fix AST end location for lone generator expression in function
+  call, e.g. f(i for i in a).
+
+- bpo-39209: Correctly handle multi-line tokens in interactive mode. Patch
+  by Pablo Galindo.
+
+- bpo-39216: Fix constant folding optimization for positional only arguments
+  - by Anthony Sottile.
+
+- bpo-39215: Fix ``SystemError`` when nested function has annotation on
+  positional-only argument - by Anthony Sottile.
+
+- bpo-38588: Fix possible crashes in dict and list when calling
+  :c:func:`PyObject_RichCompareBool`.
+
+- bpo-38610: Fix possible crashes in several list methods by holding strong
+  references to list elements when calling
+  :c:func:`PyObject_RichCompareBool`.
+
+Library
+-------
+
+- bpo-39590: Collections.deque now holds strong references during
+  deque.__contains__ and deque.count, fixing crashes.
+
+- bpo-38149: :func:`sys.audit` is now called only once per call of
+  :func:`glob.glob` and :func:`glob.iglob`.
+
+- bpo-39450: Striped whitespace from docstring before returning it from
+  :func:`unittest.case.shortDescription`.
+
+- bpo-39493: Mark ``typing.IO.closed`` as a property
+
+- bpo-39485: Fix a bug in :func:`unittest.mock.create_autospec` that would
+  complain about the wrong number of arguments for custom descriptors
+  defined in an extension module returning functions.
+
+- bpo-39082: Allow AsyncMock to correctly patch static/class methods
+
+- bpo-39430: Fixed race condition in lazy imports in :mod:`tarfile`.
+
+- bpo-39390: Fixed a regression with the `ignore` callback of
+  :func:`shutil.copytree`. The argument types are now str and List[str]
+  again.
+
+- bpo-39389: Write accurate compression level metadata in :mod:`gzip`
+  archives, rather than always signaling maximum compression.
+
+- bpo-39274: ``bool(fraction.Fraction)`` now returns a boolean even if
+  (numerator != 0) does not return a boolean (ex: numpy number).
+
+- bpo-39297: Improved performance of importlib.metadata distribution
+  discovery and resilients to inaccessible sys.path entries
+  (importlib_metadata v1.4.0).
+
+- bpo-39242: Updated the Gmane domain from news.gmane.org to news.gmane.io
+  which is used for examples of :class:`~nntplib.NNTP` news reader server
+  and nntplib tests.
+
+- bpo-38907: In http.server script, restore binding to IPv4 on Windows.
+
+- bpo-39152: Fix ttk.Scale.configure([name]) to return configuration tuple
+  for name or all options.  Giovanni Lombardo contributed part of the patch.
+
+- bpo-39198: If an exception were to be thrown in `Logger.isEnabledFor`
+  (say, by asyncio timeouts or stopit) , the `logging` global lock may not
+  be released appropriately, resulting in deadlock.  This change wraps that
+  block of code with `try...finally` to ensure the lock is released.
+
+- bpo-39191: Perform a check for running loop before starting a new task in
+  ``loop.run_until_complete()`` to fail fast; it prevents the side effect of
+  new task spawning before exception raising.
+
+- bpo-38871: Correctly parenthesize filter-based statements that contain
+  lambda expressions in mod:`lib2to3`. Patch by Dong-hee Na.
+
+- bpo-39142: A change was made to logging.config.dictConfig to avoid
+  converting instances of named tuples to ConvertingTuple. It's assumed that
+  named tuples are too specialised to be treated like ordinary tuples; if a
+  user of named tuples requires ConvertingTuple functionality, they will
+  have to implement that themselves in their named tuple class.
+
+- bpo-39129: Fix import path for ``asyncio.TimeoutError``
+
+- bpo-39057: :func:`urllib.request.proxy_bypass_environment` now ignores
+  leading dots and no longer ignores a trailing newline.
+
+- bpo-39056: Fixed handling invalid warning category in the -W option.  No
+  longer import the re module if it is not needed.
+
+- bpo-39055: :func:`base64.b64decode` with ``validate=True`` raises now a
+  binascii.Error if the input ends with a single ``\n``.
+
+- bpo-39033: Fix :exc:`NameError` in :mod:`zipimport`. Patch by Karthikeyan
+  Singaravelan.
+
+- bpo-38878: Fixed __subclasshook__ of :class:`os.PathLike` to return a
+  correct result upon inheritence. Patch by Bar Harel.
+
+- bpo-35182: Fixed :func:`Popen.communicate` subsequent call crash when the
+  child process has already closed any piped standard stream, but still
+  continues to be running. Patch by Andriy Maletsky.
+
+- bpo-38473: Use signature from inner mock for autospecced methods attached
+  with :func:`unittest.mock.attach_mock`. Patch by Karthikeyan Singaravelan.
+
+- bpo-38293: Add :func:`copy.copy` and :func:`copy.deepcopy` support to
+  :func:`property` objects.
+
+Documentation
+-------------
+
+- bpo-39153: Clarify refcounting semantics for the following functions: -
+  PyObject_SetItem - PyMapping_SetItemString - PyDict_SetItem -
+  PyDict_SetItemString
+
+- bpo-39392: Explain that when filling with turtle, overlap regions may be
+  left unfilled.
+
+- bpo-39381: Mention in docs that :func:`asyncio.get_event_loop` implicitly
+  creates new event loop only if called from the main thread.
+
+- bpo-38918: Add an entry for ``__module__`` in the "function" & "method"
+  sections of the `inspect docs types and members table
+  <https://docs.python.org/3/library/inspect.html#types-and-members>`_
+
+- bpo-3530: In the :mod:`ast` module documentation, fix a misleading
+  ``NodeTransformer`` example and add advice on when to use the
+  ``fix_missing_locations`` function.
+
+Tests
+-----
+
+- bpo-39502: Skip test_zipfile.test_add_file_after_2107() if
+  :func:`time.localtime` fails with :exc:`OverflowError`. It is the case on
+  AIX 6.1 for example.
+
+- bpo-38546: Fix test_ressources_gced_in_workers() of
+  test_concurrent_futures: explicitly stop the manager to prevent leaking a
+  child process running in the background after the test completes.
+
+Build
+-----
+
+- bpo-39144: The ctags and etags build targets both include Modules/_ctypes
+  and Python standard library source files.
+
+Windows
+-------
+
+- bpo-39439: Honor the Python path when a virtualenv is active on Windows.
+
+- bpo-39393: Improve the error message when attempting to load a DLL with
+  unresolved dependencies.
+
+- bpo-38883: :meth:`~pathlib.Path.home()` and
+  :meth:`~pathlib.Path.expanduser()` on Windows now prefer
+  :envvar:`USERPROFILE` and no longer use :envvar:`HOME`, which is not
+  normally set for regular user accounts. This makes them again behave like
+  :func:`os.path.expanduser`, which was changed to ignore :envvar:`HOME` in
+  3.8, see :issue:`36264`.
+
+- bpo-39185: The build.bat script has additional options for very-quiet
+  output (-q) and very-verbose output (-vv)
+
+IDLE
+----
+
+- bpo-30780: Add remaining configdialog tests for buttons and highlights and
+  keys tabs.
+
+- bpo-39388: IDLE Settings Cancel button now cancels pending changes
+
+- bpo-39050: Make IDLE Settings dialog Help button work again.
+
+- bpo-34118: Tag memoryview, range, and tuple as classes, the same as list,
+  etcetera, in the library manual built-in functions list.
+
+- bpo-38792: Close an IDLE shell calltip if a :exc:`KeyboardInterrupt` or
+  shell restart occurs.  Patch by Zackery Spytz.
+
+- bpo-32989: Add tests for editor newline_and_indent_event method. Remove
+  dead code from pyparse find_good_parse_start method.
+
+
 What's New in Python 3.8.1 final?
 =================================
 
@@ -19,13 +731,13 @@ Core and Builtins
   consistent with the "if" node. Patch by Lysandros Nikolaou.
 
 - bpo-39008: :c:func:`PySys_Audit` now requires ``Py_ssize_t`` to be used
-  for size arguments in the format string, regardless of whethen
+  for size arguments in the format string, regardless of whether
   ``PY_SSIZE_T_CLEAN`` was defined at include time.
 
 Library
 -------
 
-- bpo-39022: Update importliib.metadata to include improvements from
+- bpo-39022: Update importlib.metadata to include improvements from
   importlib_metadata 1.3 including better serialization of EntryPoints and
   improved documentation for custom finders.
 
@@ -55,7 +767,7 @@ macOS
 IDLE
 ----
 
-- bpo-38944: Excape key now closes IDLE completion windows.  Patch by Johnny
+- bpo-38944: Escape key now closes IDLE completion windows.  Patch by Johnny
   Najera.
 
 - bpo-38943: Fix IDLE autocomplete windows not always appearing on some
@@ -407,7 +1119,7 @@ Library
 Documentation
 -------------
 
-- bpo-38294: Add list of no-longer-escaped chars to re.escape documentation
+- bpo-38294: Add list of no-longer-escaped chars to re.escape documentation.
 
 Tests
 -----
@@ -421,7 +1133,7 @@ Tests
 Windows
 -------
 
-- bpo-38344: Fix error message in activate.bat
+- bpo-38344: Fix error message in activate.bat.
 
 - bpo-38359: Ensures ``pyw.exe`` launcher reads correct registry key.
 
index 45e79fcf6f4682d1445be4f5a4a92da4ef3cddf9..e8f62ba64764236ee5e69af100dd7bb32e6c3bb0 100644 (file)
@@ -160,7 +160,7 @@ document pystackv
   Print the entire Python call stack - verbose mode
 end
 
-def pu
+define pu
   set $uni = $arg0
   set $i = 0
   while (*$uni && $i++<100)
index 3aa9f1f9c7eace537a5700ca5f794128be7f0f02..3645b0206eb2b569bd477a677934835d75a37f0d 100644 (file)
@@ -273,7 +273,45 @@ field matches the line number, where zero matches all line numbers and
 is thus equivalent to an omitted line number.
 .TP
 .BI "\-X " option
-Set implementation specific option.
+Set implementation specific option. The following options are available:
+
+    -X faulthandler: enable faulthandler
+
+    -X showrefcount: output the total reference count and number of used
+        memory blocks when the program finishes or after each statement in the
+        interactive interpreter. This only works on debug builds
+
+    -X tracemalloc: start tracing Python memory allocations using the
+        tracemalloc module. By default, only the most recent frame is stored in a
+        traceback of a trace. Use -X tracemalloc=NFRAME to start tracing with a
+        traceback limit of NFRAME frames
+
+    -X showalloccount: output the total count of allocated objects for each
+        type when the program finishes. This only works when Python was built with
+        COUNT_ALLOCS defined
+
+    -X importtime: show how long each import takes. It shows module name,
+        cumulative time (including nested imports) and self time (excluding
+        nested imports). Note that its output may be broken in multi-threaded
+        application. Typical usage is python3 -X importtime -c 'import asyncio'
+
+    -X dev: enable CPython’s “development mode”, introducing additional runtime
+        checks which are too expensive to be enabled by default. It will not be
+        more verbose than the default if the code is correct: new warnings are
+        only emitted when an issue is detected. Effect of the developer mode:
+           * Add default warning filter, as -W default
+           * Install debug hooks on memory allocators: see the PyMem_SetupDebugHooks() C function
+           * Enable the faulthandler module to dump the Python traceback on a crash
+           * Enable asyncio debug mode
+           * Set the dev_mode attribute of sys.flags to True
+           * io.IOBase destructor logs close() exceptions
+
+    -X utf8: enable UTF-8 mode for operating system interfaces, overriding the default
+        locale-aware mode. -X utf8=0 explicitly disables UTF-8 mode (even when it would
+        otherwise activate automatically). See PYTHONUTF8 for more details
+
+    -X pycache_prefix=PATH: enable writing .pyc files to a parallel tree rooted at the
+         given directory instead of to the code tree.
 .TP
 .B \-x
 Skip the first line of the source.  This is intended for a DOS
index 38a5ea3cd2b828f8625448ccffbd23b376b12efc..c9c45ba7ed6de4fde761e6c1ca2bd917e44b3bc3 100644 (file)
 
 }
 
+{
+   Uninitialised byte(s) false alarm, see bpo-35561
+   Memcheck:Param
+   epoll_ctl(event)
+   fun:epoll_ctl
+   fun:pyepoll_internal_ctl
+}
+
 {
    ZLIB problems, see test_gzip
    Memcheck:Cond
index f4efa2120a9c85c23444fa28d9b54d5564cc4c92..8e1cd4f52a540a285ce10c0d23bda1195a73818d 100644 (file)
@@ -2626,6 +2626,10 @@ task_step_impl(TaskObj *task, PyObject *exc)
     coro = task->task_coro;
     if (coro == NULL) {
         PyErr_SetString(PyExc_RuntimeError, "uninitialized Task object");
+        if (clear_exc) {
+            /* We created 'exc' during this call */
+            Py_DECREF(exc);
+        }
         return NULL;
     }
 
@@ -3261,6 +3265,8 @@ module_free(void *m)
     Py_CLEAR(context_kwname);
 
     module_free_freelists();
+
+    module_initialized = 0;
 }
 
 static int
index 45169ecd11af00dbde01528981a040f25d2b8f12..cc2b90eaa283ea3f704e1a3f593dfcb32ffba642 100644 (file)
@@ -966,7 +966,9 @@ deque_count(dequeobject *deque, PyObject *v)
     while (--n >= 0) {
         CHECK_NOT_END(b);
         item = b->data[index];
+        Py_INCREF(item);
         cmp = PyObject_RichCompareBool(item, v, Py_EQ);
+        Py_DECREF(item);
         if (cmp < 0)
             return NULL;
         count += cmp;
@@ -1003,7 +1005,9 @@ deque_contains(dequeobject *deque, PyObject *v)
     while (--n >= 0) {
         CHECK_NOT_END(b);
         item = b->data[index];
+        Py_INCREF(item);
         cmp = PyObject_RichCompareBool(item, v, Py_EQ);
+        Py_DECREF(item);
         if (cmp) {
             return cmp;
         }
index 347a3656b62578a0632fb07de95d74f55fff48c8..b10b86725ff171da479cb4bbba84ef08f65ca30e 100644 (file)
@@ -2401,6 +2401,23 @@ converters_from_argtypes(PyObject *ob)
     for (i = 0; i < nArgs; ++i) {
         PyObject *cnv;
         PyObject *tp = PyTuple_GET_ITEM(ob, i);
+/*
+ *      The following checks, relating to bpo-16575 and bpo-16576, have been
+ *      disabled. The reason is that, although there is a definite problem with
+ *      how libffi handles unions (https://github.com/libffi/libffi/issues/33),
+ *      there are numerous libraries which pass structures containing unions
+ *      by values - especially on Windows but examples also exist on Linux
+ *      (https://bugs.python.org/msg359834).
+ *
+ *      It may not be possible to get proper support for unions and bitfields
+ *      until support is forthcoming in libffi, but for now, adding the checks
+ *      has caused problems in otherwise-working software, which suggests it
+ *      is better to disable the checks.
+ *
+ *      Although specific examples reported relate specifically to unions and
+ *      not bitfields, the bitfields check is also being disabled as a
+ *      precaution.
+
         StgDictObject *stgdict = PyType_stgdict(tp);
 
         if (stgdict != NULL) {
@@ -2428,6 +2445,7 @@ converters_from_argtypes(PyObject *ob)
                 return NULL;
             }
         }
+ */
 
         if (_PyObject_LookupAttrId(tp, &PyId_from_param, &cnv) <= 0) {
             Py_DECREF(converters);
@@ -3554,10 +3572,12 @@ PyCFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
     if (PySys_Audit("ctypes.dlsym",
                     ((uintptr_t)name & ~0xFFFF) ? "Os" : "On",
                     dll, name) < 0) {
+        Py_DECREF(ftuple);
         return NULL;
     }
 #else
     if (PySys_Audit("ctypes.dlsym", "Os", dll, name) < 0) {
+        Py_DECREF(ftuple);
         return NULL;
     }
 #endif
index 77492e650ea484f389de056af0a1979c74ecb694..4027bdb622750c5fa4fbe7fe229f3d3a28710153 100644 (file)
@@ -1311,8 +1311,9 @@ static PyObject *load_library(PyObject *self, PyObject *args)
 
     if (err == ERROR_MOD_NOT_FOUND) {
         PyErr_Format(PyExc_FileNotFoundError,
-                     ("Could not find module '%.500S'. Try using "
-                      "the full path with constructor syntax."),
+                     ("Could not find module '%.500S' (or one of its "
+                      "dependencies). Try using the full path with "
+                      "constructor syntax."),
                      nameobj);
         return NULL;
     } else if (err) {
index e2ac19800315cea43059316eeba06cead28a53f1..df7c6e254bcf29f863886dc5038c4dcc215c6f5f 100644 (file)
@@ -122,7 +122,14 @@ incr_false(void)
 }
 
 
-static PyObject *current_context_var;
+#ifndef WITH_DECIMAL_CONTEXTVAR
+/* Key for thread state dictionary */
+static PyObject *tls_context_key = NULL;
+/* Invariant: NULL or the most recently accessed thread local context */
+static PyDecContextObject *cached_context = NULL;
+#else
+static PyObject *current_context_var = NULL;
+#endif
 
 /* Template for creating new thread contexts, calling Context() without
  * arguments and initializing the module_context on first access. */
@@ -1217,6 +1224,12 @@ context_new(PyTypeObject *type, PyObject *args UNUSED, PyObject *kwds UNUSED)
 static void
 context_dealloc(PyDecContextObject *self)
 {
+#ifndef WITH_DECIMAL_CONTEXTVAR
+    if (self == cached_context) {
+        cached_context = NULL;
+    }
+#endif
+
     Py_XDECREF(self->traps);
     Py_XDECREF(self->flags);
     Py_TYPE(self)->tp_free(self);
@@ -1491,6 +1504,134 @@ static PyGetSetDef context_getsets [] =
  * operation.
  */
 
+#ifndef WITH_DECIMAL_CONTEXTVAR
+/* Get the context from the thread state dictionary. */
+static PyObject *
+current_context_from_dict(void)
+{
+    PyObject *dict;
+    PyObject *tl_context;
+    PyThreadState *tstate;
+
+    dict = PyThreadState_GetDict();
+    if (dict == NULL) {
+        PyErr_SetString(PyExc_RuntimeError,
+            "cannot get thread state");
+        return NULL;
+    }
+
+    tl_context = PyDict_GetItemWithError(dict, tls_context_key);
+    if (tl_context != NULL) {
+        /* We already have a thread local context. */
+        CONTEXT_CHECK(tl_context);
+    }
+    else {
+        if (PyErr_Occurred()) {
+            return NULL;
+        }
+
+        /* Set up a new thread local context. */
+        tl_context = context_copy(default_context_template, NULL);
+        if (tl_context == NULL) {
+            return NULL;
+        }
+        CTX(tl_context)->status = 0;
+
+        if (PyDict_SetItem(dict, tls_context_key, tl_context) < 0) {
+            Py_DECREF(tl_context);
+            return NULL;
+        }
+        Py_DECREF(tl_context);
+    }
+
+    /* Cache the context of the current thread, assuming that it
+     * will be accessed several times before a thread switch. */
+    tstate = PyThreadState_GET();
+    if (tstate) {
+        cached_context = (PyDecContextObject *)tl_context;
+        cached_context->tstate = tstate;
+    }
+
+    /* Borrowed reference with refcount==1 */
+    return tl_context;
+}
+
+/* Return borrowed reference to thread local context. */
+static PyObject *
+current_context(void)
+{
+    PyThreadState *tstate;
+
+    tstate = PyThreadState_GET();
+    if (cached_context && cached_context->tstate == tstate) {
+        return (PyObject *)cached_context;
+    }
+
+    return current_context_from_dict();
+}
+
+/* ctxobj := borrowed reference to the current context */
+#define CURRENT_CONTEXT(ctxobj) \
+    ctxobj = current_context(); \
+    if (ctxobj == NULL) {       \
+        return NULL;            \
+    }
+
+/* Return a new reference to the current context */
+static PyObject *
+PyDec_GetCurrentContext(PyObject *self UNUSED, PyObject *args UNUSED)
+{
+    PyObject *context;
+
+    context = current_context();
+    if (context == NULL) {
+        return NULL;
+    }
+
+    Py_INCREF(context);
+    return context;
+}
+
+/* Set the thread local context to a new context, decrement old reference */
+static PyObject *
+PyDec_SetCurrentContext(PyObject *self UNUSED, PyObject *v)
+{
+    PyObject *dict;
+
+    CONTEXT_CHECK(v);
+
+    dict = PyThreadState_GetDict();
+    if (dict == NULL) {
+        PyErr_SetString(PyExc_RuntimeError,
+            "cannot get thread state");
+        return NULL;
+    }
+
+    /* If the new context is one of the templates, make a copy.
+     * This is the current behavior of decimal.py. */
+    if (v == default_context_template ||
+        v == basic_context_template ||
+        v == extended_context_template) {
+        v = context_copy(v, NULL);
+        if (v == NULL) {
+            return NULL;
+        }
+        CTX(v)->status = 0;
+    }
+    else {
+        Py_INCREF(v);
+    }
+
+    cached_context = NULL;
+    if (PyDict_SetItem(dict, tls_context_key, v) < 0) {
+        Py_DECREF(v);
+        return NULL;
+    }
+
+    Py_DECREF(v);
+    Py_RETURN_NONE;
+}
+#else
 static PyObject *
 init_current_context(void)
 {
@@ -1570,6 +1711,7 @@ PyDec_SetCurrentContext(PyObject *self UNUSED, PyObject *v)
 
     Py_RETURN_NONE;
 }
+#endif
 
 /* Context manager object for the 'with' statement. The manager
  * owns one reference to the global (outer) context and one
@@ -4388,15 +4530,8 @@ _dec_hash(PyDecObject *v)
     mpd_ssize_t exp;
     uint32_t status = 0;
     mpd_context_t maxctx;
-    PyObject *context;
 
 
-    context = current_context();
-    if (context == NULL) {
-        return -1;
-    }
-    Py_DECREF(context);
-
     if (mpd_isspecial(MPD(v))) {
         if (mpd_issnan(MPD(v))) {
             PyErr_SetString(PyExc_TypeError,
@@ -5538,11 +5673,6 @@ PyInit__decimal(void)
     mpd_free = PyMem_Free;
     mpd_setminalloc(_Py_DEC_MINALLOC);
 
-    /* Init context variable */
-    current_context_var = PyContextVar_New("decimal_context", NULL);
-    if (current_context_var == NULL) {
-        goto error;
-    }
 
     /* Init external C-API functions */
     _py_long_multiply = PyLong_Type.tp_as_number->nb_multiply;
@@ -5714,6 +5844,15 @@ PyInit__decimal(void)
     CHECK_INT(PyModule_AddObject(m, "DefaultContext",
                                  default_context_template));
 
+#ifndef WITH_DECIMAL_CONTEXTVAR
+    ASSIGN_PTR(tls_context_key, PyUnicode_FromString("___DECIMAL_CTX__"));
+    Py_INCREF(Py_False);
+    CHECK_INT(PyModule_AddObject(m, "HAVE_CONTEXTVAR", Py_False));
+#else
+    ASSIGN_PTR(current_context_var, PyContextVar_New("decimal_context", NULL));
+    Py_INCREF(Py_True);
+    CHECK_INT(PyModule_AddObject(m, "HAVE_CONTEXTVAR", Py_True));
+#endif
     Py_INCREF(Py_True);
     CHECK_INT(PyModule_AddObject(m, "HAVE_THREADS", Py_True));
 
@@ -5773,9 +5912,13 @@ error:
     Py_CLEAR(SignalTuple); /* GCOV_NOT_REACHED */
     Py_CLEAR(DecimalTuple); /* GCOV_NOT_REACHED */
     Py_CLEAR(default_context_template); /* GCOV_NOT_REACHED */
+#ifndef WITH_DECIMAL_CONTEXTVAR
+    Py_CLEAR(tls_context_key); /* GCOV_NOT_REACHED */
+#else
+    Py_CLEAR(current_context_var); /* GCOV_NOT_REACHED */
+#endif
     Py_CLEAR(basic_context_template); /* GCOV_NOT_REACHED */
     Py_CLEAR(extended_context_template); /* GCOV_NOT_REACHED */
-    Py_CLEAR(current_context_var); /* GCOV_NOT_REACHED */
     Py_CLEAR(m); /* GCOV_NOT_REACHED */
 
     return NULL; /* GCOV_NOT_REACHED */
index bfa8bb343e60c1db28c2f11fa07baa7c8d20d796..0986edb576a10ffff4ff22a87f52936c80c3b202 100644 (file)
@@ -3781,6 +3781,43 @@ mpd_qdiv(mpd_t *q, const mpd_t *a, const mpd_t *b,
          const mpd_context_t *ctx, uint32_t *status)
 {
     _mpd_qdiv(SET_IDEAL_EXP, q, a, b, ctx, status);
+
+    if (*status & MPD_Malloc_error) {
+        /* Inexact quotients (the usual case) fill the entire context precision,
+         * which can lead to malloc() failures for very high precisions. Retry
+         * the operation with a lower precision in case the result is exact.
+         *
+         * We need an upper bound for the number of digits of a_coeff / b_coeff
+         * when the result is exact.  If a_coeff' * 1 / b_coeff' is in lowest
+         * terms, then maxdigits(a_coeff') + maxdigits(1 / b_coeff') is a suitable
+         * bound.
+         *
+         * 1 / b_coeff' is exact iff b_coeff' exclusively has prime factors 2 or 5.
+         * The largest amount of digits is generated if b_coeff' is a power of 2 or
+         * a power of 5 and is less than or equal to log5(b_coeff') <= log2(b_coeff').
+         *
+         * We arrive at a total upper bound:
+         *
+         *   maxdigits(a_coeff') + maxdigits(1 / b_coeff') <=
+         *   a->digits + log2(b_coeff) =
+         *   a->digits + log10(b_coeff) / log10(2) <=
+         *   a->digits + b->digits * 4;
+         */
+        uint32_t workstatus = 0;
+        mpd_context_t workctx = *ctx;
+        workctx.prec = a->digits + b->digits * 4;
+        if (workctx.prec >= ctx->prec) {
+            return;  /* No point in retrying, keep the original error. */
+        }
+
+        _mpd_qdiv(SET_IDEAL_EXP, q, a, b, &workctx, &workstatus);
+        if (workstatus == 0) { /* The result is exact, unrounded, normal etc. */
+            *status = 0;
+            return;
+        }
+
+        mpd_seterror(q, *status, status);
+    }
 }
 
 /* Internal function. */
@@ -7702,9 +7739,9 @@ mpd_qinvroot(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
 /* END LIBMPDEC_ONLY */
 
 /* Algorithm from decimal.py */
-void
-mpd_qsqrt(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
-          uint32_t *status)
+static void
+_mpd_qsqrt(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
+           uint32_t *status)
 {
     mpd_context_t maxcontext;
     MPD_NEW_STATIC(c,0,0,0,0);
@@ -7836,6 +7873,40 @@ malloc_error:
     goto out;
 }
 
+void
+mpd_qsqrt(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
+          uint32_t *status)
+{
+    _mpd_qsqrt(result, a, ctx, status);
+
+    if (*status & (MPD_Malloc_error|MPD_Division_impossible)) {
+        /* The above conditions can occur at very high context precisions
+         * if intermediate values get too large. Retry the operation with
+         * a lower context precision in case the result is exact.
+         *
+         * If the result is exact, an upper bound for the number of digits
+         * is the number of digits in the input.
+         *
+         * NOTE: sqrt(40e9) = 2.0e+5 /\ digits(40e9) = digits(2.0e+5) = 2
+         */
+        uint32_t workstatus = 0;
+        mpd_context_t workctx = *ctx;
+        workctx.prec = a->digits;
+
+        if (workctx.prec >= ctx->prec) {
+            return; /* No point in repeating this, keep the original error. */
+        }
+
+        _mpd_qsqrt(result, a, &workctx, &workstatus);
+        if (workstatus == 0) {
+            *status = 0;
+            return;
+        }
+
+        mpd_seterror(result, *status, status);
+    }
+}
+
 
 /******************************************************************************/
 /*                              Base conversions                              */
index f907531e1ffa58b52e9e5a48b6f5e70a7d35c0ce..5cd5db5711426c10cbce63a56f0a4fde9a6fa10b 100644 (file)
@@ -125,6 +125,12 @@ ContextFunctions = {
     'special': ('context.__reduce_ex__', 'context.create_decimal_from_float')
 }
 
+# Functions that set no context flags but whose result can differ depending
+# on prec, Emin and Emax.
+MaxContextSkip = ['is_normal', 'is_subnormal', 'logical_invert', 'next_minus',
+                  'next_plus', 'number_class', 'logical_and', 'logical_or',
+                  'logical_xor', 'next_toward', 'rotate', 'shift']
+
 # Functions that require a restricted exponent range for reasonable runtimes.
 UnaryRestricted = [
   '__ceil__', '__floor__', '__int__', '__trunc__',
@@ -344,6 +350,20 @@ class TestSet(object):
         self.pex = RestrictedList()      # Python exceptions for P.Decimal
         self.presults = RestrictedList() # P.Decimal results
 
+        # If the above results are exact, unrounded and not clamped, repeat
+        # the operation with a maxcontext to ensure that huge intermediate
+        # values do not cause a MemoryError.
+        self.with_maxcontext = False
+        self.maxcontext = context.c.copy()
+        self.maxcontext.prec = C.MAX_PREC
+        self.maxcontext.Emax = C.MAX_EMAX
+        self.maxcontext.Emin = C.MIN_EMIN
+        self.maxcontext.clear_flags()
+
+        self.maxop = RestrictedList()       # converted C.Decimal operands
+        self.maxex = RestrictedList()       # Python exceptions for C.Decimal
+        self.maxresults = RestrictedList()  # C.Decimal results
+
 
 # ======================================================================
 #                SkipHandler: skip known discrepancies
@@ -545,13 +565,17 @@ def function_as_string(t):
     if t.contextfunc:
         cargs = t.cop
         pargs = t.pop
+        maxargs = t.maxop
         cfunc = "c_func: %s(" % t.funcname
         pfunc = "p_func: %s(" % t.funcname
+        maxfunc = "max_func: %s(" % t.funcname
     else:
         cself, cargs = t.cop[0], t.cop[1:]
         pself, pargs = t.pop[0], t.pop[1:]
+        maxself, maxargs = t.maxop[0], t.maxop[1:]
         cfunc = "c_func: %s.%s(" % (repr(cself), t.funcname)
         pfunc = "p_func: %s.%s(" % (repr(pself), t.funcname)
+        maxfunc = "max_func: %s.%s(" % (repr(maxself), t.funcname)
 
     err = cfunc
     for arg in cargs:
@@ -565,6 +589,14 @@ def function_as_string(t):
     err = err.rstrip(", ")
     err += ")"
 
+    if t.with_maxcontext:
+        err += "\n"
+        err += maxfunc
+        for arg in maxargs:
+            err += "%s, " % repr(arg)
+        err = err.rstrip(", ")
+        err += ")"
+
     return err
 
 def raise_error(t):
@@ -577,9 +609,24 @@ def raise_error(t):
     err = "Error in %s:\n\n" % t.funcname
     err += "input operands: %s\n\n" % (t.op,)
     err += function_as_string(t)
-    err += "\n\nc_result: %s\np_result: %s\n\n" % (t.cresults, t.presults)
-    err += "c_exceptions: %s\np_exceptions: %s\n\n" % (t.cex, t.pex)
-    err += "%s\n\n" % str(t.context)
+
+    err += "\n\nc_result: %s\np_result: %s\n" % (t.cresults, t.presults)
+    if t.with_maxcontext:
+        err += "max_result: %s\n\n" % (t.maxresults)
+    else:
+        err += "\n"
+
+    err += "c_exceptions: %s\np_exceptions: %s\n" % (t.cex, t.pex)
+    if t.with_maxcontext:
+        err += "max_exceptions: %s\n\n" % t.maxex
+    else:
+        err += "\n"
+
+    err += "%s\n" % str(t.context)
+    if t.with_maxcontext:
+        err += "%s\n" % str(t.maxcontext)
+    else:
+        err += "\n"
 
     raise VerifyError(err)
 
@@ -603,6 +650,13 @@ def raise_error(t):
 #                are printed to stdout.
 # ======================================================================
 
+def all_nan(a):
+    if isinstance(a, C.Decimal):
+        return a.is_nan()
+    elif isinstance(a, tuple):
+        return all(all_nan(v) for v in a)
+    return False
+
 def convert(t, convstr=True):
     """ t is the testset. At this stage the testset contains a tuple of
         operands t.op of various types. For decimal methods the first
@@ -617,10 +671,12 @@ def convert(t, convstr=True):
     for i, op in enumerate(t.op):
 
         context.clear_status()
+        t.maxcontext.clear_flags()
 
         if op in RoundModes:
             t.cop.append(op)
             t.pop.append(op)
+            t.maxop.append(op)
 
         elif not t.contextfunc and i == 0 or \
              convstr and isinstance(op, str):
@@ -638,11 +694,25 @@ def convert(t, convstr=True):
                 p = None
                 pex = e.__class__
 
+            try:
+                C.setcontext(t.maxcontext)
+                maxop = C.Decimal(op)
+                maxex = None
+            except (TypeError, ValueError, OverflowError) as e:
+                maxop = None
+                maxex = e.__class__
+            finally:
+                C.setcontext(context.c)
+
             t.cop.append(c)
             t.cex.append(cex)
+
             t.pop.append(p)
             t.pex.append(pex)
 
+            t.maxop.append(maxop)
+            t.maxex.append(maxex)
+
             if cex is pex:
                 if str(c) != str(p) or not context.assert_eq_status():
                     raise_error(t)
@@ -652,14 +722,21 @@ def convert(t, convstr=True):
             else:
                 raise_error(t)
 
+            # The exceptions in the maxcontext operation can legitimately
+            # differ, only test that maxex implies cex:
+            if maxex is not None and cex is not maxex:
+                raise_error(t)
+
         elif isinstance(op, Context):
             t.context = op
             t.cop.append(op.c)
             t.pop.append(op.p)
+            t.maxop.append(t.maxcontext)
 
         else:
             t.cop.append(op)
             t.pop.append(op)
+            t.maxop.append(op)
 
     return 1
 
@@ -673,6 +750,7 @@ def callfuncs(t):
         t.rc and t.rp are the results of the operation.
     """
     context.clear_status()
+    t.maxcontext.clear_flags()
 
     try:
         if t.contextfunc:
@@ -700,6 +778,35 @@ def callfuncs(t):
         t.rp = None
         t.pex.append(e.__class__)
 
+    # If the above results are exact, unrounded, normal etc., repeat the
+    # operation with a maxcontext to ensure that huge intermediate values
+    # do not cause a MemoryError.
+    if (t.funcname not in MaxContextSkip and
+        not context.c.flags[C.InvalidOperation] and
+        not context.c.flags[C.Inexact] and
+        not context.c.flags[C.Rounded] and
+        not context.c.flags[C.Subnormal] and
+        not context.c.flags[C.Clamped] and
+        not context.clamp and # results are padded to context.prec if context.clamp==1.
+        not any(isinstance(v, C.Context) for v in t.cop)): # another context is used.
+        t.with_maxcontext = True
+        try:
+            if t.contextfunc:
+                maxargs = t.maxop
+                t.rmax = getattr(t.maxcontext, t.funcname)(*maxargs)
+            else:
+                maxself = t.maxop[0]
+                maxargs = t.maxop[1:]
+                try:
+                    C.setcontext(t.maxcontext)
+                    t.rmax = getattr(maxself, t.funcname)(*maxargs)
+                finally:
+                    C.setcontext(context.c)
+            t.maxex.append(None)
+        except (TypeError, ValueError, OverflowError, MemoryError) as e:
+            t.rmax = None
+            t.maxex.append(e.__class__)
+
 def verify(t, stat):
     """ t is the testset. At this stage the testset contains the following
         tuples:
@@ -714,6 +821,9 @@ def verify(t, stat):
     """
     t.cresults.append(str(t.rc))
     t.presults.append(str(t.rp))
+    if t.with_maxcontext:
+        t.maxresults.append(str(t.rmax))
+
     if isinstance(t.rc, C.Decimal) and isinstance(t.rp, P.Decimal):
         # General case: both results are Decimals.
         t.cresults.append(t.rc.to_eng_string())
@@ -725,6 +835,12 @@ def verify(t, stat):
         t.presults.append(str(t.rp.imag))
         t.presults.append(str(t.rp.real))
 
+        if t.with_maxcontext and isinstance(t.rmax, C.Decimal):
+            t.maxresults.append(t.rmax.to_eng_string())
+            t.maxresults.append(t.rmax.as_tuple())
+            t.maxresults.append(str(t.rmax.imag))
+            t.maxresults.append(str(t.rmax.real))
+
         nc = t.rc.number_class().lstrip('+-s')
         stat[nc] += 1
     else:
@@ -732,6 +848,9 @@ def verify(t, stat):
         if not isinstance(t.rc, tuple) and not isinstance(t.rp, tuple):
             if t.rc != t.rp:
                 raise_error(t)
+            if t.with_maxcontext and not isinstance(t.rmax, tuple):
+                if t.rmax != t.rc:
+                    raise_error(t)
         stat[type(t.rc).__name__] += 1
 
     # The return value lists must be equal.
@@ -744,6 +863,20 @@ def verify(t, stat):
     if not t.context.assert_eq_status():
         raise_error(t)
 
+    if t.with_maxcontext:
+        # NaN payloads etc. depend on precision and clamp.
+        if all_nan(t.rc) and all_nan(t.rmax):
+            return
+        # The return value lists must be equal.
+        if t.maxresults != t.cresults:
+            raise_error(t)
+        # The Python exception lists (TypeError, etc.) must be equal.
+        if t.maxex != t.cex:
+            raise_error(t)
+        # The context flags must be equal.
+        if t.maxcontext.flags != t.context.c.flags:
+            raise_error(t)
+
 
 # ======================================================================
 #                           Main test loops
index 77c0c9cd82c13feec57efe7e7de895db7861f4db..7f3e527461871a61b83660ca54dc357d9fb4e929 100755 (executable)
@@ -1,8 +1,8 @@
 #!/bin/sh
 
 #
-# Purpose: test all machine configurations, pydebug, refleaks, release build
-#          and release build with valgrind.
+# Purpose: test with and without contextvar, all machine configurations, pydebug,
+#          refleaks, release build and release build with valgrind.
 #
 # Synopsis: ./runall-memorydebugger.sh [--all-configs64 | --all-configs32]
 #
@@ -18,7 +18,7 @@ CONFIGS_64="x64 uint128 ansi64 universal"
 CONFIGS_32="ppro ansi32 ansi-legacy universal"
 
 VALGRIND="valgrind --tool=memcheck --leak-resolution=high \
-          --db-attach=yes --suppressions=Misc/valgrind-python.supp"
+          --suppressions=Misc/valgrind-python.supp"
 
 # Get args
 case $@ in
@@ -57,7 +57,8 @@ print_config ()
 cd ..
 
 # test_decimal: refleak, regular and Valgrind tests
-for config in $CONFIGS; do
+for args in "--without-decimal-contextvar" ""; do
+    for config in $CONFIGS; do
 
         unset PYTHON_DECIMAL_WITH_MACHINE
         libmpdec_config=$config
@@ -69,24 +70,24 @@ for config in $CONFIGS; do
         fi
 
         ############ refleak tests ###########
-        print_config "refleak tests: config=$config"
+        print_config "refleak tests: config=$config" $args
         printf "\nbuilding python ...\n\n"
 
         cd ../../
         $GMAKE distclean > /dev/null 2>&1
-        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --with-pydebug > /dev/null 2>&1
+        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --with-pydebug $args > /dev/null 2>&1
         $GMAKE | grep _decimal
 
         printf "\n\n# ======================== refleak tests ===========================\n\n"
-        ./python -m test -uall -R 2:2 test_decimal
+        ./python -m test -uall -R 3:3 test_decimal
 
 
         ############ regular tests ###########
-        print_config "regular tests: config=$config"
+        print_config "regular tests: config=$config" $args
         printf "\nbuilding python ...\n\n"
 
         $GMAKE distclean > /dev/null 2>&1
-        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" > /dev/null 2>&1
+        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" $args > /dev/null 2>&1
         $GMAKE | grep _decimal
 
         printf "\n\n# ======================== regular tests ===========================\n\n"
@@ -103,21 +104,23 @@ for config in $CONFIGS; do
                   esac
         esac
 
-        print_config "valgrind tests: config=$config"
+        print_config "valgrind tests: config=$config" $args
         printf "\nbuilding python ...\n\n"
         $GMAKE distclean > /dev/null 2>&1
-        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --without-pymalloc > /dev/null 2>&1
+        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --without-pymalloc $args > /dev/null 2>&1
         $GMAKE | grep _decimal
 
         printf "\n\n# ======================== valgrind tests ===========================\n\n"
         $valgrind ./python -m test -uall test_decimal
 
         cd Modules/_decimal
+    done
 done
 
 # deccheck
 cd ../../
-for config in $CONFIGS; do
+for args in "--without-decimal-contextvar" ""; do
+    for config in $CONFIGS; do
 
         unset PYTHON_DECIMAL_WITH_MACHINE
         if [ X"$config" != X"auto" ]; then
@@ -126,22 +129,22 @@ for config in $CONFIGS; do
         fi
 
         ############ debug ############
-        print_config "deccheck: config=$config --with-pydebug"
+        print_config "deccheck: config=$config --with-pydebug" $args
         printf "\nbuilding python ...\n\n"
 
         $GMAKE distclean > /dev/null 2>&1
-        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --with-pydebug > /dev/null 2>&1
+        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --with-pydebug $args > /dev/null 2>&1
         $GMAKE | grep _decimal
 
         printf "\n\n# ========================== debug ===========================\n\n"
         ./python Modules/_decimal/tests/deccheck.py
 
         ########### regular ###########
-        print_config "deccheck: config=$config "
+        print_config "deccheck: config=$config" $args
         printf "\nbuilding python ...\n\n"
 
         $GMAKE distclean > /dev/null 2>&1
-        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" > /dev/null 2>&1
+        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" $args > /dev/null 2>&1
         $GMAKE | grep _decimal
 
         printf "\n\n# ======================== regular ===========================\n\n"
@@ -157,15 +160,16 @@ for config in $CONFIGS; do
                   esac
         esac
 
-        print_config "valgrind deccheck: config=$config "
+        print_config "valgrind deccheck: config=$config" $args
         printf "\nbuilding python ...\n\n"
 
         $GMAKE distclean > /dev/null 2>&1
-        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --without-pymalloc > /dev/null 2>&1
+        ./configure CFLAGS="$ADD_CFLAGS" LDFLAGS="$ADD_LDFLAGS" --without-pymalloc $args > /dev/null 2>&1
         $GMAKE | grep _decimal
 
         printf "\n\n# ======================== valgrind ==========================\n\n"
         $valgrind ./python Modules/_decimal/tests/deccheck.py
+    done
 done
 
 
index 568f92f6ddf392486e4a02f656ceb0aa7671782c..f278ef33b5fc5b071053fd2bfc6abf003596d840 100755 (executable)
@@ -7,105 +7,123 @@ cd ..\..\..\
 \r
 echo.\r
 echo # ======================================================================\r
-echo #                            Building Python\r
+echo #                      Building Python (Debug^|x64)\r
 echo # ======================================================================\r
 echo.\r
 \r
-call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x64\r
-msbuild /noconsolelogger /target:clean PCbuild\pcbuild.sln /p:Configuration=Release /p:PlatformTarget=x64\r
-msbuild /noconsolelogger /target:clean PCbuild\pcbuild.sln /p:Configuration=Debug /p:PlatformTarget=x64\r
-msbuild /noconsolelogger PCbuild\pcbuild.sln /p:Configuration=Release /p:Platform=x64\r
-msbuild /noconsolelogger PCbuild\pcbuild.sln /p:Configuration=Debug /p:Platform=x64\r
-\r
-call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" x86\r
-msbuild /noconsolelogger PCbuild\pcbuild.sln /p:Configuration=Release /p:Platform=Win32\r
-msbuild /noconsolelogger PCbuild\pcbuild.sln /p:Configuration=Debug /p:Platform=Win32\r
-echo.\r
-echo.\r
+call .\Tools\buildbot\clean.bat\r
+call .\Tools\buildbot\build.bat -c Debug -p x64\r
 \r
 echo.\r
 echo # ======================================================================\r
-echo #                       test_decimal: platform=x64\r
+echo #                           platform=Debug^|x64\r
 echo # ======================================================================\r
 echo.\r
 \r
-cd PCbuild\amd64\r
-\r
 echo # ==================== refleak tests =======================\r
 echo.\r
-python_d.exe -m test -uall -R 2:2 test_decimal\r
+call python.bat -m test -uall -R 3:3 test_decimal\r
 echo.\r
 echo.\r
 \r
 echo # ==================== regular tests =======================\r
 echo.\r
-python.exe -m test -uall test_decimal\r
+call python.bat -m test -uall test_decimal\r
+echo.\r
+echo.\r
+\r
+echo # ==================== deccheck =======================\r
+echo.\r
+call python.bat .\Modules\_decimal\tests\deccheck.py\r
 echo.\r
 echo.\r
 \r
-cd ..\r
 \r
 echo.\r
 echo # ======================================================================\r
-echo #                       test_decimal: platform=x86\r
+echo #                      Building Python (Release^|x64)\r
 echo # ======================================================================\r
 echo.\r
 \r
-echo # ==================== refleak tests =======================\r
-echo.\r
-python_d.exe -m test -uall -R 2:2 test_decimal\r
+call .\Tools\buildbot\clean.bat\r
+call .\Tools\buildbot\build.bat -c Release -p x64\r
+\r
 echo.\r
+echo # ======================================================================\r
+echo #                          platform=Release^|x64\r
+echo # ======================================================================\r
 echo.\r
 \r
 echo # ==================== regular tests =======================\r
 echo.\r
-python.exe -m test -uall test_decimal\r
+call python.bat -m test -uall test_decimal\r
+echo.\r
+echo.\r
+\r
+echo # ==================== deccheck =======================\r
+echo.\r
+call python.bat .\Modules\_decimal\tests\deccheck.py\r
+echo.\r
+echo.\r
+\r
+\r
 echo.\r
+echo # ======================================================================\r
+echo #                      Building Python (Debug^|Win32)\r
+echo # ======================================================================\r
 echo.\r
 \r
-cd amd64\r
+call .\Tools\buildbot\clean.bat\r
+call Tools\buildbot\build.bat -c Debug -p Win32\r
 \r
 echo.\r
 echo # ======================================================================\r
-echo #                         deccheck: platform=x64\r
+echo #                         platform=Debug^|Win32\r
 echo # ======================================================================\r
 echo.\r
 \r
-echo # ==================== debug build =======================\r
+echo # ==================== refleak tests =======================\r
+echo.\r
+call python.bat -m test -uall -R 3:3 test_decimal\r
+echo.\r
+echo.\r
+\r
+echo # ==================== regular tests =======================\r
 echo.\r
-python_d.exe ..\..\Modules\_decimal\tests\deccheck.py\r
+call python.bat -m test -uall test_decimal\r
 echo.\r
 echo.\r
 \r
-echo # =================== release build ======================\r
+echo # ==================== deccheck =======================\r
 echo.\r
-python.exe ..\..\Modules\_decimal\tests\deccheck.py\r
+call python.bat .\Modules\_decimal\tests\deccheck.py\r
 echo.\r
 echo.\r
 \r
-cd ..\r
 \r
 echo.\r
 echo # ======================================================================\r
-echo #                         deccheck: platform=x86\r
+echo #                      Building Python (Release^|Win32)\r
 echo # ======================================================================\r
 echo.\r
+\r
+call .\Tools\buildbot\clean.bat\r
+call .\Tools\buildbot\build.bat -c Release -p Win32\r
+\r
+echo.\r
+echo # ======================================================================\r
+echo #                          platform=Release^|Win32\r
+echo # ======================================================================\r
 echo.\r
 \r
-echo # ==================== debug build =======================\r
+echo # ==================== regular tests =======================\r
 echo.\r
-python_d.exe ..\Modules\_decimal\tests\deccheck.py\r
+call python.bat -m test -uall test_decimal\r
 echo.\r
 echo.\r
 \r
-echo # =================== release build ======================\r
+echo # ==================== deccheck =======================\r
 echo.\r
-python.exe ..\Modules\_decimal\tests\deccheck.py\r
+call python.bat .\Modules\_decimal\tests\deccheck.py\r
 echo.\r
 echo.\r
-\r
-\r
-cd ..\Modules\_decimal\tests\r
-\r
-\r
-\r
index c3f30c9339cd0aef3a3e0fe7858793da1851fda4..a96e3f43b5597f99cf1358dc534ef38b699dbd61 100644 (file)
@@ -950,8 +950,8 @@ static PyObject *
 _elementtree_Element___getstate___impl(ElementObject *self)
 /*[clinic end generated code: output=37279aeeb6bb5b04 input=f0d16d7ec2f7adc1]*/
 {
-    Py_ssize_t i, noattrib;
-    PyObject *instancedict = NULL, *children;
+    Py_ssize_t i;
+    PyObject *children, *attrib;
 
     /* Build a list of children. */
     children = PyList_New(self->extra ? self->extra->length : 0);
@@ -963,33 +963,24 @@ _elementtree_Element___getstate___impl(ElementObject *self)
         PyList_SET_ITEM(children, i, child);
     }
 
-    /* Construct the state object. */
-    noattrib = (self->extra == NULL || self->extra->attrib == Py_None);
-    if (noattrib)
-        instancedict = Py_BuildValue("{sOsOs{}sOsO}",
-                                     PICKLED_TAG, self->tag,
-                                     PICKLED_CHILDREN, children,
-                                     PICKLED_ATTRIB,
-                                     PICKLED_TEXT, JOIN_OBJ(self->text),
-                                     PICKLED_TAIL, JOIN_OBJ(self->tail));
-    else
-        instancedict = Py_BuildValue("{sOsOsOsOsO}",
-                                     PICKLED_TAG, self->tag,
-                                     PICKLED_CHILDREN, children,
-                                     PICKLED_ATTRIB, self->extra->attrib,
-                                     PICKLED_TEXT, JOIN_OBJ(self->text),
-                                     PICKLED_TAIL, JOIN_OBJ(self->tail));
-    if (instancedict) {
-        Py_DECREF(children);
-        return instancedict;
+    if (self->extra && self->extra->attrib != Py_None) {
+        attrib = self->extra->attrib;
+        Py_INCREF(attrib);
     }
     else {
-        for (i = 0; i < PyList_GET_SIZE(children); i++)
-            Py_DECREF(PyList_GET_ITEM(children, i));
-        Py_DECREF(children);
-
-        return NULL;
+        attrib = PyDict_New();
+        if (!attrib) {
+            Py_DECREF(children);
+            return NULL;
+        }
     }
+
+    return Py_BuildValue("{sOsNsNsOsO}",
+                         PICKLED_TAG, self->tag,
+                         PICKLED_CHILDREN, children,
+                         PICKLED_ATTRIB, attrib,
+                         PICKLED_TEXT, JOIN_OBJ(self->text),
+                         PICKLED_TAIL, JOIN_OBJ(self->tail));
 }
 
 static PyObject *
@@ -3886,6 +3877,17 @@ xmlparser_dealloc(XMLParserObject* self)
     Py_TYPE(self)->tp_free((PyObject *)self);
 }
 
+Py_LOCAL_INLINE(int)
+_check_xmlparser(XMLParserObject* self)
+{
+    if (self->target == NULL) {
+        PyErr_SetString(PyExc_ValueError,
+                        "XMLParser.__init__() wasn't called");
+        return 0;
+    }
+    return 1;
+}
+
 LOCAL(PyObject*)
 expat_parse(XMLParserObject* self, const char* data, int data_len, int final)
 {
@@ -3922,6 +3924,10 @@ _elementtree_XMLParser_close_impl(XMLParserObject *self)
     /* end feeding data to parser */
 
     PyObject* res;
+
+    if (!_check_xmlparser(self)) {
+        return NULL;
+    }
     res = expat_parse(self, "", 0, 1);
     if (!res)
         return NULL;
@@ -3953,6 +3959,9 @@ _elementtree_XMLParser_feed(XMLParserObject *self, PyObject *data)
 {
     /* feed data to parser */
 
+    if (!_check_xmlparser(self)) {
+        return NULL;
+    }
     if (PyUnicode_Check(data)) {
         Py_ssize_t data_len;
         const char *data_ptr = PyUnicode_AsUTF8AndSize(data, &data_len);
@@ -4000,6 +4009,9 @@ _elementtree_XMLParser__parse_whole(XMLParserObject *self, PyObject *file)
     PyObject* temp;
     PyObject* res;
 
+    if (!_check_xmlparser(self)) {
+        return NULL;
+    }
     reader = PyObject_GetAttrString(file, "read");
     if (!reader)
         return NULL;
@@ -4087,6 +4099,9 @@ _elementtree_XMLParser__setevents_impl(XMLParserObject *self,
     TreeBuilderObject *target;
     PyObject *events_append, *events_seq;
 
+    if (!_check_xmlparser(self)) {
+        return NULL;
+    }
     if (!TreeBuilder_CheckExact(self->target)) {
         PyErr_SetString(
             PyExc_TypeError,
index a84cade3aaa16a5c40d054a174699140c9ba79ff..6bc18b5f82fb82db52cec8b6a90256db928196b9 100644 (file)
@@ -36,7 +36,11 @@ siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos)
     while (pos > startpos) {
         parentpos = (pos - 1) >> 1;
         parent = arr[parentpos];
+        Py_INCREF(newitem);
+        Py_INCREF(parent);
         cmp = PyObject_RichCompareBool(newitem, parent, Py_LT);
+        Py_DECREF(parent);
+        Py_DECREF(newitem);
         if (cmp < 0)
             return -1;
         if (size != PyList_GET_SIZE(heap)) {
@@ -78,10 +82,13 @@ siftup(PyListObject *heap, Py_ssize_t pos)
         /* Set childpos to index of smaller child.   */
         childpos = 2*pos + 1;    /* leftmost child position  */
         if (childpos + 1 < endpos) {
-            cmp = PyObject_RichCompareBool(
-                arr[childpos],
-                arr[childpos + 1],
-                Py_LT);
+            PyObject* a = arr[childpos];
+            PyObject* b = arr[childpos + 1];
+            Py_INCREF(a);
+            Py_INCREF(b);
+            cmp = PyObject_RichCompareBool(a, b, Py_LT);
+            Py_DECREF(a);
+            Py_DECREF(b);
             if (cmp < 0)
                 return -1;
             childpos += ((unsigned)cmp ^ 1);   /* increment when cmp==0 */
@@ -264,7 +271,10 @@ _heapq_heappushpop_impl(PyObject *module, PyObject *heap, PyObject *item)
         return item;
     }
 
-    cmp = PyObject_RichCompareBool(PyList_GET_ITEM(heap, 0), item, Py_LT);
+    PyObject* top = PyList_GET_ITEM(heap, 0);
+    Py_INCREF(top);
+    cmp = PyObject_RichCompareBool(top, item, Py_LT);
+    Py_DECREF(top);
     if (cmp < 0)
         return NULL;
     if (cmp == 0) {
@@ -420,7 +430,11 @@ siftdown_max(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos)
     while (pos > startpos) {
         parentpos = (pos - 1) >> 1;
         parent = arr[parentpos];
+        Py_INCREF(parent);
+        Py_INCREF(newitem);
         cmp = PyObject_RichCompareBool(parent, newitem, Py_LT);
+        Py_DECREF(parent);
+        Py_DECREF(newitem);
         if (cmp < 0)
             return -1;
         if (size != PyList_GET_SIZE(heap)) {
@@ -462,10 +476,13 @@ siftup_max(PyListObject *heap, Py_ssize_t pos)
         /* Set childpos to index of smaller child.   */
         childpos = 2*pos + 1;    /* leftmost child position  */
         if (childpos + 1 < endpos) {
-            cmp = PyObject_RichCompareBool(
-                arr[childpos + 1],
-                arr[childpos],
-                Py_LT);
+            PyObject* a = arr[childpos + 1];
+            PyObject* b = arr[childpos];
+            Py_INCREF(a);
+            Py_INCREF(b);
+            cmp = PyObject_RichCompareBool(a, b, Py_LT);
+            Py_DECREF(a);
+            Py_DECREF(b);
             if (cmp < 0)
                 return -1;
             childpos += ((unsigned)cmp ^ 1);   /* increment when cmp==0 */
index 8e8ff97ff8c676f951f8cc0e301c7ec36414ff16..ad7a8c9d264270acd0ef605c0fd5d5fa7f589427 100644 (file)
@@ -965,6 +965,7 @@ _buffered_readinto_generic(buffered *self, Py_buffer *buffer, char readinto1)
     PyObject *res = NULL;
 
     CHECK_INITIALIZED(self)
+    CHECK_CLOSED(self, "readinto of closed file")
 
     n = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t);
     if (n > 0) {
index 2f4a5245681f0b2685d8ac59a4ad6c605c80d6ce..a4bf7cd1076707e9e1602f2824d3dda93ac73dec 100644 (file)
@@ -1985,7 +1985,7 @@ find_control_char(int kind, const char *s, const char *end, Py_UCS4 ch)
 {
     if (kind == PyUnicode_1BYTE_KIND) {
         assert(ch < 256);
-        return (char *) memchr((void *) s, (char) ch, end - s);
+        return (char *) memchr((const void *) s, (char) ch, end - s);
     }
     for (;;) {
         while (PyUnicode_READ(kind, s, 0) > ch)
@@ -2003,7 +2003,7 @@ _PyIO_find_line_ending(
     int translated, int universal, PyObject *readnl,
     int kind, const char *start, const char *end, Py_ssize_t *consumed)
 {
-    Py_ssize_t len = ((char*)end - (char*)start)/kind;
+    Py_ssize_t len = (end - start)/kind;
 
     if (translated) {
         /* Newlines are already translated, only search for \n */
index 8ee7d8ee2a793195f3b2e441293f0ca32c01b814..55affb2c7c47968fd6624a3eb17ee937ca52f776 100644 (file)
@@ -1371,13 +1371,42 @@ _Unpickler_ReadInto(UnpicklerObject *self, char *buf, Py_ssize_t n)
     }
 
     /* Read from file */
-    if (!self->readinto) {
+    if (!self->read) {
+        /* We're unpickling memory, this means the input is truncated */
         return bad_readline();
     }
     if (_Unpickler_SkipConsumed(self) < 0) {
         return -1;
     }
 
+    if (!self->readinto) {
+        /* readinto() not supported on file-like object, fall back to read()
+         * and copy into destination buffer (bpo-39681) */
+        PyObject* len = PyLong_FromSsize_t(n);
+        if (len == NULL) {
+            return -1;
+        }
+        PyObject* data = _Pickle_FastCall(self->read, len);
+        if (data == NULL) {
+            return -1;
+        }
+        if (!PyBytes_Check(data)) {
+            PyErr_Format(PyExc_ValueError,
+                         "read() returned non-bytes object (%R)",
+                         Py_TYPE(data));
+            Py_DECREF(data);
+            return -1;
+        }
+        Py_ssize_t read_size = PyBytes_GET_SIZE(data);
+        if (read_size < n) {
+            Py_DECREF(data);
+            return bad_readline();
+        }
+        memcpy(buf, PyBytes_AS_STRING(data), n);
+        Py_DECREF(data);
+        return n;
+    }
+
     /* Call readinto() into user buffer */
     PyObject *buf_obj = PyMemoryView_FromMemory(buf, n, PyBUF_WRITE);
     if (buf_obj == NULL) {
@@ -1606,17 +1635,19 @@ _Unpickler_SetInputStream(UnpicklerObject *self, PyObject *file)
     _Py_IDENTIFIER(readinto);
     _Py_IDENTIFIER(readline);
 
+    /* Optional file methods */
     if (_PyObject_LookupAttrId(file, &PyId_peek, &self->peek) < 0) {
         return -1;
     }
+    if (_PyObject_LookupAttrId(file, &PyId_readinto, &self->readinto) < 0) {
+        return -1;
+    }
     (void)_PyObject_LookupAttrId(file, &PyId_read, &self->read);
-    (void)_PyObject_LookupAttrId(file, &PyId_readinto, &self->readinto);
     (void)_PyObject_LookupAttrId(file, &PyId_readline, &self->readline);
-    if (!self->readline || !self->readinto || !self->read) {
+    if (!self->readline || !self->read) {
         if (!PyErr_Occurred()) {
             PyErr_SetString(PyExc_TypeError,
-                            "file must have 'read', 'readinto' and "
-                            "'readline' attributes");
+                            "file must have 'read' and 'readline' attributes");
         }
         Py_CLEAR(self->read);
         Py_CLEAR(self->readinto);
@@ -4457,12 +4488,13 @@ static int
 dump(PicklerObject *self, PyObject *obj)
 {
     const char stop_op = STOP;
+    int status = -1;
     PyObject *tmp;
     _Py_IDENTIFIER(reducer_override);
 
     if (_PyObject_LookupAttrId((PyObject *)self, &PyId_reducer_override,
                                &tmp) < 0) {
-        return -1;
+      goto error;
     }
     /* Cache the reducer_override method, if it exists. */
     if (tmp != NULL) {
@@ -4479,7 +4511,7 @@ dump(PicklerObject *self, PyObject *obj)
         assert(self->proto >= 0 && self->proto < 256);
         header[1] = (unsigned char)self->proto;
         if (_Pickler_Write(self, header, 2) < 0)
-            return -1;
+            goto error;
         if (self->proto >= 4)
             self->framing = 1;
     }
@@ -4487,9 +4519,22 @@ dump(PicklerObject *self, PyObject *obj)
     if (save(self, obj, 0) < 0 ||
         _Pickler_Write(self, &stop_op, 1) < 0 ||
         _Pickler_CommitFrame(self) < 0)
-        return -1;
+        goto error;
+
+    // Success
+    status = 0;
+
+  error:
     self->framing = 0;
-    return 0;
+
+    /* Break the reference cycle we generated at the beginning this function
+     * call when setting the reducer_override attribute of the Pickler instance
+     * to a bound method of the same instance. This is important as the Pickler
+     * instance holds a reference to each object it has pickled (through its
+     * memo): thus, these objects wont be garbage-collected as long as the
+     * Pickler itself is not collected. */
+    Py_CLEAR(self->reducer_override);
+    return status;
 }
 
 /*[clinic input]
@@ -4647,8 +4692,9 @@ _pickle.Pickler.__init__
 This takes a binary file for writing a pickle data stream.
 
 The optional *protocol* argument tells the pickler to use the given
-protocol; supported protocols are 0, 1, 2, 3 and 4.  The default
-protocol is 3; a backward-incompatible protocol designed for Python 3.
+protocol; supported protocols are 0, 1, 2, 3, 4 and 5.  The default
+protocol is 4. It was introduced in Python 3.4, and is incompatible
+with previous versions.
 
 Specifying a negative protocol version selects the highest protocol
 version supported.  The higher the protocol used, the more recent the
@@ -4680,7 +4726,7 @@ static int
 _pickle_Pickler___init___impl(PicklerObject *self, PyObject *file,
                               PyObject *protocol, int fix_imports,
                               PyObject *buffer_callback)
-/*[clinic end generated code: output=0abedc50590d259b input=bb886e00443a7811]*/
+/*[clinic end generated code: output=0abedc50590d259b input=a7c969699bf5dad3]*/
 {
     _Py_IDENTIFIER(persistent_id);
     _Py_IDENTIFIER(dispatch_table);
@@ -7633,8 +7679,8 @@ This is equivalent to ``Pickler(file, protocol).dump(obj)``, but may
 be more efficient.
 
 The optional *protocol* argument tells the pickler to use the given
-protocol; supported protocols are 0, 1, 2, 3 and 4.  The default
-protocol is 4. It was introduced in Python 3.4, it is incompatible
+protocol; supported protocols are 0, 1, 2, 3, 4 and 5.  The default
+protocol is 4. It was introduced in Python 3.4, and is incompatible
 with previous versions.
 
 Specifying a negative protocol version selects the highest protocol
@@ -7660,7 +7706,7 @@ static PyObject *
 _pickle_dump_impl(PyObject *module, PyObject *obj, PyObject *file,
                   PyObject *protocol, int fix_imports,
                   PyObject *buffer_callback)
-/*[clinic end generated code: output=706186dba996490c input=cfdcaf573ed6e46c]*/
+/*[clinic end generated code: output=706186dba996490c input=5ed6653da99cd97c]*/
 {
     PicklerObject *pickler = _Pickler_New();
 
@@ -7703,8 +7749,8 @@ _pickle.dumps
 Return the pickled representation of the object as a bytes object.
 
 The optional *protocol* argument tells the pickler to use the given
-protocol; supported protocols are 0, 1, 2, 3 and 4.  The default
-protocol is 4. It was introduced in Python 3.4, it is incompatible
+protocol; supported protocols are 0, 1, 2, 3, 4 and 5.  The default
+protocol is 4. It was introduced in Python 3.4, and is incompatible
 with previous versions.
 
 Specifying a negative protocol version selects the highest protocol
@@ -7724,7 +7770,7 @@ into *file* as part of the pickle stream.  It is an error if
 static PyObject *
 _pickle_dumps_impl(PyObject *module, PyObject *obj, PyObject *protocol,
                    int fix_imports, PyObject *buffer_callback)
-/*[clinic end generated code: output=fbab0093a5580fdf input=9f334d535ff7194f]*/
+/*[clinic end generated code: output=fbab0093a5580fdf input=e543272436c6f987]*/
 {
     PyObject *result;
     PicklerObject *pickler = _Pickler_New();
@@ -7915,6 +7961,7 @@ pickle_traverse(PyObject *m, visitproc visit, void *arg)
     Py_VISIT(st->import_mapping_3to2);
     Py_VISIT(st->codecs_encode);
     Py_VISIT(st->getattr);
+    Py_VISIT(st->partial);
     return 0;
 }
 
index 01b9dc44cb5da50376ef668eafd8e8fc4e5044b5..8cfa6e50e822250a8efd4854d7ba2cdc6367fa1e 100644 (file)
@@ -193,22 +193,30 @@ pysqlite_build_row_cast_map(pysqlite_Cursor* self)
 }
 
 static PyObject *
-_pysqlite_build_column_name(const char* colname)
+_pysqlite_build_column_name(pysqlite_Cursor *self, const char *colname)
 {
     const char* pos;
+    Py_ssize_t len;
 
     if (!colname) {
         Py_RETURN_NONE;
     }
 
-    for (pos = colname;; pos++) {
-        if (*pos == 0 || *pos == '[') {
-            if ((*pos == '[') && (pos > colname) && (*(pos-1) == ' ')) {
-                pos--;
+    if (self->connection->detect_types & PARSE_COLNAMES) {
+        for (pos = colname; *pos; pos++) {
+            if (*pos == '[') {
+                if ((pos != colname) && (*(pos-1) == ' ')) {
+                    pos--;
+                }
+                break;
             }
-            return PyUnicode_FromStringAndSize(colname, pos - colname);
         }
+        len = pos - colname;
+    }
+    else {
+        len = strlen(colname);
     }
+    return PyUnicode_FromStringAndSize(colname, len);
 }
 
 /*
@@ -370,6 +378,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
     PyObject* result;
     int numcols;
     PyObject* descriptor;
+    PyObject* column_name;
     PyObject* second_argument = NULL;
     sqlite_int64 lastrowid;
 
@@ -546,7 +555,13 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* args)
                 if (!descriptor) {
                     goto error;
                 }
-                PyTuple_SetItem(descriptor, 0, _pysqlite_build_column_name(sqlite3_column_name(self->statement->st, i)));
+                column_name = _pysqlite_build_column_name(self,
+                                sqlite3_column_name(self->statement->st, i));
+                if (!column_name) {
+                    Py_DECREF(descriptor);
+                    goto error;
+                }
+                PyTuple_SetItem(descriptor, 0, column_name);
                 Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 1, Py_None);
                 Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 2, Py_None);
                 Py_INCREF(Py_None); PyTuple_SetItem(descriptor, 3, Py_None);
index 85165b90bc389c4db9edd9bcab5a1e97349dd832..8f2994f52dfef86874d76aab5d10d65e3c15797b 100644 (file)
 /* File generated by Tools/ssl/make_ssl_data.py */
-/* Generated on 2015-01-17T20:33:43.377453 */
+/* Generated on 2020-04-13T21:45:54.559159 */
 
 static struct py_ssl_library_code library_codes[] = {
+#ifdef ERR_LIB_ASN1
+    {"ASN1", ERR_LIB_ASN1},
+#endif
+#ifdef ERR_LIB_ASYNC
+    {"ASYNC", ERR_LIB_ASYNC},
+#endif
+#ifdef ERR_LIB_BIO
+    {"BIO", ERR_LIB_BIO},
+#endif
+#ifdef ERR_LIB_BN
+    {"BN", ERR_LIB_BN},
+#endif
+#ifdef ERR_LIB_CMS
+    {"CMS", ERR_LIB_CMS},
+#endif
+#ifdef ERR_LIB_COMP
+    {"COMP", ERR_LIB_COMP},
+#endif
+#ifdef ERR_LIB_CONF
+    {"CONF", ERR_LIB_CONF},
+#endif
+#ifdef ERR_LIB_CRYPTO
+    {"CRYPTO", ERR_LIB_CRYPTO},
+#endif
+#ifdef ERR_LIB_CT
+    {"CT", ERR_LIB_CT},
+#endif
+#ifdef ERR_LIB_DH
+    {"DH", ERR_LIB_DH},
+#endif
+#ifdef ERR_LIB_DSA
+    {"DSA", ERR_LIB_DSA},
+#endif
+#ifdef ERR_LIB_EC
+    {"EC", ERR_LIB_EC},
+#endif
+#ifdef ERR_LIB_ENGINE
+    {"ENGINE", ERR_LIB_ENGINE},
+#endif
+#ifdef ERR_LIB_EVP
+    {"EVP", ERR_LIB_EVP},
+#endif
+#ifdef ERR_LIB_KDF
+    {"KDF", ERR_LIB_KDF},
+#endif
+#ifdef ERR_LIB_OCSP
+    {"OCSP", ERR_LIB_OCSP},
+#endif
+#ifdef ERR_LIB_PEM
     {"PEM", ERR_LIB_PEM},
+#endif
+#ifdef ERR_LIB_PKCS12
+    {"PKCS12", ERR_LIB_PKCS12},
+#endif
+#ifdef ERR_LIB_PKCS7
+    {"PKCS7", ERR_LIB_PKCS7},
+#endif
+#ifdef ERR_LIB_RAND
+    {"RAND", ERR_LIB_RAND},
+#endif
+#ifdef ERR_LIB_RSA
+    {"RSA", ERR_LIB_RSA},
+#endif
+#ifdef ERR_LIB_SSL
     {"SSL", ERR_LIB_SSL},
+#endif
+#ifdef ERR_LIB_TS
+    {"TS", ERR_LIB_TS},
+#endif
+#ifdef ERR_LIB_UI
+    {"UI", ERR_LIB_UI},
+#endif
+#ifdef ERR_LIB_X509
     {"X509", ERR_LIB_X509},
+#endif
+#ifdef ERR_LIB_X509V3
+    {"X509V3", ERR_LIB_X509V3},
+#endif
     { NULL }
 };
 
 static struct py_ssl_error_code error_codes[] = {
-  #ifdef PEM_R_BAD_BASE64_DECODE
-    {"BAD_BASE64_DECODE", ERR_LIB_PEM, PEM_R_BAD_BASE64_DECODE},
+  #ifdef ASN1_R_ADDING_OBJECT
+    {"ADDING_OBJECT", ERR_LIB_ASN1, ASN1_R_ADDING_OBJECT},
   #else
-    {"BAD_BASE64_DECODE", ERR_LIB_PEM, 100},
+    {"ADDING_OBJECT", 13, 171},
   #endif
-  #ifdef PEM_R_BAD_DECRYPT
-    {"BAD_DECRYPT", ERR_LIB_PEM, PEM_R_BAD_DECRYPT},
+  #ifdef ASN1_R_ASN1_PARSE_ERROR
+    {"ASN1_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_ASN1_PARSE_ERROR},
   #else
-    {"BAD_DECRYPT", ERR_LIB_PEM, 101},
+    {"ASN1_PARSE_ERROR", 13, 203},
   #endif
-  #ifdef PEM_R_BAD_END_LINE
-    {"BAD_END_LINE", ERR_LIB_PEM, PEM_R_BAD_END_LINE},
+  #ifdef ASN1_R_ASN1_SIG_PARSE_ERROR
+    {"ASN1_SIG_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_ASN1_SIG_PARSE_ERROR},
   #else
-    {"BAD_END_LINE", ERR_LIB_PEM, 102},
+    {"ASN1_SIG_PARSE_ERROR", 13, 204},
   #endif
-  #ifdef PEM_R_BAD_IV_CHARS
-    {"BAD_IV_CHARS", ERR_LIB_PEM, PEM_R_BAD_IV_CHARS},
+  #ifdef ASN1_R_AUX_ERROR
+    {"AUX_ERROR", ERR_LIB_ASN1, ASN1_R_AUX_ERROR},
   #else
-    {"BAD_IV_CHARS", ERR_LIB_PEM, 103},
+    {"AUX_ERROR", 13, 100},
   #endif
-  #ifdef PEM_R_BAD_MAGIC_NUMBER
-    {"BAD_MAGIC_NUMBER", ERR_LIB_PEM, PEM_R_BAD_MAGIC_NUMBER},
+  #ifdef ASN1_R_BAD_OBJECT_HEADER
+    {"BAD_OBJECT_HEADER", ERR_LIB_ASN1, ASN1_R_BAD_OBJECT_HEADER},
   #else
-    {"BAD_MAGIC_NUMBER", ERR_LIB_PEM, 116},
+    {"BAD_OBJECT_HEADER", 13, 102},
   #endif
-  #ifdef PEM_R_BAD_PASSWORD_READ
-    {"BAD_PASSWORD_READ", ERR_LIB_PEM, PEM_R_BAD_PASSWORD_READ},
+  #ifdef ASN1_R_BMPSTRING_IS_WRONG_LENGTH
+    {"BMPSTRING_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_BMPSTRING_IS_WRONG_LENGTH},
   #else
-    {"BAD_PASSWORD_READ", ERR_LIB_PEM, 104},
+    {"BMPSTRING_IS_WRONG_LENGTH", 13, 214},
   #endif
-  #ifdef PEM_R_BAD_VERSION_NUMBER
-    {"BAD_VERSION_NUMBER", ERR_LIB_PEM, PEM_R_BAD_VERSION_NUMBER},
+  #ifdef ASN1_R_BN_LIB
+    {"BN_LIB", ERR_LIB_ASN1, ASN1_R_BN_LIB},
   #else
-    {"BAD_VERSION_NUMBER", ERR_LIB_PEM, 117},
+    {"BN_LIB", 13, 105},
   #endif
-  #ifdef PEM_R_BIO_WRITE_FAILURE
-    {"BIO_WRITE_FAILURE", ERR_LIB_PEM, PEM_R_BIO_WRITE_FAILURE},
+  #ifdef ASN1_R_BOOLEAN_IS_WRONG_LENGTH
+    {"BOOLEAN_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_BOOLEAN_IS_WRONG_LENGTH},
   #else
-    {"BIO_WRITE_FAILURE", ERR_LIB_PEM, 118},
+    {"BOOLEAN_IS_WRONG_LENGTH", 13, 106},
   #endif
-  #ifdef PEM_R_CIPHER_IS_NULL
-    {"CIPHER_IS_NULL", ERR_LIB_PEM, PEM_R_CIPHER_IS_NULL},
+  #ifdef ASN1_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_ASN1, ASN1_R_BUFFER_TOO_SMALL},
   #else
-    {"CIPHER_IS_NULL", ERR_LIB_PEM, 127},
+    {"BUFFER_TOO_SMALL", 13, 107},
   #endif
-  #ifdef PEM_R_ERROR_CONVERTING_PRIVATE_KEY
-    {"ERROR_CONVERTING_PRIVATE_KEY", ERR_LIB_PEM, PEM_R_ERROR_CONVERTING_PRIVATE_KEY},
+  #ifdef ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", ERR_LIB_ASN1, ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER},
   #else
-    {"ERROR_CONVERTING_PRIVATE_KEY", ERR_LIB_PEM, 115},
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", 13, 108},
   #endif
-  #ifdef PEM_R_EXPECTING_PRIVATE_KEY_BLOB
-    {"EXPECTING_PRIVATE_KEY_BLOB", ERR_LIB_PEM, PEM_R_EXPECTING_PRIVATE_KEY_BLOB},
+  #ifdef ASN1_R_CONTEXT_NOT_INITIALISED
+    {"CONTEXT_NOT_INITIALISED", ERR_LIB_ASN1, ASN1_R_CONTEXT_NOT_INITIALISED},
   #else
-    {"EXPECTING_PRIVATE_KEY_BLOB", ERR_LIB_PEM, 119},
+    {"CONTEXT_NOT_INITIALISED", 13, 217},
   #endif
-  #ifdef PEM_R_EXPECTING_PUBLIC_KEY_BLOB
-    {"EXPECTING_PUBLIC_KEY_BLOB", ERR_LIB_PEM, PEM_R_EXPECTING_PUBLIC_KEY_BLOB},
+  #ifdef ASN1_R_DATA_IS_WRONG
+    {"DATA_IS_WRONG", ERR_LIB_ASN1, ASN1_R_DATA_IS_WRONG},
   #else
-    {"EXPECTING_PUBLIC_KEY_BLOB", ERR_LIB_PEM, 120},
+    {"DATA_IS_WRONG", 13, 109},
   #endif
-  #ifdef PEM_R_INCONSISTENT_HEADER
-    {"INCONSISTENT_HEADER", ERR_LIB_PEM, PEM_R_INCONSISTENT_HEADER},
+  #ifdef ASN1_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_ASN1, ASN1_R_DECODE_ERROR},
   #else
-    {"INCONSISTENT_HEADER", ERR_LIB_PEM, 121},
+    {"DECODE_ERROR", 13, 110},
   #endif
-  #ifdef PEM_R_KEYBLOB_HEADER_PARSE_ERROR
-    {"KEYBLOB_HEADER_PARSE_ERROR", ERR_LIB_PEM, PEM_R_KEYBLOB_HEADER_PARSE_ERROR},
+  #ifdef ASN1_R_DEPTH_EXCEEDED
+    {"DEPTH_EXCEEDED", ERR_LIB_ASN1, ASN1_R_DEPTH_EXCEEDED},
   #else
-    {"KEYBLOB_HEADER_PARSE_ERROR", ERR_LIB_PEM, 122},
+    {"DEPTH_EXCEEDED", 13, 174},
   #endif
-  #ifdef PEM_R_KEYBLOB_TOO_SHORT
-    {"KEYBLOB_TOO_SHORT", ERR_LIB_PEM, PEM_R_KEYBLOB_TOO_SHORT},
+  #ifdef ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED
+    {"DIGEST_AND_KEY_TYPE_NOT_SUPPORTED", ERR_LIB_ASN1, ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED},
   #else
-    {"KEYBLOB_TOO_SHORT", ERR_LIB_PEM, 123},
+    {"DIGEST_AND_KEY_TYPE_NOT_SUPPORTED", 13, 198},
   #endif
-  #ifdef PEM_R_NOT_DEK_INFO
-    {"NOT_DEK_INFO", ERR_LIB_PEM, PEM_R_NOT_DEK_INFO},
+  #ifdef ASN1_R_ENCODE_ERROR
+    {"ENCODE_ERROR", ERR_LIB_ASN1, ASN1_R_ENCODE_ERROR},
   #else
-    {"NOT_DEK_INFO", ERR_LIB_PEM, 105},
+    {"ENCODE_ERROR", 13, 112},
   #endif
-  #ifdef PEM_R_NOT_ENCRYPTED
-    {"NOT_ENCRYPTED", ERR_LIB_PEM, PEM_R_NOT_ENCRYPTED},
+  #ifdef ASN1_R_ERROR_GETTING_TIME
+    {"ERROR_GETTING_TIME", ERR_LIB_ASN1, ASN1_R_ERROR_GETTING_TIME},
   #else
-    {"NOT_ENCRYPTED", ERR_LIB_PEM, 106},
+    {"ERROR_GETTING_TIME", 13, 173},
   #endif
-  #ifdef PEM_R_NOT_PROC_TYPE
-    {"NOT_PROC_TYPE", ERR_LIB_PEM, PEM_R_NOT_PROC_TYPE},
+  #ifdef ASN1_R_ERROR_LOADING_SECTION
+    {"ERROR_LOADING_SECTION", ERR_LIB_ASN1, ASN1_R_ERROR_LOADING_SECTION},
   #else
-    {"NOT_PROC_TYPE", ERR_LIB_PEM, 107},
+    {"ERROR_LOADING_SECTION", 13, 172},
   #endif
-  #ifdef PEM_R_NO_START_LINE
-    {"NO_START_LINE", ERR_LIB_PEM, PEM_R_NO_START_LINE},
+  #ifdef ASN1_R_ERROR_SETTING_CIPHER_PARAMS
+    {"ERROR_SETTING_CIPHER_PARAMS", ERR_LIB_ASN1, ASN1_R_ERROR_SETTING_CIPHER_PARAMS},
   #else
-    {"NO_START_LINE", ERR_LIB_PEM, 108},
+    {"ERROR_SETTING_CIPHER_PARAMS", 13, 114},
   #endif
-  #ifdef PEM_R_PROBLEMS_GETTING_PASSWORD
-    {"PROBLEMS_GETTING_PASSWORD", ERR_LIB_PEM, PEM_R_PROBLEMS_GETTING_PASSWORD},
+  #ifdef ASN1_R_EXPECTING_AN_INTEGER
+    {"EXPECTING_AN_INTEGER", ERR_LIB_ASN1, ASN1_R_EXPECTING_AN_INTEGER},
   #else
-    {"PROBLEMS_GETTING_PASSWORD", ERR_LIB_PEM, 109},
+    {"EXPECTING_AN_INTEGER", 13, 115},
   #endif
-  #ifdef PEM_R_PUBLIC_KEY_NO_RSA
-    {"PUBLIC_KEY_NO_RSA", ERR_LIB_PEM, PEM_R_PUBLIC_KEY_NO_RSA},
+  #ifdef ASN1_R_EXPECTING_AN_OBJECT
+    {"EXPECTING_AN_OBJECT", ERR_LIB_ASN1, ASN1_R_EXPECTING_AN_OBJECT},
   #else
-    {"PUBLIC_KEY_NO_RSA", ERR_LIB_PEM, 110},
+    {"EXPECTING_AN_OBJECT", 13, 116},
   #endif
-  #ifdef PEM_R_PVK_DATA_TOO_SHORT
-    {"PVK_DATA_TOO_SHORT", ERR_LIB_PEM, PEM_R_PVK_DATA_TOO_SHORT},
+  #ifdef ASN1_R_EXPLICIT_LENGTH_MISMATCH
+    {"EXPLICIT_LENGTH_MISMATCH", ERR_LIB_ASN1, ASN1_R_EXPLICIT_LENGTH_MISMATCH},
   #else
-    {"PVK_DATA_TOO_SHORT", ERR_LIB_PEM, 124},
+    {"EXPLICIT_LENGTH_MISMATCH", 13, 119},
   #endif
-  #ifdef PEM_R_PVK_TOO_SHORT
-    {"PVK_TOO_SHORT", ERR_LIB_PEM, PEM_R_PVK_TOO_SHORT},
+  #ifdef ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED
+    {"EXPLICIT_TAG_NOT_CONSTRUCTED", ERR_LIB_ASN1, ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED},
   #else
-    {"PVK_TOO_SHORT", ERR_LIB_PEM, 125},
+    {"EXPLICIT_TAG_NOT_CONSTRUCTED", 13, 120},
   #endif
-  #ifdef PEM_R_READ_KEY
-    {"READ_KEY", ERR_LIB_PEM, PEM_R_READ_KEY},
+  #ifdef ASN1_R_FIELD_MISSING
+    {"FIELD_MISSING", ERR_LIB_ASN1, ASN1_R_FIELD_MISSING},
   #else
-    {"READ_KEY", ERR_LIB_PEM, 111},
+    {"FIELD_MISSING", 13, 121},
   #endif
-  #ifdef PEM_R_SHORT_HEADER
-    {"SHORT_HEADER", ERR_LIB_PEM, PEM_R_SHORT_HEADER},
+  #ifdef ASN1_R_FIRST_NUM_TOO_LARGE
+    {"FIRST_NUM_TOO_LARGE", ERR_LIB_ASN1, ASN1_R_FIRST_NUM_TOO_LARGE},
   #else
-    {"SHORT_HEADER", ERR_LIB_PEM, 112},
+    {"FIRST_NUM_TOO_LARGE", 13, 122},
   #endif
-  #ifdef PEM_R_UNSUPPORTED_CIPHER
-    {"UNSUPPORTED_CIPHER", ERR_LIB_PEM, PEM_R_UNSUPPORTED_CIPHER},
+  #ifdef ASN1_R_HEADER_TOO_LONG
+    {"HEADER_TOO_LONG", ERR_LIB_ASN1, ASN1_R_HEADER_TOO_LONG},
   #else
-    {"UNSUPPORTED_CIPHER", ERR_LIB_PEM, 113},
+    {"HEADER_TOO_LONG", 13, 123},
   #endif
-  #ifdef PEM_R_UNSUPPORTED_ENCRYPTION
-    {"UNSUPPORTED_ENCRYPTION", ERR_LIB_PEM, PEM_R_UNSUPPORTED_ENCRYPTION},
+  #ifdef ASN1_R_ILLEGAL_BITSTRING_FORMAT
+    {"ILLEGAL_BITSTRING_FORMAT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_BITSTRING_FORMAT},
   #else
-    {"UNSUPPORTED_ENCRYPTION", ERR_LIB_PEM, 114},
+    {"ILLEGAL_BITSTRING_FORMAT", 13, 175},
   #endif
-  #ifdef PEM_R_UNSUPPORTED_KEY_COMPONENTS
-    {"UNSUPPORTED_KEY_COMPONENTS", ERR_LIB_PEM, PEM_R_UNSUPPORTED_KEY_COMPONENTS},
+  #ifdef ASN1_R_ILLEGAL_BOOLEAN
+    {"ILLEGAL_BOOLEAN", ERR_LIB_ASN1, ASN1_R_ILLEGAL_BOOLEAN},
   #else
-    {"UNSUPPORTED_KEY_COMPONENTS", ERR_LIB_PEM, 126},
+    {"ILLEGAL_BOOLEAN", 13, 176},
   #endif
-  #ifdef SSL_R_APP_DATA_IN_HANDSHAKE
-    {"APP_DATA_IN_HANDSHAKE", ERR_LIB_SSL, SSL_R_APP_DATA_IN_HANDSHAKE},
+  #ifdef ASN1_R_ILLEGAL_CHARACTERS
+    {"ILLEGAL_CHARACTERS", ERR_LIB_ASN1, ASN1_R_ILLEGAL_CHARACTERS},
   #else
-    {"APP_DATA_IN_HANDSHAKE", ERR_LIB_SSL, 100},
+    {"ILLEGAL_CHARACTERS", 13, 124},
   #endif
-  #ifdef SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT
-    {"ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT", ERR_LIB_SSL, SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT},
+  #ifdef ASN1_R_ILLEGAL_FORMAT
+    {"ILLEGAL_FORMAT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_FORMAT},
   #else
-    {"ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT", ERR_LIB_SSL, 272},
+    {"ILLEGAL_FORMAT", 13, 177},
   #endif
-  #ifdef SSL_R_BAD_ALERT_RECORD
-    {"BAD_ALERT_RECORD", ERR_LIB_SSL, SSL_R_BAD_ALERT_RECORD},
+  #ifdef ASN1_R_ILLEGAL_HEX
+    {"ILLEGAL_HEX", ERR_LIB_ASN1, ASN1_R_ILLEGAL_HEX},
   #else
-    {"BAD_ALERT_RECORD", ERR_LIB_SSL, 101},
+    {"ILLEGAL_HEX", 13, 178},
   #endif
-  #ifdef SSL_R_BAD_AUTHENTICATION_TYPE
-    {"BAD_AUTHENTICATION_TYPE", ERR_LIB_SSL, SSL_R_BAD_AUTHENTICATION_TYPE},
+  #ifdef ASN1_R_ILLEGAL_IMPLICIT_TAG
+    {"ILLEGAL_IMPLICIT_TAG", ERR_LIB_ASN1, ASN1_R_ILLEGAL_IMPLICIT_TAG},
   #else
-    {"BAD_AUTHENTICATION_TYPE", ERR_LIB_SSL, 102},
+    {"ILLEGAL_IMPLICIT_TAG", 13, 179},
   #endif
-  #ifdef SSL_R_BAD_CHANGE_CIPHER_SPEC
-    {"BAD_CHANGE_CIPHER_SPEC", ERR_LIB_SSL, SSL_R_BAD_CHANGE_CIPHER_SPEC},
+  #ifdef ASN1_R_ILLEGAL_INTEGER
+    {"ILLEGAL_INTEGER", ERR_LIB_ASN1, ASN1_R_ILLEGAL_INTEGER},
   #else
-    {"BAD_CHANGE_CIPHER_SPEC", ERR_LIB_SSL, 103},
+    {"ILLEGAL_INTEGER", 13, 180},
   #endif
-  #ifdef SSL_R_BAD_CHECKSUM
-    {"BAD_CHECKSUM", ERR_LIB_SSL, SSL_R_BAD_CHECKSUM},
+  #ifdef ASN1_R_ILLEGAL_NEGATIVE_VALUE
+    {"ILLEGAL_NEGATIVE_VALUE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NEGATIVE_VALUE},
   #else
-    {"BAD_CHECKSUM", ERR_LIB_SSL, 104},
+    {"ILLEGAL_NEGATIVE_VALUE", 13, 226},
   #endif
-  #ifdef SSL_R_BAD_DATA
-    {"BAD_DATA", ERR_LIB_SSL, SSL_R_BAD_DATA},
+  #ifdef ASN1_R_ILLEGAL_NESTED_TAGGING
+    {"ILLEGAL_NESTED_TAGGING", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NESTED_TAGGING},
   #else
-    {"BAD_DATA", ERR_LIB_SSL, 390},
+    {"ILLEGAL_NESTED_TAGGING", 13, 181},
   #endif
-  #ifdef SSL_R_BAD_DATA_RETURNED_BY_CALLBACK
-    {"BAD_DATA_RETURNED_BY_CALLBACK", ERR_LIB_SSL, SSL_R_BAD_DATA_RETURNED_BY_CALLBACK},
+  #ifdef ASN1_R_ILLEGAL_NULL
+    {"ILLEGAL_NULL", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NULL},
   #else
-    {"BAD_DATA_RETURNED_BY_CALLBACK", ERR_LIB_SSL, 106},
+    {"ILLEGAL_NULL", 13, 125},
   #endif
-  #ifdef SSL_R_BAD_DECOMPRESSION
-    {"BAD_DECOMPRESSION", ERR_LIB_SSL, SSL_R_BAD_DECOMPRESSION},
+  #ifdef ASN1_R_ILLEGAL_NULL_VALUE
+    {"ILLEGAL_NULL_VALUE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_NULL_VALUE},
   #else
-    {"BAD_DECOMPRESSION", ERR_LIB_SSL, 107},
+    {"ILLEGAL_NULL_VALUE", 13, 182},
   #endif
-  #ifdef SSL_R_BAD_DH_G_LENGTH
-    {"BAD_DH_G_LENGTH", ERR_LIB_SSL, SSL_R_BAD_DH_G_LENGTH},
+  #ifdef ASN1_R_ILLEGAL_OBJECT
+    {"ILLEGAL_OBJECT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_OBJECT},
   #else
-    {"BAD_DH_G_LENGTH", ERR_LIB_SSL, 108},
+    {"ILLEGAL_OBJECT", 13, 183},
   #endif
-  #ifdef SSL_R_BAD_DH_PUB_KEY_LENGTH
-    {"BAD_DH_PUB_KEY_LENGTH", ERR_LIB_SSL, SSL_R_BAD_DH_PUB_KEY_LENGTH},
+  #ifdef ASN1_R_ILLEGAL_OPTIONAL_ANY
+    {"ILLEGAL_OPTIONAL_ANY", ERR_LIB_ASN1, ASN1_R_ILLEGAL_OPTIONAL_ANY},
   #else
-    {"BAD_DH_PUB_KEY_LENGTH", ERR_LIB_SSL, 109},
+    {"ILLEGAL_OPTIONAL_ANY", 13, 126},
   #endif
-  #ifdef SSL_R_BAD_DH_P_LENGTH
-    {"BAD_DH_P_LENGTH", ERR_LIB_SSL, SSL_R_BAD_DH_P_LENGTH},
+  #ifdef ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE
+    {"ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE},
   #else
-    {"BAD_DH_P_LENGTH", ERR_LIB_SSL, 110},
+    {"ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE", 13, 170},
   #endif
-  #ifdef SSL_R_BAD_DIGEST_LENGTH
-    {"BAD_DIGEST_LENGTH", ERR_LIB_SSL, SSL_R_BAD_DIGEST_LENGTH},
+  #ifdef ASN1_R_ILLEGAL_PADDING
+    {"ILLEGAL_PADDING", ERR_LIB_ASN1, ASN1_R_ILLEGAL_PADDING},
   #else
-    {"BAD_DIGEST_LENGTH", ERR_LIB_SSL, 111},
+    {"ILLEGAL_PADDING", 13, 221},
   #endif
-  #ifdef SSL_R_BAD_DSA_SIGNATURE
-    {"BAD_DSA_SIGNATURE", ERR_LIB_SSL, SSL_R_BAD_DSA_SIGNATURE},
+  #ifdef ASN1_R_ILLEGAL_TAGGED_ANY
+    {"ILLEGAL_TAGGED_ANY", ERR_LIB_ASN1, ASN1_R_ILLEGAL_TAGGED_ANY},
   #else
-    {"BAD_DSA_SIGNATURE", ERR_LIB_SSL, 112},
+    {"ILLEGAL_TAGGED_ANY", 13, 127},
   #endif
-  #ifdef SSL_R_BAD_ECC_CERT
-    {"BAD_ECC_CERT", ERR_LIB_SSL, SSL_R_BAD_ECC_CERT},
+  #ifdef ASN1_R_ILLEGAL_TIME_VALUE
+    {"ILLEGAL_TIME_VALUE", ERR_LIB_ASN1, ASN1_R_ILLEGAL_TIME_VALUE},
   #else
-    {"BAD_ECC_CERT", ERR_LIB_SSL, 304},
+    {"ILLEGAL_TIME_VALUE", 13, 184},
   #endif
-  #ifdef SSL_R_BAD_ECDSA_SIGNATURE
-    {"BAD_ECDSA_SIGNATURE", ERR_LIB_SSL, SSL_R_BAD_ECDSA_SIGNATURE},
+  #ifdef ASN1_R_ILLEGAL_ZERO_CONTENT
+    {"ILLEGAL_ZERO_CONTENT", ERR_LIB_ASN1, ASN1_R_ILLEGAL_ZERO_CONTENT},
   #else
-    {"BAD_ECDSA_SIGNATURE", ERR_LIB_SSL, 305},
+    {"ILLEGAL_ZERO_CONTENT", 13, 222},
   #endif
-  #ifdef SSL_R_BAD_ECPOINT
-    {"BAD_ECPOINT", ERR_LIB_SSL, SSL_R_BAD_ECPOINT},
+  #ifdef ASN1_R_INTEGER_NOT_ASCII_FORMAT
+    {"INTEGER_NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_INTEGER_NOT_ASCII_FORMAT},
   #else
-    {"BAD_ECPOINT", ERR_LIB_SSL, 306},
+    {"INTEGER_NOT_ASCII_FORMAT", 13, 185},
   #endif
-  #ifdef SSL_R_BAD_HANDSHAKE_LENGTH
-    {"BAD_HANDSHAKE_LENGTH", ERR_LIB_SSL, SSL_R_BAD_HANDSHAKE_LENGTH},
+  #ifdef ASN1_R_INTEGER_TOO_LARGE_FOR_LONG
+    {"INTEGER_TOO_LARGE_FOR_LONG", ERR_LIB_ASN1, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG},
   #else
-    {"BAD_HANDSHAKE_LENGTH", ERR_LIB_SSL, 332},
+    {"INTEGER_TOO_LARGE_FOR_LONG", 13, 128},
   #endif
-  #ifdef SSL_R_BAD_HELLO_REQUEST
-    {"BAD_HELLO_REQUEST", ERR_LIB_SSL, SSL_R_BAD_HELLO_REQUEST},
+  #ifdef ASN1_R_INVALID_BIT_STRING_BITS_LEFT
+    {"INVALID_BIT_STRING_BITS_LEFT", ERR_LIB_ASN1, ASN1_R_INVALID_BIT_STRING_BITS_LEFT},
   #else
-    {"BAD_HELLO_REQUEST", ERR_LIB_SSL, 105},
+    {"INVALID_BIT_STRING_BITS_LEFT", 13, 220},
   #endif
-  #ifdef SSL_R_BAD_LENGTH
-    {"BAD_LENGTH", ERR_LIB_SSL, SSL_R_BAD_LENGTH},
+  #ifdef ASN1_R_INVALID_BMPSTRING_LENGTH
+    {"INVALID_BMPSTRING_LENGTH", ERR_LIB_ASN1, ASN1_R_INVALID_BMPSTRING_LENGTH},
   #else
-    {"BAD_LENGTH", ERR_LIB_SSL, 271},
+    {"INVALID_BMPSTRING_LENGTH", 13, 129},
   #endif
-  #ifdef SSL_R_BAD_MAC_DECODE
-    {"BAD_MAC_DECODE", ERR_LIB_SSL, SSL_R_BAD_MAC_DECODE},
+  #ifdef ASN1_R_INVALID_DIGIT
+    {"INVALID_DIGIT", ERR_LIB_ASN1, ASN1_R_INVALID_DIGIT},
   #else
-    {"BAD_MAC_DECODE", ERR_LIB_SSL, 113},
+    {"INVALID_DIGIT", 13, 130},
   #endif
-  #ifdef SSL_R_BAD_MAC_LENGTH
-    {"BAD_MAC_LENGTH", ERR_LIB_SSL, SSL_R_BAD_MAC_LENGTH},
+  #ifdef ASN1_R_INVALID_MIME_TYPE
+    {"INVALID_MIME_TYPE", ERR_LIB_ASN1, ASN1_R_INVALID_MIME_TYPE},
   #else
-    {"BAD_MAC_LENGTH", ERR_LIB_SSL, 333},
+    {"INVALID_MIME_TYPE", 13, 205},
   #endif
-  #ifdef SSL_R_BAD_MESSAGE_TYPE
-    {"BAD_MESSAGE_TYPE", ERR_LIB_SSL, SSL_R_BAD_MESSAGE_TYPE},
+  #ifdef ASN1_R_INVALID_MODIFIER
+    {"INVALID_MODIFIER", ERR_LIB_ASN1, ASN1_R_INVALID_MODIFIER},
   #else
-    {"BAD_MESSAGE_TYPE", ERR_LIB_SSL, 114},
+    {"INVALID_MODIFIER", 13, 186},
   #endif
-  #ifdef SSL_R_BAD_PACKET_LENGTH
-    {"BAD_PACKET_LENGTH", ERR_LIB_SSL, SSL_R_BAD_PACKET_LENGTH},
+  #ifdef ASN1_R_INVALID_NUMBER
+    {"INVALID_NUMBER", ERR_LIB_ASN1, ASN1_R_INVALID_NUMBER},
   #else
-    {"BAD_PACKET_LENGTH", ERR_LIB_SSL, 115},
+    {"INVALID_NUMBER", 13, 187},
   #endif
-  #ifdef SSL_R_BAD_PROTOCOL_VERSION_NUMBER
-    {"BAD_PROTOCOL_VERSION_NUMBER", ERR_LIB_SSL, SSL_R_BAD_PROTOCOL_VERSION_NUMBER},
+  #ifdef ASN1_R_INVALID_OBJECT_ENCODING
+    {"INVALID_OBJECT_ENCODING", ERR_LIB_ASN1, ASN1_R_INVALID_OBJECT_ENCODING},
   #else
-    {"BAD_PROTOCOL_VERSION_NUMBER", ERR_LIB_SSL, 116},
+    {"INVALID_OBJECT_ENCODING", 13, 216},
   #endif
-  #ifdef SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH
-    {"BAD_PSK_IDENTITY_HINT_LENGTH", ERR_LIB_SSL, SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH},
+  #ifdef ASN1_R_INVALID_SCRYPT_PARAMETERS
+    {"INVALID_SCRYPT_PARAMETERS", ERR_LIB_ASN1, ASN1_R_INVALID_SCRYPT_PARAMETERS},
   #else
-    {"BAD_PSK_IDENTITY_HINT_LENGTH", ERR_LIB_SSL, 316},
+    {"INVALID_SCRYPT_PARAMETERS", 13, 227},
   #endif
-  #ifdef SSL_R_BAD_RESPONSE_ARGUMENT
-    {"BAD_RESPONSE_ARGUMENT", ERR_LIB_SSL, SSL_R_BAD_RESPONSE_ARGUMENT},
+  #ifdef ASN1_R_INVALID_SEPARATOR
+    {"INVALID_SEPARATOR", ERR_LIB_ASN1, ASN1_R_INVALID_SEPARATOR},
   #else
-    {"BAD_RESPONSE_ARGUMENT", ERR_LIB_SSL, 117},
+    {"INVALID_SEPARATOR", 13, 131},
   #endif
-  #ifdef SSL_R_BAD_RSA_DECRYPT
-    {"BAD_RSA_DECRYPT", ERR_LIB_SSL, SSL_R_BAD_RSA_DECRYPT},
+  #ifdef ASN1_R_INVALID_STRING_TABLE_VALUE
+    {"INVALID_STRING_TABLE_VALUE", ERR_LIB_ASN1, ASN1_R_INVALID_STRING_TABLE_VALUE},
   #else
-    {"BAD_RSA_DECRYPT", ERR_LIB_SSL, 118},
+    {"INVALID_STRING_TABLE_VALUE", 13, 218},
   #endif
-  #ifdef SSL_R_BAD_RSA_ENCRYPT
-    {"BAD_RSA_ENCRYPT", ERR_LIB_SSL, SSL_R_BAD_RSA_ENCRYPT},
+  #ifdef ASN1_R_INVALID_UNIVERSALSTRING_LENGTH
+    {"INVALID_UNIVERSALSTRING_LENGTH", ERR_LIB_ASN1, ASN1_R_INVALID_UNIVERSALSTRING_LENGTH},
   #else
-    {"BAD_RSA_ENCRYPT", ERR_LIB_SSL, 119},
+    {"INVALID_UNIVERSALSTRING_LENGTH", 13, 133},
   #endif
-  #ifdef SSL_R_BAD_RSA_E_LENGTH
-    {"BAD_RSA_E_LENGTH", ERR_LIB_SSL, SSL_R_BAD_RSA_E_LENGTH},
+  #ifdef ASN1_R_INVALID_UTF8STRING
+    {"INVALID_UTF8STRING", ERR_LIB_ASN1, ASN1_R_INVALID_UTF8STRING},
   #else
-    {"BAD_RSA_E_LENGTH", ERR_LIB_SSL, 120},
+    {"INVALID_UTF8STRING", 13, 134},
   #endif
-  #ifdef SSL_R_BAD_RSA_MODULUS_LENGTH
-    {"BAD_RSA_MODULUS_LENGTH", ERR_LIB_SSL, SSL_R_BAD_RSA_MODULUS_LENGTH},
+  #ifdef ASN1_R_INVALID_VALUE
+    {"INVALID_VALUE", ERR_LIB_ASN1, ASN1_R_INVALID_VALUE},
   #else
-    {"BAD_RSA_MODULUS_LENGTH", ERR_LIB_SSL, 121},
+    {"INVALID_VALUE", 13, 219},
   #endif
-  #ifdef SSL_R_BAD_RSA_SIGNATURE
-    {"BAD_RSA_SIGNATURE", ERR_LIB_SSL, SSL_R_BAD_RSA_SIGNATURE},
+  #ifdef ASN1_R_LIST_ERROR
+    {"LIST_ERROR", ERR_LIB_ASN1, ASN1_R_LIST_ERROR},
   #else
-    {"BAD_RSA_SIGNATURE", ERR_LIB_SSL, 122},
+    {"LIST_ERROR", 13, 188},
   #endif
-  #ifdef SSL_R_BAD_SIGNATURE
-    {"BAD_SIGNATURE", ERR_LIB_SSL, SSL_R_BAD_SIGNATURE},
+  #ifdef ASN1_R_MIME_NO_CONTENT_TYPE
+    {"MIME_NO_CONTENT_TYPE", ERR_LIB_ASN1, ASN1_R_MIME_NO_CONTENT_TYPE},
   #else
-    {"BAD_SIGNATURE", ERR_LIB_SSL, 123},
+    {"MIME_NO_CONTENT_TYPE", 13, 206},
   #endif
-  #ifdef SSL_R_BAD_SRP_A_LENGTH
-    {"BAD_SRP_A_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_A_LENGTH},
+  #ifdef ASN1_R_MIME_PARSE_ERROR
+    {"MIME_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_MIME_PARSE_ERROR},
   #else
-    {"BAD_SRP_A_LENGTH", ERR_LIB_SSL, 347},
+    {"MIME_PARSE_ERROR", 13, 207},
   #endif
-  #ifdef SSL_R_BAD_SRP_B_LENGTH
-    {"BAD_SRP_B_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_B_LENGTH},
+  #ifdef ASN1_R_MIME_SIG_PARSE_ERROR
+    {"MIME_SIG_PARSE_ERROR", ERR_LIB_ASN1, ASN1_R_MIME_SIG_PARSE_ERROR},
   #else
-    {"BAD_SRP_B_LENGTH", ERR_LIB_SSL, 348},
+    {"MIME_SIG_PARSE_ERROR", 13, 208},
   #endif
-  #ifdef SSL_R_BAD_SRP_G_LENGTH
-    {"BAD_SRP_G_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_G_LENGTH},
+  #ifdef ASN1_R_MISSING_EOC
+    {"MISSING_EOC", ERR_LIB_ASN1, ASN1_R_MISSING_EOC},
   #else
-    {"BAD_SRP_G_LENGTH", ERR_LIB_SSL, 349},
+    {"MISSING_EOC", 13, 137},
   #endif
-  #ifdef SSL_R_BAD_SRP_N_LENGTH
-    {"BAD_SRP_N_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_N_LENGTH},
+  #ifdef ASN1_R_MISSING_SECOND_NUMBER
+    {"MISSING_SECOND_NUMBER", ERR_LIB_ASN1, ASN1_R_MISSING_SECOND_NUMBER},
   #else
-    {"BAD_SRP_N_LENGTH", ERR_LIB_SSL, 350},
+    {"MISSING_SECOND_NUMBER", 13, 138},
   #endif
-  #ifdef SSL_R_BAD_SRP_PARAMETERS
-    {"BAD_SRP_PARAMETERS", ERR_LIB_SSL, SSL_R_BAD_SRP_PARAMETERS},
+  #ifdef ASN1_R_MISSING_VALUE
+    {"MISSING_VALUE", ERR_LIB_ASN1, ASN1_R_MISSING_VALUE},
   #else
-    {"BAD_SRP_PARAMETERS", ERR_LIB_SSL, 371},
+    {"MISSING_VALUE", 13, 189},
   #endif
-  #ifdef SSL_R_BAD_SRP_S_LENGTH
-    {"BAD_SRP_S_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_S_LENGTH},
+  #ifdef ASN1_R_MSTRING_NOT_UNIVERSAL
+    {"MSTRING_NOT_UNIVERSAL", ERR_LIB_ASN1, ASN1_R_MSTRING_NOT_UNIVERSAL},
   #else
-    {"BAD_SRP_S_LENGTH", ERR_LIB_SSL, 351},
+    {"MSTRING_NOT_UNIVERSAL", 13, 139},
   #endif
-  #ifdef SSL_R_BAD_SRTP_MKI_VALUE
-    {"BAD_SRTP_MKI_VALUE", ERR_LIB_SSL, SSL_R_BAD_SRTP_MKI_VALUE},
+  #ifdef ASN1_R_MSTRING_WRONG_TAG
+    {"MSTRING_WRONG_TAG", ERR_LIB_ASN1, ASN1_R_MSTRING_WRONG_TAG},
   #else
-    {"BAD_SRTP_MKI_VALUE", ERR_LIB_SSL, 352},
+    {"MSTRING_WRONG_TAG", 13, 140},
   #endif
-  #ifdef SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST
-    {"BAD_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST},
+  #ifdef ASN1_R_NESTED_ASN1_STRING
+    {"NESTED_ASN1_STRING", ERR_LIB_ASN1, ASN1_R_NESTED_ASN1_STRING},
   #else
-    {"BAD_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, 353},
+    {"NESTED_ASN1_STRING", 13, 197},
   #endif
-  #ifdef SSL_R_BAD_SSL_FILETYPE
-    {"BAD_SSL_FILETYPE", ERR_LIB_SSL, SSL_R_BAD_SSL_FILETYPE},
+  #ifdef ASN1_R_NESTED_TOO_DEEP
+    {"NESTED_TOO_DEEP", ERR_LIB_ASN1, ASN1_R_NESTED_TOO_DEEP},
   #else
-    {"BAD_SSL_FILETYPE", ERR_LIB_SSL, 124},
+    {"NESTED_TOO_DEEP", 13, 201},
   #endif
-  #ifdef SSL_R_BAD_SSL_SESSION_ID_LENGTH
-    {"BAD_SSL_SESSION_ID_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SSL_SESSION_ID_LENGTH},
+  #ifdef ASN1_R_NON_HEX_CHARACTERS
+    {"NON_HEX_CHARACTERS", ERR_LIB_ASN1, ASN1_R_NON_HEX_CHARACTERS},
   #else
-    {"BAD_SSL_SESSION_ID_LENGTH", ERR_LIB_SSL, 125},
+    {"NON_HEX_CHARACTERS", 13, 141},
   #endif
-  #ifdef SSL_R_BAD_STATE
-    {"BAD_STATE", ERR_LIB_SSL, SSL_R_BAD_STATE},
+  #ifdef ASN1_R_NOT_ASCII_FORMAT
+    {"NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_NOT_ASCII_FORMAT},
   #else
-    {"BAD_STATE", ERR_LIB_SSL, 126},
+    {"NOT_ASCII_FORMAT", 13, 190},
   #endif
-  #ifdef SSL_R_BAD_VALUE
-    {"BAD_VALUE", ERR_LIB_SSL, SSL_R_BAD_VALUE},
+  #ifdef ASN1_R_NOT_ENOUGH_DATA
+    {"NOT_ENOUGH_DATA", ERR_LIB_ASN1, ASN1_R_NOT_ENOUGH_DATA},
   #else
-    {"BAD_VALUE", ERR_LIB_SSL, 384},
+    {"NOT_ENOUGH_DATA", 13, 142},
   #endif
-  #ifdef SSL_R_BAD_WRITE_RETRY
-    {"BAD_WRITE_RETRY", ERR_LIB_SSL, SSL_R_BAD_WRITE_RETRY},
+  #ifdef ASN1_R_NO_CONTENT_TYPE
+    {"NO_CONTENT_TYPE", ERR_LIB_ASN1, ASN1_R_NO_CONTENT_TYPE},
   #else
-    {"BAD_WRITE_RETRY", ERR_LIB_SSL, 127},
+    {"NO_CONTENT_TYPE", 13, 209},
   #endif
-  #ifdef SSL_R_BIO_NOT_SET
-    {"BIO_NOT_SET", ERR_LIB_SSL, SSL_R_BIO_NOT_SET},
+  #ifdef ASN1_R_NO_MATCHING_CHOICE_TYPE
+    {"NO_MATCHING_CHOICE_TYPE", ERR_LIB_ASN1, ASN1_R_NO_MATCHING_CHOICE_TYPE},
   #else
-    {"BIO_NOT_SET", ERR_LIB_SSL, 128},
+    {"NO_MATCHING_CHOICE_TYPE", 13, 143},
   #endif
-  #ifdef SSL_R_BLOCK_CIPHER_PAD_IS_WRONG
-    {"BLOCK_CIPHER_PAD_IS_WRONG", ERR_LIB_SSL, SSL_R_BLOCK_CIPHER_PAD_IS_WRONG},
+  #ifdef ASN1_R_NO_MULTIPART_BODY_FAILURE
+    {"NO_MULTIPART_BODY_FAILURE", ERR_LIB_ASN1, ASN1_R_NO_MULTIPART_BODY_FAILURE},
   #else
-    {"BLOCK_CIPHER_PAD_IS_WRONG", ERR_LIB_SSL, 129},
+    {"NO_MULTIPART_BODY_FAILURE", 13, 210},
   #endif
-  #ifdef SSL_R_BN_LIB
-    {"BN_LIB", ERR_LIB_SSL, SSL_R_BN_LIB},
+  #ifdef ASN1_R_NO_MULTIPART_BOUNDARY
+    {"NO_MULTIPART_BOUNDARY", ERR_LIB_ASN1, ASN1_R_NO_MULTIPART_BOUNDARY},
   #else
-    {"BN_LIB", ERR_LIB_SSL, 130},
+    {"NO_MULTIPART_BOUNDARY", 13, 211},
   #endif
-  #ifdef SSL_R_CA_DN_LENGTH_MISMATCH
-    {"CA_DN_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_CA_DN_LENGTH_MISMATCH},
+  #ifdef ASN1_R_NO_SIG_CONTENT_TYPE
+    {"NO_SIG_CONTENT_TYPE", ERR_LIB_ASN1, ASN1_R_NO_SIG_CONTENT_TYPE},
   #else
-    {"CA_DN_LENGTH_MISMATCH", ERR_LIB_SSL, 131},
+    {"NO_SIG_CONTENT_TYPE", 13, 212},
   #endif
-  #ifdef SSL_R_CA_DN_TOO_LONG
-    {"CA_DN_TOO_LONG", ERR_LIB_SSL, SSL_R_CA_DN_TOO_LONG},
+  #ifdef ASN1_R_NULL_IS_WRONG_LENGTH
+    {"NULL_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_NULL_IS_WRONG_LENGTH},
   #else
-    {"CA_DN_TOO_LONG", ERR_LIB_SSL, 132},
+    {"NULL_IS_WRONG_LENGTH", 13, 144},
   #endif
-  #ifdef SSL_R_CA_KEY_TOO_SMALL
-    {"CA_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_CA_KEY_TOO_SMALL},
+  #ifdef ASN1_R_OBJECT_NOT_ASCII_FORMAT
+    {"OBJECT_NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_OBJECT_NOT_ASCII_FORMAT},
   #else
-    {"CA_KEY_TOO_SMALL", ERR_LIB_SSL, 397},
+    {"OBJECT_NOT_ASCII_FORMAT", 13, 191},
   #endif
-  #ifdef SSL_R_CA_MD_TOO_WEAK
-    {"CA_MD_TOO_WEAK", ERR_LIB_SSL, SSL_R_CA_MD_TOO_WEAK},
+  #ifdef ASN1_R_ODD_NUMBER_OF_CHARS
+    {"ODD_NUMBER_OF_CHARS", ERR_LIB_ASN1, ASN1_R_ODD_NUMBER_OF_CHARS},
   #else
-    {"CA_MD_TOO_WEAK", ERR_LIB_SSL, 398},
+    {"ODD_NUMBER_OF_CHARS", 13, 145},
   #endif
-  #ifdef SSL_R_CCS_RECEIVED_EARLY
-    {"CCS_RECEIVED_EARLY", ERR_LIB_SSL, SSL_R_CCS_RECEIVED_EARLY},
+  #ifdef ASN1_R_SECOND_NUMBER_TOO_LARGE
+    {"SECOND_NUMBER_TOO_LARGE", ERR_LIB_ASN1, ASN1_R_SECOND_NUMBER_TOO_LARGE},
   #else
-    {"CCS_RECEIVED_EARLY", ERR_LIB_SSL, 133},
+    {"SECOND_NUMBER_TOO_LARGE", 13, 147},
   #endif
-  #ifdef SSL_R_CERTIFICATE_VERIFY_FAILED
-    {"CERTIFICATE_VERIFY_FAILED", ERR_LIB_SSL, SSL_R_CERTIFICATE_VERIFY_FAILED},
+  #ifdef ASN1_R_SEQUENCE_LENGTH_MISMATCH
+    {"SEQUENCE_LENGTH_MISMATCH", ERR_LIB_ASN1, ASN1_R_SEQUENCE_LENGTH_MISMATCH},
   #else
-    {"CERTIFICATE_VERIFY_FAILED", ERR_LIB_SSL, 134},
+    {"SEQUENCE_LENGTH_MISMATCH", 13, 148},
   #endif
-  #ifdef SSL_R_CERT_CB_ERROR
-    {"CERT_CB_ERROR", ERR_LIB_SSL, SSL_R_CERT_CB_ERROR},
+  #ifdef ASN1_R_SEQUENCE_NOT_CONSTRUCTED
+    {"SEQUENCE_NOT_CONSTRUCTED", ERR_LIB_ASN1, ASN1_R_SEQUENCE_NOT_CONSTRUCTED},
   #else
-    {"CERT_CB_ERROR", ERR_LIB_SSL, 377},
+    {"SEQUENCE_NOT_CONSTRUCTED", 13, 149},
   #endif
-  #ifdef SSL_R_CERT_LENGTH_MISMATCH
-    {"CERT_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_CERT_LENGTH_MISMATCH},
+  #ifdef ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG
+    {"SEQUENCE_OR_SET_NEEDS_CONFIG", ERR_LIB_ASN1, ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG},
   #else
-    {"CERT_LENGTH_MISMATCH", ERR_LIB_SSL, 135},
+    {"SEQUENCE_OR_SET_NEEDS_CONFIG", 13, 192},
   #endif
-  #ifdef SSL_R_CHALLENGE_IS_DIFFERENT
-    {"CHALLENGE_IS_DIFFERENT", ERR_LIB_SSL, SSL_R_CHALLENGE_IS_DIFFERENT},
+  #ifdef ASN1_R_SHORT_LINE
+    {"SHORT_LINE", ERR_LIB_ASN1, ASN1_R_SHORT_LINE},
   #else
-    {"CHALLENGE_IS_DIFFERENT", ERR_LIB_SSL, 136},
+    {"SHORT_LINE", 13, 150},
   #endif
-  #ifdef SSL_R_CIPHER_CODE_WRONG_LENGTH
-    {"CIPHER_CODE_WRONG_LENGTH", ERR_LIB_SSL, SSL_R_CIPHER_CODE_WRONG_LENGTH},
+  #ifdef ASN1_R_SIG_INVALID_MIME_TYPE
+    {"SIG_INVALID_MIME_TYPE", ERR_LIB_ASN1, ASN1_R_SIG_INVALID_MIME_TYPE},
   #else
-    {"CIPHER_CODE_WRONG_LENGTH", ERR_LIB_SSL, 137},
+    {"SIG_INVALID_MIME_TYPE", 13, 213},
   #endif
-  #ifdef SSL_R_CIPHER_OR_HASH_UNAVAILABLE
-    {"CIPHER_OR_HASH_UNAVAILABLE", ERR_LIB_SSL, SSL_R_CIPHER_OR_HASH_UNAVAILABLE},
+  #ifdef ASN1_R_STREAMING_NOT_SUPPORTED
+    {"STREAMING_NOT_SUPPORTED", ERR_LIB_ASN1, ASN1_R_STREAMING_NOT_SUPPORTED},
   #else
-    {"CIPHER_OR_HASH_UNAVAILABLE", ERR_LIB_SSL, 138},
+    {"STREAMING_NOT_SUPPORTED", 13, 202},
   #endif
-  #ifdef SSL_R_CIPHER_TABLE_SRC_ERROR
-    {"CIPHER_TABLE_SRC_ERROR", ERR_LIB_SSL, SSL_R_CIPHER_TABLE_SRC_ERROR},
+  #ifdef ASN1_R_STRING_TOO_LONG
+    {"STRING_TOO_LONG", ERR_LIB_ASN1, ASN1_R_STRING_TOO_LONG},
   #else
-    {"CIPHER_TABLE_SRC_ERROR", ERR_LIB_SSL, 139},
+    {"STRING_TOO_LONG", 13, 151},
   #endif
-  #ifdef SSL_R_CLIENTHELLO_TLSEXT
-    {"CLIENTHELLO_TLSEXT", ERR_LIB_SSL, SSL_R_CLIENTHELLO_TLSEXT},
+  #ifdef ASN1_R_STRING_TOO_SHORT
+    {"STRING_TOO_SHORT", ERR_LIB_ASN1, ASN1_R_STRING_TOO_SHORT},
   #else
-    {"CLIENTHELLO_TLSEXT", ERR_LIB_SSL, 226},
+    {"STRING_TOO_SHORT", 13, 152},
   #endif
-  #ifdef SSL_R_COMPRESSED_LENGTH_TOO_LONG
-    {"COMPRESSED_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_COMPRESSED_LENGTH_TOO_LONG},
+  #ifdef ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", ERR_LIB_ASN1, ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD},
   #else
-    {"COMPRESSED_LENGTH_TOO_LONG", ERR_LIB_SSL, 140},
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", 13, 154},
   #endif
-  #ifdef SSL_R_COMPRESSION_DISABLED
-    {"COMPRESSION_DISABLED", ERR_LIB_SSL, SSL_R_COMPRESSION_DISABLED},
+  #ifdef ASN1_R_TIME_NOT_ASCII_FORMAT
+    {"TIME_NOT_ASCII_FORMAT", ERR_LIB_ASN1, ASN1_R_TIME_NOT_ASCII_FORMAT},
   #else
-    {"COMPRESSION_DISABLED", ERR_LIB_SSL, 343},
+    {"TIME_NOT_ASCII_FORMAT", 13, 193},
   #endif
-  #ifdef SSL_R_COMPRESSION_FAILURE
-    {"COMPRESSION_FAILURE", ERR_LIB_SSL, SSL_R_COMPRESSION_FAILURE},
+  #ifdef ASN1_R_TOO_LARGE
+    {"TOO_LARGE", ERR_LIB_ASN1, ASN1_R_TOO_LARGE},
   #else
-    {"COMPRESSION_FAILURE", ERR_LIB_SSL, 141},
+    {"TOO_LARGE", 13, 223},
   #endif
-  #ifdef SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE
-    {"COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE", ERR_LIB_SSL, SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE},
+  #ifdef ASN1_R_TOO_LONG
+    {"TOO_LONG", ERR_LIB_ASN1, ASN1_R_TOO_LONG},
   #else
-    {"COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE", ERR_LIB_SSL, 307},
+    {"TOO_LONG", 13, 155},
   #endif
-  #ifdef SSL_R_COMPRESSION_LIBRARY_ERROR
-    {"COMPRESSION_LIBRARY_ERROR", ERR_LIB_SSL, SSL_R_COMPRESSION_LIBRARY_ERROR},
+  #ifdef ASN1_R_TOO_SMALL
+    {"TOO_SMALL", ERR_LIB_ASN1, ASN1_R_TOO_SMALL},
   #else
-    {"COMPRESSION_LIBRARY_ERROR", ERR_LIB_SSL, 142},
+    {"TOO_SMALL", 13, 224},
   #endif
-  #ifdef SSL_R_CONNECTION_ID_IS_DIFFERENT
-    {"CONNECTION_ID_IS_DIFFERENT", ERR_LIB_SSL, SSL_R_CONNECTION_ID_IS_DIFFERENT},
+  #ifdef ASN1_R_TYPE_NOT_CONSTRUCTED
+    {"TYPE_NOT_CONSTRUCTED", ERR_LIB_ASN1, ASN1_R_TYPE_NOT_CONSTRUCTED},
   #else
-    {"CONNECTION_ID_IS_DIFFERENT", ERR_LIB_SSL, 143},
+    {"TYPE_NOT_CONSTRUCTED", 13, 156},
   #endif
-  #ifdef SSL_R_CONNECTION_TYPE_NOT_SET
-    {"CONNECTION_TYPE_NOT_SET", ERR_LIB_SSL, SSL_R_CONNECTION_TYPE_NOT_SET},
+  #ifdef ASN1_R_TYPE_NOT_PRIMITIVE
+    {"TYPE_NOT_PRIMITIVE", ERR_LIB_ASN1, ASN1_R_TYPE_NOT_PRIMITIVE},
   #else
-    {"CONNECTION_TYPE_NOT_SET", ERR_LIB_SSL, 144},
+    {"TYPE_NOT_PRIMITIVE", 13, 195},
   #endif
-  #ifdef SSL_R_COOKIE_MISMATCH
-    {"COOKIE_MISMATCH", ERR_LIB_SSL, SSL_R_COOKIE_MISMATCH},
+  #ifdef ASN1_R_UNEXPECTED_EOC
+    {"UNEXPECTED_EOC", ERR_LIB_ASN1, ASN1_R_UNEXPECTED_EOC},
   #else
-    {"COOKIE_MISMATCH", ERR_LIB_SSL, 308},
+    {"UNEXPECTED_EOC", 13, 159},
   #endif
-  #ifdef SSL_R_DATA_BETWEEN_CCS_AND_FINISHED
-    {"DATA_BETWEEN_CCS_AND_FINISHED", ERR_LIB_SSL, SSL_R_DATA_BETWEEN_CCS_AND_FINISHED},
+  #ifdef ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH
+    {"UNIVERSALSTRING_IS_WRONG_LENGTH", ERR_LIB_ASN1, ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH},
   #else
-    {"DATA_BETWEEN_CCS_AND_FINISHED", ERR_LIB_SSL, 145},
+    {"UNIVERSALSTRING_IS_WRONG_LENGTH", 13, 215},
   #endif
-  #ifdef SSL_R_DATA_LENGTH_TOO_LONG
-    {"DATA_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_DATA_LENGTH_TOO_LONG},
+  #ifdef ASN1_R_UNKNOWN_FORMAT
+    {"UNKNOWN_FORMAT", ERR_LIB_ASN1, ASN1_R_UNKNOWN_FORMAT},
   #else
-    {"DATA_LENGTH_TOO_LONG", ERR_LIB_SSL, 146},
+    {"UNKNOWN_FORMAT", 13, 160},
   #endif
-  #ifdef SSL_R_DECRYPTION_FAILED
-    {"DECRYPTION_FAILED", ERR_LIB_SSL, SSL_R_DECRYPTION_FAILED},
+  #ifdef ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM
+    {"UNKNOWN_MESSAGE_DIGEST_ALGORITHM", ERR_LIB_ASN1, ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM},
   #else
-    {"DECRYPTION_FAILED", ERR_LIB_SSL, 147},
+    {"UNKNOWN_MESSAGE_DIGEST_ALGORITHM", 13, 161},
   #endif
-  #ifdef SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
-    {"DECRYPTION_FAILED_OR_BAD_RECORD_MAC", ERR_LIB_SSL, SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC},
+  #ifdef ASN1_R_UNKNOWN_OBJECT_TYPE
+    {"UNKNOWN_OBJECT_TYPE", ERR_LIB_ASN1, ASN1_R_UNKNOWN_OBJECT_TYPE},
   #else
-    {"DECRYPTION_FAILED_OR_BAD_RECORD_MAC", ERR_LIB_SSL, 281},
+    {"UNKNOWN_OBJECT_TYPE", 13, 162},
   #endif
-  #ifdef SSL_R_DH_KEY_TOO_SMALL
-    {"DH_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_DH_KEY_TOO_SMALL},
+  #ifdef ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE
+    {"UNKNOWN_PUBLIC_KEY_TYPE", ERR_LIB_ASN1, ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE},
   #else
-    {"DH_KEY_TOO_SMALL", ERR_LIB_SSL, 394},
+    {"UNKNOWN_PUBLIC_KEY_TYPE", 13, 163},
   #endif
-  #ifdef SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG
-    {"DH_PUBLIC_VALUE_LENGTH_IS_WRONG", ERR_LIB_SSL, SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG},
+  #ifdef ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM
+    {"UNKNOWN_SIGNATURE_ALGORITHM", ERR_LIB_ASN1, ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM},
   #else
-    {"DH_PUBLIC_VALUE_LENGTH_IS_WRONG", ERR_LIB_SSL, 148},
+    {"UNKNOWN_SIGNATURE_ALGORITHM", 13, 199},
   #endif
-  #ifdef SSL_R_DIGEST_CHECK_FAILED
-    {"DIGEST_CHECK_FAILED", ERR_LIB_SSL, SSL_R_DIGEST_CHECK_FAILED},
+  #ifdef ASN1_R_UNKNOWN_TAG
+    {"UNKNOWN_TAG", ERR_LIB_ASN1, ASN1_R_UNKNOWN_TAG},
   #else
-    {"DIGEST_CHECK_FAILED", ERR_LIB_SSL, 149},
+    {"UNKNOWN_TAG", 13, 194},
   #endif
-  #ifdef SSL_R_DTLS_MESSAGE_TOO_BIG
-    {"DTLS_MESSAGE_TOO_BIG", ERR_LIB_SSL, SSL_R_DTLS_MESSAGE_TOO_BIG},
+  #ifdef ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE
+    {"UNSUPPORTED_ANY_DEFINED_BY_TYPE", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE},
   #else
-    {"DTLS_MESSAGE_TOO_BIG", ERR_LIB_SSL, 334},
+    {"UNSUPPORTED_ANY_DEFINED_BY_TYPE", 13, 164},
   #endif
-  #ifdef SSL_R_DUPLICATE_COMPRESSION_ID
-    {"DUPLICATE_COMPRESSION_ID", ERR_LIB_SSL, SSL_R_DUPLICATE_COMPRESSION_ID},
+  #ifdef ASN1_R_UNSUPPORTED_CIPHER
+    {"UNSUPPORTED_CIPHER", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_CIPHER},
   #else
-    {"DUPLICATE_COMPRESSION_ID", ERR_LIB_SSL, 309},
+    {"UNSUPPORTED_CIPHER", 13, 228},
   #endif
-  #ifdef SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT
-    {"ECC_CERT_NOT_FOR_KEY_AGREEMENT", ERR_LIB_SSL, SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT},
+  #ifdef ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE
+    {"UNSUPPORTED_PUBLIC_KEY_TYPE", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE},
   #else
-    {"ECC_CERT_NOT_FOR_KEY_AGREEMENT", ERR_LIB_SSL, 317},
+    {"UNSUPPORTED_PUBLIC_KEY_TYPE", 13, 167},
   #endif
-  #ifdef SSL_R_ECC_CERT_NOT_FOR_SIGNING
-    {"ECC_CERT_NOT_FOR_SIGNING", ERR_LIB_SSL, SSL_R_ECC_CERT_NOT_FOR_SIGNING},
+  #ifdef ASN1_R_UNSUPPORTED_TYPE
+    {"UNSUPPORTED_TYPE", ERR_LIB_ASN1, ASN1_R_UNSUPPORTED_TYPE},
   #else
-    {"ECC_CERT_NOT_FOR_SIGNING", ERR_LIB_SSL, 318},
+    {"UNSUPPORTED_TYPE", 13, 196},
   #endif
-  #ifdef SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE
-    {"ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE", ERR_LIB_SSL, SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE},
+  #ifdef ASN1_R_WRONG_INTEGER_TYPE
+    {"WRONG_INTEGER_TYPE", ERR_LIB_ASN1, ASN1_R_WRONG_INTEGER_TYPE},
   #else
-    {"ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE", ERR_LIB_SSL, 322},
+    {"WRONG_INTEGER_TYPE", 13, 225},
   #endif
-  #ifdef SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE
-    {"ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE", ERR_LIB_SSL, SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE},
+  #ifdef ASN1_R_WRONG_PUBLIC_KEY_TYPE
+    {"WRONG_PUBLIC_KEY_TYPE", ERR_LIB_ASN1, ASN1_R_WRONG_PUBLIC_KEY_TYPE},
   #else
-    {"ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE", ERR_LIB_SSL, 323},
+    {"WRONG_PUBLIC_KEY_TYPE", 13, 200},
   #endif
-  #ifdef SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE
-    {"ECDH_REQUIRED_FOR_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE},
+  #ifdef ASN1_R_WRONG_TAG
+    {"WRONG_TAG", ERR_LIB_ASN1, ASN1_R_WRONG_TAG},
   #else
-    {"ECDH_REQUIRED_FOR_SUITEB_MODE", ERR_LIB_SSL, 374},
+    {"WRONG_TAG", 13, 168},
   #endif
-  #ifdef SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER
-    {"ECGROUP_TOO_LARGE_FOR_CIPHER", ERR_LIB_SSL, SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER},
+  #ifdef ASYNC_R_FAILED_TO_SET_POOL
+    {"FAILED_TO_SET_POOL", ERR_LIB_ASYNC, ASYNC_R_FAILED_TO_SET_POOL},
   #else
-    {"ECGROUP_TOO_LARGE_FOR_CIPHER", ERR_LIB_SSL, 310},
+    {"FAILED_TO_SET_POOL", 51, 101},
   #endif
-  #ifdef SSL_R_EE_KEY_TOO_SMALL
-    {"EE_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_EE_KEY_TOO_SMALL},
+  #ifdef ASYNC_R_FAILED_TO_SWAP_CONTEXT
+    {"FAILED_TO_SWAP_CONTEXT", ERR_LIB_ASYNC, ASYNC_R_FAILED_TO_SWAP_CONTEXT},
   #else
-    {"EE_KEY_TOO_SMALL", ERR_LIB_SSL, 399},
+    {"FAILED_TO_SWAP_CONTEXT", 51, 102},
   #endif
-  #ifdef SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST
-    {"EMPTY_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST},
+  #ifdef ASYNC_R_INIT_FAILED
+    {"INIT_FAILED", ERR_LIB_ASYNC, ASYNC_R_INIT_FAILED},
   #else
-    {"EMPTY_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, 354},
+    {"INIT_FAILED", 51, 105},
   #endif
-  #ifdef SSL_R_ENCRYPTED_LENGTH_TOO_LONG
-    {"ENCRYPTED_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_ENCRYPTED_LENGTH_TOO_LONG},
+  #ifdef ASYNC_R_INVALID_POOL_SIZE
+    {"INVALID_POOL_SIZE", ERR_LIB_ASYNC, ASYNC_R_INVALID_POOL_SIZE},
   #else
-    {"ENCRYPTED_LENGTH_TOO_LONG", ERR_LIB_SSL, 150},
+    {"INVALID_POOL_SIZE", 51, 103},
   #endif
-  #ifdef SSL_R_ERROR_GENERATING_TMP_RSA_KEY
-    {"ERROR_GENERATING_TMP_RSA_KEY", ERR_LIB_SSL, SSL_R_ERROR_GENERATING_TMP_RSA_KEY},
+  #ifdef BIO_R_ACCEPT_ERROR
+    {"ACCEPT_ERROR", ERR_LIB_BIO, BIO_R_ACCEPT_ERROR},
   #else
-    {"ERROR_GENERATING_TMP_RSA_KEY", ERR_LIB_SSL, 282},
+    {"ACCEPT_ERROR", 32, 100},
   #endif
-  #ifdef SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST
-    {"ERROR_IN_RECEIVED_CIPHER_LIST", ERR_LIB_SSL, SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST},
+  #ifdef BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET
+    {"ADDRINFO_ADDR_IS_NOT_AF_INET", ERR_LIB_BIO, BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET},
   #else
-    {"ERROR_IN_RECEIVED_CIPHER_LIST", ERR_LIB_SSL, 151},
+    {"ADDRINFO_ADDR_IS_NOT_AF_INET", 32, 141},
   #endif
-  #ifdef SSL_R_EXCESSIVE_MESSAGE_SIZE
-    {"EXCESSIVE_MESSAGE_SIZE", ERR_LIB_SSL, SSL_R_EXCESSIVE_MESSAGE_SIZE},
+  #ifdef BIO_R_AMBIGUOUS_HOST_OR_SERVICE
+    {"AMBIGUOUS_HOST_OR_SERVICE", ERR_LIB_BIO, BIO_R_AMBIGUOUS_HOST_OR_SERVICE},
   #else
-    {"EXCESSIVE_MESSAGE_SIZE", ERR_LIB_SSL, 152},
+    {"AMBIGUOUS_HOST_OR_SERVICE", 32, 129},
   #endif
-  #ifdef SSL_R_EXTRA_DATA_IN_MESSAGE
-    {"EXTRA_DATA_IN_MESSAGE", ERR_LIB_SSL, SSL_R_EXTRA_DATA_IN_MESSAGE},
+  #ifdef BIO_R_BAD_FOPEN_MODE
+    {"BAD_FOPEN_MODE", ERR_LIB_BIO, BIO_R_BAD_FOPEN_MODE},
   #else
-    {"EXTRA_DATA_IN_MESSAGE", ERR_LIB_SSL, 153},
+    {"BAD_FOPEN_MODE", 32, 101},
   #endif
-  #ifdef SSL_R_GOT_A_FIN_BEFORE_A_CCS
-    {"GOT_A_FIN_BEFORE_A_CCS", ERR_LIB_SSL, SSL_R_GOT_A_FIN_BEFORE_A_CCS},
+  #ifdef BIO_R_BROKEN_PIPE
+    {"BROKEN_PIPE", ERR_LIB_BIO, BIO_R_BROKEN_PIPE},
   #else
-    {"GOT_A_FIN_BEFORE_A_CCS", ERR_LIB_SSL, 154},
+    {"BROKEN_PIPE", 32, 124},
   #endif
-  #ifdef SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS
-    {"GOT_NEXT_PROTO_BEFORE_A_CCS", ERR_LIB_SSL, SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS},
+  #ifdef BIO_R_CONNECT_ERROR
+    {"CONNECT_ERROR", ERR_LIB_BIO, BIO_R_CONNECT_ERROR},
   #else
-    {"GOT_NEXT_PROTO_BEFORE_A_CCS", ERR_LIB_SSL, 355},
+    {"CONNECT_ERROR", 32, 103},
   #endif
-  #ifdef SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION
-    {"GOT_NEXT_PROTO_WITHOUT_EXTENSION", ERR_LIB_SSL, SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION},
+  #ifdef BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET
+    {"GETHOSTBYNAME_ADDR_IS_NOT_AF_INET", ERR_LIB_BIO, BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET},
   #else
-    {"GOT_NEXT_PROTO_WITHOUT_EXTENSION", ERR_LIB_SSL, 356},
+    {"GETHOSTBYNAME_ADDR_IS_NOT_AF_INET", 32, 107},
   #endif
-  #ifdef SSL_R_HTTPS_PROXY_REQUEST
-    {"HTTPS_PROXY_REQUEST", ERR_LIB_SSL, SSL_R_HTTPS_PROXY_REQUEST},
+  #ifdef BIO_R_GETSOCKNAME_ERROR
+    {"GETSOCKNAME_ERROR", ERR_LIB_BIO, BIO_R_GETSOCKNAME_ERROR},
   #else
-    {"HTTPS_PROXY_REQUEST", ERR_LIB_SSL, 155},
+    {"GETSOCKNAME_ERROR", 32, 132},
   #endif
-  #ifdef SSL_R_HTTP_REQUEST
-    {"HTTP_REQUEST", ERR_LIB_SSL, SSL_R_HTTP_REQUEST},
+  #ifdef BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS
+    {"GETSOCKNAME_TRUNCATED_ADDRESS", ERR_LIB_BIO, BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS},
   #else
-    {"HTTP_REQUEST", ERR_LIB_SSL, 156},
+    {"GETSOCKNAME_TRUNCATED_ADDRESS", 32, 133},
   #endif
-  #ifdef SSL_R_ILLEGAL_PADDING
-    {"ILLEGAL_PADDING", ERR_LIB_SSL, SSL_R_ILLEGAL_PADDING},
+  #ifdef BIO_R_GETTING_SOCKTYPE
+    {"GETTING_SOCKTYPE", ERR_LIB_BIO, BIO_R_GETTING_SOCKTYPE},
   #else
-    {"ILLEGAL_PADDING", ERR_LIB_SSL, 283},
+    {"GETTING_SOCKTYPE", 32, 134},
   #endif
-  #ifdef SSL_R_ILLEGAL_SUITEB_DIGEST
-    {"ILLEGAL_SUITEB_DIGEST", ERR_LIB_SSL, SSL_R_ILLEGAL_SUITEB_DIGEST},
+  #ifdef BIO_R_INVALID_ARGUMENT
+    {"INVALID_ARGUMENT", ERR_LIB_BIO, BIO_R_INVALID_ARGUMENT},
   #else
-    {"ILLEGAL_SUITEB_DIGEST", ERR_LIB_SSL, 380},
+    {"INVALID_ARGUMENT", 32, 125},
   #endif
-  #ifdef SSL_R_INAPPROPRIATE_FALLBACK
-    {"INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, SSL_R_INAPPROPRIATE_FALLBACK},
+  #ifdef BIO_R_INVALID_SOCKET
+    {"INVALID_SOCKET", ERR_LIB_BIO, BIO_R_INVALID_SOCKET},
   #else
-    {"INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, 373},
+    {"INVALID_SOCKET", 32, 135},
   #endif
-  #ifdef SSL_R_INCONSISTENT_COMPRESSION
-    {"INCONSISTENT_COMPRESSION", ERR_LIB_SSL, SSL_R_INCONSISTENT_COMPRESSION},
+  #ifdef BIO_R_IN_USE
+    {"IN_USE", ERR_LIB_BIO, BIO_R_IN_USE},
   #else
-    {"INCONSISTENT_COMPRESSION", ERR_LIB_SSL, 340},
+    {"IN_USE", 32, 123},
   #endif
-  #ifdef SSL_R_INVALID_CHALLENGE_LENGTH
-    {"INVALID_CHALLENGE_LENGTH", ERR_LIB_SSL, SSL_R_INVALID_CHALLENGE_LENGTH},
+  #ifdef BIO_R_LENGTH_TOO_LONG
+    {"LENGTH_TOO_LONG", ERR_LIB_BIO, BIO_R_LENGTH_TOO_LONG},
   #else
-    {"INVALID_CHALLENGE_LENGTH", ERR_LIB_SSL, 158},
+    {"LENGTH_TOO_LONG", 32, 102},
   #endif
-  #ifdef SSL_R_INVALID_COMMAND
-    {"INVALID_COMMAND", ERR_LIB_SSL, SSL_R_INVALID_COMMAND},
+  #ifdef BIO_R_LISTEN_V6_ONLY
+    {"LISTEN_V6_ONLY", ERR_LIB_BIO, BIO_R_LISTEN_V6_ONLY},
   #else
-    {"INVALID_COMMAND", ERR_LIB_SSL, 280},
+    {"LISTEN_V6_ONLY", 32, 136},
   #endif
-  #ifdef SSL_R_INVALID_COMPRESSION_ALGORITHM
-    {"INVALID_COMPRESSION_ALGORITHM", ERR_LIB_SSL, SSL_R_INVALID_COMPRESSION_ALGORITHM},
+  #ifdef BIO_R_LOOKUP_RETURNED_NOTHING
+    {"LOOKUP_RETURNED_NOTHING", ERR_LIB_BIO, BIO_R_LOOKUP_RETURNED_NOTHING},
   #else
-    {"INVALID_COMPRESSION_ALGORITHM", ERR_LIB_SSL, 341},
+    {"LOOKUP_RETURNED_NOTHING", 32, 142},
   #endif
-  #ifdef SSL_R_INVALID_NULL_CMD_NAME
-    {"INVALID_NULL_CMD_NAME", ERR_LIB_SSL, SSL_R_INVALID_NULL_CMD_NAME},
+  #ifdef BIO_R_MALFORMED_HOST_OR_SERVICE
+    {"MALFORMED_HOST_OR_SERVICE", ERR_LIB_BIO, BIO_R_MALFORMED_HOST_OR_SERVICE},
   #else
-    {"INVALID_NULL_CMD_NAME", ERR_LIB_SSL, 385},
+    {"MALFORMED_HOST_OR_SERVICE", 32, 130},
   #endif
-  #ifdef SSL_R_INVALID_PURPOSE
-    {"INVALID_PURPOSE", ERR_LIB_SSL, SSL_R_INVALID_PURPOSE},
+  #ifdef BIO_R_NBIO_CONNECT_ERROR
+    {"NBIO_CONNECT_ERROR", ERR_LIB_BIO, BIO_R_NBIO_CONNECT_ERROR},
   #else
-    {"INVALID_PURPOSE", ERR_LIB_SSL, 278},
+    {"NBIO_CONNECT_ERROR", 32, 110},
   #endif
-  #ifdef SSL_R_INVALID_SERVERINFO_DATA
-    {"INVALID_SERVERINFO_DATA", ERR_LIB_SSL, SSL_R_INVALID_SERVERINFO_DATA},
+  #ifdef BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED
+    {"NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED", ERR_LIB_BIO, BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED},
   #else
-    {"INVALID_SERVERINFO_DATA", ERR_LIB_SSL, 388},
+    {"NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED", 32, 143},
   #endif
-  #ifdef SSL_R_INVALID_SRP_USERNAME
-    {"INVALID_SRP_USERNAME", ERR_LIB_SSL, SSL_R_INVALID_SRP_USERNAME},
+  #ifdef BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED
+    {"NO_HOSTNAME_OR_SERVICE_SPECIFIED", ERR_LIB_BIO, BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED},
   #else
-    {"INVALID_SRP_USERNAME", ERR_LIB_SSL, 357},
+    {"NO_HOSTNAME_OR_SERVICE_SPECIFIED", 32, 144},
   #endif
-  #ifdef SSL_R_INVALID_STATUS_RESPONSE
-    {"INVALID_STATUS_RESPONSE", ERR_LIB_SSL, SSL_R_INVALID_STATUS_RESPONSE},
+  #ifdef BIO_R_NO_PORT_DEFINED
+    {"NO_PORT_DEFINED", ERR_LIB_BIO, BIO_R_NO_PORT_DEFINED},
   #else
-    {"INVALID_STATUS_RESPONSE", ERR_LIB_SSL, 328},
+    {"NO_PORT_DEFINED", 32, 113},
   #endif
-  #ifdef SSL_R_INVALID_TICKET_KEYS_LENGTH
-    {"INVALID_TICKET_KEYS_LENGTH", ERR_LIB_SSL, SSL_R_INVALID_TICKET_KEYS_LENGTH},
+  #ifdef BIO_R_NO_SUCH_FILE
+    {"NO_SUCH_FILE", ERR_LIB_BIO, BIO_R_NO_SUCH_FILE},
   #else
-    {"INVALID_TICKET_KEYS_LENGTH", ERR_LIB_SSL, 325},
+    {"NO_SUCH_FILE", 32, 128},
   #endif
-  #ifdef SSL_R_INVALID_TRUST
-    {"INVALID_TRUST", ERR_LIB_SSL, SSL_R_INVALID_TRUST},
+  #ifdef BIO_R_NULL_PARAMETER
+    {"NULL_PARAMETER", ERR_LIB_BIO, BIO_R_NULL_PARAMETER},
   #else
-    {"INVALID_TRUST", ERR_LIB_SSL, 279},
+    {"NULL_PARAMETER", 32, 115},
   #endif
-  #ifdef SSL_R_KEY_ARG_TOO_LONG
-    {"KEY_ARG_TOO_LONG", ERR_LIB_SSL, SSL_R_KEY_ARG_TOO_LONG},
+  #ifdef BIO_R_UNABLE_TO_BIND_SOCKET
+    {"UNABLE_TO_BIND_SOCKET", ERR_LIB_BIO, BIO_R_UNABLE_TO_BIND_SOCKET},
   #else
-    {"KEY_ARG_TOO_LONG", ERR_LIB_SSL, 284},
+    {"UNABLE_TO_BIND_SOCKET", 32, 117},
   #endif
-  #ifdef SSL_R_KRB5
-    {"KRB5", ERR_LIB_SSL, SSL_R_KRB5},
+  #ifdef BIO_R_UNABLE_TO_CREATE_SOCKET
+    {"UNABLE_TO_CREATE_SOCKET", ERR_LIB_BIO, BIO_R_UNABLE_TO_CREATE_SOCKET},
   #else
-    {"KRB5", ERR_LIB_SSL, 285},
+    {"UNABLE_TO_CREATE_SOCKET", 32, 118},
   #endif
-  #ifdef SSL_R_KRB5_C_CC_PRINC
-    {"KRB5_C_CC_PRINC", ERR_LIB_SSL, SSL_R_KRB5_C_CC_PRINC},
+  #ifdef BIO_R_UNABLE_TO_KEEPALIVE
+    {"UNABLE_TO_KEEPALIVE", ERR_LIB_BIO, BIO_R_UNABLE_TO_KEEPALIVE},
   #else
-    {"KRB5_C_CC_PRINC", ERR_LIB_SSL, 286},
+    {"UNABLE_TO_KEEPALIVE", 32, 137},
   #endif
-  #ifdef SSL_R_KRB5_C_GET_CRED
-    {"KRB5_C_GET_CRED", ERR_LIB_SSL, SSL_R_KRB5_C_GET_CRED},
+  #ifdef BIO_R_UNABLE_TO_LISTEN_SOCKET
+    {"UNABLE_TO_LISTEN_SOCKET", ERR_LIB_BIO, BIO_R_UNABLE_TO_LISTEN_SOCKET},
   #else
-    {"KRB5_C_GET_CRED", ERR_LIB_SSL, 287},
+    {"UNABLE_TO_LISTEN_SOCKET", 32, 119},
   #endif
-  #ifdef SSL_R_KRB5_C_INIT
-    {"KRB5_C_INIT", ERR_LIB_SSL, SSL_R_KRB5_C_INIT},
+  #ifdef BIO_R_UNABLE_TO_NODELAY
+    {"UNABLE_TO_NODELAY", ERR_LIB_BIO, BIO_R_UNABLE_TO_NODELAY},
   #else
-    {"KRB5_C_INIT", ERR_LIB_SSL, 288},
+    {"UNABLE_TO_NODELAY", 32, 138},
   #endif
-  #ifdef SSL_R_KRB5_C_MK_REQ
-    {"KRB5_C_MK_REQ", ERR_LIB_SSL, SSL_R_KRB5_C_MK_REQ},
+  #ifdef BIO_R_UNABLE_TO_REUSEADDR
+    {"UNABLE_TO_REUSEADDR", ERR_LIB_BIO, BIO_R_UNABLE_TO_REUSEADDR},
   #else
-    {"KRB5_C_MK_REQ", ERR_LIB_SSL, 289},
+    {"UNABLE_TO_REUSEADDR", 32, 139},
   #endif
-  #ifdef SSL_R_KRB5_S_BAD_TICKET
-    {"KRB5_S_BAD_TICKET", ERR_LIB_SSL, SSL_R_KRB5_S_BAD_TICKET},
+  #ifdef BIO_R_UNAVAILABLE_IP_FAMILY
+    {"UNAVAILABLE_IP_FAMILY", ERR_LIB_BIO, BIO_R_UNAVAILABLE_IP_FAMILY},
   #else
-    {"KRB5_S_BAD_TICKET", ERR_LIB_SSL, 290},
+    {"UNAVAILABLE_IP_FAMILY", 32, 145},
   #endif
-  #ifdef SSL_R_KRB5_S_INIT
-    {"KRB5_S_INIT", ERR_LIB_SSL, SSL_R_KRB5_S_INIT},
+  #ifdef BIO_R_UNINITIALIZED
+    {"UNINITIALIZED", ERR_LIB_BIO, BIO_R_UNINITIALIZED},
   #else
-    {"KRB5_S_INIT", ERR_LIB_SSL, 291},
+    {"UNINITIALIZED", 32, 120},
   #endif
-  #ifdef SSL_R_KRB5_S_RD_REQ
-    {"KRB5_S_RD_REQ", ERR_LIB_SSL, SSL_R_KRB5_S_RD_REQ},
+  #ifdef BIO_R_UNKNOWN_INFO_TYPE
+    {"UNKNOWN_INFO_TYPE", ERR_LIB_BIO, BIO_R_UNKNOWN_INFO_TYPE},
   #else
-    {"KRB5_S_RD_REQ", ERR_LIB_SSL, 292},
+    {"UNKNOWN_INFO_TYPE", 32, 140},
   #endif
-  #ifdef SSL_R_KRB5_S_TKT_EXPIRED
-    {"KRB5_S_TKT_EXPIRED", ERR_LIB_SSL, SSL_R_KRB5_S_TKT_EXPIRED},
+  #ifdef BIO_R_UNSUPPORTED_IP_FAMILY
+    {"UNSUPPORTED_IP_FAMILY", ERR_LIB_BIO, BIO_R_UNSUPPORTED_IP_FAMILY},
   #else
-    {"KRB5_S_TKT_EXPIRED", ERR_LIB_SSL, 293},
+    {"UNSUPPORTED_IP_FAMILY", 32, 146},
   #endif
-  #ifdef SSL_R_KRB5_S_TKT_NYV
-    {"KRB5_S_TKT_NYV", ERR_LIB_SSL, SSL_R_KRB5_S_TKT_NYV},
+  #ifdef BIO_R_UNSUPPORTED_METHOD
+    {"UNSUPPORTED_METHOD", ERR_LIB_BIO, BIO_R_UNSUPPORTED_METHOD},
   #else
-    {"KRB5_S_TKT_NYV", ERR_LIB_SSL, 294},
+    {"UNSUPPORTED_METHOD", 32, 121},
   #endif
-  #ifdef SSL_R_KRB5_S_TKT_SKEW
-    {"KRB5_S_TKT_SKEW", ERR_LIB_SSL, SSL_R_KRB5_S_TKT_SKEW},
+  #ifdef BIO_R_UNSUPPORTED_PROTOCOL_FAMILY
+    {"UNSUPPORTED_PROTOCOL_FAMILY", ERR_LIB_BIO, BIO_R_UNSUPPORTED_PROTOCOL_FAMILY},
   #else
-    {"KRB5_S_TKT_SKEW", ERR_LIB_SSL, 295},
+    {"UNSUPPORTED_PROTOCOL_FAMILY", 32, 131},
   #endif
-  #ifdef SSL_R_LENGTH_MISMATCH
-    {"LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_LENGTH_MISMATCH},
+  #ifdef BIO_R_WRITE_TO_READ_ONLY_BIO
+    {"WRITE_TO_READ_ONLY_BIO", ERR_LIB_BIO, BIO_R_WRITE_TO_READ_ONLY_BIO},
   #else
-    {"LENGTH_MISMATCH", ERR_LIB_SSL, 159},
+    {"WRITE_TO_READ_ONLY_BIO", 32, 126},
   #endif
-  #ifdef SSL_R_LENGTH_TOO_SHORT
-    {"LENGTH_TOO_SHORT", ERR_LIB_SSL, SSL_R_LENGTH_TOO_SHORT},
+  #ifdef BIO_R_WSASTARTUP
+    {"WSASTARTUP", ERR_LIB_BIO, BIO_R_WSASTARTUP},
   #else
-    {"LENGTH_TOO_SHORT", ERR_LIB_SSL, 160},
+    {"WSASTARTUP", 32, 122},
   #endif
-  #ifdef SSL_R_LIBRARY_BUG
-    {"LIBRARY_BUG", ERR_LIB_SSL, SSL_R_LIBRARY_BUG},
+  #ifdef BN_R_ARG2_LT_ARG3
+    {"ARG2_LT_ARG3", ERR_LIB_BN, BN_R_ARG2_LT_ARG3},
   #else
-    {"LIBRARY_BUG", ERR_LIB_SSL, 274},
+    {"ARG2_LT_ARG3", 3, 100},
   #endif
-  #ifdef SSL_R_LIBRARY_HAS_NO_CIPHERS
-    {"LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, SSL_R_LIBRARY_HAS_NO_CIPHERS},
+  #ifdef BN_R_BAD_RECIPROCAL
+    {"BAD_RECIPROCAL", ERR_LIB_BN, BN_R_BAD_RECIPROCAL},
   #else
-    {"LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, 161},
+    {"BAD_RECIPROCAL", 3, 101},
   #endif
-  #ifdef SSL_R_MESSAGE_TOO_LONG
-    {"MESSAGE_TOO_LONG", ERR_LIB_SSL, SSL_R_MESSAGE_TOO_LONG},
+  #ifdef BN_R_BIGNUM_TOO_LONG
+    {"BIGNUM_TOO_LONG", ERR_LIB_BN, BN_R_BIGNUM_TOO_LONG},
   #else
-    {"MESSAGE_TOO_LONG", ERR_LIB_SSL, 296},
+    {"BIGNUM_TOO_LONG", 3, 114},
   #endif
-  #ifdef SSL_R_MISSING_DH_DSA_CERT
-    {"MISSING_DH_DSA_CERT", ERR_LIB_SSL, SSL_R_MISSING_DH_DSA_CERT},
+  #ifdef BN_R_BITS_TOO_SMALL
+    {"BITS_TOO_SMALL", ERR_LIB_BN, BN_R_BITS_TOO_SMALL},
   #else
-    {"MISSING_DH_DSA_CERT", ERR_LIB_SSL, 162},
+    {"BITS_TOO_SMALL", 3, 118},
   #endif
-  #ifdef SSL_R_MISSING_DH_KEY
-    {"MISSING_DH_KEY", ERR_LIB_SSL, SSL_R_MISSING_DH_KEY},
+  #ifdef BN_R_CALLED_WITH_EVEN_MODULUS
+    {"CALLED_WITH_EVEN_MODULUS", ERR_LIB_BN, BN_R_CALLED_WITH_EVEN_MODULUS},
   #else
-    {"MISSING_DH_KEY", ERR_LIB_SSL, 163},
+    {"CALLED_WITH_EVEN_MODULUS", 3, 102},
   #endif
-  #ifdef SSL_R_MISSING_DH_RSA_CERT
-    {"MISSING_DH_RSA_CERT", ERR_LIB_SSL, SSL_R_MISSING_DH_RSA_CERT},
+  #ifdef BN_R_DIV_BY_ZERO
+    {"DIV_BY_ZERO", ERR_LIB_BN, BN_R_DIV_BY_ZERO},
   #else
-    {"MISSING_DH_RSA_CERT", ERR_LIB_SSL, 164},
+    {"DIV_BY_ZERO", 3, 103},
   #endif
-  #ifdef SSL_R_MISSING_DSA_SIGNING_CERT
-    {"MISSING_DSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_DSA_SIGNING_CERT},
+  #ifdef BN_R_ENCODING_ERROR
+    {"ENCODING_ERROR", ERR_LIB_BN, BN_R_ENCODING_ERROR},
   #else
-    {"MISSING_DSA_SIGNING_CERT", ERR_LIB_SSL, 165},
+    {"ENCODING_ERROR", 3, 104},
   #endif
-  #ifdef SSL_R_MISSING_ECDH_CERT
-    {"MISSING_ECDH_CERT", ERR_LIB_SSL, SSL_R_MISSING_ECDH_CERT},
+  #ifdef BN_R_EXPAND_ON_STATIC_BIGNUM_DATA
+    {"EXPAND_ON_STATIC_BIGNUM_DATA", ERR_LIB_BN, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA},
   #else
-    {"MISSING_ECDH_CERT", ERR_LIB_SSL, 382},
+    {"EXPAND_ON_STATIC_BIGNUM_DATA", 3, 105},
   #endif
-  #ifdef SSL_R_MISSING_ECDSA_SIGNING_CERT
-    {"MISSING_ECDSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_ECDSA_SIGNING_CERT},
+  #ifdef BN_R_INPUT_NOT_REDUCED
+    {"INPUT_NOT_REDUCED", ERR_LIB_BN, BN_R_INPUT_NOT_REDUCED},
   #else
-    {"MISSING_ECDSA_SIGNING_CERT", ERR_LIB_SSL, 381},
+    {"INPUT_NOT_REDUCED", 3, 110},
   #endif
-  #ifdef SSL_R_MISSING_EXPORT_TMP_DH_KEY
-    {"MISSING_EXPORT_TMP_DH_KEY", ERR_LIB_SSL, SSL_R_MISSING_EXPORT_TMP_DH_KEY},
+  #ifdef BN_R_INVALID_LENGTH
+    {"INVALID_LENGTH", ERR_LIB_BN, BN_R_INVALID_LENGTH},
   #else
-    {"MISSING_EXPORT_TMP_DH_KEY", ERR_LIB_SSL, 166},
+    {"INVALID_LENGTH", 3, 106},
   #endif
-  #ifdef SSL_R_MISSING_EXPORT_TMP_RSA_KEY
-    {"MISSING_EXPORT_TMP_RSA_KEY", ERR_LIB_SSL, SSL_R_MISSING_EXPORT_TMP_RSA_KEY},
+  #ifdef BN_R_INVALID_RANGE
+    {"INVALID_RANGE", ERR_LIB_BN, BN_R_INVALID_RANGE},
   #else
-    {"MISSING_EXPORT_TMP_RSA_KEY", ERR_LIB_SSL, 167},
+    {"INVALID_RANGE", 3, 115},
   #endif
-  #ifdef SSL_R_MISSING_RSA_CERTIFICATE
-    {"MISSING_RSA_CERTIFICATE", ERR_LIB_SSL, SSL_R_MISSING_RSA_CERTIFICATE},
+  #ifdef BN_R_INVALID_SHIFT
+    {"INVALID_SHIFT", ERR_LIB_BN, BN_R_INVALID_SHIFT},
   #else
-    {"MISSING_RSA_CERTIFICATE", ERR_LIB_SSL, 168},
+    {"INVALID_SHIFT", 3, 119},
   #endif
-  #ifdef SSL_R_MISSING_RSA_ENCRYPTING_CERT
-    {"MISSING_RSA_ENCRYPTING_CERT", ERR_LIB_SSL, SSL_R_MISSING_RSA_ENCRYPTING_CERT},
+  #ifdef BN_R_NOT_A_SQUARE
+    {"NOT_A_SQUARE", ERR_LIB_BN, BN_R_NOT_A_SQUARE},
   #else
-    {"MISSING_RSA_ENCRYPTING_CERT", ERR_LIB_SSL, 169},
+    {"NOT_A_SQUARE", 3, 111},
   #endif
-  #ifdef SSL_R_MISSING_RSA_SIGNING_CERT
-    {"MISSING_RSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_RSA_SIGNING_CERT},
+  #ifdef BN_R_NOT_INITIALIZED
+    {"NOT_INITIALIZED", ERR_LIB_BN, BN_R_NOT_INITIALIZED},
   #else
-    {"MISSING_RSA_SIGNING_CERT", ERR_LIB_SSL, 170},
+    {"NOT_INITIALIZED", 3, 107},
   #endif
-  #ifdef SSL_R_MISSING_SRP_PARAM
-    {"MISSING_SRP_PARAM", ERR_LIB_SSL, SSL_R_MISSING_SRP_PARAM},
+  #ifdef BN_R_NO_INVERSE
+    {"NO_INVERSE", ERR_LIB_BN, BN_R_NO_INVERSE},
   #else
-    {"MISSING_SRP_PARAM", ERR_LIB_SSL, 358},
+    {"NO_INVERSE", 3, 108},
+  #endif
+  #ifdef BN_R_NO_SOLUTION
+    {"NO_SOLUTION", ERR_LIB_BN, BN_R_NO_SOLUTION},
+  #else
+    {"NO_SOLUTION", 3, 116},
+  #endif
+  #ifdef BN_R_PRIVATE_KEY_TOO_LARGE
+    {"PRIVATE_KEY_TOO_LARGE", ERR_LIB_BN, BN_R_PRIVATE_KEY_TOO_LARGE},
+  #else
+    {"PRIVATE_KEY_TOO_LARGE", 3, 117},
+  #endif
+  #ifdef BN_R_P_IS_NOT_PRIME
+    {"P_IS_NOT_PRIME", ERR_LIB_BN, BN_R_P_IS_NOT_PRIME},
+  #else
+    {"P_IS_NOT_PRIME", 3, 112},
+  #endif
+  #ifdef BN_R_TOO_MANY_ITERATIONS
+    {"TOO_MANY_ITERATIONS", ERR_LIB_BN, BN_R_TOO_MANY_ITERATIONS},
+  #else
+    {"TOO_MANY_ITERATIONS", 3, 113},
+  #endif
+  #ifdef BN_R_TOO_MANY_TEMPORARY_VARIABLES
+    {"TOO_MANY_TEMPORARY_VARIABLES", ERR_LIB_BN, BN_R_TOO_MANY_TEMPORARY_VARIABLES},
+  #else
+    {"TOO_MANY_TEMPORARY_VARIABLES", 3, 109},
+  #endif
+  #ifdef CMS_R_ADD_SIGNER_ERROR
+    {"ADD_SIGNER_ERROR", ERR_LIB_CMS, CMS_R_ADD_SIGNER_ERROR},
+  #else
+    {"ADD_SIGNER_ERROR", 46, 99},
+  #endif
+  #ifdef CMS_R_ATTRIBUTE_ERROR
+    {"ATTRIBUTE_ERROR", ERR_LIB_CMS, CMS_R_ATTRIBUTE_ERROR},
+  #else
+    {"ATTRIBUTE_ERROR", 46, 161},
+  #endif
+  #ifdef CMS_R_CERTIFICATE_ALREADY_PRESENT
+    {"CERTIFICATE_ALREADY_PRESENT", ERR_LIB_CMS, CMS_R_CERTIFICATE_ALREADY_PRESENT},
+  #else
+    {"CERTIFICATE_ALREADY_PRESENT", 46, 175},
+  #endif
+  #ifdef CMS_R_CERTIFICATE_HAS_NO_KEYID
+    {"CERTIFICATE_HAS_NO_KEYID", ERR_LIB_CMS, CMS_R_CERTIFICATE_HAS_NO_KEYID},
+  #else
+    {"CERTIFICATE_HAS_NO_KEYID", 46, 160},
+  #endif
+  #ifdef CMS_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_CMS, CMS_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 46, 100},
+  #endif
+  #ifdef CMS_R_CIPHER_INITIALISATION_ERROR
+    {"CIPHER_INITIALISATION_ERROR", ERR_LIB_CMS, CMS_R_CIPHER_INITIALISATION_ERROR},
+  #else
+    {"CIPHER_INITIALISATION_ERROR", 46, 101},
+  #endif
+  #ifdef CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR
+    {"CIPHER_PARAMETER_INITIALISATION_ERROR", ERR_LIB_CMS, CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR},
+  #else
+    {"CIPHER_PARAMETER_INITIALISATION_ERROR", 46, 102},
+  #endif
+  #ifdef CMS_R_CMS_DATAFINAL_ERROR
+    {"CMS_DATAFINAL_ERROR", ERR_LIB_CMS, CMS_R_CMS_DATAFINAL_ERROR},
+  #else
+    {"CMS_DATAFINAL_ERROR", 46, 103},
+  #endif
+  #ifdef CMS_R_CMS_LIB
+    {"CMS_LIB", ERR_LIB_CMS, CMS_R_CMS_LIB},
+  #else
+    {"CMS_LIB", 46, 104},
+  #endif
+  #ifdef CMS_R_CONTENTIDENTIFIER_MISMATCH
+    {"CONTENTIDENTIFIER_MISMATCH", ERR_LIB_CMS, CMS_R_CONTENTIDENTIFIER_MISMATCH},
+  #else
+    {"CONTENTIDENTIFIER_MISMATCH", 46, 170},
+  #endif
+  #ifdef CMS_R_CONTENT_NOT_FOUND
+    {"CONTENT_NOT_FOUND", ERR_LIB_CMS, CMS_R_CONTENT_NOT_FOUND},
+  #else
+    {"CONTENT_NOT_FOUND", 46, 105},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_MISMATCH
+    {"CONTENT_TYPE_MISMATCH", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_MISMATCH},
+  #else
+    {"CONTENT_TYPE_MISMATCH", 46, 171},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA
+    {"CONTENT_TYPE_NOT_COMPRESSED_DATA", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_COMPRESSED_DATA", 46, 106},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA
+    {"CONTENT_TYPE_NOT_ENVELOPED_DATA", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_ENVELOPED_DATA", 46, 107},
+  #endif
+  #ifdef CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA
+    {"CONTENT_TYPE_NOT_SIGNED_DATA", ERR_LIB_CMS, CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_SIGNED_DATA", 46, 108},
+  #endif
+  #ifdef CMS_R_CONTENT_VERIFY_ERROR
+    {"CONTENT_VERIFY_ERROR", ERR_LIB_CMS, CMS_R_CONTENT_VERIFY_ERROR},
+  #else
+    {"CONTENT_VERIFY_ERROR", 46, 109},
+  #endif
+  #ifdef CMS_R_CTRL_ERROR
+    {"CTRL_ERROR", ERR_LIB_CMS, CMS_R_CTRL_ERROR},
+  #else
+    {"CTRL_ERROR", 46, 110},
+  #endif
+  #ifdef CMS_R_CTRL_FAILURE
+    {"CTRL_FAILURE", ERR_LIB_CMS, CMS_R_CTRL_FAILURE},
+  #else
+    {"CTRL_FAILURE", 46, 111},
+  #endif
+  #ifdef CMS_R_DECRYPT_ERROR
+    {"DECRYPT_ERROR", ERR_LIB_CMS, CMS_R_DECRYPT_ERROR},
+  #else
+    {"DECRYPT_ERROR", 46, 112},
+  #endif
+  #ifdef CMS_R_ERROR_GETTING_PUBLIC_KEY
+    {"ERROR_GETTING_PUBLIC_KEY", ERR_LIB_CMS, CMS_R_ERROR_GETTING_PUBLIC_KEY},
+  #else
+    {"ERROR_GETTING_PUBLIC_KEY", 46, 113},
+  #endif
+  #ifdef CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE
+    {"ERROR_READING_MESSAGEDIGEST_ATTRIBUTE", ERR_LIB_CMS, CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE},
+  #else
+    {"ERROR_READING_MESSAGEDIGEST_ATTRIBUTE", 46, 114},
+  #endif
+  #ifdef CMS_R_ERROR_SETTING_KEY
+    {"ERROR_SETTING_KEY", ERR_LIB_CMS, CMS_R_ERROR_SETTING_KEY},
+  #else
+    {"ERROR_SETTING_KEY", 46, 115},
+  #endif
+  #ifdef CMS_R_ERROR_SETTING_RECIPIENTINFO
+    {"ERROR_SETTING_RECIPIENTINFO", ERR_LIB_CMS, CMS_R_ERROR_SETTING_RECIPIENTINFO},
+  #else
+    {"ERROR_SETTING_RECIPIENTINFO", 46, 116},
+  #endif
+  #ifdef CMS_R_INVALID_ENCRYPTED_KEY_LENGTH
+    {"INVALID_ENCRYPTED_KEY_LENGTH", ERR_LIB_CMS, CMS_R_INVALID_ENCRYPTED_KEY_LENGTH},
+  #else
+    {"INVALID_ENCRYPTED_KEY_LENGTH", 46, 117},
+  #endif
+  #ifdef CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER
+    {"INVALID_KEY_ENCRYPTION_PARAMETER", ERR_LIB_CMS, CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER},
+  #else
+    {"INVALID_KEY_ENCRYPTION_PARAMETER", 46, 176},
+  #endif
+  #ifdef CMS_R_INVALID_KEY_LENGTH
+    {"INVALID_KEY_LENGTH", ERR_LIB_CMS, CMS_R_INVALID_KEY_LENGTH},
+  #else
+    {"INVALID_KEY_LENGTH", 46, 118},
+  #endif
+  #ifdef CMS_R_MD_BIO_INIT_ERROR
+    {"MD_BIO_INIT_ERROR", ERR_LIB_CMS, CMS_R_MD_BIO_INIT_ERROR},
+  #else
+    {"MD_BIO_INIT_ERROR", 46, 119},
+  #endif
+  #ifdef CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH
+    {"MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH", ERR_LIB_CMS, CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH},
+  #else
+    {"MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH", 46, 120},
+  #endif
+  #ifdef CMS_R_MESSAGEDIGEST_WRONG_LENGTH
+    {"MESSAGEDIGEST_WRONG_LENGTH", ERR_LIB_CMS, CMS_R_MESSAGEDIGEST_WRONG_LENGTH},
+  #else
+    {"MESSAGEDIGEST_WRONG_LENGTH", 46, 121},
+  #endif
+  #ifdef CMS_R_MSGSIGDIGEST_ERROR
+    {"MSGSIGDIGEST_ERROR", ERR_LIB_CMS, CMS_R_MSGSIGDIGEST_ERROR},
+  #else
+    {"MSGSIGDIGEST_ERROR", 46, 172},
+  #endif
+  #ifdef CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE
+    {"MSGSIGDIGEST_VERIFICATION_FAILURE", ERR_LIB_CMS, CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE},
+  #else
+    {"MSGSIGDIGEST_VERIFICATION_FAILURE", 46, 162},
+  #endif
+  #ifdef CMS_R_MSGSIGDIGEST_WRONG_LENGTH
+    {"MSGSIGDIGEST_WRONG_LENGTH", ERR_LIB_CMS, CMS_R_MSGSIGDIGEST_WRONG_LENGTH},
+  #else
+    {"MSGSIGDIGEST_WRONG_LENGTH", 46, 163},
+  #endif
+  #ifdef CMS_R_NEED_ONE_SIGNER
+    {"NEED_ONE_SIGNER", ERR_LIB_CMS, CMS_R_NEED_ONE_SIGNER},
+  #else
+    {"NEED_ONE_SIGNER", 46, 164},
+  #endif
+  #ifdef CMS_R_NOT_A_SIGNED_RECEIPT
+    {"NOT_A_SIGNED_RECEIPT", ERR_LIB_CMS, CMS_R_NOT_A_SIGNED_RECEIPT},
+  #else
+    {"NOT_A_SIGNED_RECEIPT", 46, 165},
+  #endif
+  #ifdef CMS_R_NOT_ENCRYPTED_DATA
+    {"NOT_ENCRYPTED_DATA", ERR_LIB_CMS, CMS_R_NOT_ENCRYPTED_DATA},
+  #else
+    {"NOT_ENCRYPTED_DATA", 46, 122},
+  #endif
+  #ifdef CMS_R_NOT_KEK
+    {"NOT_KEK", ERR_LIB_CMS, CMS_R_NOT_KEK},
+  #else
+    {"NOT_KEK", 46, 123},
+  #endif
+  #ifdef CMS_R_NOT_KEY_AGREEMENT
+    {"NOT_KEY_AGREEMENT", ERR_LIB_CMS, CMS_R_NOT_KEY_AGREEMENT},
+  #else
+    {"NOT_KEY_AGREEMENT", 46, 181},
+  #endif
+  #ifdef CMS_R_NOT_KEY_TRANSPORT
+    {"NOT_KEY_TRANSPORT", ERR_LIB_CMS, CMS_R_NOT_KEY_TRANSPORT},
+  #else
+    {"NOT_KEY_TRANSPORT", 46, 124},
+  #endif
+  #ifdef CMS_R_NOT_PWRI
+    {"NOT_PWRI", ERR_LIB_CMS, CMS_R_NOT_PWRI},
+  #else
+    {"NOT_PWRI", 46, 177},
+  #endif
+  #ifdef CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE
+    {"NOT_SUPPORTED_FOR_THIS_KEY_TYPE", ERR_LIB_CMS, CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE},
+  #else
+    {"NOT_SUPPORTED_FOR_THIS_KEY_TYPE", 46, 125},
+  #endif
+  #ifdef CMS_R_NO_CIPHER
+    {"NO_CIPHER", ERR_LIB_CMS, CMS_R_NO_CIPHER},
+  #else
+    {"NO_CIPHER", 46, 126},
+  #endif
+  #ifdef CMS_R_NO_CONTENT
+    {"NO_CONTENT", ERR_LIB_CMS, CMS_R_NO_CONTENT},
+  #else
+    {"NO_CONTENT", 46, 127},
+  #endif
+  #ifdef CMS_R_NO_CONTENT_TYPE
+    {"NO_CONTENT_TYPE", ERR_LIB_CMS, CMS_R_NO_CONTENT_TYPE},
+  #else
+    {"NO_CONTENT_TYPE", 46, 173},
+  #endif
+  #ifdef CMS_R_NO_DEFAULT_DIGEST
+    {"NO_DEFAULT_DIGEST", ERR_LIB_CMS, CMS_R_NO_DEFAULT_DIGEST},
+  #else
+    {"NO_DEFAULT_DIGEST", 46, 128},
+  #endif
+  #ifdef CMS_R_NO_DIGEST_SET
+    {"NO_DIGEST_SET", ERR_LIB_CMS, CMS_R_NO_DIGEST_SET},
+  #else
+    {"NO_DIGEST_SET", 46, 129},
+  #endif
+  #ifdef CMS_R_NO_KEY
+    {"NO_KEY", ERR_LIB_CMS, CMS_R_NO_KEY},
+  #else
+    {"NO_KEY", 46, 130},
+  #endif
+  #ifdef CMS_R_NO_KEY_OR_CERT
+    {"NO_KEY_OR_CERT", ERR_LIB_CMS, CMS_R_NO_KEY_OR_CERT},
+  #else
+    {"NO_KEY_OR_CERT", 46, 174},
+  #endif
+  #ifdef CMS_R_NO_MATCHING_DIGEST
+    {"NO_MATCHING_DIGEST", ERR_LIB_CMS, CMS_R_NO_MATCHING_DIGEST},
+  #else
+    {"NO_MATCHING_DIGEST", 46, 131},
+  #endif
+  #ifdef CMS_R_NO_MATCHING_RECIPIENT
+    {"NO_MATCHING_RECIPIENT", ERR_LIB_CMS, CMS_R_NO_MATCHING_RECIPIENT},
+  #else
+    {"NO_MATCHING_RECIPIENT", 46, 132},
+  #endif
+  #ifdef CMS_R_NO_MATCHING_SIGNATURE
+    {"NO_MATCHING_SIGNATURE", ERR_LIB_CMS, CMS_R_NO_MATCHING_SIGNATURE},
+  #else
+    {"NO_MATCHING_SIGNATURE", 46, 166},
+  #endif
+  #ifdef CMS_R_NO_MSGSIGDIGEST
+    {"NO_MSGSIGDIGEST", ERR_LIB_CMS, CMS_R_NO_MSGSIGDIGEST},
+  #else
+    {"NO_MSGSIGDIGEST", 46, 167},
+  #endif
+  #ifdef CMS_R_NO_PASSWORD
+    {"NO_PASSWORD", ERR_LIB_CMS, CMS_R_NO_PASSWORD},
+  #else
+    {"NO_PASSWORD", 46, 178},
+  #endif
+  #ifdef CMS_R_NO_PRIVATE_KEY
+    {"NO_PRIVATE_KEY", ERR_LIB_CMS, CMS_R_NO_PRIVATE_KEY},
+  #else
+    {"NO_PRIVATE_KEY", 46, 133},
+  #endif
+  #ifdef CMS_R_NO_PUBLIC_KEY
+    {"NO_PUBLIC_KEY", ERR_LIB_CMS, CMS_R_NO_PUBLIC_KEY},
+  #else
+    {"NO_PUBLIC_KEY", 46, 134},
+  #endif
+  #ifdef CMS_R_NO_RECEIPT_REQUEST
+    {"NO_RECEIPT_REQUEST", ERR_LIB_CMS, CMS_R_NO_RECEIPT_REQUEST},
+  #else
+    {"NO_RECEIPT_REQUEST", 46, 168},
+  #endif
+  #ifdef CMS_R_NO_SIGNERS
+    {"NO_SIGNERS", ERR_LIB_CMS, CMS_R_NO_SIGNERS},
+  #else
+    {"NO_SIGNERS", 46, 135},
+  #endif
+  #ifdef CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_CMS, CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 46, 136},
+  #endif
+  #ifdef CMS_R_RECEIPT_DECODE_ERROR
+    {"RECEIPT_DECODE_ERROR", ERR_LIB_CMS, CMS_R_RECEIPT_DECODE_ERROR},
+  #else
+    {"RECEIPT_DECODE_ERROR", 46, 169},
+  #endif
+  #ifdef CMS_R_RECIPIENT_ERROR
+    {"RECIPIENT_ERROR", ERR_LIB_CMS, CMS_R_RECIPIENT_ERROR},
+  #else
+    {"RECIPIENT_ERROR", 46, 137},
+  #endif
+  #ifdef CMS_R_SIGNER_CERTIFICATE_NOT_FOUND
+    {"SIGNER_CERTIFICATE_NOT_FOUND", ERR_LIB_CMS, CMS_R_SIGNER_CERTIFICATE_NOT_FOUND},
+  #else
+    {"SIGNER_CERTIFICATE_NOT_FOUND", 46, 138},
+  #endif
+  #ifdef CMS_R_SIGNFINAL_ERROR
+    {"SIGNFINAL_ERROR", ERR_LIB_CMS, CMS_R_SIGNFINAL_ERROR},
+  #else
+    {"SIGNFINAL_ERROR", 46, 139},
+  #endif
+  #ifdef CMS_R_SMIME_TEXT_ERROR
+    {"SMIME_TEXT_ERROR", ERR_LIB_CMS, CMS_R_SMIME_TEXT_ERROR},
+  #else
+    {"SMIME_TEXT_ERROR", 46, 140},
+  #endif
+  #ifdef CMS_R_STORE_INIT_ERROR
+    {"STORE_INIT_ERROR", ERR_LIB_CMS, CMS_R_STORE_INIT_ERROR},
+  #else
+    {"STORE_INIT_ERROR", 46, 141},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_COMPRESSED_DATA
+    {"TYPE_NOT_COMPRESSED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_COMPRESSED_DATA},
+  #else
+    {"TYPE_NOT_COMPRESSED_DATA", 46, 142},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_DATA
+    {"TYPE_NOT_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_DATA},
+  #else
+    {"TYPE_NOT_DATA", 46, 143},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_DIGESTED_DATA
+    {"TYPE_NOT_DIGESTED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_DIGESTED_DATA},
+  #else
+    {"TYPE_NOT_DIGESTED_DATA", 46, 144},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_ENCRYPTED_DATA
+    {"TYPE_NOT_ENCRYPTED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_ENCRYPTED_DATA},
+  #else
+    {"TYPE_NOT_ENCRYPTED_DATA", 46, 145},
+  #endif
+  #ifdef CMS_R_TYPE_NOT_ENVELOPED_DATA
+    {"TYPE_NOT_ENVELOPED_DATA", ERR_LIB_CMS, CMS_R_TYPE_NOT_ENVELOPED_DATA},
+  #else
+    {"TYPE_NOT_ENVELOPED_DATA", 46, 146},
+  #endif
+  #ifdef CMS_R_UNABLE_TO_FINALIZE_CONTEXT
+    {"UNABLE_TO_FINALIZE_CONTEXT", ERR_LIB_CMS, CMS_R_UNABLE_TO_FINALIZE_CONTEXT},
+  #else
+    {"UNABLE_TO_FINALIZE_CONTEXT", 46, 147},
+  #endif
+  #ifdef CMS_R_UNKNOWN_CIPHER
+    {"UNKNOWN_CIPHER", ERR_LIB_CMS, CMS_R_UNKNOWN_CIPHER},
+  #else
+    {"UNKNOWN_CIPHER", 46, 148},
+  #endif
+  #ifdef CMS_R_UNKNOWN_DIGEST_ALGORITHM
+    {"UNKNOWN_DIGEST_ALGORITHM", ERR_LIB_CMS, CMS_R_UNKNOWN_DIGEST_ALGORITHM},
+  #else
+    {"UNKNOWN_DIGEST_ALGORITHM", 46, 149},
+  #endif
+  #ifdef CMS_R_UNKNOWN_ID
+    {"UNKNOWN_ID", ERR_LIB_CMS, CMS_R_UNKNOWN_ID},
+  #else
+    {"UNKNOWN_ID", 46, 150},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", ERR_LIB_CMS, CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM},
+  #else
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", 46, 151},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_CONTENT_TYPE
+    {"UNSUPPORTED_CONTENT_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_CONTENT_TYPE},
+  #else
+    {"UNSUPPORTED_CONTENT_TYPE", 46, 152},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_KEK_ALGORITHM
+    {"UNSUPPORTED_KEK_ALGORITHM", ERR_LIB_CMS, CMS_R_UNSUPPORTED_KEK_ALGORITHM},
+  #else
+    {"UNSUPPORTED_KEK_ALGORITHM", 46, 153},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM
+    {"UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM", ERR_LIB_CMS, CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM},
+  #else
+    {"UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM", 46, 179},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE
+    {"UNSUPPORTED_RECIPIENTINFO_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE},
+  #else
+    {"UNSUPPORTED_RECIPIENTINFO_TYPE", 46, 155},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_RECIPIENT_TYPE
+    {"UNSUPPORTED_RECIPIENT_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_RECIPIENT_TYPE},
+  #else
+    {"UNSUPPORTED_RECIPIENT_TYPE", 46, 154},
+  #endif
+  #ifdef CMS_R_UNSUPPORTED_TYPE
+    {"UNSUPPORTED_TYPE", ERR_LIB_CMS, CMS_R_UNSUPPORTED_TYPE},
+  #else
+    {"UNSUPPORTED_TYPE", 46, 156},
+  #endif
+  #ifdef CMS_R_UNWRAP_ERROR
+    {"UNWRAP_ERROR", ERR_LIB_CMS, CMS_R_UNWRAP_ERROR},
+  #else
+    {"UNWRAP_ERROR", 46, 157},
+  #endif
+  #ifdef CMS_R_UNWRAP_FAILURE
+    {"UNWRAP_FAILURE", ERR_LIB_CMS, CMS_R_UNWRAP_FAILURE},
+  #else
+    {"UNWRAP_FAILURE", 46, 180},
+  #endif
+  #ifdef CMS_R_VERIFICATION_FAILURE
+    {"VERIFICATION_FAILURE", ERR_LIB_CMS, CMS_R_VERIFICATION_FAILURE},
+  #else
+    {"VERIFICATION_FAILURE", 46, 158},
+  #endif
+  #ifdef CMS_R_WRAP_ERROR
+    {"WRAP_ERROR", ERR_LIB_CMS, CMS_R_WRAP_ERROR},
+  #else
+    {"WRAP_ERROR", 46, 159},
+  #endif
+  #ifdef COMP_R_ZLIB_DEFLATE_ERROR
+    {"ZLIB_DEFLATE_ERROR", ERR_LIB_COMP, COMP_R_ZLIB_DEFLATE_ERROR},
+  #else
+    {"ZLIB_DEFLATE_ERROR", 41, 99},
+  #endif
+  #ifdef COMP_R_ZLIB_INFLATE_ERROR
+    {"ZLIB_INFLATE_ERROR", ERR_LIB_COMP, COMP_R_ZLIB_INFLATE_ERROR},
+  #else
+    {"ZLIB_INFLATE_ERROR", 41, 100},
+  #endif
+  #ifdef COMP_R_ZLIB_NOT_SUPPORTED
+    {"ZLIB_NOT_SUPPORTED", ERR_LIB_COMP, COMP_R_ZLIB_NOT_SUPPORTED},
+  #else
+    {"ZLIB_NOT_SUPPORTED", 41, 101},
+  #endif
+  #ifdef CONF_R_ERROR_LOADING_DSO
+    {"ERROR_LOADING_DSO", ERR_LIB_CONF, CONF_R_ERROR_LOADING_DSO},
+  #else
+    {"ERROR_LOADING_DSO", 14, 110},
+  #endif
+  #ifdef CONF_R_LIST_CANNOT_BE_NULL
+    {"LIST_CANNOT_BE_NULL", ERR_LIB_CONF, CONF_R_LIST_CANNOT_BE_NULL},
+  #else
+    {"LIST_CANNOT_BE_NULL", 14, 115},
+  #endif
+  #ifdef CONF_R_MISSING_CLOSE_SQUARE_BRACKET
+    {"MISSING_CLOSE_SQUARE_BRACKET", ERR_LIB_CONF, CONF_R_MISSING_CLOSE_SQUARE_BRACKET},
+  #else
+    {"MISSING_CLOSE_SQUARE_BRACKET", 14, 100},
+  #endif
+  #ifdef CONF_R_MISSING_EQUAL_SIGN
+    {"MISSING_EQUAL_SIGN", ERR_LIB_CONF, CONF_R_MISSING_EQUAL_SIGN},
+  #else
+    {"MISSING_EQUAL_SIGN", 14, 101},
+  #endif
+  #ifdef CONF_R_MISSING_INIT_FUNCTION
+    {"MISSING_INIT_FUNCTION", ERR_LIB_CONF, CONF_R_MISSING_INIT_FUNCTION},
+  #else
+    {"MISSING_INIT_FUNCTION", 14, 112},
+  #endif
+  #ifdef CONF_R_MODULE_INITIALIZATION_ERROR
+    {"MODULE_INITIALIZATION_ERROR", ERR_LIB_CONF, CONF_R_MODULE_INITIALIZATION_ERROR},
+  #else
+    {"MODULE_INITIALIZATION_ERROR", 14, 109},
+  #endif
+  #ifdef CONF_R_NO_CLOSE_BRACE
+    {"NO_CLOSE_BRACE", ERR_LIB_CONF, CONF_R_NO_CLOSE_BRACE},
+  #else
+    {"NO_CLOSE_BRACE", 14, 102},
+  #endif
+  #ifdef CONF_R_NO_CONF
+    {"NO_CONF", ERR_LIB_CONF, CONF_R_NO_CONF},
+  #else
+    {"NO_CONF", 14, 105},
+  #endif
+  #ifdef CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE
+    {"NO_CONF_OR_ENVIRONMENT_VARIABLE", ERR_LIB_CONF, CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE},
+  #else
+    {"NO_CONF_OR_ENVIRONMENT_VARIABLE", 14, 106},
+  #endif
+  #ifdef CONF_R_NO_SECTION
+    {"NO_SECTION", ERR_LIB_CONF, CONF_R_NO_SECTION},
+  #else
+    {"NO_SECTION", 14, 107},
+  #endif
+  #ifdef CONF_R_NO_SUCH_FILE
+    {"NO_SUCH_FILE", ERR_LIB_CONF, CONF_R_NO_SUCH_FILE},
+  #else
+    {"NO_SUCH_FILE", 14, 114},
+  #endif
+  #ifdef CONF_R_NO_VALUE
+    {"NO_VALUE", ERR_LIB_CONF, CONF_R_NO_VALUE},
+  #else
+    {"NO_VALUE", 14, 108},
+  #endif
+  #ifdef CONF_R_NUMBER_TOO_LARGE
+    {"NUMBER_TOO_LARGE", ERR_LIB_CONF, CONF_R_NUMBER_TOO_LARGE},
+  #else
+    {"NUMBER_TOO_LARGE", 14, 121},
+  #endif
+  #ifdef CONF_R_RECURSIVE_DIRECTORY_INCLUDE
+    {"RECURSIVE_DIRECTORY_INCLUDE", ERR_LIB_CONF, CONF_R_RECURSIVE_DIRECTORY_INCLUDE},
+  #else
+    {"RECURSIVE_DIRECTORY_INCLUDE", 14, 111},
+  #endif
+  #ifdef CONF_R_SSL_COMMAND_SECTION_EMPTY
+    {"SSL_COMMAND_SECTION_EMPTY", ERR_LIB_CONF, CONF_R_SSL_COMMAND_SECTION_EMPTY},
+  #else
+    {"SSL_COMMAND_SECTION_EMPTY", 14, 117},
+  #endif
+  #ifdef CONF_R_SSL_COMMAND_SECTION_NOT_FOUND
+    {"SSL_COMMAND_SECTION_NOT_FOUND", ERR_LIB_CONF, CONF_R_SSL_COMMAND_SECTION_NOT_FOUND},
+  #else
+    {"SSL_COMMAND_SECTION_NOT_FOUND", 14, 118},
+  #endif
+  #ifdef CONF_R_SSL_SECTION_EMPTY
+    {"SSL_SECTION_EMPTY", ERR_LIB_CONF, CONF_R_SSL_SECTION_EMPTY},
+  #else
+    {"SSL_SECTION_EMPTY", 14, 119},
+  #endif
+  #ifdef CONF_R_SSL_SECTION_NOT_FOUND
+    {"SSL_SECTION_NOT_FOUND", ERR_LIB_CONF, CONF_R_SSL_SECTION_NOT_FOUND},
+  #else
+    {"SSL_SECTION_NOT_FOUND", 14, 120},
+  #endif
+  #ifdef CONF_R_UNABLE_TO_CREATE_NEW_SECTION
+    {"UNABLE_TO_CREATE_NEW_SECTION", ERR_LIB_CONF, CONF_R_UNABLE_TO_CREATE_NEW_SECTION},
+  #else
+    {"UNABLE_TO_CREATE_NEW_SECTION", 14, 103},
+  #endif
+  #ifdef CONF_R_UNKNOWN_MODULE_NAME
+    {"UNKNOWN_MODULE_NAME", ERR_LIB_CONF, CONF_R_UNKNOWN_MODULE_NAME},
+  #else
+    {"UNKNOWN_MODULE_NAME", 14, 113},
+  #endif
+  #ifdef CONF_R_VARIABLE_EXPANSION_TOO_LONG
+    {"VARIABLE_EXPANSION_TOO_LONG", ERR_LIB_CONF, CONF_R_VARIABLE_EXPANSION_TOO_LONG},
+  #else
+    {"VARIABLE_EXPANSION_TOO_LONG", 14, 116},
+  #endif
+  #ifdef CONF_R_VARIABLE_HAS_NO_VALUE
+    {"VARIABLE_HAS_NO_VALUE", ERR_LIB_CONF, CONF_R_VARIABLE_HAS_NO_VALUE},
+  #else
+    {"VARIABLE_HAS_NO_VALUE", 14, 104},
+  #endif
+  #ifdef CRYPTO_R_FIPS_MODE_NOT_SUPPORTED
+    {"FIPS_MODE_NOT_SUPPORTED", ERR_LIB_CRYPTO, CRYPTO_R_FIPS_MODE_NOT_SUPPORTED},
+  #else
+    {"FIPS_MODE_NOT_SUPPORTED", 15, 101},
+  #endif
+  #ifdef CRYPTO_R_ILLEGAL_HEX_DIGIT
+    {"ILLEGAL_HEX_DIGIT", ERR_LIB_CRYPTO, CRYPTO_R_ILLEGAL_HEX_DIGIT},
+  #else
+    {"ILLEGAL_HEX_DIGIT", 15, 102},
+  #endif
+  #ifdef CRYPTO_R_ODD_NUMBER_OF_DIGITS
+    {"ODD_NUMBER_OF_DIGITS", ERR_LIB_CRYPTO, CRYPTO_R_ODD_NUMBER_OF_DIGITS},
+  #else
+    {"ODD_NUMBER_OF_DIGITS", 15, 103},
+  #endif
+  #ifdef CT_R_BASE64_DECODE_ERROR
+    {"BASE64_DECODE_ERROR", ERR_LIB_CT, CT_R_BASE64_DECODE_ERROR},
+  #else
+    {"BASE64_DECODE_ERROR", 50, 108},
+  #endif
+  #ifdef CT_R_INVALID_LOG_ID_LENGTH
+    {"INVALID_LOG_ID_LENGTH", ERR_LIB_CT, CT_R_INVALID_LOG_ID_LENGTH},
+  #else
+    {"INVALID_LOG_ID_LENGTH", 50, 100},
+  #endif
+  #ifdef CT_R_LOG_CONF_INVALID
+    {"LOG_CONF_INVALID", ERR_LIB_CT, CT_R_LOG_CONF_INVALID},
+  #else
+    {"LOG_CONF_INVALID", 50, 109},
+  #endif
+  #ifdef CT_R_LOG_CONF_INVALID_KEY
+    {"LOG_CONF_INVALID_KEY", ERR_LIB_CT, CT_R_LOG_CONF_INVALID_KEY},
+  #else
+    {"LOG_CONF_INVALID_KEY", 50, 110},
+  #endif
+  #ifdef CT_R_LOG_CONF_MISSING_DESCRIPTION
+    {"LOG_CONF_MISSING_DESCRIPTION", ERR_LIB_CT, CT_R_LOG_CONF_MISSING_DESCRIPTION},
+  #else
+    {"LOG_CONF_MISSING_DESCRIPTION", 50, 111},
+  #endif
+  #ifdef CT_R_LOG_CONF_MISSING_KEY
+    {"LOG_CONF_MISSING_KEY", ERR_LIB_CT, CT_R_LOG_CONF_MISSING_KEY},
+  #else
+    {"LOG_CONF_MISSING_KEY", 50, 112},
+  #endif
+  #ifdef CT_R_LOG_KEY_INVALID
+    {"LOG_KEY_INVALID", ERR_LIB_CT, CT_R_LOG_KEY_INVALID},
+  #else
+    {"LOG_KEY_INVALID", 50, 113},
+  #endif
+  #ifdef CT_R_SCT_FUTURE_TIMESTAMP
+    {"SCT_FUTURE_TIMESTAMP", ERR_LIB_CT, CT_R_SCT_FUTURE_TIMESTAMP},
+  #else
+    {"SCT_FUTURE_TIMESTAMP", 50, 116},
+  #endif
+  #ifdef CT_R_SCT_INVALID
+    {"SCT_INVALID", ERR_LIB_CT, CT_R_SCT_INVALID},
+  #else
+    {"SCT_INVALID", 50, 104},
+  #endif
+  #ifdef CT_R_SCT_INVALID_SIGNATURE
+    {"SCT_INVALID_SIGNATURE", ERR_LIB_CT, CT_R_SCT_INVALID_SIGNATURE},
+  #else
+    {"SCT_INVALID_SIGNATURE", 50, 107},
+  #endif
+  #ifdef CT_R_SCT_LIST_INVALID
+    {"SCT_LIST_INVALID", ERR_LIB_CT, CT_R_SCT_LIST_INVALID},
+  #else
+    {"SCT_LIST_INVALID", 50, 105},
+  #endif
+  #ifdef CT_R_SCT_LOG_ID_MISMATCH
+    {"SCT_LOG_ID_MISMATCH", ERR_LIB_CT, CT_R_SCT_LOG_ID_MISMATCH},
+  #else
+    {"SCT_LOG_ID_MISMATCH", 50, 114},
+  #endif
+  #ifdef CT_R_SCT_NOT_SET
+    {"SCT_NOT_SET", ERR_LIB_CT, CT_R_SCT_NOT_SET},
+  #else
+    {"SCT_NOT_SET", 50, 106},
+  #endif
+  #ifdef CT_R_SCT_UNSUPPORTED_VERSION
+    {"SCT_UNSUPPORTED_VERSION", ERR_LIB_CT, CT_R_SCT_UNSUPPORTED_VERSION},
+  #else
+    {"SCT_UNSUPPORTED_VERSION", 50, 115},
+  #endif
+  #ifdef CT_R_UNRECOGNIZED_SIGNATURE_NID
+    {"UNRECOGNIZED_SIGNATURE_NID", ERR_LIB_CT, CT_R_UNRECOGNIZED_SIGNATURE_NID},
+  #else
+    {"UNRECOGNIZED_SIGNATURE_NID", 50, 101},
+  #endif
+  #ifdef CT_R_UNSUPPORTED_ENTRY_TYPE
+    {"UNSUPPORTED_ENTRY_TYPE", ERR_LIB_CT, CT_R_UNSUPPORTED_ENTRY_TYPE},
+  #else
+    {"UNSUPPORTED_ENTRY_TYPE", 50, 102},
+  #endif
+  #ifdef CT_R_UNSUPPORTED_VERSION
+    {"UNSUPPORTED_VERSION", ERR_LIB_CT, CT_R_UNSUPPORTED_VERSION},
+  #else
+    {"UNSUPPORTED_VERSION", 50, 103},
+  #endif
+  #ifdef DH_R_BAD_GENERATOR
+    {"BAD_GENERATOR", ERR_LIB_DH, DH_R_BAD_GENERATOR},
+  #else
+    {"BAD_GENERATOR", 5, 101},
+  #endif
+  #ifdef DH_R_BN_DECODE_ERROR
+    {"BN_DECODE_ERROR", ERR_LIB_DH, DH_R_BN_DECODE_ERROR},
+  #else
+    {"BN_DECODE_ERROR", 5, 109},
+  #endif
+  #ifdef DH_R_BN_ERROR
+    {"BN_ERROR", ERR_LIB_DH, DH_R_BN_ERROR},
+  #else
+    {"BN_ERROR", 5, 106},
+  #endif
+  #ifdef DH_R_CHECK_INVALID_J_VALUE
+    {"CHECK_INVALID_J_VALUE", ERR_LIB_DH, DH_R_CHECK_INVALID_J_VALUE},
+  #else
+    {"CHECK_INVALID_J_VALUE", 5, 115},
+  #endif
+  #ifdef DH_R_CHECK_INVALID_Q_VALUE
+    {"CHECK_INVALID_Q_VALUE", ERR_LIB_DH, DH_R_CHECK_INVALID_Q_VALUE},
+  #else
+    {"CHECK_INVALID_Q_VALUE", 5, 116},
+  #endif
+  #ifdef DH_R_CHECK_PUBKEY_INVALID
+    {"CHECK_PUBKEY_INVALID", ERR_LIB_DH, DH_R_CHECK_PUBKEY_INVALID},
+  #else
+    {"CHECK_PUBKEY_INVALID", 5, 122},
+  #endif
+  #ifdef DH_R_CHECK_PUBKEY_TOO_LARGE
+    {"CHECK_PUBKEY_TOO_LARGE", ERR_LIB_DH, DH_R_CHECK_PUBKEY_TOO_LARGE},
+  #else
+    {"CHECK_PUBKEY_TOO_LARGE", 5, 123},
+  #endif
+  #ifdef DH_R_CHECK_PUBKEY_TOO_SMALL
+    {"CHECK_PUBKEY_TOO_SMALL", ERR_LIB_DH, DH_R_CHECK_PUBKEY_TOO_SMALL},
+  #else
+    {"CHECK_PUBKEY_TOO_SMALL", 5, 124},
+  #endif
+  #ifdef DH_R_CHECK_P_NOT_PRIME
+    {"CHECK_P_NOT_PRIME", ERR_LIB_DH, DH_R_CHECK_P_NOT_PRIME},
+  #else
+    {"CHECK_P_NOT_PRIME", 5, 117},
+  #endif
+  #ifdef DH_R_CHECK_P_NOT_SAFE_PRIME
+    {"CHECK_P_NOT_SAFE_PRIME", ERR_LIB_DH, DH_R_CHECK_P_NOT_SAFE_PRIME},
+  #else
+    {"CHECK_P_NOT_SAFE_PRIME", 5, 118},
+  #endif
+  #ifdef DH_R_CHECK_Q_NOT_PRIME
+    {"CHECK_Q_NOT_PRIME", ERR_LIB_DH, DH_R_CHECK_Q_NOT_PRIME},
+  #else
+    {"CHECK_Q_NOT_PRIME", 5, 119},
+  #endif
+  #ifdef DH_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_DH, DH_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 5, 104},
+  #endif
+  #ifdef DH_R_INVALID_PARAMETER_NAME
+    {"INVALID_PARAMETER_NAME", ERR_LIB_DH, DH_R_INVALID_PARAMETER_NAME},
+  #else
+    {"INVALID_PARAMETER_NAME", 5, 110},
+  #endif
+  #ifdef DH_R_INVALID_PARAMETER_NID
+    {"INVALID_PARAMETER_NID", ERR_LIB_DH, DH_R_INVALID_PARAMETER_NID},
+  #else
+    {"INVALID_PARAMETER_NID", 5, 114},
+  #endif
+  #ifdef DH_R_INVALID_PUBKEY
+    {"INVALID_PUBKEY", ERR_LIB_DH, DH_R_INVALID_PUBKEY},
+  #else
+    {"INVALID_PUBKEY", 5, 102},
+  #endif
+  #ifdef DH_R_KDF_PARAMETER_ERROR
+    {"KDF_PARAMETER_ERROR", ERR_LIB_DH, DH_R_KDF_PARAMETER_ERROR},
+  #else
+    {"KDF_PARAMETER_ERROR", 5, 112},
+  #endif
+  #ifdef DH_R_KEYS_NOT_SET
+    {"KEYS_NOT_SET", ERR_LIB_DH, DH_R_KEYS_NOT_SET},
+  #else
+    {"KEYS_NOT_SET", 5, 108},
+  #endif
+  #ifdef DH_R_MISSING_PUBKEY
+    {"MISSING_PUBKEY", ERR_LIB_DH, DH_R_MISSING_PUBKEY},
+  #else
+    {"MISSING_PUBKEY", 5, 125},
+  #endif
+  #ifdef DH_R_MODULUS_TOO_LARGE
+    {"MODULUS_TOO_LARGE", ERR_LIB_DH, DH_R_MODULUS_TOO_LARGE},
+  #else
+    {"MODULUS_TOO_LARGE", 5, 103},
+  #endif
+  #ifdef DH_R_NOT_SUITABLE_GENERATOR
+    {"NOT_SUITABLE_GENERATOR", ERR_LIB_DH, DH_R_NOT_SUITABLE_GENERATOR},
+  #else
+    {"NOT_SUITABLE_GENERATOR", 5, 120},
+  #endif
+  #ifdef DH_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_DH, DH_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 5, 107},
+  #endif
+  #ifdef DH_R_NO_PRIVATE_VALUE
+    {"NO_PRIVATE_VALUE", ERR_LIB_DH, DH_R_NO_PRIVATE_VALUE},
+  #else
+    {"NO_PRIVATE_VALUE", 5, 100},
+  #endif
+  #ifdef DH_R_PARAMETER_ENCODING_ERROR
+    {"PARAMETER_ENCODING_ERROR", ERR_LIB_DH, DH_R_PARAMETER_ENCODING_ERROR},
+  #else
+    {"PARAMETER_ENCODING_ERROR", 5, 105},
+  #endif
+  #ifdef DH_R_PEER_KEY_ERROR
+    {"PEER_KEY_ERROR", ERR_LIB_DH, DH_R_PEER_KEY_ERROR},
+  #else
+    {"PEER_KEY_ERROR", 5, 111},
+  #endif
+  #ifdef DH_R_SHARED_INFO_ERROR
+    {"SHARED_INFO_ERROR", ERR_LIB_DH, DH_R_SHARED_INFO_ERROR},
+  #else
+    {"SHARED_INFO_ERROR", 5, 113},
+  #endif
+  #ifdef DH_R_UNABLE_TO_CHECK_GENERATOR
+    {"UNABLE_TO_CHECK_GENERATOR", ERR_LIB_DH, DH_R_UNABLE_TO_CHECK_GENERATOR},
+  #else
+    {"UNABLE_TO_CHECK_GENERATOR", 5, 121},
+  #endif
+  #ifdef DSA_R_BAD_Q_VALUE
+    {"BAD_Q_VALUE", ERR_LIB_DSA, DSA_R_BAD_Q_VALUE},
+  #else
+    {"BAD_Q_VALUE", 10, 102},
+  #endif
+  #ifdef DSA_R_BN_DECODE_ERROR
+    {"BN_DECODE_ERROR", ERR_LIB_DSA, DSA_R_BN_DECODE_ERROR},
+  #else
+    {"BN_DECODE_ERROR", 10, 108},
+  #endif
+  #ifdef DSA_R_BN_ERROR
+    {"BN_ERROR", ERR_LIB_DSA, DSA_R_BN_ERROR},
+  #else
+    {"BN_ERROR", 10, 109},
+  #endif
+  #ifdef DSA_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_DSA, DSA_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 10, 104},
+  #endif
+  #ifdef DSA_R_INVALID_DIGEST_TYPE
+    {"INVALID_DIGEST_TYPE", ERR_LIB_DSA, DSA_R_INVALID_DIGEST_TYPE},
+  #else
+    {"INVALID_DIGEST_TYPE", 10, 106},
+  #endif
+  #ifdef DSA_R_INVALID_PARAMETERS
+    {"INVALID_PARAMETERS", ERR_LIB_DSA, DSA_R_INVALID_PARAMETERS},
+  #else
+    {"INVALID_PARAMETERS", 10, 112},
+  #endif
+  #ifdef DSA_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_DSA, DSA_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 10, 101},
+  #endif
+  #ifdef DSA_R_MISSING_PRIVATE_KEY
+    {"MISSING_PRIVATE_KEY", ERR_LIB_DSA, DSA_R_MISSING_PRIVATE_KEY},
+  #else
+    {"MISSING_PRIVATE_KEY", 10, 111},
+  #endif
+  #ifdef DSA_R_MODULUS_TOO_LARGE
+    {"MODULUS_TOO_LARGE", ERR_LIB_DSA, DSA_R_MODULUS_TOO_LARGE},
+  #else
+    {"MODULUS_TOO_LARGE", 10, 103},
+  #endif
+  #ifdef DSA_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_DSA, DSA_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 10, 107},
+  #endif
+  #ifdef DSA_R_PARAMETER_ENCODING_ERROR
+    {"PARAMETER_ENCODING_ERROR", ERR_LIB_DSA, DSA_R_PARAMETER_ENCODING_ERROR},
+  #else
+    {"PARAMETER_ENCODING_ERROR", 10, 105},
+  #endif
+  #ifdef DSA_R_Q_NOT_PRIME
+    {"Q_NOT_PRIME", ERR_LIB_DSA, DSA_R_Q_NOT_PRIME},
+  #else
+    {"Q_NOT_PRIME", 10, 113},
+  #endif
+  #ifdef DSA_R_SEED_LEN_SMALL
+    {"SEED_LEN_SMALL", ERR_LIB_DSA, DSA_R_SEED_LEN_SMALL},
+  #else
+    {"SEED_LEN_SMALL", 10, 110},
+  #endif
+  #ifdef EC_R_ASN1_ERROR
+    {"ASN1_ERROR", ERR_LIB_EC, EC_R_ASN1_ERROR},
+  #else
+    {"ASN1_ERROR", 16, 115},
+  #endif
+  #ifdef EC_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_EC, EC_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 16, 156},
+  #endif
+  #ifdef EC_R_BIGNUM_OUT_OF_RANGE
+    {"BIGNUM_OUT_OF_RANGE", ERR_LIB_EC, EC_R_BIGNUM_OUT_OF_RANGE},
+  #else
+    {"BIGNUM_OUT_OF_RANGE", 16, 144},
+  #endif
+  #ifdef EC_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL},
+  #else
+    {"BUFFER_TOO_SMALL", 16, 100},
+  #endif
+  #ifdef EC_R_CANNOT_INVERT
+    {"CANNOT_INVERT", ERR_LIB_EC, EC_R_CANNOT_INVERT},
+  #else
+    {"CANNOT_INVERT", 16, 165},
+  #endif
+  #ifdef EC_R_COORDINATES_OUT_OF_RANGE
+    {"COORDINATES_OUT_OF_RANGE", ERR_LIB_EC, EC_R_COORDINATES_OUT_OF_RANGE},
+  #else
+    {"COORDINATES_OUT_OF_RANGE", 16, 146},
+  #endif
+  #ifdef EC_R_CURVE_DOES_NOT_SUPPORT_ECDH
+    {"CURVE_DOES_NOT_SUPPORT_ECDH", ERR_LIB_EC, EC_R_CURVE_DOES_NOT_SUPPORT_ECDH},
+  #else
+    {"CURVE_DOES_NOT_SUPPORT_ECDH", 16, 160},
+  #endif
+  #ifdef EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING
+    {"CURVE_DOES_NOT_SUPPORT_SIGNING", ERR_LIB_EC, EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING},
+  #else
+    {"CURVE_DOES_NOT_SUPPORT_SIGNING", 16, 159},
+  #endif
+  #ifdef EC_R_D2I_ECPKPARAMETERS_FAILURE
+    {"D2I_ECPKPARAMETERS_FAILURE", ERR_LIB_EC, EC_R_D2I_ECPKPARAMETERS_FAILURE},
+  #else
+    {"D2I_ECPKPARAMETERS_FAILURE", 16, 117},
+  #endif
+  #ifdef EC_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_EC, EC_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 16, 142},
+  #endif
+  #ifdef EC_R_DISCRIMINANT_IS_ZERO
+    {"DISCRIMINANT_IS_ZERO", ERR_LIB_EC, EC_R_DISCRIMINANT_IS_ZERO},
+  #else
+    {"DISCRIMINANT_IS_ZERO", 16, 118},
+  #endif
+  #ifdef EC_R_EC_GROUP_NEW_BY_NAME_FAILURE
+    {"EC_GROUP_NEW_BY_NAME_FAILURE", ERR_LIB_EC, EC_R_EC_GROUP_NEW_BY_NAME_FAILURE},
+  #else
+    {"EC_GROUP_NEW_BY_NAME_FAILURE", 16, 119},
+  #endif
+  #ifdef EC_R_FIELD_TOO_LARGE
+    {"FIELD_TOO_LARGE", ERR_LIB_EC, EC_R_FIELD_TOO_LARGE},
+  #else
+    {"FIELD_TOO_LARGE", 16, 143},
+  #endif
+  #ifdef EC_R_GF2M_NOT_SUPPORTED
+    {"GF2M_NOT_SUPPORTED", ERR_LIB_EC, EC_R_GF2M_NOT_SUPPORTED},
+  #else
+    {"GF2M_NOT_SUPPORTED", 16, 147},
+  #endif
+  #ifdef EC_R_GROUP2PKPARAMETERS_FAILURE
+    {"GROUP2PKPARAMETERS_FAILURE", ERR_LIB_EC, EC_R_GROUP2PKPARAMETERS_FAILURE},
+  #else
+    {"GROUP2PKPARAMETERS_FAILURE", 16, 120},
+  #endif
+  #ifdef EC_R_I2D_ECPKPARAMETERS_FAILURE
+    {"I2D_ECPKPARAMETERS_FAILURE", ERR_LIB_EC, EC_R_I2D_ECPKPARAMETERS_FAILURE},
+  #else
+    {"I2D_ECPKPARAMETERS_FAILURE", 16, 121},
+  #endif
+  #ifdef EC_R_INCOMPATIBLE_OBJECTS
+    {"INCOMPATIBLE_OBJECTS", ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS},
+  #else
+    {"INCOMPATIBLE_OBJECTS", 16, 101},
+  #endif
+  #ifdef EC_R_INVALID_ARGUMENT
+    {"INVALID_ARGUMENT", ERR_LIB_EC, EC_R_INVALID_ARGUMENT},
+  #else
+    {"INVALID_ARGUMENT", 16, 112},
+  #endif
+  #ifdef EC_R_INVALID_COMPRESSED_POINT
+    {"INVALID_COMPRESSED_POINT", ERR_LIB_EC, EC_R_INVALID_COMPRESSED_POINT},
+  #else
+    {"INVALID_COMPRESSED_POINT", 16, 110},
+  #endif
+  #ifdef EC_R_INVALID_COMPRESSION_BIT
+    {"INVALID_COMPRESSION_BIT", ERR_LIB_EC, EC_R_INVALID_COMPRESSION_BIT},
+  #else
+    {"INVALID_COMPRESSION_BIT", 16, 109},
+  #endif
+  #ifdef EC_R_INVALID_CURVE
+    {"INVALID_CURVE", ERR_LIB_EC, EC_R_INVALID_CURVE},
+  #else
+    {"INVALID_CURVE", 16, 141},
+  #endif
+  #ifdef EC_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_EC, EC_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 16, 151},
+  #endif
+  #ifdef EC_R_INVALID_DIGEST_TYPE
+    {"INVALID_DIGEST_TYPE", ERR_LIB_EC, EC_R_INVALID_DIGEST_TYPE},
+  #else
+    {"INVALID_DIGEST_TYPE", 16, 138},
+  #endif
+  #ifdef EC_R_INVALID_ENCODING
+    {"INVALID_ENCODING", ERR_LIB_EC, EC_R_INVALID_ENCODING},
+  #else
+    {"INVALID_ENCODING", 16, 102},
+  #endif
+  #ifdef EC_R_INVALID_FIELD
+    {"INVALID_FIELD", ERR_LIB_EC, EC_R_INVALID_FIELD},
+  #else
+    {"INVALID_FIELD", 16, 103},
+  #endif
+  #ifdef EC_R_INVALID_FORM
+    {"INVALID_FORM", ERR_LIB_EC, EC_R_INVALID_FORM},
+  #else
+    {"INVALID_FORM", 16, 104},
+  #endif
+  #ifdef EC_R_INVALID_GROUP_ORDER
+    {"INVALID_GROUP_ORDER", ERR_LIB_EC, EC_R_INVALID_GROUP_ORDER},
+  #else
+    {"INVALID_GROUP_ORDER", 16, 122},
+  #endif
+  #ifdef EC_R_INVALID_KEY
+    {"INVALID_KEY", ERR_LIB_EC, EC_R_INVALID_KEY},
+  #else
+    {"INVALID_KEY", 16, 116},
+  #endif
+  #ifdef EC_R_INVALID_OUTPUT_LENGTH
+    {"INVALID_OUTPUT_LENGTH", ERR_LIB_EC, EC_R_INVALID_OUTPUT_LENGTH},
+  #else
+    {"INVALID_OUTPUT_LENGTH", 16, 161},
+  #endif
+  #ifdef EC_R_INVALID_PEER_KEY
+    {"INVALID_PEER_KEY", ERR_LIB_EC, EC_R_INVALID_PEER_KEY},
+  #else
+    {"INVALID_PEER_KEY", 16, 133},
+  #endif
+  #ifdef EC_R_INVALID_PENTANOMIAL_BASIS
+    {"INVALID_PENTANOMIAL_BASIS", ERR_LIB_EC, EC_R_INVALID_PENTANOMIAL_BASIS},
+  #else
+    {"INVALID_PENTANOMIAL_BASIS", 16, 132},
+  #endif
+  #ifdef EC_R_INVALID_PRIVATE_KEY
+    {"INVALID_PRIVATE_KEY", ERR_LIB_EC, EC_R_INVALID_PRIVATE_KEY},
+  #else
+    {"INVALID_PRIVATE_KEY", 16, 123},
+  #endif
+  #ifdef EC_R_INVALID_TRINOMIAL_BASIS
+    {"INVALID_TRINOMIAL_BASIS", ERR_LIB_EC, EC_R_INVALID_TRINOMIAL_BASIS},
+  #else
+    {"INVALID_TRINOMIAL_BASIS", 16, 137},
+  #endif
+  #ifdef EC_R_KDF_PARAMETER_ERROR
+    {"KDF_PARAMETER_ERROR", ERR_LIB_EC, EC_R_KDF_PARAMETER_ERROR},
+  #else
+    {"KDF_PARAMETER_ERROR", 16, 148},
+  #endif
+  #ifdef EC_R_KEYS_NOT_SET
+    {"KEYS_NOT_SET", ERR_LIB_EC, EC_R_KEYS_NOT_SET},
+  #else
+    {"KEYS_NOT_SET", 16, 140},
+  #endif
+  #ifdef EC_R_LADDER_POST_FAILURE
+    {"LADDER_POST_FAILURE", ERR_LIB_EC, EC_R_LADDER_POST_FAILURE},
+  #else
+    {"LADDER_POST_FAILURE", 16, 136},
+  #endif
+  #ifdef EC_R_LADDER_PRE_FAILURE
+    {"LADDER_PRE_FAILURE", ERR_LIB_EC, EC_R_LADDER_PRE_FAILURE},
+  #else
+    {"LADDER_PRE_FAILURE", 16, 153},
+  #endif
+  #ifdef EC_R_LADDER_STEP_FAILURE
+    {"LADDER_STEP_FAILURE", ERR_LIB_EC, EC_R_LADDER_STEP_FAILURE},
+  #else
+    {"LADDER_STEP_FAILURE", 16, 162},
+  #endif
+  #ifdef EC_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_EC, EC_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 16, 124},
+  #endif
+  #ifdef EC_R_MISSING_PRIVATE_KEY
+    {"MISSING_PRIVATE_KEY", ERR_LIB_EC, EC_R_MISSING_PRIVATE_KEY},
+  #else
+    {"MISSING_PRIVATE_KEY", 16, 125},
+  #endif
+  #ifdef EC_R_NEED_NEW_SETUP_VALUES
+    {"NEED_NEW_SETUP_VALUES", ERR_LIB_EC, EC_R_NEED_NEW_SETUP_VALUES},
+  #else
+    {"NEED_NEW_SETUP_VALUES", 16, 157},
+  #endif
+  #ifdef EC_R_NOT_A_NIST_PRIME
+    {"NOT_A_NIST_PRIME", ERR_LIB_EC, EC_R_NOT_A_NIST_PRIME},
+  #else
+    {"NOT_A_NIST_PRIME", 16, 135},
+  #endif
+  #ifdef EC_R_NOT_IMPLEMENTED
+    {"NOT_IMPLEMENTED", ERR_LIB_EC, EC_R_NOT_IMPLEMENTED},
+  #else
+    {"NOT_IMPLEMENTED", 16, 126},
+  #endif
+  #ifdef EC_R_NOT_INITIALIZED
+    {"NOT_INITIALIZED", ERR_LIB_EC, EC_R_NOT_INITIALIZED},
+  #else
+    {"NOT_INITIALIZED", 16, 111},
+  #endif
+  #ifdef EC_R_NO_PARAMETERS_SET
+    {"NO_PARAMETERS_SET", ERR_LIB_EC, EC_R_NO_PARAMETERS_SET},
+  #else
+    {"NO_PARAMETERS_SET", 16, 139},
+  #endif
+  #ifdef EC_R_NO_PRIVATE_VALUE
+    {"NO_PRIVATE_VALUE", ERR_LIB_EC, EC_R_NO_PRIVATE_VALUE},
+  #else
+    {"NO_PRIVATE_VALUE", 16, 154},
+  #endif
+  #ifdef EC_R_OPERATION_NOT_SUPPORTED
+    {"OPERATION_NOT_SUPPORTED", ERR_LIB_EC, EC_R_OPERATION_NOT_SUPPORTED},
+  #else
+    {"OPERATION_NOT_SUPPORTED", 16, 152},
+  #endif
+  #ifdef EC_R_PASSED_NULL_PARAMETER
+    {"PASSED_NULL_PARAMETER", ERR_LIB_EC, EC_R_PASSED_NULL_PARAMETER},
+  #else
+    {"PASSED_NULL_PARAMETER", 16, 134},
+  #endif
+  #ifdef EC_R_PEER_KEY_ERROR
+    {"PEER_KEY_ERROR", ERR_LIB_EC, EC_R_PEER_KEY_ERROR},
+  #else
+    {"PEER_KEY_ERROR", 16, 149},
+  #endif
+  #ifdef EC_R_PKPARAMETERS2GROUP_FAILURE
+    {"PKPARAMETERS2GROUP_FAILURE", ERR_LIB_EC, EC_R_PKPARAMETERS2GROUP_FAILURE},
+  #else
+    {"PKPARAMETERS2GROUP_FAILURE", 16, 127},
+  #endif
+  #ifdef EC_R_POINT_ARITHMETIC_FAILURE
+    {"POINT_ARITHMETIC_FAILURE", ERR_LIB_EC, EC_R_POINT_ARITHMETIC_FAILURE},
+  #else
+    {"POINT_ARITHMETIC_FAILURE", 16, 155},
+  #endif
+  #ifdef EC_R_POINT_AT_INFINITY
+    {"POINT_AT_INFINITY", ERR_LIB_EC, EC_R_POINT_AT_INFINITY},
+  #else
+    {"POINT_AT_INFINITY", 16, 106},
+  #endif
+  #ifdef EC_R_POINT_COORDINATES_BLIND_FAILURE
+    {"POINT_COORDINATES_BLIND_FAILURE", ERR_LIB_EC, EC_R_POINT_COORDINATES_BLIND_FAILURE},
+  #else
+    {"POINT_COORDINATES_BLIND_FAILURE", 16, 163},
+  #endif
+  #ifdef EC_R_POINT_IS_NOT_ON_CURVE
+    {"POINT_IS_NOT_ON_CURVE", ERR_LIB_EC, EC_R_POINT_IS_NOT_ON_CURVE},
+  #else
+    {"POINT_IS_NOT_ON_CURVE", 16, 107},
+  #endif
+  #ifdef EC_R_RANDOM_NUMBER_GENERATION_FAILED
+    {"RANDOM_NUMBER_GENERATION_FAILED", ERR_LIB_EC, EC_R_RANDOM_NUMBER_GENERATION_FAILED},
+  #else
+    {"RANDOM_NUMBER_GENERATION_FAILED", 16, 158},
+  #endif
+  #ifdef EC_R_SHARED_INFO_ERROR
+    {"SHARED_INFO_ERROR", ERR_LIB_EC, EC_R_SHARED_INFO_ERROR},
+  #else
+    {"SHARED_INFO_ERROR", 16, 150},
+  #endif
+  #ifdef EC_R_SLOT_FULL
+    {"SLOT_FULL", ERR_LIB_EC, EC_R_SLOT_FULL},
+  #else
+    {"SLOT_FULL", 16, 108},
+  #endif
+  #ifdef EC_R_UNDEFINED_GENERATOR
+    {"UNDEFINED_GENERATOR", ERR_LIB_EC, EC_R_UNDEFINED_GENERATOR},
+  #else
+    {"UNDEFINED_GENERATOR", 16, 113},
+  #endif
+  #ifdef EC_R_UNDEFINED_ORDER
+    {"UNDEFINED_ORDER", ERR_LIB_EC, EC_R_UNDEFINED_ORDER},
+  #else
+    {"UNDEFINED_ORDER", 16, 128},
+  #endif
+  #ifdef EC_R_UNKNOWN_COFACTOR
+    {"UNKNOWN_COFACTOR", ERR_LIB_EC, EC_R_UNKNOWN_COFACTOR},
+  #else
+    {"UNKNOWN_COFACTOR", 16, 164},
+  #endif
+  #ifdef EC_R_UNKNOWN_GROUP
+    {"UNKNOWN_GROUP", ERR_LIB_EC, EC_R_UNKNOWN_GROUP},
+  #else
+    {"UNKNOWN_GROUP", 16, 129},
+  #endif
+  #ifdef EC_R_UNKNOWN_ORDER
+    {"UNKNOWN_ORDER", ERR_LIB_EC, EC_R_UNKNOWN_ORDER},
+  #else
+    {"UNKNOWN_ORDER", 16, 114},
+  #endif
+  #ifdef EC_R_UNSUPPORTED_FIELD
+    {"UNSUPPORTED_FIELD", ERR_LIB_EC, EC_R_UNSUPPORTED_FIELD},
+  #else
+    {"UNSUPPORTED_FIELD", 16, 131},
+  #endif
+  #ifdef EC_R_WRONG_CURVE_PARAMETERS
+    {"WRONG_CURVE_PARAMETERS", ERR_LIB_EC, EC_R_WRONG_CURVE_PARAMETERS},
+  #else
+    {"WRONG_CURVE_PARAMETERS", 16, 145},
+  #endif
+  #ifdef EC_R_WRONG_ORDER
+    {"WRONG_ORDER", ERR_LIB_EC, EC_R_WRONG_ORDER},
+  #else
+    {"WRONG_ORDER", 16, 130},
+  #endif
+  #ifdef ENGINE_R_ALREADY_LOADED
+    {"ALREADY_LOADED", ERR_LIB_ENGINE, ENGINE_R_ALREADY_LOADED},
+  #else
+    {"ALREADY_LOADED", 38, 100},
+  #endif
+  #ifdef ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER
+    {"ARGUMENT_IS_NOT_A_NUMBER", ERR_LIB_ENGINE, ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER},
+  #else
+    {"ARGUMENT_IS_NOT_A_NUMBER", 38, 133},
+  #endif
+  #ifdef ENGINE_R_CMD_NOT_EXECUTABLE
+    {"CMD_NOT_EXECUTABLE", ERR_LIB_ENGINE, ENGINE_R_CMD_NOT_EXECUTABLE},
+  #else
+    {"CMD_NOT_EXECUTABLE", 38, 134},
+  #endif
+  #ifdef ENGINE_R_COMMAND_TAKES_INPUT
+    {"COMMAND_TAKES_INPUT", ERR_LIB_ENGINE, ENGINE_R_COMMAND_TAKES_INPUT},
+  #else
+    {"COMMAND_TAKES_INPUT", 38, 135},
+  #endif
+  #ifdef ENGINE_R_COMMAND_TAKES_NO_INPUT
+    {"COMMAND_TAKES_NO_INPUT", ERR_LIB_ENGINE, ENGINE_R_COMMAND_TAKES_NO_INPUT},
+  #else
+    {"COMMAND_TAKES_NO_INPUT", 38, 136},
+  #endif
+  #ifdef ENGINE_R_CONFLICTING_ENGINE_ID
+    {"CONFLICTING_ENGINE_ID", ERR_LIB_ENGINE, ENGINE_R_CONFLICTING_ENGINE_ID},
+  #else
+    {"CONFLICTING_ENGINE_ID", 38, 103},
+  #endif
+  #ifdef ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED
+    {"CTRL_COMMAND_NOT_IMPLEMENTED", ERR_LIB_ENGINE, ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED},
+  #else
+    {"CTRL_COMMAND_NOT_IMPLEMENTED", 38, 119},
+  #endif
+  #ifdef ENGINE_R_DSO_FAILURE
+    {"DSO_FAILURE", ERR_LIB_ENGINE, ENGINE_R_DSO_FAILURE},
+  #else
+    {"DSO_FAILURE", 38, 104},
+  #endif
+  #ifdef ENGINE_R_DSO_NOT_FOUND
+    {"DSO_NOT_FOUND", ERR_LIB_ENGINE, ENGINE_R_DSO_NOT_FOUND},
+  #else
+    {"DSO_NOT_FOUND", 38, 132},
+  #endif
+  #ifdef ENGINE_R_ENGINES_SECTION_ERROR
+    {"ENGINES_SECTION_ERROR", ERR_LIB_ENGINE, ENGINE_R_ENGINES_SECTION_ERROR},
+  #else
+    {"ENGINES_SECTION_ERROR", 38, 148},
+  #endif
+  #ifdef ENGINE_R_ENGINE_CONFIGURATION_ERROR
+    {"ENGINE_CONFIGURATION_ERROR", ERR_LIB_ENGINE, ENGINE_R_ENGINE_CONFIGURATION_ERROR},
+  #else
+    {"ENGINE_CONFIGURATION_ERROR", 38, 102},
+  #endif
+  #ifdef ENGINE_R_ENGINE_IS_NOT_IN_LIST
+    {"ENGINE_IS_NOT_IN_LIST", ERR_LIB_ENGINE, ENGINE_R_ENGINE_IS_NOT_IN_LIST},
+  #else
+    {"ENGINE_IS_NOT_IN_LIST", 38, 105},
+  #endif
+  #ifdef ENGINE_R_ENGINE_SECTION_ERROR
+    {"ENGINE_SECTION_ERROR", ERR_LIB_ENGINE, ENGINE_R_ENGINE_SECTION_ERROR},
+  #else
+    {"ENGINE_SECTION_ERROR", 38, 149},
+  #endif
+  #ifdef ENGINE_R_FAILED_LOADING_PRIVATE_KEY
+    {"FAILED_LOADING_PRIVATE_KEY", ERR_LIB_ENGINE, ENGINE_R_FAILED_LOADING_PRIVATE_KEY},
+  #else
+    {"FAILED_LOADING_PRIVATE_KEY", 38, 128},
+  #endif
+  #ifdef ENGINE_R_FAILED_LOADING_PUBLIC_KEY
+    {"FAILED_LOADING_PUBLIC_KEY", ERR_LIB_ENGINE, ENGINE_R_FAILED_LOADING_PUBLIC_KEY},
+  #else
+    {"FAILED_LOADING_PUBLIC_KEY", 38, 129},
+  #endif
+  #ifdef ENGINE_R_FINISH_FAILED
+    {"FINISH_FAILED", ERR_LIB_ENGINE, ENGINE_R_FINISH_FAILED},
+  #else
+    {"FINISH_FAILED", 38, 106},
+  #endif
+  #ifdef ENGINE_R_ID_OR_NAME_MISSING
+    {"ID_OR_NAME_MISSING", ERR_LIB_ENGINE, ENGINE_R_ID_OR_NAME_MISSING},
+  #else
+    {"ID_OR_NAME_MISSING", 38, 108},
+  #endif
+  #ifdef ENGINE_R_INIT_FAILED
+    {"INIT_FAILED", ERR_LIB_ENGINE, ENGINE_R_INIT_FAILED},
+  #else
+    {"INIT_FAILED", 38, 109},
+  #endif
+  #ifdef ENGINE_R_INTERNAL_LIST_ERROR
+    {"INTERNAL_LIST_ERROR", ERR_LIB_ENGINE, ENGINE_R_INTERNAL_LIST_ERROR},
+  #else
+    {"INTERNAL_LIST_ERROR", 38, 110},
+  #endif
+  #ifdef ENGINE_R_INVALID_ARGUMENT
+    {"INVALID_ARGUMENT", ERR_LIB_ENGINE, ENGINE_R_INVALID_ARGUMENT},
+  #else
+    {"INVALID_ARGUMENT", 38, 143},
+  #endif
+  #ifdef ENGINE_R_INVALID_CMD_NAME
+    {"INVALID_CMD_NAME", ERR_LIB_ENGINE, ENGINE_R_INVALID_CMD_NAME},
+  #else
+    {"INVALID_CMD_NAME", 38, 137},
+  #endif
+  #ifdef ENGINE_R_INVALID_CMD_NUMBER
+    {"INVALID_CMD_NUMBER", ERR_LIB_ENGINE, ENGINE_R_INVALID_CMD_NUMBER},
+  #else
+    {"INVALID_CMD_NUMBER", 38, 138},
+  #endif
+  #ifdef ENGINE_R_INVALID_INIT_VALUE
+    {"INVALID_INIT_VALUE", ERR_LIB_ENGINE, ENGINE_R_INVALID_INIT_VALUE},
+  #else
+    {"INVALID_INIT_VALUE", 38, 151},
+  #endif
+  #ifdef ENGINE_R_INVALID_STRING
+    {"INVALID_STRING", ERR_LIB_ENGINE, ENGINE_R_INVALID_STRING},
+  #else
+    {"INVALID_STRING", 38, 150},
+  #endif
+  #ifdef ENGINE_R_NOT_INITIALISED
+    {"NOT_INITIALISED", ERR_LIB_ENGINE, ENGINE_R_NOT_INITIALISED},
+  #else
+    {"NOT_INITIALISED", 38, 117},
+  #endif
+  #ifdef ENGINE_R_NOT_LOADED
+    {"NOT_LOADED", ERR_LIB_ENGINE, ENGINE_R_NOT_LOADED},
+  #else
+    {"NOT_LOADED", 38, 112},
+  #endif
+  #ifdef ENGINE_R_NO_CONTROL_FUNCTION
+    {"NO_CONTROL_FUNCTION", ERR_LIB_ENGINE, ENGINE_R_NO_CONTROL_FUNCTION},
+  #else
+    {"NO_CONTROL_FUNCTION", 38, 120},
+  #endif
+  #ifdef ENGINE_R_NO_INDEX
+    {"NO_INDEX", ERR_LIB_ENGINE, ENGINE_R_NO_INDEX},
+  #else
+    {"NO_INDEX", 38, 144},
+  #endif
+  #ifdef ENGINE_R_NO_LOAD_FUNCTION
+    {"NO_LOAD_FUNCTION", ERR_LIB_ENGINE, ENGINE_R_NO_LOAD_FUNCTION},
+  #else
+    {"NO_LOAD_FUNCTION", 38, 125},
+  #endif
+  #ifdef ENGINE_R_NO_REFERENCE
+    {"NO_REFERENCE", ERR_LIB_ENGINE, ENGINE_R_NO_REFERENCE},
+  #else
+    {"NO_REFERENCE", 38, 130},
+  #endif
+  #ifdef ENGINE_R_NO_SUCH_ENGINE
+    {"NO_SUCH_ENGINE", ERR_LIB_ENGINE, ENGINE_R_NO_SUCH_ENGINE},
+  #else
+    {"NO_SUCH_ENGINE", 38, 116},
+  #endif
+  #ifdef ENGINE_R_UNIMPLEMENTED_CIPHER
+    {"UNIMPLEMENTED_CIPHER", ERR_LIB_ENGINE, ENGINE_R_UNIMPLEMENTED_CIPHER},
+  #else
+    {"UNIMPLEMENTED_CIPHER", 38, 146},
+  #endif
+  #ifdef ENGINE_R_UNIMPLEMENTED_DIGEST
+    {"UNIMPLEMENTED_DIGEST", ERR_LIB_ENGINE, ENGINE_R_UNIMPLEMENTED_DIGEST},
+  #else
+    {"UNIMPLEMENTED_DIGEST", 38, 147},
+  #endif
+  #ifdef ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD
+    {"UNIMPLEMENTED_PUBLIC_KEY_METHOD", ERR_LIB_ENGINE, ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD},
+  #else
+    {"UNIMPLEMENTED_PUBLIC_KEY_METHOD", 38, 101},
+  #endif
+  #ifdef ENGINE_R_VERSION_INCOMPATIBILITY
+    {"VERSION_INCOMPATIBILITY", ERR_LIB_ENGINE, ENGINE_R_VERSION_INCOMPATIBILITY},
+  #else
+    {"VERSION_INCOMPATIBILITY", 38, 145},
+  #endif
+  #ifdef EVP_R_AES_KEY_SETUP_FAILED
+    {"AES_KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_AES_KEY_SETUP_FAILED},
+  #else
+    {"AES_KEY_SETUP_FAILED", 6, 143},
+  #endif
+  #ifdef EVP_R_ARIA_KEY_SETUP_FAILED
+    {"ARIA_KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_ARIA_KEY_SETUP_FAILED},
+  #else
+    {"ARIA_KEY_SETUP_FAILED", 6, 176},
+  #endif
+  #ifdef EVP_R_BAD_DECRYPT
+    {"BAD_DECRYPT", ERR_LIB_EVP, EVP_R_BAD_DECRYPT},
+  #else
+    {"BAD_DECRYPT", 6, 100},
+  #endif
+  #ifdef EVP_R_BAD_KEY_LENGTH
+    {"BAD_KEY_LENGTH", ERR_LIB_EVP, EVP_R_BAD_KEY_LENGTH},
+  #else
+    {"BAD_KEY_LENGTH", 6, 195},
+  #endif
+  #ifdef EVP_R_BUFFER_TOO_SMALL
+    {"BUFFER_TOO_SMALL", ERR_LIB_EVP, EVP_R_BUFFER_TOO_SMALL},
+  #else
+    {"BUFFER_TOO_SMALL", 6, 155},
+  #endif
+  #ifdef EVP_R_CAMELLIA_KEY_SETUP_FAILED
+    {"CAMELLIA_KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_CAMELLIA_KEY_SETUP_FAILED},
+  #else
+    {"CAMELLIA_KEY_SETUP_FAILED", 6, 157},
+  #endif
+  #ifdef EVP_R_CIPHER_PARAMETER_ERROR
+    {"CIPHER_PARAMETER_ERROR", ERR_LIB_EVP, EVP_R_CIPHER_PARAMETER_ERROR},
+  #else
+    {"CIPHER_PARAMETER_ERROR", 6, 122},
+  #endif
+  #ifdef EVP_R_COMMAND_NOT_SUPPORTED
+    {"COMMAND_NOT_SUPPORTED", ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED},
+  #else
+    {"COMMAND_NOT_SUPPORTED", 6, 147},
+  #endif
+  #ifdef EVP_R_COPY_ERROR
+    {"COPY_ERROR", ERR_LIB_EVP, EVP_R_COPY_ERROR},
+  #else
+    {"COPY_ERROR", 6, 173},
+  #endif
+  #ifdef EVP_R_CTRL_NOT_IMPLEMENTED
+    {"CTRL_NOT_IMPLEMENTED", ERR_LIB_EVP, EVP_R_CTRL_NOT_IMPLEMENTED},
+  #else
+    {"CTRL_NOT_IMPLEMENTED", 6, 132},
+  #endif
+  #ifdef EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED
+    {"CTRL_OPERATION_NOT_IMPLEMENTED", ERR_LIB_EVP, EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED},
+  #else
+    {"CTRL_OPERATION_NOT_IMPLEMENTED", 6, 133},
+  #endif
+  #ifdef EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH
+    {"DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH", ERR_LIB_EVP, EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH},
+  #else
+    {"DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH", 6, 138},
+  #endif
+  #ifdef EVP_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_EVP, EVP_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 6, 114},
+  #endif
+  #ifdef EVP_R_DIFFERENT_KEY_TYPES
+    {"DIFFERENT_KEY_TYPES", ERR_LIB_EVP, EVP_R_DIFFERENT_KEY_TYPES},
+  #else
+    {"DIFFERENT_KEY_TYPES", 6, 101},
+  #endif
+  #ifdef EVP_R_DIFFERENT_PARAMETERS
+    {"DIFFERENT_PARAMETERS", ERR_LIB_EVP, EVP_R_DIFFERENT_PARAMETERS},
+  #else
+    {"DIFFERENT_PARAMETERS", 6, 153},
+  #endif
+  #ifdef EVP_R_ERROR_LOADING_SECTION
+    {"ERROR_LOADING_SECTION", ERR_LIB_EVP, EVP_R_ERROR_LOADING_SECTION},
+  #else
+    {"ERROR_LOADING_SECTION", 6, 165},
+  #endif
+  #ifdef EVP_R_ERROR_SETTING_FIPS_MODE
+    {"ERROR_SETTING_FIPS_MODE", ERR_LIB_EVP, EVP_R_ERROR_SETTING_FIPS_MODE},
+  #else
+    {"ERROR_SETTING_FIPS_MODE", 6, 166},
+  #endif
+  #ifdef EVP_R_EXPECTING_AN_HMAC_KEY
+    {"EXPECTING_AN_HMAC_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_AN_HMAC_KEY},
+  #else
+    {"EXPECTING_AN_HMAC_KEY", 6, 174},
+  #endif
+  #ifdef EVP_R_EXPECTING_AN_RSA_KEY
+    {"EXPECTING_AN_RSA_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_AN_RSA_KEY},
+  #else
+    {"EXPECTING_AN_RSA_KEY", 6, 127},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_DH_KEY
+    {"EXPECTING_A_DH_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_DH_KEY},
+  #else
+    {"EXPECTING_A_DH_KEY", 6, 128},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_DSA_KEY
+    {"EXPECTING_A_DSA_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_DSA_KEY},
+  #else
+    {"EXPECTING_A_DSA_KEY", 6, 129},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_EC_KEY
+    {"EXPECTING_A_EC_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_EC_KEY},
+  #else
+    {"EXPECTING_A_EC_KEY", 6, 142},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_POLY1305_KEY
+    {"EXPECTING_A_POLY1305_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_POLY1305_KEY},
+  #else
+    {"EXPECTING_A_POLY1305_KEY", 6, 164},
+  #endif
+  #ifdef EVP_R_EXPECTING_A_SIPHASH_KEY
+    {"EXPECTING_A_SIPHASH_KEY", ERR_LIB_EVP, EVP_R_EXPECTING_A_SIPHASH_KEY},
+  #else
+    {"EXPECTING_A_SIPHASH_KEY", 6, 175},
+  #endif
+  #ifdef EVP_R_FIPS_MODE_NOT_SUPPORTED
+    {"FIPS_MODE_NOT_SUPPORTED", ERR_LIB_EVP, EVP_R_FIPS_MODE_NOT_SUPPORTED},
+  #else
+    {"FIPS_MODE_NOT_SUPPORTED", 6, 167},
+  #endif
+  #ifdef EVP_R_GET_RAW_KEY_FAILED
+    {"GET_RAW_KEY_FAILED", ERR_LIB_EVP, EVP_R_GET_RAW_KEY_FAILED},
+  #else
+    {"GET_RAW_KEY_FAILED", 6, 182},
+  #endif
+  #ifdef EVP_R_ILLEGAL_SCRYPT_PARAMETERS
+    {"ILLEGAL_SCRYPT_PARAMETERS", ERR_LIB_EVP, EVP_R_ILLEGAL_SCRYPT_PARAMETERS},
+  #else
+    {"ILLEGAL_SCRYPT_PARAMETERS", 6, 171},
+  #endif
+  #ifdef EVP_R_INITIALIZATION_ERROR
+    {"INITIALIZATION_ERROR", ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR},
+  #else
+    {"INITIALIZATION_ERROR", 6, 134},
+  #endif
+  #ifdef EVP_R_INPUT_NOT_INITIALIZED
+    {"INPUT_NOT_INITIALIZED", ERR_LIB_EVP, EVP_R_INPUT_NOT_INITIALIZED},
+  #else
+    {"INPUT_NOT_INITIALIZED", 6, 111},
+  #endif
+  #ifdef EVP_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_EVP, EVP_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 6, 152},
+  #endif
+  #ifdef EVP_R_INVALID_FIPS_MODE
+    {"INVALID_FIPS_MODE", ERR_LIB_EVP, EVP_R_INVALID_FIPS_MODE},
+  #else
+    {"INVALID_FIPS_MODE", 6, 168},
+  #endif
+  #ifdef EVP_R_INVALID_IV_LENGTH
+    {"INVALID_IV_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_IV_LENGTH},
+  #else
+    {"INVALID_IV_LENGTH", 6, 194},
+  #endif
+  #ifdef EVP_R_INVALID_KEY
+    {"INVALID_KEY", ERR_LIB_EVP, EVP_R_INVALID_KEY},
+  #else
+    {"INVALID_KEY", 6, 163},
+  #endif
+  #ifdef EVP_R_INVALID_KEY_LENGTH
+    {"INVALID_KEY_LENGTH", ERR_LIB_EVP, EVP_R_INVALID_KEY_LENGTH},
+  #else
+    {"INVALID_KEY_LENGTH", 6, 130},
+  #endif
+  #ifdef EVP_R_INVALID_OPERATION
+    {"INVALID_OPERATION", ERR_LIB_EVP, EVP_R_INVALID_OPERATION},
+  #else
+    {"INVALID_OPERATION", 6, 148},
+  #endif
+  #ifdef EVP_R_KEYGEN_FAILURE
+    {"KEYGEN_FAILURE", ERR_LIB_EVP, EVP_R_KEYGEN_FAILURE},
+  #else
+    {"KEYGEN_FAILURE", 6, 120},
+  #endif
+  #ifdef EVP_R_KEY_SETUP_FAILED
+    {"KEY_SETUP_FAILED", ERR_LIB_EVP, EVP_R_KEY_SETUP_FAILED},
+  #else
+    {"KEY_SETUP_FAILED", 6, 180},
+  #endif
+  #ifdef EVP_R_MEMORY_LIMIT_EXCEEDED
+    {"MEMORY_LIMIT_EXCEEDED", ERR_LIB_EVP, EVP_R_MEMORY_LIMIT_EXCEEDED},
+  #else
+    {"MEMORY_LIMIT_EXCEEDED", 6, 172},
+  #endif
+  #ifdef EVP_R_MESSAGE_DIGEST_IS_NULL
+    {"MESSAGE_DIGEST_IS_NULL", ERR_LIB_EVP, EVP_R_MESSAGE_DIGEST_IS_NULL},
+  #else
+    {"MESSAGE_DIGEST_IS_NULL", 6, 159},
+  #endif
+  #ifdef EVP_R_METHOD_NOT_SUPPORTED
+    {"METHOD_NOT_SUPPORTED", ERR_LIB_EVP, EVP_R_METHOD_NOT_SUPPORTED},
+  #else
+    {"METHOD_NOT_SUPPORTED", 6, 144},
+  #endif
+  #ifdef EVP_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_EVP, EVP_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 6, 103},
+  #endif
+  #ifdef EVP_R_NOT_XOF_OR_INVALID_LENGTH
+    {"NOT_XOF_OR_INVALID_LENGTH", ERR_LIB_EVP, EVP_R_NOT_XOF_OR_INVALID_LENGTH},
+  #else
+    {"NOT_XOF_OR_INVALID_LENGTH", 6, 178},
+  #endif
+  #ifdef EVP_R_NO_CIPHER_SET
+    {"NO_CIPHER_SET", ERR_LIB_EVP, EVP_R_NO_CIPHER_SET},
+  #else
+    {"NO_CIPHER_SET", 6, 131},
+  #endif
+  #ifdef EVP_R_NO_DEFAULT_DIGEST
+    {"NO_DEFAULT_DIGEST", ERR_LIB_EVP, EVP_R_NO_DEFAULT_DIGEST},
+  #else
+    {"NO_DEFAULT_DIGEST", 6, 158},
+  #endif
+  #ifdef EVP_R_NO_DIGEST_SET
+    {"NO_DIGEST_SET", ERR_LIB_EVP, EVP_R_NO_DIGEST_SET},
+  #else
+    {"NO_DIGEST_SET", 6, 139},
+  #endif
+  #ifdef EVP_R_NO_KEY_SET
+    {"NO_KEY_SET", ERR_LIB_EVP, EVP_R_NO_KEY_SET},
+  #else
+    {"NO_KEY_SET", 6, 154},
+  #endif
+  #ifdef EVP_R_NO_OPERATION_SET
+    {"NO_OPERATION_SET", ERR_LIB_EVP, EVP_R_NO_OPERATION_SET},
+  #else
+    {"NO_OPERATION_SET", 6, 149},
+  #endif
+  #ifdef EVP_R_ONLY_ONESHOT_SUPPORTED
+    {"ONLY_ONESHOT_SUPPORTED", ERR_LIB_EVP, EVP_R_ONLY_ONESHOT_SUPPORTED},
+  #else
+    {"ONLY_ONESHOT_SUPPORTED", 6, 177},
+  #endif
+  #ifdef EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE},
+  #else
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", 6, 150},
+  #endif
+  #ifdef EVP_R_OPERATON_NOT_INITIALIZED
+    {"OPERATON_NOT_INITIALIZED", ERR_LIB_EVP, EVP_R_OPERATON_NOT_INITIALIZED},
+  #else
+    {"OPERATON_NOT_INITIALIZED", 6, 151},
+  #endif
+  #ifdef EVP_R_PARTIALLY_OVERLAPPING
+    {"PARTIALLY_OVERLAPPING", ERR_LIB_EVP, EVP_R_PARTIALLY_OVERLAPPING},
+  #else
+    {"PARTIALLY_OVERLAPPING", 6, 162},
+  #endif
+  #ifdef EVP_R_PBKDF2_ERROR
+    {"PBKDF2_ERROR", ERR_LIB_EVP, EVP_R_PBKDF2_ERROR},
+  #else
+    {"PBKDF2_ERROR", 6, 181},
+  #endif
+  #ifdef EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED
+    {"PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED", ERR_LIB_EVP, EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED},
+  #else
+    {"PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED", 6, 179},
+  #endif
+  #ifdef EVP_R_PRIVATE_KEY_DECODE_ERROR
+    {"PRIVATE_KEY_DECODE_ERROR", ERR_LIB_EVP, EVP_R_PRIVATE_KEY_DECODE_ERROR},
+  #else
+    {"PRIVATE_KEY_DECODE_ERROR", 6, 145},
+  #endif
+  #ifdef EVP_R_PRIVATE_KEY_ENCODE_ERROR
+    {"PRIVATE_KEY_ENCODE_ERROR", ERR_LIB_EVP, EVP_R_PRIVATE_KEY_ENCODE_ERROR},
+  #else
+    {"PRIVATE_KEY_ENCODE_ERROR", 6, 146},
+  #endif
+  #ifdef EVP_R_PUBLIC_KEY_NOT_RSA
+    {"PUBLIC_KEY_NOT_RSA", ERR_LIB_EVP, EVP_R_PUBLIC_KEY_NOT_RSA},
+  #else
+    {"PUBLIC_KEY_NOT_RSA", 6, 106},
+  #endif
+  #ifdef EVP_R_UNKNOWN_CIPHER
+    {"UNKNOWN_CIPHER", ERR_LIB_EVP, EVP_R_UNKNOWN_CIPHER},
+  #else
+    {"UNKNOWN_CIPHER", 6, 160},
+  #endif
+  #ifdef EVP_R_UNKNOWN_DIGEST
+    {"UNKNOWN_DIGEST", ERR_LIB_EVP, EVP_R_UNKNOWN_DIGEST},
+  #else
+    {"UNKNOWN_DIGEST", 6, 161},
+  #endif
+  #ifdef EVP_R_UNKNOWN_OPTION
+    {"UNKNOWN_OPTION", ERR_LIB_EVP, EVP_R_UNKNOWN_OPTION},
+  #else
+    {"UNKNOWN_OPTION", 6, 169},
+  #endif
+  #ifdef EVP_R_UNKNOWN_PBE_ALGORITHM
+    {"UNKNOWN_PBE_ALGORITHM", ERR_LIB_EVP, EVP_R_UNKNOWN_PBE_ALGORITHM},
+  #else
+    {"UNKNOWN_PBE_ALGORITHM", 6, 121},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_ALGORITHM
+    {"UNSUPPORTED_ALGORITHM", ERR_LIB_EVP, EVP_R_UNSUPPORTED_ALGORITHM},
+  #else
+    {"UNSUPPORTED_ALGORITHM", 6, 156},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_CIPHER
+    {"UNSUPPORTED_CIPHER", ERR_LIB_EVP, EVP_R_UNSUPPORTED_CIPHER},
+  #else
+    {"UNSUPPORTED_CIPHER", 6, 107},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_KEYLENGTH
+    {"UNSUPPORTED_KEYLENGTH", ERR_LIB_EVP, EVP_R_UNSUPPORTED_KEYLENGTH},
+  #else
+    {"UNSUPPORTED_KEYLENGTH", 6, 123},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION
+    {"UNSUPPORTED_KEY_DERIVATION_FUNCTION", ERR_LIB_EVP, EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION},
+  #else
+    {"UNSUPPORTED_KEY_DERIVATION_FUNCTION", 6, 124},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_KEY_SIZE
+    {"UNSUPPORTED_KEY_SIZE", ERR_LIB_EVP, EVP_R_UNSUPPORTED_KEY_SIZE},
+  #else
+    {"UNSUPPORTED_KEY_SIZE", 6, 108},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS
+    {"UNSUPPORTED_NUMBER_OF_ROUNDS", ERR_LIB_EVP, EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS},
+  #else
+    {"UNSUPPORTED_NUMBER_OF_ROUNDS", 6, 135},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_PRF
+    {"UNSUPPORTED_PRF", ERR_LIB_EVP, EVP_R_UNSUPPORTED_PRF},
+  #else
+    {"UNSUPPORTED_PRF", 6, 125},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM
+    {"UNSUPPORTED_PRIVATE_KEY_ALGORITHM", ERR_LIB_EVP, EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM},
+  #else
+    {"UNSUPPORTED_PRIVATE_KEY_ALGORITHM", 6, 118},
+  #endif
+  #ifdef EVP_R_UNSUPPORTED_SALT_TYPE
+    {"UNSUPPORTED_SALT_TYPE", ERR_LIB_EVP, EVP_R_UNSUPPORTED_SALT_TYPE},
+  #else
+    {"UNSUPPORTED_SALT_TYPE", 6, 126},
+  #endif
+  #ifdef EVP_R_WRAP_MODE_NOT_ALLOWED
+    {"WRAP_MODE_NOT_ALLOWED", ERR_LIB_EVP, EVP_R_WRAP_MODE_NOT_ALLOWED},
+  #else
+    {"WRAP_MODE_NOT_ALLOWED", 6, 170},
+  #endif
+  #ifdef EVP_R_WRONG_FINAL_BLOCK_LENGTH
+    {"WRONG_FINAL_BLOCK_LENGTH", ERR_LIB_EVP, EVP_R_WRONG_FINAL_BLOCK_LENGTH},
+  #else
+    {"WRONG_FINAL_BLOCK_LENGTH", 6, 109},
+  #endif
+  #ifdef EVP_R_XTS_DUPLICATED_KEYS
+    {"XTS_DUPLICATED_KEYS", ERR_LIB_EVP, EVP_R_XTS_DUPLICATED_KEYS},
+  #else
+    {"XTS_DUPLICATED_KEYS", 6, 183},
+  #endif
+  #ifdef KDF_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_KDF, KDF_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 52, 100},
+  #endif
+  #ifdef KDF_R_MISSING_ITERATION_COUNT
+    {"MISSING_ITERATION_COUNT", ERR_LIB_KDF, KDF_R_MISSING_ITERATION_COUNT},
+  #else
+    {"MISSING_ITERATION_COUNT", 52, 109},
+  #endif
+  #ifdef KDF_R_MISSING_KEY
+    {"MISSING_KEY", ERR_LIB_KDF, KDF_R_MISSING_KEY},
+  #else
+    {"MISSING_KEY", 52, 104},
+  #endif
+  #ifdef KDF_R_MISSING_MESSAGE_DIGEST
+    {"MISSING_MESSAGE_DIGEST", ERR_LIB_KDF, KDF_R_MISSING_MESSAGE_DIGEST},
+  #else
+    {"MISSING_MESSAGE_DIGEST", 52, 105},
+  #endif
+  #ifdef KDF_R_MISSING_PARAMETER
+    {"MISSING_PARAMETER", ERR_LIB_KDF, KDF_R_MISSING_PARAMETER},
+  #else
+    {"MISSING_PARAMETER", 52, 101},
+  #endif
+  #ifdef KDF_R_MISSING_PASS
+    {"MISSING_PASS", ERR_LIB_KDF, KDF_R_MISSING_PASS},
+  #else
+    {"MISSING_PASS", 52, 110},
+  #endif
+  #ifdef KDF_R_MISSING_SALT
+    {"MISSING_SALT", ERR_LIB_KDF, KDF_R_MISSING_SALT},
+  #else
+    {"MISSING_SALT", 52, 111},
+  #endif
+  #ifdef KDF_R_MISSING_SECRET
+    {"MISSING_SECRET", ERR_LIB_KDF, KDF_R_MISSING_SECRET},
+  #else
+    {"MISSING_SECRET", 52, 107},
+  #endif
+  #ifdef KDF_R_MISSING_SEED
+    {"MISSING_SEED", ERR_LIB_KDF, KDF_R_MISSING_SEED},
+  #else
+    {"MISSING_SEED", 52, 106},
+  #endif
+  #ifdef KDF_R_UNKNOWN_PARAMETER_TYPE
+    {"UNKNOWN_PARAMETER_TYPE", ERR_LIB_KDF, KDF_R_UNKNOWN_PARAMETER_TYPE},
+  #else
+    {"UNKNOWN_PARAMETER_TYPE", 52, 103},
+  #endif
+  #ifdef KDF_R_VALUE_ERROR
+    {"VALUE_ERROR", ERR_LIB_KDF, KDF_R_VALUE_ERROR},
+  #else
+    {"VALUE_ERROR", 52, 108},
+  #endif
+  #ifdef KDF_R_VALUE_MISSING
+    {"VALUE_MISSING", ERR_LIB_KDF, KDF_R_VALUE_MISSING},
+  #else
+    {"VALUE_MISSING", 52, 102},
+  #endif
+  #ifdef OCSP_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_OCSP, OCSP_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 39, 101},
+  #endif
+  #ifdef OCSP_R_DIGEST_ERR
+    {"DIGEST_ERR", ERR_LIB_OCSP, OCSP_R_DIGEST_ERR},
+  #else
+    {"DIGEST_ERR", 39, 102},
+  #endif
+  #ifdef OCSP_R_ERROR_IN_NEXTUPDATE_FIELD
+    {"ERROR_IN_NEXTUPDATE_FIELD", ERR_LIB_OCSP, OCSP_R_ERROR_IN_NEXTUPDATE_FIELD},
+  #else
+    {"ERROR_IN_NEXTUPDATE_FIELD", 39, 122},
+  #endif
+  #ifdef OCSP_R_ERROR_IN_THISUPDATE_FIELD
+    {"ERROR_IN_THISUPDATE_FIELD", ERR_LIB_OCSP, OCSP_R_ERROR_IN_THISUPDATE_FIELD},
+  #else
+    {"ERROR_IN_THISUPDATE_FIELD", 39, 123},
+  #endif
+  #ifdef OCSP_R_ERROR_PARSING_URL
+    {"ERROR_PARSING_URL", ERR_LIB_OCSP, OCSP_R_ERROR_PARSING_URL},
+  #else
+    {"ERROR_PARSING_URL", 39, 121},
+  #endif
+  #ifdef OCSP_R_MISSING_OCSPSIGNING_USAGE
+    {"MISSING_OCSPSIGNING_USAGE", ERR_LIB_OCSP, OCSP_R_MISSING_OCSPSIGNING_USAGE},
+  #else
+    {"MISSING_OCSPSIGNING_USAGE", 39, 103},
+  #endif
+  #ifdef OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE
+    {"NEXTUPDATE_BEFORE_THISUPDATE", ERR_LIB_OCSP, OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE},
+  #else
+    {"NEXTUPDATE_BEFORE_THISUPDATE", 39, 124},
+  #endif
+  #ifdef OCSP_R_NOT_BASIC_RESPONSE
+    {"NOT_BASIC_RESPONSE", ERR_LIB_OCSP, OCSP_R_NOT_BASIC_RESPONSE},
+  #else
+    {"NOT_BASIC_RESPONSE", 39, 104},
+  #endif
+  #ifdef OCSP_R_NO_CERTIFICATES_IN_CHAIN
+    {"NO_CERTIFICATES_IN_CHAIN", ERR_LIB_OCSP, OCSP_R_NO_CERTIFICATES_IN_CHAIN},
+  #else
+    {"NO_CERTIFICATES_IN_CHAIN", 39, 105},
+  #endif
+  #ifdef OCSP_R_NO_RESPONSE_DATA
+    {"NO_RESPONSE_DATA", ERR_LIB_OCSP, OCSP_R_NO_RESPONSE_DATA},
+  #else
+    {"NO_RESPONSE_DATA", 39, 108},
+  #endif
+  #ifdef OCSP_R_NO_REVOKED_TIME
+    {"NO_REVOKED_TIME", ERR_LIB_OCSP, OCSP_R_NO_REVOKED_TIME},
+  #else
+    {"NO_REVOKED_TIME", 39, 109},
+  #endif
+  #ifdef OCSP_R_NO_SIGNER_KEY
+    {"NO_SIGNER_KEY", ERR_LIB_OCSP, OCSP_R_NO_SIGNER_KEY},
+  #else
+    {"NO_SIGNER_KEY", 39, 130},
+  #endif
+  #ifdef OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_OCSP, OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 39, 110},
+  #endif
+  #ifdef OCSP_R_REQUEST_NOT_SIGNED
+    {"REQUEST_NOT_SIGNED", ERR_LIB_OCSP, OCSP_R_REQUEST_NOT_SIGNED},
+  #else
+    {"REQUEST_NOT_SIGNED", 39, 128},
+  #endif
+  #ifdef OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA
+    {"RESPONSE_CONTAINS_NO_REVOCATION_DATA", ERR_LIB_OCSP, OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA},
+  #else
+    {"RESPONSE_CONTAINS_NO_REVOCATION_DATA", 39, 111},
+  #endif
+  #ifdef OCSP_R_ROOT_CA_NOT_TRUSTED
+    {"ROOT_CA_NOT_TRUSTED", ERR_LIB_OCSP, OCSP_R_ROOT_CA_NOT_TRUSTED},
+  #else
+    {"ROOT_CA_NOT_TRUSTED", 39, 112},
+  #endif
+  #ifdef OCSP_R_SERVER_RESPONSE_ERROR
+    {"SERVER_RESPONSE_ERROR", ERR_LIB_OCSP, OCSP_R_SERVER_RESPONSE_ERROR},
+  #else
+    {"SERVER_RESPONSE_ERROR", 39, 114},
+  #endif
+  #ifdef OCSP_R_SERVER_RESPONSE_PARSE_ERROR
+    {"SERVER_RESPONSE_PARSE_ERROR", ERR_LIB_OCSP, OCSP_R_SERVER_RESPONSE_PARSE_ERROR},
+  #else
+    {"SERVER_RESPONSE_PARSE_ERROR", 39, 115},
+  #endif
+  #ifdef OCSP_R_SIGNATURE_FAILURE
+    {"SIGNATURE_FAILURE", ERR_LIB_OCSP, OCSP_R_SIGNATURE_FAILURE},
+  #else
+    {"SIGNATURE_FAILURE", 39, 117},
+  #endif
+  #ifdef OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND
+    {"SIGNER_CERTIFICATE_NOT_FOUND", ERR_LIB_OCSP, OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND},
+  #else
+    {"SIGNER_CERTIFICATE_NOT_FOUND", 39, 118},
+  #endif
+  #ifdef OCSP_R_STATUS_EXPIRED
+    {"STATUS_EXPIRED", ERR_LIB_OCSP, OCSP_R_STATUS_EXPIRED},
+  #else
+    {"STATUS_EXPIRED", 39, 125},
+  #endif
+  #ifdef OCSP_R_STATUS_NOT_YET_VALID
+    {"STATUS_NOT_YET_VALID", ERR_LIB_OCSP, OCSP_R_STATUS_NOT_YET_VALID},
+  #else
+    {"STATUS_NOT_YET_VALID", 39, 126},
+  #endif
+  #ifdef OCSP_R_STATUS_TOO_OLD
+    {"STATUS_TOO_OLD", ERR_LIB_OCSP, OCSP_R_STATUS_TOO_OLD},
+  #else
+    {"STATUS_TOO_OLD", 39, 127},
+  #endif
+  #ifdef OCSP_R_UNKNOWN_MESSAGE_DIGEST
+    {"UNKNOWN_MESSAGE_DIGEST", ERR_LIB_OCSP, OCSP_R_UNKNOWN_MESSAGE_DIGEST},
+  #else
+    {"UNKNOWN_MESSAGE_DIGEST", 39, 119},
+  #endif
+  #ifdef OCSP_R_UNKNOWN_NID
+    {"UNKNOWN_NID", ERR_LIB_OCSP, OCSP_R_UNKNOWN_NID},
+  #else
+    {"UNKNOWN_NID", 39, 120},
+  #endif
+  #ifdef OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE
+    {"UNSUPPORTED_REQUESTORNAME_TYPE", ERR_LIB_OCSP, OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE},
+  #else
+    {"UNSUPPORTED_REQUESTORNAME_TYPE", 39, 129},
+  #endif
+  #ifdef PEM_R_BAD_BASE64_DECODE
+    {"BAD_BASE64_DECODE", ERR_LIB_PEM, PEM_R_BAD_BASE64_DECODE},
+  #else
+    {"BAD_BASE64_DECODE", 9, 100},
+  #endif
+  #ifdef PEM_R_BAD_DECRYPT
+    {"BAD_DECRYPT", ERR_LIB_PEM, PEM_R_BAD_DECRYPT},
+  #else
+    {"BAD_DECRYPT", 9, 101},
+  #endif
+  #ifdef PEM_R_BAD_END_LINE
+    {"BAD_END_LINE", ERR_LIB_PEM, PEM_R_BAD_END_LINE},
+  #else
+    {"BAD_END_LINE", 9, 102},
+  #endif
+  #ifdef PEM_R_BAD_IV_CHARS
+    {"BAD_IV_CHARS", ERR_LIB_PEM, PEM_R_BAD_IV_CHARS},
+  #else
+    {"BAD_IV_CHARS", 9, 103},
+  #endif
+  #ifdef PEM_R_BAD_MAGIC_NUMBER
+    {"BAD_MAGIC_NUMBER", ERR_LIB_PEM, PEM_R_BAD_MAGIC_NUMBER},
+  #else
+    {"BAD_MAGIC_NUMBER", 9, 116},
+  #endif
+  #ifdef PEM_R_BAD_PASSWORD_READ
+    {"BAD_PASSWORD_READ", ERR_LIB_PEM, PEM_R_BAD_PASSWORD_READ},
+  #else
+    {"BAD_PASSWORD_READ", 9, 104},
+  #endif
+  #ifdef PEM_R_BAD_VERSION_NUMBER
+    {"BAD_VERSION_NUMBER", ERR_LIB_PEM, PEM_R_BAD_VERSION_NUMBER},
+  #else
+    {"BAD_VERSION_NUMBER", 9, 117},
+  #endif
+  #ifdef PEM_R_BIO_WRITE_FAILURE
+    {"BIO_WRITE_FAILURE", ERR_LIB_PEM, PEM_R_BIO_WRITE_FAILURE},
+  #else
+    {"BIO_WRITE_FAILURE", 9, 118},
+  #endif
+  #ifdef PEM_R_CIPHER_IS_NULL
+    {"CIPHER_IS_NULL", ERR_LIB_PEM, PEM_R_CIPHER_IS_NULL},
+  #else
+    {"CIPHER_IS_NULL", 9, 127},
+  #endif
+  #ifdef PEM_R_ERROR_CONVERTING_PRIVATE_KEY
+    {"ERROR_CONVERTING_PRIVATE_KEY", ERR_LIB_PEM, PEM_R_ERROR_CONVERTING_PRIVATE_KEY},
+  #else
+    {"ERROR_CONVERTING_PRIVATE_KEY", 9, 115},
+  #endif
+  #ifdef PEM_R_EXPECTING_PRIVATE_KEY_BLOB
+    {"EXPECTING_PRIVATE_KEY_BLOB", ERR_LIB_PEM, PEM_R_EXPECTING_PRIVATE_KEY_BLOB},
+  #else
+    {"EXPECTING_PRIVATE_KEY_BLOB", 9, 119},
+  #endif
+  #ifdef PEM_R_EXPECTING_PUBLIC_KEY_BLOB
+    {"EXPECTING_PUBLIC_KEY_BLOB", ERR_LIB_PEM, PEM_R_EXPECTING_PUBLIC_KEY_BLOB},
+  #else
+    {"EXPECTING_PUBLIC_KEY_BLOB", 9, 120},
+  #endif
+  #ifdef PEM_R_HEADER_TOO_LONG
+    {"HEADER_TOO_LONG", ERR_LIB_PEM, PEM_R_HEADER_TOO_LONG},
+  #else
+    {"HEADER_TOO_LONG", 9, 128},
+  #endif
+  #ifdef PEM_R_INCONSISTENT_HEADER
+    {"INCONSISTENT_HEADER", ERR_LIB_PEM, PEM_R_INCONSISTENT_HEADER},
+  #else
+    {"INCONSISTENT_HEADER", 9, 121},
+  #endif
+  #ifdef PEM_R_KEYBLOB_HEADER_PARSE_ERROR
+    {"KEYBLOB_HEADER_PARSE_ERROR", ERR_LIB_PEM, PEM_R_KEYBLOB_HEADER_PARSE_ERROR},
+  #else
+    {"KEYBLOB_HEADER_PARSE_ERROR", 9, 122},
+  #endif
+  #ifdef PEM_R_KEYBLOB_TOO_SHORT
+    {"KEYBLOB_TOO_SHORT", ERR_LIB_PEM, PEM_R_KEYBLOB_TOO_SHORT},
+  #else
+    {"KEYBLOB_TOO_SHORT", 9, 123},
+  #endif
+  #ifdef PEM_R_MISSING_DEK_IV
+    {"MISSING_DEK_IV", ERR_LIB_PEM, PEM_R_MISSING_DEK_IV},
+  #else
+    {"MISSING_DEK_IV", 9, 129},
+  #endif
+  #ifdef PEM_R_NOT_DEK_INFO
+    {"NOT_DEK_INFO", ERR_LIB_PEM, PEM_R_NOT_DEK_INFO},
+  #else
+    {"NOT_DEK_INFO", 9, 105},
+  #endif
+  #ifdef PEM_R_NOT_ENCRYPTED
+    {"NOT_ENCRYPTED", ERR_LIB_PEM, PEM_R_NOT_ENCRYPTED},
+  #else
+    {"NOT_ENCRYPTED", 9, 106},
+  #endif
+  #ifdef PEM_R_NOT_PROC_TYPE
+    {"NOT_PROC_TYPE", ERR_LIB_PEM, PEM_R_NOT_PROC_TYPE},
+  #else
+    {"NOT_PROC_TYPE", 9, 107},
+  #endif
+  #ifdef PEM_R_NO_START_LINE
+    {"NO_START_LINE", ERR_LIB_PEM, PEM_R_NO_START_LINE},
+  #else
+    {"NO_START_LINE", 9, 108},
+  #endif
+  #ifdef PEM_R_PROBLEMS_GETTING_PASSWORD
+    {"PROBLEMS_GETTING_PASSWORD", ERR_LIB_PEM, PEM_R_PROBLEMS_GETTING_PASSWORD},
+  #else
+    {"PROBLEMS_GETTING_PASSWORD", 9, 109},
+  #endif
+  #ifdef PEM_R_PUBLIC_KEY_NO_RSA
+    {"PUBLIC_KEY_NO_RSA", ERR_LIB_PEM, PEM_R_PUBLIC_KEY_NO_RSA},
+  #else
+    {"PUBLIC_KEY_NO_RSA", 9, 110},
+  #endif
+  #ifdef PEM_R_PVK_DATA_TOO_SHORT
+    {"PVK_DATA_TOO_SHORT", ERR_LIB_PEM, PEM_R_PVK_DATA_TOO_SHORT},
+  #else
+    {"PVK_DATA_TOO_SHORT", 9, 124},
+  #endif
+  #ifdef PEM_R_PVK_TOO_SHORT
+    {"PVK_TOO_SHORT", ERR_LIB_PEM, PEM_R_PVK_TOO_SHORT},
+  #else
+    {"PVK_TOO_SHORT", 9, 125},
+  #endif
+  #ifdef PEM_R_READ_KEY
+    {"READ_KEY", ERR_LIB_PEM, PEM_R_READ_KEY},
+  #else
+    {"READ_KEY", 9, 111},
+  #endif
+  #ifdef PEM_R_SHORT_HEADER
+    {"SHORT_HEADER", ERR_LIB_PEM, PEM_R_SHORT_HEADER},
+  #else
+    {"SHORT_HEADER", 9, 112},
+  #endif
+  #ifdef PEM_R_UNEXPECTED_DEK_IV
+    {"UNEXPECTED_DEK_IV", ERR_LIB_PEM, PEM_R_UNEXPECTED_DEK_IV},
+  #else
+    {"UNEXPECTED_DEK_IV", 9, 130},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_CIPHER
+    {"UNSUPPORTED_CIPHER", ERR_LIB_PEM, PEM_R_UNSUPPORTED_CIPHER},
+  #else
+    {"UNSUPPORTED_CIPHER", 9, 113},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_ENCRYPTION
+    {"UNSUPPORTED_ENCRYPTION", ERR_LIB_PEM, PEM_R_UNSUPPORTED_ENCRYPTION},
+  #else
+    {"UNSUPPORTED_ENCRYPTION", 9, 114},
+  #endif
+  #ifdef PEM_R_UNSUPPORTED_KEY_COMPONENTS
+    {"UNSUPPORTED_KEY_COMPONENTS", ERR_LIB_PEM, PEM_R_UNSUPPORTED_KEY_COMPONENTS},
+  #else
+    {"UNSUPPORTED_KEY_COMPONENTS", 9, 126},
+  #endif
+  #ifdef PKCS12_R_CANT_PACK_STRUCTURE
+    {"CANT_PACK_STRUCTURE", ERR_LIB_PKCS12, PKCS12_R_CANT_PACK_STRUCTURE},
+  #else
+    {"CANT_PACK_STRUCTURE", 35, 100},
+  #endif
+  #ifdef PKCS12_R_CONTENT_TYPE_NOT_DATA
+    {"CONTENT_TYPE_NOT_DATA", ERR_LIB_PKCS12, PKCS12_R_CONTENT_TYPE_NOT_DATA},
+  #else
+    {"CONTENT_TYPE_NOT_DATA", 35, 121},
+  #endif
+  #ifdef PKCS12_R_DECODE_ERROR
+    {"DECODE_ERROR", ERR_LIB_PKCS12, PKCS12_R_DECODE_ERROR},
+  #else
+    {"DECODE_ERROR", 35, 101},
+  #endif
+  #ifdef PKCS12_R_ENCODE_ERROR
+    {"ENCODE_ERROR", ERR_LIB_PKCS12, PKCS12_R_ENCODE_ERROR},
+  #else
+    {"ENCODE_ERROR", 35, 102},
+  #endif
+  #ifdef PKCS12_R_ENCRYPT_ERROR
+    {"ENCRYPT_ERROR", ERR_LIB_PKCS12, PKCS12_R_ENCRYPT_ERROR},
+  #else
+    {"ENCRYPT_ERROR", 35, 103},
+  #endif
+  #ifdef PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE
+    {"ERROR_SETTING_ENCRYPTED_DATA_TYPE", ERR_LIB_PKCS12, PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE},
+  #else
+    {"ERROR_SETTING_ENCRYPTED_DATA_TYPE", 35, 120},
+  #endif
+  #ifdef PKCS12_R_INVALID_NULL_ARGUMENT
+    {"INVALID_NULL_ARGUMENT", ERR_LIB_PKCS12, PKCS12_R_INVALID_NULL_ARGUMENT},
+  #else
+    {"INVALID_NULL_ARGUMENT", 35, 104},
+  #endif
+  #ifdef PKCS12_R_INVALID_NULL_PKCS12_POINTER
+    {"INVALID_NULL_PKCS12_POINTER", ERR_LIB_PKCS12, PKCS12_R_INVALID_NULL_PKCS12_POINTER},
+  #else
+    {"INVALID_NULL_PKCS12_POINTER", 35, 105},
+  #endif
+  #ifdef PKCS12_R_IV_GEN_ERROR
+    {"IV_GEN_ERROR", ERR_LIB_PKCS12, PKCS12_R_IV_GEN_ERROR},
+  #else
+    {"IV_GEN_ERROR", 35, 106},
+  #endif
+  #ifdef PKCS12_R_KEY_GEN_ERROR
+    {"KEY_GEN_ERROR", ERR_LIB_PKCS12, PKCS12_R_KEY_GEN_ERROR},
+  #else
+    {"KEY_GEN_ERROR", 35, 107},
+  #endif
+  #ifdef PKCS12_R_MAC_ABSENT
+    {"MAC_ABSENT", ERR_LIB_PKCS12, PKCS12_R_MAC_ABSENT},
+  #else
+    {"MAC_ABSENT", 35, 108},
+  #endif
+  #ifdef PKCS12_R_MAC_GENERATION_ERROR
+    {"MAC_GENERATION_ERROR", ERR_LIB_PKCS12, PKCS12_R_MAC_GENERATION_ERROR},
+  #else
+    {"MAC_GENERATION_ERROR", 35, 109},
+  #endif
+  #ifdef PKCS12_R_MAC_SETUP_ERROR
+    {"MAC_SETUP_ERROR", ERR_LIB_PKCS12, PKCS12_R_MAC_SETUP_ERROR},
+  #else
+    {"MAC_SETUP_ERROR", 35, 110},
+  #endif
+  #ifdef PKCS12_R_MAC_STRING_SET_ERROR
+    {"MAC_STRING_SET_ERROR", ERR_LIB_PKCS12, PKCS12_R_MAC_STRING_SET_ERROR},
+  #else
+    {"MAC_STRING_SET_ERROR", 35, 111},
+  #endif
+  #ifdef PKCS12_R_MAC_VERIFY_FAILURE
+    {"MAC_VERIFY_FAILURE", ERR_LIB_PKCS12, PKCS12_R_MAC_VERIFY_FAILURE},
+  #else
+    {"MAC_VERIFY_FAILURE", 35, 113},
+  #endif
+  #ifdef PKCS12_R_PARSE_ERROR
+    {"PARSE_ERROR", ERR_LIB_PKCS12, PKCS12_R_PARSE_ERROR},
+  #else
+    {"PARSE_ERROR", 35, 114},
+  #endif
+  #ifdef PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR
+    {"PKCS12_ALGOR_CIPHERINIT_ERROR", ERR_LIB_PKCS12, PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR},
+  #else
+    {"PKCS12_ALGOR_CIPHERINIT_ERROR", 35, 115},
+  #endif
+  #ifdef PKCS12_R_PKCS12_CIPHERFINAL_ERROR
+    {"PKCS12_CIPHERFINAL_ERROR", ERR_LIB_PKCS12, PKCS12_R_PKCS12_CIPHERFINAL_ERROR},
+  #else
+    {"PKCS12_CIPHERFINAL_ERROR", 35, 116},
+  #endif
+  #ifdef PKCS12_R_PKCS12_PBE_CRYPT_ERROR
+    {"PKCS12_PBE_CRYPT_ERROR", ERR_LIB_PKCS12, PKCS12_R_PKCS12_PBE_CRYPT_ERROR},
+  #else
+    {"PKCS12_PBE_CRYPT_ERROR", 35, 117},
+  #endif
+  #ifdef PKCS12_R_UNKNOWN_DIGEST_ALGORITHM
+    {"UNKNOWN_DIGEST_ALGORITHM", ERR_LIB_PKCS12, PKCS12_R_UNKNOWN_DIGEST_ALGORITHM},
+  #else
+    {"UNKNOWN_DIGEST_ALGORITHM", 35, 118},
+  #endif
+  #ifdef PKCS12_R_UNSUPPORTED_PKCS12_MODE
+    {"UNSUPPORTED_PKCS12_MODE", ERR_LIB_PKCS12, PKCS12_R_UNSUPPORTED_PKCS12_MODE},
+  #else
+    {"UNSUPPORTED_PKCS12_MODE", 35, 119},
+  #endif
+  #ifdef PKCS7_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_PKCS7, PKCS7_R_CERTIFICATE_VERIFY_ERROR},
+  #else
+    {"CERTIFICATE_VERIFY_ERROR", 33, 117},
+  #endif
+  #ifdef PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", ERR_LIB_PKCS7, PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER},
+  #else
+    {"CIPHER_HAS_NO_OBJECT_IDENTIFIER", 33, 144},
+  #endif
+  #ifdef PKCS7_R_CIPHER_NOT_INITIALIZED
+    {"CIPHER_NOT_INITIALIZED", ERR_LIB_PKCS7, PKCS7_R_CIPHER_NOT_INITIALIZED},
+  #else
+    {"CIPHER_NOT_INITIALIZED", 33, 116},
+  #endif
+  #ifdef PKCS7_R_CONTENT_AND_DATA_PRESENT
+    {"CONTENT_AND_DATA_PRESENT", ERR_LIB_PKCS7, PKCS7_R_CONTENT_AND_DATA_PRESENT},
+  #else
+    {"CONTENT_AND_DATA_PRESENT", 33, 118},
+  #endif
+  #ifdef PKCS7_R_CTRL_ERROR
+    {"CTRL_ERROR", ERR_LIB_PKCS7, PKCS7_R_CTRL_ERROR},
+  #else
+    {"CTRL_ERROR", 33, 152},
+  #endif
+  #ifdef PKCS7_R_DECRYPT_ERROR
+    {"DECRYPT_ERROR", ERR_LIB_PKCS7, PKCS7_R_DECRYPT_ERROR},
+  #else
+    {"DECRYPT_ERROR", 33, 119},
+  #endif
+  #ifdef PKCS7_R_DIGEST_FAILURE
+    {"DIGEST_FAILURE", ERR_LIB_PKCS7, PKCS7_R_DIGEST_FAILURE},
+  #else
+    {"DIGEST_FAILURE", 33, 101},
+  #endif
+  #ifdef PKCS7_R_ENCRYPTION_CTRL_FAILURE
+    {"ENCRYPTION_CTRL_FAILURE", ERR_LIB_PKCS7, PKCS7_R_ENCRYPTION_CTRL_FAILURE},
+  #else
+    {"ENCRYPTION_CTRL_FAILURE", 33, 149},
+  #endif
+  #ifdef PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE
+    {"ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", ERR_LIB_PKCS7, PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE},
+  #else
+    {"ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", 33, 150},
+  #endif
+  #ifdef PKCS7_R_ERROR_ADDING_RECIPIENT
+    {"ERROR_ADDING_RECIPIENT", ERR_LIB_PKCS7, PKCS7_R_ERROR_ADDING_RECIPIENT},
+  #else
+    {"ERROR_ADDING_RECIPIENT", 33, 120},
+  #endif
+  #ifdef PKCS7_R_ERROR_SETTING_CIPHER
+    {"ERROR_SETTING_CIPHER", ERR_LIB_PKCS7, PKCS7_R_ERROR_SETTING_CIPHER},
+  #else
+    {"ERROR_SETTING_CIPHER", 33, 121},
+  #endif
+  #ifdef PKCS7_R_INVALID_NULL_POINTER
+    {"INVALID_NULL_POINTER", ERR_LIB_PKCS7, PKCS7_R_INVALID_NULL_POINTER},
+  #else
+    {"INVALID_NULL_POINTER", 33, 143},
+  #endif
+  #ifdef PKCS7_R_INVALID_SIGNED_DATA_TYPE
+    {"INVALID_SIGNED_DATA_TYPE", ERR_LIB_PKCS7, PKCS7_R_INVALID_SIGNED_DATA_TYPE},
+  #else
+    {"INVALID_SIGNED_DATA_TYPE", 33, 155},
+  #endif
+  #ifdef PKCS7_R_NO_CONTENT
+    {"NO_CONTENT", ERR_LIB_PKCS7, PKCS7_R_NO_CONTENT},
+  #else
+    {"NO_CONTENT", 33, 122},
+  #endif
+  #ifdef PKCS7_R_NO_DEFAULT_DIGEST
+    {"NO_DEFAULT_DIGEST", ERR_LIB_PKCS7, PKCS7_R_NO_DEFAULT_DIGEST},
+  #else
+    {"NO_DEFAULT_DIGEST", 33, 151},
+  #endif
+  #ifdef PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND
+    {"NO_MATCHING_DIGEST_TYPE_FOUND", ERR_LIB_PKCS7, PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND},
+  #else
+    {"NO_MATCHING_DIGEST_TYPE_FOUND", 33, 154},
+  #endif
+  #ifdef PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE
+    {"NO_RECIPIENT_MATCHES_CERTIFICATE", ERR_LIB_PKCS7, PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE},
+  #else
+    {"NO_RECIPIENT_MATCHES_CERTIFICATE", 33, 115},
+  #endif
+  #ifdef PKCS7_R_NO_SIGNATURES_ON_DATA
+    {"NO_SIGNATURES_ON_DATA", ERR_LIB_PKCS7, PKCS7_R_NO_SIGNATURES_ON_DATA},
+  #else
+    {"NO_SIGNATURES_ON_DATA", 33, 123},
+  #endif
+  #ifdef PKCS7_R_NO_SIGNERS
+    {"NO_SIGNERS", ERR_LIB_PKCS7, PKCS7_R_NO_SIGNERS},
+  #else
+    {"NO_SIGNERS", 33, 142},
+  #endif
+  #ifdef PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE
+    {"OPERATION_NOT_SUPPORTED_ON_THIS_TYPE", ERR_LIB_PKCS7, PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE},
+  #else
+    {"OPERATION_NOT_SUPPORTED_ON_THIS_TYPE", 33, 104},
+  #endif
+  #ifdef PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR
+    {"PKCS7_ADD_SIGNATURE_ERROR", ERR_LIB_PKCS7, PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR},
+  #else
+    {"PKCS7_ADD_SIGNATURE_ERROR", 33, 124},
+  #endif
+  #ifdef PKCS7_R_PKCS7_ADD_SIGNER_ERROR
+    {"PKCS7_ADD_SIGNER_ERROR", ERR_LIB_PKCS7, PKCS7_R_PKCS7_ADD_SIGNER_ERROR},
+  #else
+    {"PKCS7_ADD_SIGNER_ERROR", 33, 153},
+  #endif
+  #ifdef PKCS7_R_PKCS7_DATASIGN
+    {"PKCS7_DATASIGN", ERR_LIB_PKCS7, PKCS7_R_PKCS7_DATASIGN},
+  #else
+    {"PKCS7_DATASIGN", 33, 145},
+  #endif
+  #ifdef PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_PKCS7, PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
+  #else
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 33, 127},
+  #endif
+  #ifdef PKCS7_R_SIGNATURE_FAILURE
+    {"SIGNATURE_FAILURE", ERR_LIB_PKCS7, PKCS7_R_SIGNATURE_FAILURE},
+  #else
+    {"SIGNATURE_FAILURE", 33, 105},
+  #endif
+  #ifdef PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND
+    {"SIGNER_CERTIFICATE_NOT_FOUND", ERR_LIB_PKCS7, PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND},
+  #else
+    {"SIGNER_CERTIFICATE_NOT_FOUND", 33, 128},
+  #endif
+  #ifdef PKCS7_R_SIGNING_CTRL_FAILURE
+    {"SIGNING_CTRL_FAILURE", ERR_LIB_PKCS7, PKCS7_R_SIGNING_CTRL_FAILURE},
+  #else
+    {"SIGNING_CTRL_FAILURE", 33, 147},
+  #endif
+  #ifdef PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE
+    {"SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", ERR_LIB_PKCS7, PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE},
+  #else
+    {"SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE", 33, 148},
+  #endif
+  #ifdef PKCS7_R_SMIME_TEXT_ERROR
+    {"SMIME_TEXT_ERROR", ERR_LIB_PKCS7, PKCS7_R_SMIME_TEXT_ERROR},
+  #else
+    {"SMIME_TEXT_ERROR", 33, 129},
+  #endif
+  #ifdef PKCS7_R_UNABLE_TO_FIND_CERTIFICATE
+    {"UNABLE_TO_FIND_CERTIFICATE", ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_CERTIFICATE},
+  #else
+    {"UNABLE_TO_FIND_CERTIFICATE", 33, 106},
+  #endif
+  #ifdef PKCS7_R_UNABLE_TO_FIND_MEM_BIO
+    {"UNABLE_TO_FIND_MEM_BIO", ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_MEM_BIO},
+  #else
+    {"UNABLE_TO_FIND_MEM_BIO", 33, 107},
+  #endif
+  #ifdef PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST
+    {"UNABLE_TO_FIND_MESSAGE_DIGEST", ERR_LIB_PKCS7, PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST},
+  #else
+    {"UNABLE_TO_FIND_MESSAGE_DIGEST", 33, 108},
+  #endif
+  #ifdef PKCS7_R_UNKNOWN_DIGEST_TYPE
+    {"UNKNOWN_DIGEST_TYPE", ERR_LIB_PKCS7, PKCS7_R_UNKNOWN_DIGEST_TYPE},
+  #else
+    {"UNKNOWN_DIGEST_TYPE", 33, 109},
+  #endif
+  #ifdef PKCS7_R_UNKNOWN_OPERATION
+    {"UNKNOWN_OPERATION", ERR_LIB_PKCS7, PKCS7_R_UNKNOWN_OPERATION},
+  #else
+    {"UNKNOWN_OPERATION", 33, 110},
+  #endif
+  #ifdef PKCS7_R_UNSUPPORTED_CIPHER_TYPE
+    {"UNSUPPORTED_CIPHER_TYPE", ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CIPHER_TYPE},
+  #else
+    {"UNSUPPORTED_CIPHER_TYPE", 33, 111},
+  #endif
+  #ifdef PKCS7_R_UNSUPPORTED_CONTENT_TYPE
+    {"UNSUPPORTED_CONTENT_TYPE", ERR_LIB_PKCS7, PKCS7_R_UNSUPPORTED_CONTENT_TYPE},
+  #else
+    {"UNSUPPORTED_CONTENT_TYPE", 33, 112},
+  #endif
+  #ifdef PKCS7_R_WRONG_CONTENT_TYPE
+    {"WRONG_CONTENT_TYPE", ERR_LIB_PKCS7, PKCS7_R_WRONG_CONTENT_TYPE},
+  #else
+    {"WRONG_CONTENT_TYPE", 33, 113},
+  #endif
+  #ifdef PKCS7_R_WRONG_PKCS7_TYPE
+    {"WRONG_PKCS7_TYPE", ERR_LIB_PKCS7, PKCS7_R_WRONG_PKCS7_TYPE},
+  #else
+    {"WRONG_PKCS7_TYPE", 33, 114},
+  #endif
+  #ifdef RAND_R_ADDITIONAL_INPUT_TOO_LONG
+    {"ADDITIONAL_INPUT_TOO_LONG", ERR_LIB_RAND, RAND_R_ADDITIONAL_INPUT_TOO_LONG},
+  #else
+    {"ADDITIONAL_INPUT_TOO_LONG", 36, 102},
+  #endif
+  #ifdef RAND_R_ALREADY_INSTANTIATED
+    {"ALREADY_INSTANTIATED", ERR_LIB_RAND, RAND_R_ALREADY_INSTANTIATED},
+  #else
+    {"ALREADY_INSTANTIATED", 36, 103},
+  #endif
+  #ifdef RAND_R_ARGUMENT_OUT_OF_RANGE
+    {"ARGUMENT_OUT_OF_RANGE", ERR_LIB_RAND, RAND_R_ARGUMENT_OUT_OF_RANGE},
+  #else
+    {"ARGUMENT_OUT_OF_RANGE", 36, 105},
+  #endif
+  #ifdef RAND_R_CANNOT_OPEN_FILE
+    {"CANNOT_OPEN_FILE", ERR_LIB_RAND, RAND_R_CANNOT_OPEN_FILE},
+  #else
+    {"CANNOT_OPEN_FILE", 36, 121},
+  #endif
+  #ifdef RAND_R_DRBG_ALREADY_INITIALIZED
+    {"DRBG_ALREADY_INITIALIZED", ERR_LIB_RAND, RAND_R_DRBG_ALREADY_INITIALIZED},
+  #else
+    {"DRBG_ALREADY_INITIALIZED", 36, 129},
+  #endif
+  #ifdef RAND_R_DRBG_NOT_INITIALISED
+    {"DRBG_NOT_INITIALISED", ERR_LIB_RAND, RAND_R_DRBG_NOT_INITIALISED},
+  #else
+    {"DRBG_NOT_INITIALISED", 36, 104},
+  #endif
+  #ifdef RAND_R_ENTROPY_INPUT_TOO_LONG
+    {"ENTROPY_INPUT_TOO_LONG", ERR_LIB_RAND, RAND_R_ENTROPY_INPUT_TOO_LONG},
+  #else
+    {"ENTROPY_INPUT_TOO_LONG", 36, 106},
+  #endif
+  #ifdef RAND_R_ENTROPY_OUT_OF_RANGE
+    {"ENTROPY_OUT_OF_RANGE", ERR_LIB_RAND, RAND_R_ENTROPY_OUT_OF_RANGE},
+  #else
+    {"ENTROPY_OUT_OF_RANGE", 36, 124},
+  #endif
+  #ifdef RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED
+    {"ERROR_ENTROPY_POOL_WAS_IGNORED", ERR_LIB_RAND, RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED},
+  #else
+    {"ERROR_ENTROPY_POOL_WAS_IGNORED", 36, 127},
+  #endif
+  #ifdef RAND_R_ERROR_INITIALISING_DRBG
+    {"ERROR_INITIALISING_DRBG", ERR_LIB_RAND, RAND_R_ERROR_INITIALISING_DRBG},
+  #else
+    {"ERROR_INITIALISING_DRBG", 36, 107},
+  #endif
+  #ifdef RAND_R_ERROR_INSTANTIATING_DRBG
+    {"ERROR_INSTANTIATING_DRBG", ERR_LIB_RAND, RAND_R_ERROR_INSTANTIATING_DRBG},
+  #else
+    {"ERROR_INSTANTIATING_DRBG", 36, 108},
+  #endif
+  #ifdef RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT
+    {"ERROR_RETRIEVING_ADDITIONAL_INPUT", ERR_LIB_RAND, RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT},
+  #else
+    {"ERROR_RETRIEVING_ADDITIONAL_INPUT", 36, 109},
+  #endif
+  #ifdef RAND_R_ERROR_RETRIEVING_ENTROPY
+    {"ERROR_RETRIEVING_ENTROPY", ERR_LIB_RAND, RAND_R_ERROR_RETRIEVING_ENTROPY},
+  #else
+    {"ERROR_RETRIEVING_ENTROPY", 36, 110},
+  #endif
+  #ifdef RAND_R_ERROR_RETRIEVING_NONCE
+    {"ERROR_RETRIEVING_NONCE", ERR_LIB_RAND, RAND_R_ERROR_RETRIEVING_NONCE},
+  #else
+    {"ERROR_RETRIEVING_NONCE", 36, 111},
+  #endif
+  #ifdef RAND_R_FAILED_TO_CREATE_LOCK
+    {"FAILED_TO_CREATE_LOCK", ERR_LIB_RAND, RAND_R_FAILED_TO_CREATE_LOCK},
+  #else
+    {"FAILED_TO_CREATE_LOCK", 36, 126},
+  #endif
+  #ifdef RAND_R_FUNC_NOT_IMPLEMENTED
+    {"FUNC_NOT_IMPLEMENTED", ERR_LIB_RAND, RAND_R_FUNC_NOT_IMPLEMENTED},
+  #else
+    {"FUNC_NOT_IMPLEMENTED", 36, 101},
+  #endif
+  #ifdef RAND_R_FWRITE_ERROR
+    {"FWRITE_ERROR", ERR_LIB_RAND, RAND_R_FWRITE_ERROR},
+  #else
+    {"FWRITE_ERROR", 36, 123},
+  #endif
+  #ifdef RAND_R_GENERATE_ERROR
+    {"GENERATE_ERROR", ERR_LIB_RAND, RAND_R_GENERATE_ERROR},
+  #else
+    {"GENERATE_ERROR", 36, 112},
+  #endif
+  #ifdef RAND_R_INTERNAL_ERROR
+    {"INTERNAL_ERROR", ERR_LIB_RAND, RAND_R_INTERNAL_ERROR},
+  #else
+    {"INTERNAL_ERROR", 36, 113},
+  #endif
+  #ifdef RAND_R_IN_ERROR_STATE
+    {"IN_ERROR_STATE", ERR_LIB_RAND, RAND_R_IN_ERROR_STATE},
+  #else
+    {"IN_ERROR_STATE", 36, 114},
+  #endif
+  #ifdef RAND_R_NOT_A_REGULAR_FILE
+    {"NOT_A_REGULAR_FILE", ERR_LIB_RAND, RAND_R_NOT_A_REGULAR_FILE},
+  #else
+    {"NOT_A_REGULAR_FILE", 36, 122},
+  #endif
+  #ifdef RAND_R_NOT_INSTANTIATED
+    {"NOT_INSTANTIATED", ERR_LIB_RAND, RAND_R_NOT_INSTANTIATED},
+  #else
+    {"NOT_INSTANTIATED", 36, 115},
+  #endif
+  #ifdef RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED
+    {"NO_DRBG_IMPLEMENTATION_SELECTED", ERR_LIB_RAND, RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED},
+  #else
+    {"NO_DRBG_IMPLEMENTATION_SELECTED", 36, 128},
+  #endif
+  #ifdef RAND_R_PARENT_LOCKING_NOT_ENABLED
+    {"PARENT_LOCKING_NOT_ENABLED", ERR_LIB_RAND, RAND_R_PARENT_LOCKING_NOT_ENABLED},
+  #else
+    {"PARENT_LOCKING_NOT_ENABLED", 36, 130},
+  #endif
+  #ifdef RAND_R_PARENT_STRENGTH_TOO_WEAK
+    {"PARENT_STRENGTH_TOO_WEAK", ERR_LIB_RAND, RAND_R_PARENT_STRENGTH_TOO_WEAK},
+  #else
+    {"PARENT_STRENGTH_TOO_WEAK", 36, 131},
+  #endif
+  #ifdef RAND_R_PERSONALISATION_STRING_TOO_LONG
+    {"PERSONALISATION_STRING_TOO_LONG", ERR_LIB_RAND, RAND_R_PERSONALISATION_STRING_TOO_LONG},
+  #else
+    {"PERSONALISATION_STRING_TOO_LONG", 36, 116},
+  #endif
+  #ifdef RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED
+    {"PREDICTION_RESISTANCE_NOT_SUPPORTED", ERR_LIB_RAND, RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED},
+  #else
+    {"PREDICTION_RESISTANCE_NOT_SUPPORTED", 36, 133},
+  #endif
+  #ifdef RAND_R_PRNG_NOT_SEEDED
+    {"PRNG_NOT_SEEDED", ERR_LIB_RAND, RAND_R_PRNG_NOT_SEEDED},
+  #else
+    {"PRNG_NOT_SEEDED", 36, 100},
+  #endif
+  #ifdef RAND_R_RANDOM_POOL_OVERFLOW
+    {"RANDOM_POOL_OVERFLOW", ERR_LIB_RAND, RAND_R_RANDOM_POOL_OVERFLOW},
+  #else
+    {"RANDOM_POOL_OVERFLOW", 36, 125},
+  #endif
+  #ifdef RAND_R_RANDOM_POOL_UNDERFLOW
+    {"RANDOM_POOL_UNDERFLOW", ERR_LIB_RAND, RAND_R_RANDOM_POOL_UNDERFLOW},
+  #else
+    {"RANDOM_POOL_UNDERFLOW", 36, 134},
+  #endif
+  #ifdef RAND_R_REQUEST_TOO_LARGE_FOR_DRBG
+    {"REQUEST_TOO_LARGE_FOR_DRBG", ERR_LIB_RAND, RAND_R_REQUEST_TOO_LARGE_FOR_DRBG},
+  #else
+    {"REQUEST_TOO_LARGE_FOR_DRBG", 36, 117},
+  #endif
+  #ifdef RAND_R_RESEED_ERROR
+    {"RESEED_ERROR", ERR_LIB_RAND, RAND_R_RESEED_ERROR},
+  #else
+    {"RESEED_ERROR", 36, 118},
+  #endif
+  #ifdef RAND_R_SELFTEST_FAILURE
+    {"SELFTEST_FAILURE", ERR_LIB_RAND, RAND_R_SELFTEST_FAILURE},
+  #else
+    {"SELFTEST_FAILURE", 36, 119},
+  #endif
+  #ifdef RAND_R_TOO_LITTLE_NONCE_REQUESTED
+    {"TOO_LITTLE_NONCE_REQUESTED", ERR_LIB_RAND, RAND_R_TOO_LITTLE_NONCE_REQUESTED},
+  #else
+    {"TOO_LITTLE_NONCE_REQUESTED", 36, 135},
+  #endif
+  #ifdef RAND_R_TOO_MUCH_NONCE_REQUESTED
+    {"TOO_MUCH_NONCE_REQUESTED", ERR_LIB_RAND, RAND_R_TOO_MUCH_NONCE_REQUESTED},
+  #else
+    {"TOO_MUCH_NONCE_REQUESTED", 36, 136},
+  #endif
+  #ifdef RAND_R_UNSUPPORTED_DRBG_FLAGS
+    {"UNSUPPORTED_DRBG_FLAGS", ERR_LIB_RAND, RAND_R_UNSUPPORTED_DRBG_FLAGS},
+  #else
+    {"UNSUPPORTED_DRBG_FLAGS", 36, 132},
+  #endif
+  #ifdef RAND_R_UNSUPPORTED_DRBG_TYPE
+    {"UNSUPPORTED_DRBG_TYPE", ERR_LIB_RAND, RAND_R_UNSUPPORTED_DRBG_TYPE},
+  #else
+    {"UNSUPPORTED_DRBG_TYPE", 36, 120},
+  #endif
+  #ifdef RSA_R_ALGORITHM_MISMATCH
+    {"ALGORITHM_MISMATCH", ERR_LIB_RSA, RSA_R_ALGORITHM_MISMATCH},
+  #else
+    {"ALGORITHM_MISMATCH", 4, 100},
+  #endif
+  #ifdef RSA_R_BAD_E_VALUE
+    {"BAD_E_VALUE", ERR_LIB_RSA, RSA_R_BAD_E_VALUE},
+  #else
+    {"BAD_E_VALUE", 4, 101},
+  #endif
+  #ifdef RSA_R_BAD_FIXED_HEADER_DECRYPT
+    {"BAD_FIXED_HEADER_DECRYPT", ERR_LIB_RSA, RSA_R_BAD_FIXED_HEADER_DECRYPT},
+  #else
+    {"BAD_FIXED_HEADER_DECRYPT", 4, 102},
+  #endif
+  #ifdef RSA_R_BAD_PAD_BYTE_COUNT
+    {"BAD_PAD_BYTE_COUNT", ERR_LIB_RSA, RSA_R_BAD_PAD_BYTE_COUNT},
+  #else
+    {"BAD_PAD_BYTE_COUNT", 4, 103},
+  #endif
+  #ifdef RSA_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_RSA, RSA_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 4, 104},
+  #endif
+  #ifdef RSA_R_BLOCK_TYPE_IS_NOT_01
+    {"BLOCK_TYPE_IS_NOT_01", ERR_LIB_RSA, RSA_R_BLOCK_TYPE_IS_NOT_01},
+  #else
+    {"BLOCK_TYPE_IS_NOT_01", 4, 106},
+  #endif
+  #ifdef RSA_R_BLOCK_TYPE_IS_NOT_02
+    {"BLOCK_TYPE_IS_NOT_02", ERR_LIB_RSA, RSA_R_BLOCK_TYPE_IS_NOT_02},
+  #else
+    {"BLOCK_TYPE_IS_NOT_02", 4, 107},
+  #endif
+  #ifdef RSA_R_DATA_GREATER_THAN_MOD_LEN
+    {"DATA_GREATER_THAN_MOD_LEN", ERR_LIB_RSA, RSA_R_DATA_GREATER_THAN_MOD_LEN},
+  #else
+    {"DATA_GREATER_THAN_MOD_LEN", 4, 108},
+  #endif
+  #ifdef RSA_R_DATA_TOO_LARGE
+    {"DATA_TOO_LARGE", ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE},
+  #else
+    {"DATA_TOO_LARGE", 4, 109},
+  #endif
+  #ifdef RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE
+    {"DATA_TOO_LARGE_FOR_KEY_SIZE", ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE},
+  #else
+    {"DATA_TOO_LARGE_FOR_KEY_SIZE", 4, 110},
+  #endif
+  #ifdef RSA_R_DATA_TOO_LARGE_FOR_MODULUS
+    {"DATA_TOO_LARGE_FOR_MODULUS", ERR_LIB_RSA, RSA_R_DATA_TOO_LARGE_FOR_MODULUS},
+  #else
+    {"DATA_TOO_LARGE_FOR_MODULUS", 4, 132},
+  #endif
+  #ifdef RSA_R_DATA_TOO_SMALL
+    {"DATA_TOO_SMALL", ERR_LIB_RSA, RSA_R_DATA_TOO_SMALL},
+  #else
+    {"DATA_TOO_SMALL", 4, 111},
+  #endif
+  #ifdef RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE
+    {"DATA_TOO_SMALL_FOR_KEY_SIZE", ERR_LIB_RSA, RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE},
+  #else
+    {"DATA_TOO_SMALL_FOR_KEY_SIZE", 4, 122},
+  #endif
+  #ifdef RSA_R_DIGEST_DOES_NOT_MATCH
+    {"DIGEST_DOES_NOT_MATCH", ERR_LIB_RSA, RSA_R_DIGEST_DOES_NOT_MATCH},
+  #else
+    {"DIGEST_DOES_NOT_MATCH", 4, 158},
+  #endif
+  #ifdef RSA_R_DIGEST_NOT_ALLOWED
+    {"DIGEST_NOT_ALLOWED", ERR_LIB_RSA, RSA_R_DIGEST_NOT_ALLOWED},
+  #else
+    {"DIGEST_NOT_ALLOWED", 4, 145},
+  #endif
+  #ifdef RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY
+    {"DIGEST_TOO_BIG_FOR_RSA_KEY", ERR_LIB_RSA, RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY},
+  #else
+    {"DIGEST_TOO_BIG_FOR_RSA_KEY", 4, 112},
+  #endif
+  #ifdef RSA_R_DMP1_NOT_CONGRUENT_TO_D
+    {"DMP1_NOT_CONGRUENT_TO_D", ERR_LIB_RSA, RSA_R_DMP1_NOT_CONGRUENT_TO_D},
+  #else
+    {"DMP1_NOT_CONGRUENT_TO_D", 4, 124},
+  #endif
+  #ifdef RSA_R_DMQ1_NOT_CONGRUENT_TO_D
+    {"DMQ1_NOT_CONGRUENT_TO_D", ERR_LIB_RSA, RSA_R_DMQ1_NOT_CONGRUENT_TO_D},
+  #else
+    {"DMQ1_NOT_CONGRUENT_TO_D", 4, 125},
+  #endif
+  #ifdef RSA_R_D_E_NOT_CONGRUENT_TO_1
+    {"D_E_NOT_CONGRUENT_TO_1", ERR_LIB_RSA, RSA_R_D_E_NOT_CONGRUENT_TO_1},
+  #else
+    {"D_E_NOT_CONGRUENT_TO_1", 4, 123},
+  #endif
+  #ifdef RSA_R_FIRST_OCTET_INVALID
+    {"FIRST_OCTET_INVALID", ERR_LIB_RSA, RSA_R_FIRST_OCTET_INVALID},
+  #else
+    {"FIRST_OCTET_INVALID", 4, 133},
+  #endif
+  #ifdef RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE
+    {"ILLEGAL_OR_UNSUPPORTED_PADDING_MODE", ERR_LIB_RSA, RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE},
+  #else
+    {"ILLEGAL_OR_UNSUPPORTED_PADDING_MODE", 4, 144},
+  #endif
+  #ifdef RSA_R_INVALID_DIGEST
+    {"INVALID_DIGEST", ERR_LIB_RSA, RSA_R_INVALID_DIGEST},
+  #else
+    {"INVALID_DIGEST", 4, 157},
+  #endif
+  #ifdef RSA_R_INVALID_DIGEST_LENGTH
+    {"INVALID_DIGEST_LENGTH", ERR_LIB_RSA, RSA_R_INVALID_DIGEST_LENGTH},
+  #else
+    {"INVALID_DIGEST_LENGTH", 4, 143},
+  #endif
+  #ifdef RSA_R_INVALID_HEADER
+    {"INVALID_HEADER", ERR_LIB_RSA, RSA_R_INVALID_HEADER},
+  #else
+    {"INVALID_HEADER", 4, 137},
+  #endif
+  #ifdef RSA_R_INVALID_LABEL
+    {"INVALID_LABEL", ERR_LIB_RSA, RSA_R_INVALID_LABEL},
+  #else
+    {"INVALID_LABEL", 4, 160},
+  #endif
+  #ifdef RSA_R_INVALID_MESSAGE_LENGTH
+    {"INVALID_MESSAGE_LENGTH", ERR_LIB_RSA, RSA_R_INVALID_MESSAGE_LENGTH},
+  #else
+    {"INVALID_MESSAGE_LENGTH", 4, 131},
+  #endif
+  #ifdef RSA_R_INVALID_MGF1_MD
+    {"INVALID_MGF1_MD", ERR_LIB_RSA, RSA_R_INVALID_MGF1_MD},
+  #else
+    {"INVALID_MGF1_MD", 4, 156},
+  #endif
+  #ifdef RSA_R_INVALID_MULTI_PRIME_KEY
+    {"INVALID_MULTI_PRIME_KEY", ERR_LIB_RSA, RSA_R_INVALID_MULTI_PRIME_KEY},
+  #else
+    {"INVALID_MULTI_PRIME_KEY", 4, 167},
+  #endif
+  #ifdef RSA_R_INVALID_OAEP_PARAMETERS
+    {"INVALID_OAEP_PARAMETERS", ERR_LIB_RSA, RSA_R_INVALID_OAEP_PARAMETERS},
+  #else
+    {"INVALID_OAEP_PARAMETERS", 4, 161},
+  #endif
+  #ifdef RSA_R_INVALID_PADDING
+    {"INVALID_PADDING", ERR_LIB_RSA, RSA_R_INVALID_PADDING},
+  #else
+    {"INVALID_PADDING", 4, 138},
+  #endif
+  #ifdef RSA_R_INVALID_PADDING_MODE
+    {"INVALID_PADDING_MODE", ERR_LIB_RSA, RSA_R_INVALID_PADDING_MODE},
+  #else
+    {"INVALID_PADDING_MODE", 4, 141},
+  #endif
+  #ifdef RSA_R_INVALID_PSS_PARAMETERS
+    {"INVALID_PSS_PARAMETERS", ERR_LIB_RSA, RSA_R_INVALID_PSS_PARAMETERS},
+  #else
+    {"INVALID_PSS_PARAMETERS", 4, 149},
+  #endif
+  #ifdef RSA_R_INVALID_PSS_SALTLEN
+    {"INVALID_PSS_SALTLEN", ERR_LIB_RSA, RSA_R_INVALID_PSS_SALTLEN},
+  #else
+    {"INVALID_PSS_SALTLEN", 4, 146},
+  #endif
+  #ifdef RSA_R_INVALID_SALT_LENGTH
+    {"INVALID_SALT_LENGTH", ERR_LIB_RSA, RSA_R_INVALID_SALT_LENGTH},
+  #else
+    {"INVALID_SALT_LENGTH", 4, 150},
+  #endif
+  #ifdef RSA_R_INVALID_TRAILER
+    {"INVALID_TRAILER", ERR_LIB_RSA, RSA_R_INVALID_TRAILER},
+  #else
+    {"INVALID_TRAILER", 4, 139},
+  #endif
+  #ifdef RSA_R_INVALID_X931_DIGEST
+    {"INVALID_X931_DIGEST", ERR_LIB_RSA, RSA_R_INVALID_X931_DIGEST},
+  #else
+    {"INVALID_X931_DIGEST", 4, 142},
+  #endif
+  #ifdef RSA_R_IQMP_NOT_INVERSE_OF_Q
+    {"IQMP_NOT_INVERSE_OF_Q", ERR_LIB_RSA, RSA_R_IQMP_NOT_INVERSE_OF_Q},
+  #else
+    {"IQMP_NOT_INVERSE_OF_Q", 4, 126},
+  #endif
+  #ifdef RSA_R_KEY_PRIME_NUM_INVALID
+    {"KEY_PRIME_NUM_INVALID", ERR_LIB_RSA, RSA_R_KEY_PRIME_NUM_INVALID},
+  #else
+    {"KEY_PRIME_NUM_INVALID", 4, 165},
+  #endif
+  #ifdef RSA_R_KEY_SIZE_TOO_SMALL
+    {"KEY_SIZE_TOO_SMALL", ERR_LIB_RSA, RSA_R_KEY_SIZE_TOO_SMALL},
+  #else
+    {"KEY_SIZE_TOO_SMALL", 4, 120},
+  #endif
+  #ifdef RSA_R_LAST_OCTET_INVALID
+    {"LAST_OCTET_INVALID", ERR_LIB_RSA, RSA_R_LAST_OCTET_INVALID},
+  #else
+    {"LAST_OCTET_INVALID", 4, 134},
+  #endif
+  #ifdef RSA_R_MGF1_DIGEST_NOT_ALLOWED
+    {"MGF1_DIGEST_NOT_ALLOWED", ERR_LIB_RSA, RSA_R_MGF1_DIGEST_NOT_ALLOWED},
+  #else
+    {"MGF1_DIGEST_NOT_ALLOWED", 4, 152},
+  #endif
+  #ifdef RSA_R_MISSING_PRIVATE_KEY
+    {"MISSING_PRIVATE_KEY", ERR_LIB_RSA, RSA_R_MISSING_PRIVATE_KEY},
+  #else
+    {"MISSING_PRIVATE_KEY", 4, 179},
+  #endif
+  #ifdef RSA_R_MODULUS_TOO_LARGE
+    {"MODULUS_TOO_LARGE", ERR_LIB_RSA, RSA_R_MODULUS_TOO_LARGE},
+  #else
+    {"MODULUS_TOO_LARGE", 4, 105},
+  #endif
+  #ifdef RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R
+    {"MP_COEFFICIENT_NOT_INVERSE_OF_R", ERR_LIB_RSA, RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R},
+  #else
+    {"MP_COEFFICIENT_NOT_INVERSE_OF_R", 4, 168},
+  #endif
+  #ifdef RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D
+    {"MP_EXPONENT_NOT_CONGRUENT_TO_D", ERR_LIB_RSA, RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D},
+  #else
+    {"MP_EXPONENT_NOT_CONGRUENT_TO_D", 4, 169},
+  #endif
+  #ifdef RSA_R_MP_R_NOT_PRIME
+    {"MP_R_NOT_PRIME", ERR_LIB_RSA, RSA_R_MP_R_NOT_PRIME},
+  #else
+    {"MP_R_NOT_PRIME", 4, 170},
+  #endif
+  #ifdef RSA_R_NO_PUBLIC_EXPONENT
+    {"NO_PUBLIC_EXPONENT", ERR_LIB_RSA, RSA_R_NO_PUBLIC_EXPONENT},
+  #else
+    {"NO_PUBLIC_EXPONENT", 4, 140},
+  #endif
+  #ifdef RSA_R_NULL_BEFORE_BLOCK_MISSING
+    {"NULL_BEFORE_BLOCK_MISSING", ERR_LIB_RSA, RSA_R_NULL_BEFORE_BLOCK_MISSING},
+  #else
+    {"NULL_BEFORE_BLOCK_MISSING", 4, 113},
+  #endif
+  #ifdef RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES
+    {"N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES", ERR_LIB_RSA, RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES},
+  #else
+    {"N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES", 4, 172},
+  #endif
+  #ifdef RSA_R_N_DOES_NOT_EQUAL_P_Q
+    {"N_DOES_NOT_EQUAL_P_Q", ERR_LIB_RSA, RSA_R_N_DOES_NOT_EQUAL_P_Q},
+  #else
+    {"N_DOES_NOT_EQUAL_P_Q", 4, 127},
+  #endif
+  #ifdef RSA_R_OAEP_DECODING_ERROR
+    {"OAEP_DECODING_ERROR", ERR_LIB_RSA, RSA_R_OAEP_DECODING_ERROR},
+  #else
+    {"OAEP_DECODING_ERROR", 4, 121},
+  #endif
+  #ifdef RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", ERR_LIB_RSA, RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE},
+  #else
+    {"OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE", 4, 148},
+  #endif
+  #ifdef RSA_R_PADDING_CHECK_FAILED
+    {"PADDING_CHECK_FAILED", ERR_LIB_RSA, RSA_R_PADDING_CHECK_FAILED},
+  #else
+    {"PADDING_CHECK_FAILED", 4, 114},
+  #endif
+  #ifdef RSA_R_PKCS_DECODING_ERROR
+    {"PKCS_DECODING_ERROR", ERR_LIB_RSA, RSA_R_PKCS_DECODING_ERROR},
+  #else
+    {"PKCS_DECODING_ERROR", 4, 159},
+  #endif
+  #ifdef RSA_R_PSS_SALTLEN_TOO_SMALL
+    {"PSS_SALTLEN_TOO_SMALL", ERR_LIB_RSA, RSA_R_PSS_SALTLEN_TOO_SMALL},
+  #else
+    {"PSS_SALTLEN_TOO_SMALL", 4, 164},
+  #endif
+  #ifdef RSA_R_P_NOT_PRIME
+    {"P_NOT_PRIME", ERR_LIB_RSA, RSA_R_P_NOT_PRIME},
+  #else
+    {"P_NOT_PRIME", 4, 128},
+  #endif
+  #ifdef RSA_R_Q_NOT_PRIME
+    {"Q_NOT_PRIME", ERR_LIB_RSA, RSA_R_Q_NOT_PRIME},
+  #else
+    {"Q_NOT_PRIME", 4, 129},
+  #endif
+  #ifdef RSA_R_RSA_OPERATIONS_NOT_SUPPORTED
+    {"RSA_OPERATIONS_NOT_SUPPORTED", ERR_LIB_RSA, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED},
+  #else
+    {"RSA_OPERATIONS_NOT_SUPPORTED", 4, 130},
+  #endif
+  #ifdef RSA_R_SLEN_CHECK_FAILED
+    {"SLEN_CHECK_FAILED", ERR_LIB_RSA, RSA_R_SLEN_CHECK_FAILED},
+  #else
+    {"SLEN_CHECK_FAILED", 4, 136},
+  #endif
+  #ifdef RSA_R_SLEN_RECOVERY_FAILED
+    {"SLEN_RECOVERY_FAILED", ERR_LIB_RSA, RSA_R_SLEN_RECOVERY_FAILED},
+  #else
+    {"SLEN_RECOVERY_FAILED", 4, 135},
+  #endif
+  #ifdef RSA_R_SSLV3_ROLLBACK_ATTACK
+    {"SSLV3_ROLLBACK_ATTACK", ERR_LIB_RSA, RSA_R_SSLV3_ROLLBACK_ATTACK},
+  #else
+    {"SSLV3_ROLLBACK_ATTACK", 4, 115},
+  #endif
+  #ifdef RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", ERR_LIB_RSA, RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD},
+  #else
+    {"THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD", 4, 116},
+  #endif
+  #ifdef RSA_R_UNKNOWN_ALGORITHM_TYPE
+    {"UNKNOWN_ALGORITHM_TYPE", ERR_LIB_RSA, RSA_R_UNKNOWN_ALGORITHM_TYPE},
+  #else
+    {"UNKNOWN_ALGORITHM_TYPE", 4, 117},
+  #endif
+  #ifdef RSA_R_UNKNOWN_DIGEST
+    {"UNKNOWN_DIGEST", ERR_LIB_RSA, RSA_R_UNKNOWN_DIGEST},
+  #else
+    {"UNKNOWN_DIGEST", 4, 166},
+  #endif
+  #ifdef RSA_R_UNKNOWN_MASK_DIGEST
+    {"UNKNOWN_MASK_DIGEST", ERR_LIB_RSA, RSA_R_UNKNOWN_MASK_DIGEST},
+  #else
+    {"UNKNOWN_MASK_DIGEST", 4, 151},
+  #endif
+  #ifdef RSA_R_UNKNOWN_PADDING_TYPE
+    {"UNKNOWN_PADDING_TYPE", ERR_LIB_RSA, RSA_R_UNKNOWN_PADDING_TYPE},
+  #else
+    {"UNKNOWN_PADDING_TYPE", 4, 118},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_ENCRYPTION_TYPE
+    {"UNSUPPORTED_ENCRYPTION_TYPE", ERR_LIB_RSA, RSA_R_UNSUPPORTED_ENCRYPTION_TYPE},
+  #else
+    {"UNSUPPORTED_ENCRYPTION_TYPE", 4, 162},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_LABEL_SOURCE
+    {"UNSUPPORTED_LABEL_SOURCE", ERR_LIB_RSA, RSA_R_UNSUPPORTED_LABEL_SOURCE},
+  #else
+    {"UNSUPPORTED_LABEL_SOURCE", 4, 163},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_MASK_ALGORITHM
+    {"UNSUPPORTED_MASK_ALGORITHM", ERR_LIB_RSA, RSA_R_UNSUPPORTED_MASK_ALGORITHM},
+  #else
+    {"UNSUPPORTED_MASK_ALGORITHM", 4, 153},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_MASK_PARAMETER
+    {"UNSUPPORTED_MASK_PARAMETER", ERR_LIB_RSA, RSA_R_UNSUPPORTED_MASK_PARAMETER},
+  #else
+    {"UNSUPPORTED_MASK_PARAMETER", 4, 154},
+  #endif
+  #ifdef RSA_R_UNSUPPORTED_SIGNATURE_TYPE
+    {"UNSUPPORTED_SIGNATURE_TYPE", ERR_LIB_RSA, RSA_R_UNSUPPORTED_SIGNATURE_TYPE},
+  #else
+    {"UNSUPPORTED_SIGNATURE_TYPE", 4, 155},
+  #endif
+  #ifdef RSA_R_VALUE_MISSING
+    {"VALUE_MISSING", ERR_LIB_RSA, RSA_R_VALUE_MISSING},
+  #else
+    {"VALUE_MISSING", 4, 147},
+  #endif
+  #ifdef RSA_R_WRONG_SIGNATURE_LENGTH
+    {"WRONG_SIGNATURE_LENGTH", ERR_LIB_RSA, RSA_R_WRONG_SIGNATURE_LENGTH},
+  #else
+    {"WRONG_SIGNATURE_LENGTH", 4, 119},
+  #endif
+  #ifdef SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY
+    {"APPLICATION_DATA_AFTER_CLOSE_NOTIFY", ERR_LIB_SSL, SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY},
+  #else
+    {"APPLICATION_DATA_AFTER_CLOSE_NOTIFY", 20, 291},
+  #endif
+  #ifdef SSL_R_APP_DATA_IN_HANDSHAKE
+    {"APP_DATA_IN_HANDSHAKE", ERR_LIB_SSL, SSL_R_APP_DATA_IN_HANDSHAKE},
+  #else
+    {"APP_DATA_IN_HANDSHAKE", 20, 100},
+  #endif
+  #ifdef SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT
+    {"ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT", ERR_LIB_SSL, SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT},
+  #else
+    {"ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT", 20, 272},
+  #endif
+  #ifdef SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE
+    {"AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE", ERR_LIB_SSL, SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE},
+  #else
+    {"AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE", 20, 143},
+  #endif
+  #ifdef SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE
+    {"AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE", ERR_LIB_SSL, SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE},
+  #else
+    {"AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE", 20, 158},
+  #endif
+  #ifdef SSL_R_BAD_CHANGE_CIPHER_SPEC
+    {"BAD_CHANGE_CIPHER_SPEC", ERR_LIB_SSL, SSL_R_BAD_CHANGE_CIPHER_SPEC},
+  #else
+    {"BAD_CHANGE_CIPHER_SPEC", 20, 103},
+  #endif
+  #ifdef SSL_R_BAD_CIPHER
+    {"BAD_CIPHER", ERR_LIB_SSL, SSL_R_BAD_CIPHER},
+  #else
+    {"BAD_CIPHER", 20, 186},
+  #endif
+  #ifdef SSL_R_BAD_DATA
+    {"BAD_DATA", ERR_LIB_SSL, SSL_R_BAD_DATA},
+  #else
+    {"BAD_DATA", 20, 390},
+  #endif
+  #ifdef SSL_R_BAD_DATA_RETURNED_BY_CALLBACK
+    {"BAD_DATA_RETURNED_BY_CALLBACK", ERR_LIB_SSL, SSL_R_BAD_DATA_RETURNED_BY_CALLBACK},
+  #else
+    {"BAD_DATA_RETURNED_BY_CALLBACK", 20, 106},
+  #endif
+  #ifdef SSL_R_BAD_DECOMPRESSION
+    {"BAD_DECOMPRESSION", ERR_LIB_SSL, SSL_R_BAD_DECOMPRESSION},
+  #else
+    {"BAD_DECOMPRESSION", 20, 107},
+  #endif
+  #ifdef SSL_R_BAD_DH_VALUE
+    {"BAD_DH_VALUE", ERR_LIB_SSL, SSL_R_BAD_DH_VALUE},
+  #else
+    {"BAD_DH_VALUE", 20, 102},
+  #endif
+  #ifdef SSL_R_BAD_DIGEST_LENGTH
+    {"BAD_DIGEST_LENGTH", ERR_LIB_SSL, SSL_R_BAD_DIGEST_LENGTH},
+  #else
+    {"BAD_DIGEST_LENGTH", 20, 111},
+  #endif
+  #ifdef SSL_R_BAD_EARLY_DATA
+    {"BAD_EARLY_DATA", ERR_LIB_SSL, SSL_R_BAD_EARLY_DATA},
+  #else
+    {"BAD_EARLY_DATA", 20, 233},
+  #endif
+  #ifdef SSL_R_BAD_ECC_CERT
+    {"BAD_ECC_CERT", ERR_LIB_SSL, SSL_R_BAD_ECC_CERT},
+  #else
+    {"BAD_ECC_CERT", 20, 304},
+  #endif
+  #ifdef SSL_R_BAD_ECDSA_SIGNATURE
+    {"BAD_ECDSA_SIGNATURE", ERR_LIB_SSL, SSL_R_BAD_ECDSA_SIGNATURE},
+  #else
+    {"BAD_ECDSA_SIGNATURE", 20, 305},
+  #endif
+  #ifdef SSL_R_BAD_ECPOINT
+    {"BAD_ECPOINT", ERR_LIB_SSL, SSL_R_BAD_ECPOINT},
+  #else
+    {"BAD_ECPOINT", 20, 306},
+  #endif
+  #ifdef SSL_R_BAD_EXTENSION
+    {"BAD_EXTENSION", ERR_LIB_SSL, SSL_R_BAD_EXTENSION},
+  #else
+    {"BAD_EXTENSION", 20, 110},
+  #endif
+  #ifdef SSL_R_BAD_HANDSHAKE_LENGTH
+    {"BAD_HANDSHAKE_LENGTH", ERR_LIB_SSL, SSL_R_BAD_HANDSHAKE_LENGTH},
+  #else
+    {"BAD_HANDSHAKE_LENGTH", 20, 332},
+  #endif
+  #ifdef SSL_R_BAD_HANDSHAKE_STATE
+    {"BAD_HANDSHAKE_STATE", ERR_LIB_SSL, SSL_R_BAD_HANDSHAKE_STATE},
+  #else
+    {"BAD_HANDSHAKE_STATE", 20, 236},
+  #endif
+  #ifdef SSL_R_BAD_HELLO_REQUEST
+    {"BAD_HELLO_REQUEST", ERR_LIB_SSL, SSL_R_BAD_HELLO_REQUEST},
+  #else
+    {"BAD_HELLO_REQUEST", 20, 105},
+  #endif
+  #ifdef SSL_R_BAD_HRR_VERSION
+    {"BAD_HRR_VERSION", ERR_LIB_SSL, SSL_R_BAD_HRR_VERSION},
+  #else
+    {"BAD_HRR_VERSION", 20, 263},
+  #endif
+  #ifdef SSL_R_BAD_KEY_SHARE
+    {"BAD_KEY_SHARE", ERR_LIB_SSL, SSL_R_BAD_KEY_SHARE},
+  #else
+    {"BAD_KEY_SHARE", 20, 108},
+  #endif
+  #ifdef SSL_R_BAD_KEY_UPDATE
+    {"BAD_KEY_UPDATE", ERR_LIB_SSL, SSL_R_BAD_KEY_UPDATE},
+  #else
+    {"BAD_KEY_UPDATE", 20, 122},
+  #endif
+  #ifdef SSL_R_BAD_LEGACY_VERSION
+    {"BAD_LEGACY_VERSION", ERR_LIB_SSL, SSL_R_BAD_LEGACY_VERSION},
+  #else
+    {"BAD_LEGACY_VERSION", 20, 292},
+  #endif
+  #ifdef SSL_R_BAD_LENGTH
+    {"BAD_LENGTH", ERR_LIB_SSL, SSL_R_BAD_LENGTH},
+  #else
+    {"BAD_LENGTH", 20, 271},
+  #endif
+  #ifdef SSL_R_BAD_MAC_LENGTH
+    {"BAD_MAC_LENGTH", ERR_LIB_SSL, SSL_R_BAD_MAC_LENGTH},
+  #else
+    {"BAD_MAC_LENGTH", 20, 333},
+  #endif
+  #ifdef SSL_R_BAD_PACKET
+    {"BAD_PACKET", ERR_LIB_SSL, SSL_R_BAD_PACKET},
+  #else
+    {"BAD_PACKET", 20, 240},
+  #endif
+  #ifdef SSL_R_BAD_PACKET_LENGTH
+    {"BAD_PACKET_LENGTH", ERR_LIB_SSL, SSL_R_BAD_PACKET_LENGTH},
+  #else
+    {"BAD_PACKET_LENGTH", 20, 115},
+  #endif
+  #ifdef SSL_R_BAD_PROTOCOL_VERSION_NUMBER
+    {"BAD_PROTOCOL_VERSION_NUMBER", ERR_LIB_SSL, SSL_R_BAD_PROTOCOL_VERSION_NUMBER},
+  #else
+    {"BAD_PROTOCOL_VERSION_NUMBER", 20, 116},
+  #endif
+  #ifdef SSL_R_BAD_PSK
+    {"BAD_PSK", ERR_LIB_SSL, SSL_R_BAD_PSK},
+  #else
+    {"BAD_PSK", 20, 219},
+  #endif
+  #ifdef SSL_R_BAD_PSK_IDENTITY
+    {"BAD_PSK_IDENTITY", ERR_LIB_SSL, SSL_R_BAD_PSK_IDENTITY},
+  #else
+    {"BAD_PSK_IDENTITY", 20, 114},
+  #endif
+  #ifdef SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH
+    {"BAD_PSK_IDENTITY_HINT_LENGTH", ERR_LIB_SSL, SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH},
+  #else
+    {"BAD_PSK_IDENTITY_HINT_LENGTH", 20, 316},
+  #endif
+  #ifdef SSL_R_BAD_RECORD_TYPE
+    {"BAD_RECORD_TYPE", ERR_LIB_SSL, SSL_R_BAD_RECORD_TYPE},
+  #else
+    {"BAD_RECORD_TYPE", 20, 443},
+  #endif
+  #ifdef SSL_R_BAD_RSA_ENCRYPT
+    {"BAD_RSA_ENCRYPT", ERR_LIB_SSL, SSL_R_BAD_RSA_ENCRYPT},
+  #else
+    {"BAD_RSA_ENCRYPT", 20, 119},
+  #endif
+  #ifdef SSL_R_BAD_SIGNATURE
+    {"BAD_SIGNATURE", ERR_LIB_SSL, SSL_R_BAD_SIGNATURE},
+  #else
+    {"BAD_SIGNATURE", 20, 123},
+  #endif
+  #ifdef SSL_R_BAD_SRP_A_LENGTH
+    {"BAD_SRP_A_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_A_LENGTH},
+  #else
+    {"BAD_SRP_A_LENGTH", 20, 347},
+  #endif
+  #ifdef SSL_R_BAD_SRP_B_LENGTH
+    {"BAD_SRP_B_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_B_LENGTH},
+  #else
+    {"BAD_SRP_B_LENGTH", 20, 348},
+  #endif
+  #ifdef SSL_R_BAD_SRP_G_LENGTH
+    {"BAD_SRP_G_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_G_LENGTH},
+  #else
+    {"BAD_SRP_G_LENGTH", 20, 349},
+  #endif
+  #ifdef SSL_R_BAD_SRP_N_LENGTH
+    {"BAD_SRP_N_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_N_LENGTH},
+  #else
+    {"BAD_SRP_N_LENGTH", 20, 350},
+  #endif
+  #ifdef SSL_R_BAD_SRP_PARAMETERS
+    {"BAD_SRP_PARAMETERS", ERR_LIB_SSL, SSL_R_BAD_SRP_PARAMETERS},
+  #else
+    {"BAD_SRP_PARAMETERS", 20, 371},
+  #endif
+  #ifdef SSL_R_BAD_SRP_S_LENGTH
+    {"BAD_SRP_S_LENGTH", ERR_LIB_SSL, SSL_R_BAD_SRP_S_LENGTH},
+  #else
+    {"BAD_SRP_S_LENGTH", 20, 351},
+  #endif
+  #ifdef SSL_R_BAD_SRTP_MKI_VALUE
+    {"BAD_SRTP_MKI_VALUE", ERR_LIB_SSL, SSL_R_BAD_SRTP_MKI_VALUE},
+  #else
+    {"BAD_SRTP_MKI_VALUE", 20, 352},
+  #endif
+  #ifdef SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST
+    {"BAD_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST},
+  #else
+    {"BAD_SRTP_PROTECTION_PROFILE_LIST", 20, 353},
+  #endif
+  #ifdef SSL_R_BAD_SSL_FILETYPE
+    {"BAD_SSL_FILETYPE", ERR_LIB_SSL, SSL_R_BAD_SSL_FILETYPE},
+  #else
+    {"BAD_SSL_FILETYPE", 20, 124},
+  #endif
+  #ifdef SSL_R_BAD_VALUE
+    {"BAD_VALUE", ERR_LIB_SSL, SSL_R_BAD_VALUE},
+  #else
+    {"BAD_VALUE", 20, 384},
+  #endif
+  #ifdef SSL_R_BAD_WRITE_RETRY
+    {"BAD_WRITE_RETRY", ERR_LIB_SSL, SSL_R_BAD_WRITE_RETRY},
+  #else
+    {"BAD_WRITE_RETRY", 20, 127},
+  #endif
+  #ifdef SSL_R_BINDER_DOES_NOT_VERIFY
+    {"BINDER_DOES_NOT_VERIFY", ERR_LIB_SSL, SSL_R_BINDER_DOES_NOT_VERIFY},
+  #else
+    {"BINDER_DOES_NOT_VERIFY", 20, 253},
+  #endif
+  #ifdef SSL_R_BIO_NOT_SET
+    {"BIO_NOT_SET", ERR_LIB_SSL, SSL_R_BIO_NOT_SET},
+  #else
+    {"BIO_NOT_SET", 20, 128},
+  #endif
+  #ifdef SSL_R_BLOCK_CIPHER_PAD_IS_WRONG
+    {"BLOCK_CIPHER_PAD_IS_WRONG", ERR_LIB_SSL, SSL_R_BLOCK_CIPHER_PAD_IS_WRONG},
+  #else
+    {"BLOCK_CIPHER_PAD_IS_WRONG", 20, 129},
+  #endif
+  #ifdef SSL_R_BN_LIB
+    {"BN_LIB", ERR_LIB_SSL, SSL_R_BN_LIB},
+  #else
+    {"BN_LIB", 20, 130},
+  #endif
+  #ifdef SSL_R_CALLBACK_FAILED
+    {"CALLBACK_FAILED", ERR_LIB_SSL, SSL_R_CALLBACK_FAILED},
+  #else
+    {"CALLBACK_FAILED", 20, 234},
+  #endif
+  #ifdef SSL_R_CANNOT_CHANGE_CIPHER
+    {"CANNOT_CHANGE_CIPHER", ERR_LIB_SSL, SSL_R_CANNOT_CHANGE_CIPHER},
+  #else
+    {"CANNOT_CHANGE_CIPHER", 20, 109},
+  #endif
+  #ifdef SSL_R_CA_DN_LENGTH_MISMATCH
+    {"CA_DN_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_CA_DN_LENGTH_MISMATCH},
+  #else
+    {"CA_DN_LENGTH_MISMATCH", 20, 131},
+  #endif
+  #ifdef SSL_R_CA_KEY_TOO_SMALL
+    {"CA_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_CA_KEY_TOO_SMALL},
+  #else
+    {"CA_KEY_TOO_SMALL", 20, 397},
+  #endif
+  #ifdef SSL_R_CA_MD_TOO_WEAK
+    {"CA_MD_TOO_WEAK", ERR_LIB_SSL, SSL_R_CA_MD_TOO_WEAK},
+  #else
+    {"CA_MD_TOO_WEAK", 20, 398},
+  #endif
+  #ifdef SSL_R_CCS_RECEIVED_EARLY
+    {"CCS_RECEIVED_EARLY", ERR_LIB_SSL, SSL_R_CCS_RECEIVED_EARLY},
+  #else
+    {"CCS_RECEIVED_EARLY", 20, 133},
+  #endif
+  #ifdef SSL_R_CERTIFICATE_VERIFY_FAILED
+    {"CERTIFICATE_VERIFY_FAILED", ERR_LIB_SSL, SSL_R_CERTIFICATE_VERIFY_FAILED},
+  #else
+    {"CERTIFICATE_VERIFY_FAILED", 20, 134},
+  #endif
+  #ifdef SSL_R_CERT_CB_ERROR
+    {"CERT_CB_ERROR", ERR_LIB_SSL, SSL_R_CERT_CB_ERROR},
+  #else
+    {"CERT_CB_ERROR", 20, 377},
+  #endif
+  #ifdef SSL_R_CERT_LENGTH_MISMATCH
+    {"CERT_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_CERT_LENGTH_MISMATCH},
+  #else
+    {"CERT_LENGTH_MISMATCH", 20, 135},
+  #endif
+  #ifdef SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED
+    {"CIPHERSUITE_DIGEST_HAS_CHANGED", ERR_LIB_SSL, SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED},
+  #else
+    {"CIPHERSUITE_DIGEST_HAS_CHANGED", 20, 218},
+  #endif
+  #ifdef SSL_R_CIPHER_CODE_WRONG_LENGTH
+    {"CIPHER_CODE_WRONG_LENGTH", ERR_LIB_SSL, SSL_R_CIPHER_CODE_WRONG_LENGTH},
+  #else
+    {"CIPHER_CODE_WRONG_LENGTH", 20, 137},
+  #endif
+  #ifdef SSL_R_CIPHER_OR_HASH_UNAVAILABLE
+    {"CIPHER_OR_HASH_UNAVAILABLE", ERR_LIB_SSL, SSL_R_CIPHER_OR_HASH_UNAVAILABLE},
+  #else
+    {"CIPHER_OR_HASH_UNAVAILABLE", 20, 138},
+  #endif
+  #ifdef SSL_R_CLIENTHELLO_TLSEXT
+    {"CLIENTHELLO_TLSEXT", ERR_LIB_SSL, SSL_R_CLIENTHELLO_TLSEXT},
+  #else
+    {"CLIENTHELLO_TLSEXT", 20, 226},
+  #endif
+  #ifdef SSL_R_COMPRESSED_LENGTH_TOO_LONG
+    {"COMPRESSED_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_COMPRESSED_LENGTH_TOO_LONG},
+  #else
+    {"COMPRESSED_LENGTH_TOO_LONG", 20, 140},
+  #endif
+  #ifdef SSL_R_COMPRESSION_DISABLED
+    {"COMPRESSION_DISABLED", ERR_LIB_SSL, SSL_R_COMPRESSION_DISABLED},
+  #else
+    {"COMPRESSION_DISABLED", 20, 343},
+  #endif
+  #ifdef SSL_R_COMPRESSION_FAILURE
+    {"COMPRESSION_FAILURE", ERR_LIB_SSL, SSL_R_COMPRESSION_FAILURE},
+  #else
+    {"COMPRESSION_FAILURE", 20, 141},
+  #endif
+  #ifdef SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE
+    {"COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE", ERR_LIB_SSL, SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE},
+  #else
+    {"COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE", 20, 307},
+  #endif
+  #ifdef SSL_R_COMPRESSION_LIBRARY_ERROR
+    {"COMPRESSION_LIBRARY_ERROR", ERR_LIB_SSL, SSL_R_COMPRESSION_LIBRARY_ERROR},
+  #else
+    {"COMPRESSION_LIBRARY_ERROR", 20, 142},
+  #endif
+  #ifdef SSL_R_CONNECTION_TYPE_NOT_SET
+    {"CONNECTION_TYPE_NOT_SET", ERR_LIB_SSL, SSL_R_CONNECTION_TYPE_NOT_SET},
+  #else
+    {"CONNECTION_TYPE_NOT_SET", 20, 144},
+  #endif
+  #ifdef SSL_R_CONTEXT_NOT_DANE_ENABLED
+    {"CONTEXT_NOT_DANE_ENABLED", ERR_LIB_SSL, SSL_R_CONTEXT_NOT_DANE_ENABLED},
+  #else
+    {"CONTEXT_NOT_DANE_ENABLED", 20, 167},
+  #endif
+  #ifdef SSL_R_COOKIE_GEN_CALLBACK_FAILURE
+    {"COOKIE_GEN_CALLBACK_FAILURE", ERR_LIB_SSL, SSL_R_COOKIE_GEN_CALLBACK_FAILURE},
+  #else
+    {"COOKIE_GEN_CALLBACK_FAILURE", 20, 400},
+  #endif
+  #ifdef SSL_R_COOKIE_MISMATCH
+    {"COOKIE_MISMATCH", ERR_LIB_SSL, SSL_R_COOKIE_MISMATCH},
+  #else
+    {"COOKIE_MISMATCH", 20, 308},
+  #endif
+  #ifdef SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED
+    {"CUSTOM_EXT_HANDLER_ALREADY_INSTALLED", ERR_LIB_SSL, SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED},
+  #else
+    {"CUSTOM_EXT_HANDLER_ALREADY_INSTALLED", 20, 206},
+  #endif
+  #ifdef SSL_R_DANE_ALREADY_ENABLED
+    {"DANE_ALREADY_ENABLED", ERR_LIB_SSL, SSL_R_DANE_ALREADY_ENABLED},
+  #else
+    {"DANE_ALREADY_ENABLED", 20, 172},
+  #endif
+  #ifdef SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL
+    {"DANE_CANNOT_OVERRIDE_MTYPE_FULL", ERR_LIB_SSL, SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL},
+  #else
+    {"DANE_CANNOT_OVERRIDE_MTYPE_FULL", 20, 173},
+  #endif
+  #ifdef SSL_R_DANE_NOT_ENABLED
+    {"DANE_NOT_ENABLED", ERR_LIB_SSL, SSL_R_DANE_NOT_ENABLED},
+  #else
+    {"DANE_NOT_ENABLED", 20, 175},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_CERTIFICATE
+    {"DANE_TLSA_BAD_CERTIFICATE", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_CERTIFICATE},
+  #else
+    {"DANE_TLSA_BAD_CERTIFICATE", 20, 180},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE
+    {"DANE_TLSA_BAD_CERTIFICATE_USAGE", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE},
+  #else
+    {"DANE_TLSA_BAD_CERTIFICATE_USAGE", 20, 184},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_DATA_LENGTH
+    {"DANE_TLSA_BAD_DATA_LENGTH", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_DATA_LENGTH},
+  #else
+    {"DANE_TLSA_BAD_DATA_LENGTH", 20, 189},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH
+    {"DANE_TLSA_BAD_DIGEST_LENGTH", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH},
+  #else
+    {"DANE_TLSA_BAD_DIGEST_LENGTH", 20, 192},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_MATCHING_TYPE
+    {"DANE_TLSA_BAD_MATCHING_TYPE", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_MATCHING_TYPE},
+  #else
+    {"DANE_TLSA_BAD_MATCHING_TYPE", 20, 200},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_PUBLIC_KEY
+    {"DANE_TLSA_BAD_PUBLIC_KEY", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_PUBLIC_KEY},
+  #else
+    {"DANE_TLSA_BAD_PUBLIC_KEY", 20, 201},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_BAD_SELECTOR
+    {"DANE_TLSA_BAD_SELECTOR", ERR_LIB_SSL, SSL_R_DANE_TLSA_BAD_SELECTOR},
+  #else
+    {"DANE_TLSA_BAD_SELECTOR", 20, 202},
+  #endif
+  #ifdef SSL_R_DANE_TLSA_NULL_DATA
+    {"DANE_TLSA_NULL_DATA", ERR_LIB_SSL, SSL_R_DANE_TLSA_NULL_DATA},
+  #else
+    {"DANE_TLSA_NULL_DATA", 20, 203},
+  #endif
+  #ifdef SSL_R_DATA_BETWEEN_CCS_AND_FINISHED
+    {"DATA_BETWEEN_CCS_AND_FINISHED", ERR_LIB_SSL, SSL_R_DATA_BETWEEN_CCS_AND_FINISHED},
+  #else
+    {"DATA_BETWEEN_CCS_AND_FINISHED", 20, 145},
+  #endif
+  #ifdef SSL_R_DATA_LENGTH_TOO_LONG
+    {"DATA_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_DATA_LENGTH_TOO_LONG},
+  #else
+    {"DATA_LENGTH_TOO_LONG", 20, 146},
+  #endif
+  #ifdef SSL_R_DECRYPTION_FAILED
+    {"DECRYPTION_FAILED", ERR_LIB_SSL, SSL_R_DECRYPTION_FAILED},
+  #else
+    {"DECRYPTION_FAILED", 20, 147},
+  #endif
+  #ifdef SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
+    {"DECRYPTION_FAILED_OR_BAD_RECORD_MAC", ERR_LIB_SSL, SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC},
+  #else
+    {"DECRYPTION_FAILED_OR_BAD_RECORD_MAC", 20, 281},
+  #endif
+  #ifdef SSL_R_DH_KEY_TOO_SMALL
+    {"DH_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_DH_KEY_TOO_SMALL},
+  #else
+    {"DH_KEY_TOO_SMALL", 20, 394},
+  #endif
+  #ifdef SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG
+    {"DH_PUBLIC_VALUE_LENGTH_IS_WRONG", ERR_LIB_SSL, SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG},
+  #else
+    {"DH_PUBLIC_VALUE_LENGTH_IS_WRONG", 20, 148},
+  #endif
+  #ifdef SSL_R_DIGEST_CHECK_FAILED
+    {"DIGEST_CHECK_FAILED", ERR_LIB_SSL, SSL_R_DIGEST_CHECK_FAILED},
+  #else
+    {"DIGEST_CHECK_FAILED", 20, 149},
+  #endif
+  #ifdef SSL_R_DTLS_MESSAGE_TOO_BIG
+    {"DTLS_MESSAGE_TOO_BIG", ERR_LIB_SSL, SSL_R_DTLS_MESSAGE_TOO_BIG},
+  #else
+    {"DTLS_MESSAGE_TOO_BIG", 20, 334},
+  #endif
+  #ifdef SSL_R_DUPLICATE_COMPRESSION_ID
+    {"DUPLICATE_COMPRESSION_ID", ERR_LIB_SSL, SSL_R_DUPLICATE_COMPRESSION_ID},
+  #else
+    {"DUPLICATE_COMPRESSION_ID", 20, 309},
+  #endif
+  #ifdef SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT
+    {"ECC_CERT_NOT_FOR_KEY_AGREEMENT", ERR_LIB_SSL, SSL_R_ECC_CERT_NOT_FOR_KEY_AGREEMENT},
+  #else
+    {"ECC_CERT_NOT_FOR_KEY_AGREEMENT", 20, 317},
+  #endif
+  #ifdef SSL_R_ECC_CERT_NOT_FOR_SIGNING
+    {"ECC_CERT_NOT_FOR_SIGNING", ERR_LIB_SSL, SSL_R_ECC_CERT_NOT_FOR_SIGNING},
+  #else
+    {"ECC_CERT_NOT_FOR_SIGNING", 20, 318},
+  #endif
+  #ifdef SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE
+    {"ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE", ERR_LIB_SSL, SSL_R_ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE},
+  #else
+    {"ECC_CERT_SHOULD_HAVE_RSA_SIGNATURE", 20, 322},
+  #endif
+  #ifdef SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE
+    {"ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE", ERR_LIB_SSL, SSL_R_ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE},
+  #else
+    {"ECC_CERT_SHOULD_HAVE_SHA1_SIGNATURE", 20, 323},
+  #endif
+  #ifdef SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE
+    {"ECDH_REQUIRED_FOR_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE},
+  #else
+    {"ECDH_REQUIRED_FOR_SUITEB_MODE", 20, 374},
+  #endif
+  #ifdef SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER
+    {"ECGROUP_TOO_LARGE_FOR_CIPHER", ERR_LIB_SSL, SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER},
+  #else
+    {"ECGROUP_TOO_LARGE_FOR_CIPHER", 20, 310},
+  #endif
+  #ifdef SSL_R_EE_KEY_TOO_SMALL
+    {"EE_KEY_TOO_SMALL", ERR_LIB_SSL, SSL_R_EE_KEY_TOO_SMALL},
+  #else
+    {"EE_KEY_TOO_SMALL", 20, 399},
+  #endif
+  #ifdef SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST
+    {"EMPTY_SRTP_PROTECTION_PROFILE_LIST", ERR_LIB_SSL, SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST},
+  #else
+    {"EMPTY_SRTP_PROTECTION_PROFILE_LIST", 20, 354},
+  #endif
+  #ifdef SSL_R_ENCRYPTED_LENGTH_TOO_LONG
+    {"ENCRYPTED_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_ENCRYPTED_LENGTH_TOO_LONG},
+  #else
+    {"ENCRYPTED_LENGTH_TOO_LONG", 20, 150},
+  #endif
+  #ifdef SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST
+    {"ERROR_IN_RECEIVED_CIPHER_LIST", ERR_LIB_SSL, SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST},
+  #else
+    {"ERROR_IN_RECEIVED_CIPHER_LIST", 20, 151},
+  #endif
+  #ifdef SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN
+    {"ERROR_SETTING_TLSA_BASE_DOMAIN", ERR_LIB_SSL, SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN},
+  #else
+    {"ERROR_SETTING_TLSA_BASE_DOMAIN", 20, 204},
+  #endif
+  #ifdef SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE
+    {"EXCEEDS_MAX_FRAGMENT_SIZE", ERR_LIB_SSL, SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE},
+  #else
+    {"EXCEEDS_MAX_FRAGMENT_SIZE", 20, 194},
+  #endif
+  #ifdef SSL_R_EXCESSIVE_MESSAGE_SIZE
+    {"EXCESSIVE_MESSAGE_SIZE", ERR_LIB_SSL, SSL_R_EXCESSIVE_MESSAGE_SIZE},
+  #else
+    {"EXCESSIVE_MESSAGE_SIZE", 20, 152},
+  #endif
+  #ifdef SSL_R_EXTENSION_NOT_RECEIVED
+    {"EXTENSION_NOT_RECEIVED", ERR_LIB_SSL, SSL_R_EXTENSION_NOT_RECEIVED},
+  #else
+    {"EXTENSION_NOT_RECEIVED", 20, 279},
+  #endif
+  #ifdef SSL_R_EXTRA_DATA_IN_MESSAGE
+    {"EXTRA_DATA_IN_MESSAGE", ERR_LIB_SSL, SSL_R_EXTRA_DATA_IN_MESSAGE},
+  #else
+    {"EXTRA_DATA_IN_MESSAGE", 20, 153},
+  #endif
+  #ifdef SSL_R_EXT_LENGTH_MISMATCH
+    {"EXT_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_EXT_LENGTH_MISMATCH},
+  #else
+    {"EXT_LENGTH_MISMATCH", 20, 163},
+  #endif
+  #ifdef SSL_R_FAILED_TO_INIT_ASYNC
+    {"FAILED_TO_INIT_ASYNC", ERR_LIB_SSL, SSL_R_FAILED_TO_INIT_ASYNC},
+  #else
+    {"FAILED_TO_INIT_ASYNC", 20, 405},
+  #endif
+  #ifdef SSL_R_FRAGMENTED_CLIENT_HELLO
+    {"FRAGMENTED_CLIENT_HELLO", ERR_LIB_SSL, SSL_R_FRAGMENTED_CLIENT_HELLO},
+  #else
+    {"FRAGMENTED_CLIENT_HELLO", 20, 401},
+  #endif
+  #ifdef SSL_R_GOT_A_FIN_BEFORE_A_CCS
+    {"GOT_A_FIN_BEFORE_A_CCS", ERR_LIB_SSL, SSL_R_GOT_A_FIN_BEFORE_A_CCS},
+  #else
+    {"GOT_A_FIN_BEFORE_A_CCS", 20, 154},
+  #endif
+  #ifdef SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS
+    {"GOT_NEXT_PROTO_BEFORE_A_CCS", ERR_LIB_SSL, SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS},
+  #else
+    {"GOT_NEXT_PROTO_BEFORE_A_CCS", 20, 355},
+  #endif
+  #ifdef SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION
+    {"GOT_NEXT_PROTO_WITHOUT_EXTENSION", ERR_LIB_SSL, SSL_R_GOT_NEXT_PROTO_WITHOUT_EXTENSION},
+  #else
+    {"GOT_NEXT_PROTO_WITHOUT_EXTENSION", 20, 356},
+  #endif
+  #ifdef SSL_R_HTTPS_PROXY_REQUEST
+    {"HTTPS_PROXY_REQUEST", ERR_LIB_SSL, SSL_R_HTTPS_PROXY_REQUEST},
+  #else
+    {"HTTPS_PROXY_REQUEST", 20, 155},
+  #endif
+  #ifdef SSL_R_HTTP_REQUEST
+    {"HTTP_REQUEST", ERR_LIB_SSL, SSL_R_HTTP_REQUEST},
+  #else
+    {"HTTP_REQUEST", 20, 156},
+  #endif
+  #ifdef SSL_R_ILLEGAL_POINT_COMPRESSION
+    {"ILLEGAL_POINT_COMPRESSION", ERR_LIB_SSL, SSL_R_ILLEGAL_POINT_COMPRESSION},
+  #else
+    {"ILLEGAL_POINT_COMPRESSION", 20, 162},
+  #endif
+  #ifdef SSL_R_ILLEGAL_SUITEB_DIGEST
+    {"ILLEGAL_SUITEB_DIGEST", ERR_LIB_SSL, SSL_R_ILLEGAL_SUITEB_DIGEST},
+  #else
+    {"ILLEGAL_SUITEB_DIGEST", 20, 380},
+  #endif
+  #ifdef SSL_R_INAPPROPRIATE_FALLBACK
+    {"INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, SSL_R_INAPPROPRIATE_FALLBACK},
+  #else
+    {"INAPPROPRIATE_FALLBACK", 20, 373},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_COMPRESSION
+    {"INCONSISTENT_COMPRESSION", ERR_LIB_SSL, SSL_R_INCONSISTENT_COMPRESSION},
+  #else
+    {"INCONSISTENT_COMPRESSION", 20, 340},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_EARLY_DATA_ALPN
+    {"INCONSISTENT_EARLY_DATA_ALPN", ERR_LIB_SSL, SSL_R_INCONSISTENT_EARLY_DATA_ALPN},
+  #else
+    {"INCONSISTENT_EARLY_DATA_ALPN", 20, 222},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_EARLY_DATA_SNI
+    {"INCONSISTENT_EARLY_DATA_SNI", ERR_LIB_SSL, SSL_R_INCONSISTENT_EARLY_DATA_SNI},
+  #else
+    {"INCONSISTENT_EARLY_DATA_SNI", 20, 231},
+  #endif
+  #ifdef SSL_R_INCONSISTENT_EXTMS
+    {"INCONSISTENT_EXTMS", ERR_LIB_SSL, SSL_R_INCONSISTENT_EXTMS},
+  #else
+    {"INCONSISTENT_EXTMS", 20, 104},
+  #endif
+  #ifdef SSL_R_INSUFFICIENT_SECURITY
+    {"INSUFFICIENT_SECURITY", ERR_LIB_SSL, SSL_R_INSUFFICIENT_SECURITY},
+  #else
+    {"INSUFFICIENT_SECURITY", 20, 241},
+  #endif
+  #ifdef SSL_R_INVALID_ALERT
+    {"INVALID_ALERT", ERR_LIB_SSL, SSL_R_INVALID_ALERT},
+  #else
+    {"INVALID_ALERT", 20, 205},
+  #endif
+  #ifdef SSL_R_INVALID_CCS_MESSAGE
+    {"INVALID_CCS_MESSAGE", ERR_LIB_SSL, SSL_R_INVALID_CCS_MESSAGE},
+  #else
+    {"INVALID_CCS_MESSAGE", 20, 260},
+  #endif
+  #ifdef SSL_R_INVALID_CERTIFICATE_OR_ALG
+    {"INVALID_CERTIFICATE_OR_ALG", ERR_LIB_SSL, SSL_R_INVALID_CERTIFICATE_OR_ALG},
+  #else
+    {"INVALID_CERTIFICATE_OR_ALG", 20, 238},
+  #endif
+  #ifdef SSL_R_INVALID_COMMAND
+    {"INVALID_COMMAND", ERR_LIB_SSL, SSL_R_INVALID_COMMAND},
+  #else
+    {"INVALID_COMMAND", 20, 280},
+  #endif
+  #ifdef SSL_R_INVALID_COMPRESSION_ALGORITHM
+    {"INVALID_COMPRESSION_ALGORITHM", ERR_LIB_SSL, SSL_R_INVALID_COMPRESSION_ALGORITHM},
+  #else
+    {"INVALID_COMPRESSION_ALGORITHM", 20, 341},
+  #endif
+  #ifdef SSL_R_INVALID_CONFIG
+    {"INVALID_CONFIG", ERR_LIB_SSL, SSL_R_INVALID_CONFIG},
+  #else
+    {"INVALID_CONFIG", 20, 283},
+  #endif
+  #ifdef SSL_R_INVALID_CONFIGURATION_NAME
+    {"INVALID_CONFIGURATION_NAME", ERR_LIB_SSL, SSL_R_INVALID_CONFIGURATION_NAME},
+  #else
+    {"INVALID_CONFIGURATION_NAME", 20, 113},
+  #endif
+  #ifdef SSL_R_INVALID_CONTEXT
+    {"INVALID_CONTEXT", ERR_LIB_SSL, SSL_R_INVALID_CONTEXT},
+  #else
+    {"INVALID_CONTEXT", 20, 282},
+  #endif
+  #ifdef SSL_R_INVALID_CT_VALIDATION_TYPE
+    {"INVALID_CT_VALIDATION_TYPE", ERR_LIB_SSL, SSL_R_INVALID_CT_VALIDATION_TYPE},
+  #else
+    {"INVALID_CT_VALIDATION_TYPE", 20, 212},
+  #endif
+  #ifdef SSL_R_INVALID_KEY_UPDATE_TYPE
+    {"INVALID_KEY_UPDATE_TYPE", ERR_LIB_SSL, SSL_R_INVALID_KEY_UPDATE_TYPE},
+  #else
+    {"INVALID_KEY_UPDATE_TYPE", 20, 120},
+  #endif
+  #ifdef SSL_R_INVALID_MAX_EARLY_DATA
+    {"INVALID_MAX_EARLY_DATA", ERR_LIB_SSL, SSL_R_INVALID_MAX_EARLY_DATA},
+  #else
+    {"INVALID_MAX_EARLY_DATA", 20, 174},
+  #endif
+  #ifdef SSL_R_INVALID_NULL_CMD_NAME
+    {"INVALID_NULL_CMD_NAME", ERR_LIB_SSL, SSL_R_INVALID_NULL_CMD_NAME},
+  #else
+    {"INVALID_NULL_CMD_NAME", 20, 385},
+  #endif
+  #ifdef SSL_R_INVALID_SEQUENCE_NUMBER
+    {"INVALID_SEQUENCE_NUMBER", ERR_LIB_SSL, SSL_R_INVALID_SEQUENCE_NUMBER},
+  #else
+    {"INVALID_SEQUENCE_NUMBER", 20, 402},
+  #endif
+  #ifdef SSL_R_INVALID_SERVERINFO_DATA
+    {"INVALID_SERVERINFO_DATA", ERR_LIB_SSL, SSL_R_INVALID_SERVERINFO_DATA},
+  #else
+    {"INVALID_SERVERINFO_DATA", 20, 388},
+  #endif
+  #ifdef SSL_R_INVALID_SESSION_ID
+    {"INVALID_SESSION_ID", ERR_LIB_SSL, SSL_R_INVALID_SESSION_ID},
+  #else
+    {"INVALID_SESSION_ID", 20, 999},
+  #endif
+  #ifdef SSL_R_INVALID_SRP_USERNAME
+    {"INVALID_SRP_USERNAME", ERR_LIB_SSL, SSL_R_INVALID_SRP_USERNAME},
+  #else
+    {"INVALID_SRP_USERNAME", 20, 357},
+  #endif
+  #ifdef SSL_R_INVALID_STATUS_RESPONSE
+    {"INVALID_STATUS_RESPONSE", ERR_LIB_SSL, SSL_R_INVALID_STATUS_RESPONSE},
+  #else
+    {"INVALID_STATUS_RESPONSE", 20, 328},
+  #endif
+  #ifdef SSL_R_INVALID_TICKET_KEYS_LENGTH
+    {"INVALID_TICKET_KEYS_LENGTH", ERR_LIB_SSL, SSL_R_INVALID_TICKET_KEYS_LENGTH},
+  #else
+    {"INVALID_TICKET_KEYS_LENGTH", 20, 325},
+  #endif
+  #ifdef SSL_R_KRB5_S_TKT_NYV
+    {"KRB5_S_TKT_NYV", ERR_LIB_SSL, SSL_R_KRB5_S_TKT_NYV},
+  #else
+    {"KRB5_S_TKT_NYV", 20, 294},
+  #endif
+  #ifdef SSL_R_KRB5_S_TKT_SKEW
+    {"KRB5_S_TKT_SKEW", ERR_LIB_SSL, SSL_R_KRB5_S_TKT_SKEW},
+  #else
+    {"KRB5_S_TKT_SKEW", 20, 295},
+  #endif
+  #ifdef SSL_R_LENGTH_MISMATCH
+    {"LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_LENGTH_MISMATCH},
+  #else
+    {"LENGTH_MISMATCH", 20, 159},
+  #endif
+  #ifdef SSL_R_LENGTH_TOO_LONG
+    {"LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_LENGTH_TOO_LONG},
+  #else
+    {"LENGTH_TOO_LONG", 20, 404},
+  #endif
+  #ifdef SSL_R_LENGTH_TOO_SHORT
+    {"LENGTH_TOO_SHORT", ERR_LIB_SSL, SSL_R_LENGTH_TOO_SHORT},
+  #else
+    {"LENGTH_TOO_SHORT", 20, 160},
+  #endif
+  #ifdef SSL_R_LIBRARY_BUG
+    {"LIBRARY_BUG", ERR_LIB_SSL, SSL_R_LIBRARY_BUG},
+  #else
+    {"LIBRARY_BUG", 20, 274},
+  #endif
+  #ifdef SSL_R_LIBRARY_HAS_NO_CIPHERS
+    {"LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, SSL_R_LIBRARY_HAS_NO_CIPHERS},
+  #else
+    {"LIBRARY_HAS_NO_CIPHERS", 20, 161},
+  #endif
+  #ifdef SSL_R_MESSAGE_TOO_LONG
+    {"MESSAGE_TOO_LONG", ERR_LIB_SSL, SSL_R_MESSAGE_TOO_LONG},
+  #else
+    {"MESSAGE_TOO_LONG", 20, 296},
+  #endif
+  #ifdef SSL_R_MISSING_DSA_SIGNING_CERT
+    {"MISSING_DSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_DSA_SIGNING_CERT},
+  #else
+    {"MISSING_DSA_SIGNING_CERT", 20, 165},
+  #endif
+  #ifdef SSL_R_MISSING_ECDH_CERT
+    {"MISSING_ECDH_CERT", ERR_LIB_SSL, SSL_R_MISSING_ECDH_CERT},
+  #else
+    {"MISSING_ECDH_CERT", 20, 382},
+  #endif
+  #ifdef SSL_R_MISSING_ECDSA_SIGNING_CERT
+    {"MISSING_ECDSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_ECDSA_SIGNING_CERT},
+  #else
+    {"MISSING_ECDSA_SIGNING_CERT", 20, 381},
+  #endif
+  #ifdef SSL_R_MISSING_FATAL
+    {"MISSING_FATAL", ERR_LIB_SSL, SSL_R_MISSING_FATAL},
+  #else
+    {"MISSING_FATAL", 20, 256},
+  #endif
+  #ifdef SSL_R_MISSING_PARAMETERS
+    {"MISSING_PARAMETERS", ERR_LIB_SSL, SSL_R_MISSING_PARAMETERS},
+  #else
+    {"MISSING_PARAMETERS", 20, 290},
+  #endif
+  #ifdef SSL_R_MISSING_RSA_CERTIFICATE
+    {"MISSING_RSA_CERTIFICATE", ERR_LIB_SSL, SSL_R_MISSING_RSA_CERTIFICATE},
+  #else
+    {"MISSING_RSA_CERTIFICATE", 20, 168},
+  #endif
+  #ifdef SSL_R_MISSING_RSA_ENCRYPTING_CERT
+    {"MISSING_RSA_ENCRYPTING_CERT", ERR_LIB_SSL, SSL_R_MISSING_RSA_ENCRYPTING_CERT},
+  #else
+    {"MISSING_RSA_ENCRYPTING_CERT", 20, 169},
+  #endif
+  #ifdef SSL_R_MISSING_RSA_SIGNING_CERT
+    {"MISSING_RSA_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_RSA_SIGNING_CERT},
+  #else
+    {"MISSING_RSA_SIGNING_CERT", 20, 170},
+  #endif
+  #ifdef SSL_R_MISSING_SIGALGS_EXTENSION
+    {"MISSING_SIGALGS_EXTENSION", ERR_LIB_SSL, SSL_R_MISSING_SIGALGS_EXTENSION},
+  #else
+    {"MISSING_SIGALGS_EXTENSION", 20, 112},
+  #endif
+  #ifdef SSL_R_MISSING_SIGNING_CERT
+    {"MISSING_SIGNING_CERT", ERR_LIB_SSL, SSL_R_MISSING_SIGNING_CERT},
+  #else
+    {"MISSING_SIGNING_CERT", 20, 221},
+  #endif
+  #ifdef SSL_R_MISSING_SRP_PARAM
+    {"MISSING_SRP_PARAM", ERR_LIB_SSL, SSL_R_MISSING_SRP_PARAM},
+  #else
+    {"MISSING_SRP_PARAM", 20, 358},
+  #endif
+  #ifdef SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION
+    {"MISSING_SUPPORTED_GROUPS_EXTENSION", ERR_LIB_SSL, SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION},
+  #else
+    {"MISSING_SUPPORTED_GROUPS_EXTENSION", 20, 209},
   #endif
   #ifdef SSL_R_MISSING_TMP_DH_KEY
     {"MISSING_TMP_DH_KEY", ERR_LIB_SSL, SSL_R_MISSING_TMP_DH_KEY},
   #else
-    {"MISSING_TMP_DH_KEY", ERR_LIB_SSL, 171},
+    {"MISSING_TMP_DH_KEY", 20, 171},
+  #endif
+  #ifdef SSL_R_MISSING_TMP_ECDH_KEY
+    {"MISSING_TMP_ECDH_KEY", ERR_LIB_SSL, SSL_R_MISSING_TMP_ECDH_KEY},
+  #else
+    {"MISSING_TMP_ECDH_KEY", 20, 311},
+  #endif
+  #ifdef SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA
+    {"MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA", ERR_LIB_SSL, SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA},
+  #else
+    {"MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA", 20, 293},
+  #endif
+  #ifdef SSL_R_MULTIPLE_SGC_RESTARTS
+    {"MULTIPLE_SGC_RESTARTS", ERR_LIB_SSL, SSL_R_MULTIPLE_SGC_RESTARTS},
+  #else
+    {"MULTIPLE_SGC_RESTARTS", 20, 346},
+  #endif
+  #ifdef SSL_R_NOT_ON_RECORD_BOUNDARY
+    {"NOT_ON_RECORD_BOUNDARY", ERR_LIB_SSL, SSL_R_NOT_ON_RECORD_BOUNDARY},
+  #else
+    {"NOT_ON_RECORD_BOUNDARY", 20, 182},
+  #endif
+  #ifdef SSL_R_NOT_REPLACING_CERTIFICATE
+    {"NOT_REPLACING_CERTIFICATE", ERR_LIB_SSL, SSL_R_NOT_REPLACING_CERTIFICATE},
+  #else
+    {"NOT_REPLACING_CERTIFICATE", 20, 289},
+  #endif
+  #ifdef SSL_R_NOT_SERVER
+    {"NOT_SERVER", ERR_LIB_SSL, SSL_R_NOT_SERVER},
+  #else
+    {"NOT_SERVER", 20, 284},
+  #endif
+  #ifdef SSL_R_NO_APPLICATION_PROTOCOL
+    {"NO_APPLICATION_PROTOCOL", ERR_LIB_SSL, SSL_R_NO_APPLICATION_PROTOCOL},
+  #else
+    {"NO_APPLICATION_PROTOCOL", 20, 235},
+  #endif
+  #ifdef SSL_R_NO_CERTIFICATES_RETURNED
+    {"NO_CERTIFICATES_RETURNED", ERR_LIB_SSL, SSL_R_NO_CERTIFICATES_RETURNED},
+  #else
+    {"NO_CERTIFICATES_RETURNED", 20, 176},
+  #endif
+  #ifdef SSL_R_NO_CERTIFICATE_ASSIGNED
+    {"NO_CERTIFICATE_ASSIGNED", ERR_LIB_SSL, SSL_R_NO_CERTIFICATE_ASSIGNED},
+  #else
+    {"NO_CERTIFICATE_ASSIGNED", 20, 177},
+  #endif
+  #ifdef SSL_R_NO_CERTIFICATE_SET
+    {"NO_CERTIFICATE_SET", ERR_LIB_SSL, SSL_R_NO_CERTIFICATE_SET},
+  #else
+    {"NO_CERTIFICATE_SET", 20, 179},
+  #endif
+  #ifdef SSL_R_NO_CHANGE_FOLLOWING_HRR
+    {"NO_CHANGE_FOLLOWING_HRR", ERR_LIB_SSL, SSL_R_NO_CHANGE_FOLLOWING_HRR},
+  #else
+    {"NO_CHANGE_FOLLOWING_HRR", 20, 214},
+  #endif
+  #ifdef SSL_R_NO_CIPHERS_AVAILABLE
+    {"NO_CIPHERS_AVAILABLE", ERR_LIB_SSL, SSL_R_NO_CIPHERS_AVAILABLE},
+  #else
+    {"NO_CIPHERS_AVAILABLE", 20, 181},
+  #endif
+  #ifdef SSL_R_NO_CIPHERS_SPECIFIED
+    {"NO_CIPHERS_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_CIPHERS_SPECIFIED},
+  #else
+    {"NO_CIPHERS_SPECIFIED", 20, 183},
+  #endif
+  #ifdef SSL_R_NO_CIPHER_MATCH
+    {"NO_CIPHER_MATCH", ERR_LIB_SSL, SSL_R_NO_CIPHER_MATCH},
+  #else
+    {"NO_CIPHER_MATCH", 20, 185},
+  #endif
+  #ifdef SSL_R_NO_CLIENT_CERT_METHOD
+    {"NO_CLIENT_CERT_METHOD", ERR_LIB_SSL, SSL_R_NO_CLIENT_CERT_METHOD},
+  #else
+    {"NO_CLIENT_CERT_METHOD", 20, 331},
+  #endif
+  #ifdef SSL_R_NO_COMPRESSION_SPECIFIED
+    {"NO_COMPRESSION_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_COMPRESSION_SPECIFIED},
+  #else
+    {"NO_COMPRESSION_SPECIFIED", 20, 187},
+  #endif
+  #ifdef SSL_R_NO_COOKIE_CALLBACK_SET
+    {"NO_COOKIE_CALLBACK_SET", ERR_LIB_SSL, SSL_R_NO_COOKIE_CALLBACK_SET},
+  #else
+    {"NO_COOKIE_CALLBACK_SET", 20, 287},
+  #endif
+  #ifdef SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER
+    {"NO_GOST_CERTIFICATE_SENT_BY_PEER", ERR_LIB_SSL, SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER},
+  #else
+    {"NO_GOST_CERTIFICATE_SENT_BY_PEER", 20, 330},
+  #endif
+  #ifdef SSL_R_NO_METHOD_SPECIFIED
+    {"NO_METHOD_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_METHOD_SPECIFIED},
+  #else
+    {"NO_METHOD_SPECIFIED", 20, 188},
+  #endif
+  #ifdef SSL_R_NO_PEM_EXTENSIONS
+    {"NO_PEM_EXTENSIONS", ERR_LIB_SSL, SSL_R_NO_PEM_EXTENSIONS},
+  #else
+    {"NO_PEM_EXTENSIONS", 20, 389},
+  #endif
+  #ifdef SSL_R_NO_PRIVATE_KEY_ASSIGNED
+    {"NO_PRIVATE_KEY_ASSIGNED", ERR_LIB_SSL, SSL_R_NO_PRIVATE_KEY_ASSIGNED},
+  #else
+    {"NO_PRIVATE_KEY_ASSIGNED", 20, 190},
+  #endif
+  #ifdef SSL_R_NO_PROTOCOLS_AVAILABLE
+    {"NO_PROTOCOLS_AVAILABLE", ERR_LIB_SSL, SSL_R_NO_PROTOCOLS_AVAILABLE},
+  #else
+    {"NO_PROTOCOLS_AVAILABLE", 20, 191},
+  #endif
+  #ifdef SSL_R_NO_RENEGOTIATION
+    {"NO_RENEGOTIATION", ERR_LIB_SSL, SSL_R_NO_RENEGOTIATION},
+  #else
+    {"NO_RENEGOTIATION", 20, 339},
+  #endif
+  #ifdef SSL_R_NO_REQUIRED_DIGEST
+    {"NO_REQUIRED_DIGEST", ERR_LIB_SSL, SSL_R_NO_REQUIRED_DIGEST},
+  #else
+    {"NO_REQUIRED_DIGEST", 20, 324},
+  #endif
+  #ifdef SSL_R_NO_SHARED_CIPHER
+    {"NO_SHARED_CIPHER", ERR_LIB_SSL, SSL_R_NO_SHARED_CIPHER},
+  #else
+    {"NO_SHARED_CIPHER", 20, 193},
+  #endif
+  #ifdef SSL_R_NO_SHARED_GROUPS
+    {"NO_SHARED_GROUPS", ERR_LIB_SSL, SSL_R_NO_SHARED_GROUPS},
+  #else
+    {"NO_SHARED_GROUPS", 20, 410},
+  #endif
+  #ifdef SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS
+    {"NO_SHARED_SIGNATURE_ALGORITHMS", ERR_LIB_SSL, SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS},
+  #else
+    {"NO_SHARED_SIGNATURE_ALGORITHMS", 20, 376},
+  #endif
+  #ifdef SSL_R_NO_SRTP_PROFILES
+    {"NO_SRTP_PROFILES", ERR_LIB_SSL, SSL_R_NO_SRTP_PROFILES},
+  #else
+    {"NO_SRTP_PROFILES", 20, 359},
+  #endif
+  #ifdef SSL_R_NO_SUITABLE_KEY_SHARE
+    {"NO_SUITABLE_KEY_SHARE", ERR_LIB_SSL, SSL_R_NO_SUITABLE_KEY_SHARE},
+  #else
+    {"NO_SUITABLE_KEY_SHARE", 20, 101},
+  #endif
+  #ifdef SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM
+    {"NO_SUITABLE_SIGNATURE_ALGORITHM", ERR_LIB_SSL, SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM},
+  #else
+    {"NO_SUITABLE_SIGNATURE_ALGORITHM", 20, 118},
+  #endif
+  #ifdef SSL_R_NO_VALID_SCTS
+    {"NO_VALID_SCTS", ERR_LIB_SSL, SSL_R_NO_VALID_SCTS},
+  #else
+    {"NO_VALID_SCTS", 20, 216},
+  #endif
+  #ifdef SSL_R_NO_VERIFY_COOKIE_CALLBACK
+    {"NO_VERIFY_COOKIE_CALLBACK", ERR_LIB_SSL, SSL_R_NO_VERIFY_COOKIE_CALLBACK},
+  #else
+    {"NO_VERIFY_COOKIE_CALLBACK", 20, 403},
+  #endif
+  #ifdef SSL_R_NULL_SSL_CTX
+    {"NULL_SSL_CTX", ERR_LIB_SSL, SSL_R_NULL_SSL_CTX},
+  #else
+    {"NULL_SSL_CTX", 20, 195},
+  #endif
+  #ifdef SSL_R_NULL_SSL_METHOD_PASSED
+    {"NULL_SSL_METHOD_PASSED", ERR_LIB_SSL, SSL_R_NULL_SSL_METHOD_PASSED},
+  #else
+    {"NULL_SSL_METHOD_PASSED", 20, 196},
+  #endif
+  #ifdef SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED
+    {"OLD_SESSION_CIPHER_NOT_RETURNED", ERR_LIB_SSL, SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED},
+  #else
+    {"OLD_SESSION_CIPHER_NOT_RETURNED", 20, 197},
+  #endif
+  #ifdef SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED
+    {"OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED", ERR_LIB_SSL, SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED},
+  #else
+    {"OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED", 20, 344},
+  #endif
+  #ifdef SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE
+    {"ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE},
+  #else
+    {"ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE", 20, 387},
+  #endif
+  #ifdef SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE
+    {"ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE},
+  #else
+    {"ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE", 20, 379},
+  #endif
+  #ifdef SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE
+    {"ONLY_TLS_ALLOWED_IN_FIPS_MODE", ERR_LIB_SSL, SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE},
+  #else
+    {"ONLY_TLS_ALLOWED_IN_FIPS_MODE", 20, 297},
+  #endif
+  #ifdef SSL_R_OPAQUE_PRF_INPUT_TOO_LONG
+    {"OPAQUE_PRF_INPUT_TOO_LONG", ERR_LIB_SSL, SSL_R_OPAQUE_PRF_INPUT_TOO_LONG},
+  #else
+    {"OPAQUE_PRF_INPUT_TOO_LONG", 20, 327},
+  #endif
+  #ifdef SSL_R_OVERFLOW_ERROR
+    {"OVERFLOW_ERROR", ERR_LIB_SSL, SSL_R_OVERFLOW_ERROR},
+  #else
+    {"OVERFLOW_ERROR", 20, 237},
+  #endif
+  #ifdef SSL_R_PACKET_LENGTH_TOO_LONG
+    {"PACKET_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_PACKET_LENGTH_TOO_LONG},
+  #else
+    {"PACKET_LENGTH_TOO_LONG", 20, 198},
+  #endif
+  #ifdef SSL_R_PARSE_TLSEXT
+    {"PARSE_TLSEXT", ERR_LIB_SSL, SSL_R_PARSE_TLSEXT},
+  #else
+    {"PARSE_TLSEXT", 20, 227},
+  #endif
+  #ifdef SSL_R_PATH_TOO_LONG
+    {"PATH_TOO_LONG", ERR_LIB_SSL, SSL_R_PATH_TOO_LONG},
+  #else
+    {"PATH_TOO_LONG", 20, 270},
+  #endif
+  #ifdef SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE
+    {"PEER_DID_NOT_RETURN_A_CERTIFICATE", ERR_LIB_SSL, SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE},
+  #else
+    {"PEER_DID_NOT_RETURN_A_CERTIFICATE", 20, 199},
+  #endif
+  #ifdef SSL_R_PEM_NAME_BAD_PREFIX
+    {"PEM_NAME_BAD_PREFIX", ERR_LIB_SSL, SSL_R_PEM_NAME_BAD_PREFIX},
+  #else
+    {"PEM_NAME_BAD_PREFIX", 20, 391},
+  #endif
+  #ifdef SSL_R_PEM_NAME_TOO_SHORT
+    {"PEM_NAME_TOO_SHORT", ERR_LIB_SSL, SSL_R_PEM_NAME_TOO_SHORT},
+  #else
+    {"PEM_NAME_TOO_SHORT", 20, 392},
+  #endif
+  #ifdef SSL_R_PIPELINE_FAILURE
+    {"PIPELINE_FAILURE", ERR_LIB_SSL, SSL_R_PIPELINE_FAILURE},
+  #else
+    {"PIPELINE_FAILURE", 20, 406},
+  #endif
+  #ifdef SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR
+    {"POST_HANDSHAKE_AUTH_ENCODING_ERR", ERR_LIB_SSL, SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR},
+  #else
+    {"POST_HANDSHAKE_AUTH_ENCODING_ERR", 20, 278},
+  #endif
+  #ifdef SSL_R_PRIVATE_KEY_MISMATCH
+    {"PRIVATE_KEY_MISMATCH", ERR_LIB_SSL, SSL_R_PRIVATE_KEY_MISMATCH},
+  #else
+    {"PRIVATE_KEY_MISMATCH", 20, 288},
+  #endif
+  #ifdef SSL_R_PROTOCOL_IS_SHUTDOWN
+    {"PROTOCOL_IS_SHUTDOWN", ERR_LIB_SSL, SSL_R_PROTOCOL_IS_SHUTDOWN},
+  #else
+    {"PROTOCOL_IS_SHUTDOWN", 20, 207},
+  #endif
+  #ifdef SSL_R_PSK_IDENTITY_NOT_FOUND
+    {"PSK_IDENTITY_NOT_FOUND", ERR_LIB_SSL, SSL_R_PSK_IDENTITY_NOT_FOUND},
+  #else
+    {"PSK_IDENTITY_NOT_FOUND", 20, 223},
+  #endif
+  #ifdef SSL_R_PSK_NO_CLIENT_CB
+    {"PSK_NO_CLIENT_CB", ERR_LIB_SSL, SSL_R_PSK_NO_CLIENT_CB},
+  #else
+    {"PSK_NO_CLIENT_CB", 20, 224},
+  #endif
+  #ifdef SSL_R_PSK_NO_SERVER_CB
+    {"PSK_NO_SERVER_CB", ERR_LIB_SSL, SSL_R_PSK_NO_SERVER_CB},
+  #else
+    {"PSK_NO_SERVER_CB", 20, 225},
+  #endif
+  #ifdef SSL_R_READ_BIO_NOT_SET
+    {"READ_BIO_NOT_SET", ERR_LIB_SSL, SSL_R_READ_BIO_NOT_SET},
+  #else
+    {"READ_BIO_NOT_SET", 20, 211},
+  #endif
+  #ifdef SSL_R_READ_TIMEOUT_EXPIRED
+    {"READ_TIMEOUT_EXPIRED", ERR_LIB_SSL, SSL_R_READ_TIMEOUT_EXPIRED},
+  #else
+    {"READ_TIMEOUT_EXPIRED", 20, 312},
+  #endif
+  #ifdef SSL_R_RECORD_LENGTH_MISMATCH
+    {"RECORD_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_RECORD_LENGTH_MISMATCH},
+  #else
+    {"RECORD_LENGTH_MISMATCH", 20, 213},
+  #endif
+  #ifdef SSL_R_RECORD_TOO_SMALL
+    {"RECORD_TOO_SMALL", ERR_LIB_SSL, SSL_R_RECORD_TOO_SMALL},
+  #else
+    {"RECORD_TOO_SMALL", 20, 298},
+  #endif
+  #ifdef SSL_R_RENEGOTIATE_EXT_TOO_LONG
+    {"RENEGOTIATE_EXT_TOO_LONG", ERR_LIB_SSL, SSL_R_RENEGOTIATE_EXT_TOO_LONG},
+  #else
+    {"RENEGOTIATE_EXT_TOO_LONG", 20, 335},
+  #endif
+  #ifdef SSL_R_RENEGOTIATION_ENCODING_ERR
+    {"RENEGOTIATION_ENCODING_ERR", ERR_LIB_SSL, SSL_R_RENEGOTIATION_ENCODING_ERR},
+  #else
+    {"RENEGOTIATION_ENCODING_ERR", 20, 336},
+  #endif
+  #ifdef SSL_R_RENEGOTIATION_MISMATCH
+    {"RENEGOTIATION_MISMATCH", ERR_LIB_SSL, SSL_R_RENEGOTIATION_MISMATCH},
+  #else
+    {"RENEGOTIATION_MISMATCH", 20, 337},
+  #endif
+  #ifdef SSL_R_REQUEST_PENDING
+    {"REQUEST_PENDING", ERR_LIB_SSL, SSL_R_REQUEST_PENDING},
+  #else
+    {"REQUEST_PENDING", 20, 285},
+  #endif
+  #ifdef SSL_R_REQUEST_SENT
+    {"REQUEST_SENT", ERR_LIB_SSL, SSL_R_REQUEST_SENT},
+  #else
+    {"REQUEST_SENT", 20, 286},
+  #endif
+  #ifdef SSL_R_REQUIRED_CIPHER_MISSING
+    {"REQUIRED_CIPHER_MISSING", ERR_LIB_SSL, SSL_R_REQUIRED_CIPHER_MISSING},
+  #else
+    {"REQUIRED_CIPHER_MISSING", 20, 215},
+  #endif
+  #ifdef SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING
+    {"REQUIRED_COMPRESSION_ALGORITHM_MISSING", ERR_LIB_SSL, SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING},
+  #else
+    {"REQUIRED_COMPRESSION_ALGORITHM_MISSING", 20, 342},
+  #endif
+  #ifdef SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING
+    {"SCSV_RECEIVED_WHEN_RENEGOTIATING", ERR_LIB_SSL, SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING},
+  #else
+    {"SCSV_RECEIVED_WHEN_RENEGOTIATING", 20, 345},
+  #endif
+  #ifdef SSL_R_SCT_VERIFICATION_FAILED
+    {"SCT_VERIFICATION_FAILED", ERR_LIB_SSL, SSL_R_SCT_VERIFICATION_FAILED},
+  #else
+    {"SCT_VERIFICATION_FAILED", 20, 208},
+  #endif
+  #ifdef SSL_R_SERVERHELLO_TLSEXT
+    {"SERVERHELLO_TLSEXT", ERR_LIB_SSL, SSL_R_SERVERHELLO_TLSEXT},
+  #else
+    {"SERVERHELLO_TLSEXT", 20, 275},
+  #endif
+  #ifdef SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED
+    {"SESSION_ID_CONTEXT_UNINITIALIZED", ERR_LIB_SSL, SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED},
+  #else
+    {"SESSION_ID_CONTEXT_UNINITIALIZED", 20, 277},
+  #endif
+  #ifdef SSL_R_SHUTDOWN_WHILE_IN_INIT
+    {"SHUTDOWN_WHILE_IN_INIT", ERR_LIB_SSL, SSL_R_SHUTDOWN_WHILE_IN_INIT},
+  #else
+    {"SHUTDOWN_WHILE_IN_INIT", 20, 407},
+  #endif
+  #ifdef SSL_R_SIGNATURE_ALGORITHMS_ERROR
+    {"SIGNATURE_ALGORITHMS_ERROR", ERR_LIB_SSL, SSL_R_SIGNATURE_ALGORITHMS_ERROR},
+  #else
+    {"SIGNATURE_ALGORITHMS_ERROR", 20, 360},
+  #endif
+  #ifdef SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE
+    {"SIGNATURE_FOR_NON_SIGNING_CERTIFICATE", ERR_LIB_SSL, SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE},
+  #else
+    {"SIGNATURE_FOR_NON_SIGNING_CERTIFICATE", 20, 220},
+  #endif
+  #ifdef SSL_R_SRP_A_CALC
+    {"SRP_A_CALC", ERR_LIB_SSL, SSL_R_SRP_A_CALC},
+  #else
+    {"SRP_A_CALC", 20, 361},
+  #endif
+  #ifdef SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES
+    {"SRTP_COULD_NOT_ALLOCATE_PROFILES", ERR_LIB_SSL, SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES},
+  #else
+    {"SRTP_COULD_NOT_ALLOCATE_PROFILES", 20, 362},
+  #endif
+  #ifdef SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG
+    {"SRTP_PROTECTION_PROFILE_LIST_TOO_LONG", ERR_LIB_SSL, SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG},
+  #else
+    {"SRTP_PROTECTION_PROFILE_LIST_TOO_LONG", 20, 363},
+  #endif
+  #ifdef SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE
+    {"SRTP_UNKNOWN_PROTECTION_PROFILE", ERR_LIB_SSL, SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE},
+  #else
+    {"SRTP_UNKNOWN_PROTECTION_PROFILE", 20, 364},
+  #endif
+  #ifdef SSL_R_SSL2_CONNECTION_ID_TOO_LONG
+    {"SSL2_CONNECTION_ID_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL2_CONNECTION_ID_TOO_LONG},
+  #else
+    {"SSL2_CONNECTION_ID_TOO_LONG", 20, 299},
+  #endif
+  #ifdef SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT
+    {"SSL3_EXT_INVALID_ECPOINTFORMAT", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT},
+  #else
+    {"SSL3_EXT_INVALID_ECPOINTFORMAT", 20, 321},
+  #endif
+  #ifdef SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH
+    {"SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH},
+  #else
+    {"SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH", 20, 232},
+  #endif
+  #ifdef SSL_R_SSL3_EXT_INVALID_SERVERNAME
+    {"SSL3_EXT_INVALID_SERVERNAME", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME},
+  #else
+    {"SSL3_EXT_INVALID_SERVERNAME", 20, 319},
   #endif
-  #ifdef SSL_R_MISSING_TMP_ECDH_KEY
-    {"MISSING_TMP_ECDH_KEY", ERR_LIB_SSL, SSL_R_MISSING_TMP_ECDH_KEY},
+  #ifdef SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE
+    {"SSL3_EXT_INVALID_SERVERNAME_TYPE", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE},
   #else
-    {"MISSING_TMP_ECDH_KEY", ERR_LIB_SSL, 311},
+    {"SSL3_EXT_INVALID_SERVERNAME_TYPE", 20, 320},
   #endif
-  #ifdef SSL_R_MISSING_TMP_RSA_KEY
-    {"MISSING_TMP_RSA_KEY", ERR_LIB_SSL, SSL_R_MISSING_TMP_RSA_KEY},
+  #ifdef SSL_R_SSL3_SESSION_ID_TOO_LONG
+    {"SSL3_SESSION_ID_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL3_SESSION_ID_TOO_LONG},
   #else
-    {"MISSING_TMP_RSA_KEY", ERR_LIB_SSL, 172},
+    {"SSL3_SESSION_ID_TOO_LONG", 20, 300},
   #endif
-  #ifdef SSL_R_MISSING_TMP_RSA_PKEY
-    {"MISSING_TMP_RSA_PKEY", ERR_LIB_SSL, SSL_R_MISSING_TMP_RSA_PKEY},
+  #ifdef SSL_R_SSLV3_ALERT_BAD_CERTIFICATE
+    {"SSLV3_ALERT_BAD_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_BAD_CERTIFICATE},
   #else
-    {"MISSING_TMP_RSA_PKEY", ERR_LIB_SSL, 173},
+    {"SSLV3_ALERT_BAD_CERTIFICATE", 20, 1042},
   #endif
-  #ifdef SSL_R_MISSING_VERIFY_MESSAGE
-    {"MISSING_VERIFY_MESSAGE", ERR_LIB_SSL, SSL_R_MISSING_VERIFY_MESSAGE},
+  #ifdef SSL_R_SSLV3_ALERT_BAD_RECORD_MAC
+    {"SSLV3_ALERT_BAD_RECORD_MAC", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_BAD_RECORD_MAC},
   #else
-    {"MISSING_VERIFY_MESSAGE", ERR_LIB_SSL, 174},
+    {"SSLV3_ALERT_BAD_RECORD_MAC", 20, 1020},
   #endif
-  #ifdef SSL_R_MULTIPLE_SGC_RESTARTS
-    {"MULTIPLE_SGC_RESTARTS", ERR_LIB_SSL, SSL_R_MULTIPLE_SGC_RESTARTS},
+  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED
+    {"SSLV3_ALERT_CERTIFICATE_EXPIRED", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED},
   #else
-    {"MULTIPLE_SGC_RESTARTS", ERR_LIB_SSL, 346},
+    {"SSLV3_ALERT_CERTIFICATE_EXPIRED", 20, 1045},
   #endif
-  #ifdef SSL_R_NON_SSLV2_INITIAL_PACKET
-    {"NON_SSLV2_INITIAL_PACKET", ERR_LIB_SSL, SSL_R_NON_SSLV2_INITIAL_PACKET},
+  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED
+    {"SSLV3_ALERT_CERTIFICATE_REVOKED", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED},
   #else
-    {"NON_SSLV2_INITIAL_PACKET", ERR_LIB_SSL, 175},
+    {"SSLV3_ALERT_CERTIFICATE_REVOKED", 20, 1044},
   #endif
-  #ifdef SSL_R_NO_CERTIFICATES_RETURNED
-    {"NO_CERTIFICATES_RETURNED", ERR_LIB_SSL, SSL_R_NO_CERTIFICATES_RETURNED},
+  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN
+    {"SSLV3_ALERT_CERTIFICATE_UNKNOWN", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN},
   #else
-    {"NO_CERTIFICATES_RETURNED", ERR_LIB_SSL, 176},
+    {"SSLV3_ALERT_CERTIFICATE_UNKNOWN", 20, 1046},
   #endif
-  #ifdef SSL_R_NO_CERTIFICATE_ASSIGNED
-    {"NO_CERTIFICATE_ASSIGNED", ERR_LIB_SSL, SSL_R_NO_CERTIFICATE_ASSIGNED},
+  #ifdef SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE
+    {"SSLV3_ALERT_DECOMPRESSION_FAILURE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE},
   #else
-    {"NO_CERTIFICATE_ASSIGNED", ERR_LIB_SSL, 177},
+    {"SSLV3_ALERT_DECOMPRESSION_FAILURE", 20, 1030},
   #endif
-  #ifdef SSL_R_NO_CERTIFICATE_RETURNED
-    {"NO_CERTIFICATE_RETURNED", ERR_LIB_SSL, SSL_R_NO_CERTIFICATE_RETURNED},
+  #ifdef SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE
+    {"SSLV3_ALERT_HANDSHAKE_FAILURE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE},
   #else
-    {"NO_CERTIFICATE_RETURNED", ERR_LIB_SSL, 178},
+    {"SSLV3_ALERT_HANDSHAKE_FAILURE", 20, 1040},
   #endif
-  #ifdef SSL_R_NO_CERTIFICATE_SET
-    {"NO_CERTIFICATE_SET", ERR_LIB_SSL, SSL_R_NO_CERTIFICATE_SET},
+  #ifdef SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER
+    {"SSLV3_ALERT_ILLEGAL_PARAMETER", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER},
   #else
-    {"NO_CERTIFICATE_SET", ERR_LIB_SSL, 179},
+    {"SSLV3_ALERT_ILLEGAL_PARAMETER", 20, 1047},
   #endif
-  #ifdef SSL_R_NO_CERTIFICATE_SPECIFIED
-    {"NO_CERTIFICATE_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_CERTIFICATE_SPECIFIED},
+  #ifdef SSL_R_SSLV3_ALERT_NO_CERTIFICATE
+    {"SSLV3_ALERT_NO_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_NO_CERTIFICATE},
   #else
-    {"NO_CERTIFICATE_SPECIFIED", ERR_LIB_SSL, 180},
+    {"SSLV3_ALERT_NO_CERTIFICATE", 20, 1041},
   #endif
-  #ifdef SSL_R_NO_CIPHERS_AVAILABLE
-    {"NO_CIPHERS_AVAILABLE", ERR_LIB_SSL, SSL_R_NO_CIPHERS_AVAILABLE},
+  #ifdef SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE
+    {"SSLV3_ALERT_UNEXPECTED_MESSAGE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE},
   #else
-    {"NO_CIPHERS_AVAILABLE", ERR_LIB_SSL, 181},
+    {"SSLV3_ALERT_UNEXPECTED_MESSAGE", 20, 1010},
   #endif
-  #ifdef SSL_R_NO_CIPHERS_PASSED
-    {"NO_CIPHERS_PASSED", ERR_LIB_SSL, SSL_R_NO_CIPHERS_PASSED},
+  #ifdef SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE
+    {"SSLV3_ALERT_UNSUPPORTED_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE},
   #else
-    {"NO_CIPHERS_PASSED", ERR_LIB_SSL, 182},
+    {"SSLV3_ALERT_UNSUPPORTED_CERTIFICATE", 20, 1043},
   #endif
-  #ifdef SSL_R_NO_CIPHERS_SPECIFIED
-    {"NO_CIPHERS_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_CIPHERS_SPECIFIED},
+  #ifdef SSL_R_SSL_COMMAND_SECTION_EMPTY
+    {"SSL_COMMAND_SECTION_EMPTY", ERR_LIB_SSL, SSL_R_SSL_COMMAND_SECTION_EMPTY},
   #else
-    {"NO_CIPHERS_SPECIFIED", ERR_LIB_SSL, 183},
+    {"SSL_COMMAND_SECTION_EMPTY", 20, 117},
   #endif
-  #ifdef SSL_R_NO_CIPHER_LIST
-    {"NO_CIPHER_LIST", ERR_LIB_SSL, SSL_R_NO_CIPHER_LIST},
+  #ifdef SSL_R_SSL_COMMAND_SECTION_NOT_FOUND
+    {"SSL_COMMAND_SECTION_NOT_FOUND", ERR_LIB_SSL, SSL_R_SSL_COMMAND_SECTION_NOT_FOUND},
   #else
-    {"NO_CIPHER_LIST", ERR_LIB_SSL, 184},
+    {"SSL_COMMAND_SECTION_NOT_FOUND", 20, 125},
   #endif
-  #ifdef SSL_R_NO_CIPHER_MATCH
-    {"NO_CIPHER_MATCH", ERR_LIB_SSL, SSL_R_NO_CIPHER_MATCH},
+  #ifdef SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION
+    {"SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION", ERR_LIB_SSL, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION},
   #else
-    {"NO_CIPHER_MATCH", ERR_LIB_SSL, 185},
+    {"SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION", 20, 228},
   #endif
-  #ifdef SSL_R_NO_CLIENT_CERT_METHOD
-    {"NO_CLIENT_CERT_METHOD", ERR_LIB_SSL, SSL_R_NO_CLIENT_CERT_METHOD},
+  #ifdef SSL_R_SSL_HANDSHAKE_FAILURE
+    {"SSL_HANDSHAKE_FAILURE", ERR_LIB_SSL, SSL_R_SSL_HANDSHAKE_FAILURE},
   #else
-    {"NO_CLIENT_CERT_METHOD", ERR_LIB_SSL, 331},
+    {"SSL_HANDSHAKE_FAILURE", 20, 229},
   #endif
-  #ifdef SSL_R_NO_CLIENT_CERT_RECEIVED
-    {"NO_CLIENT_CERT_RECEIVED", ERR_LIB_SSL, SSL_R_NO_CLIENT_CERT_RECEIVED},
+  #ifdef SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS
+    {"SSL_LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS},
   #else
-    {"NO_CLIENT_CERT_RECEIVED", ERR_LIB_SSL, 186},
+    {"SSL_LIBRARY_HAS_NO_CIPHERS", 20, 230},
   #endif
-  #ifdef SSL_R_NO_COMPRESSION_SPECIFIED
-    {"NO_COMPRESSION_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_COMPRESSION_SPECIFIED},
+  #ifdef SSL_R_SSL_NEGATIVE_LENGTH
+    {"SSL_NEGATIVE_LENGTH", ERR_LIB_SSL, SSL_R_SSL_NEGATIVE_LENGTH},
   #else
-    {"NO_COMPRESSION_SPECIFIED", ERR_LIB_SSL, 187},
+    {"SSL_NEGATIVE_LENGTH", 20, 372},
   #endif
-  #ifdef SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER
-    {"NO_GOST_CERTIFICATE_SENT_BY_PEER", ERR_LIB_SSL, SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER},
+  #ifdef SSL_R_SSL_SECTION_EMPTY
+    {"SSL_SECTION_EMPTY", ERR_LIB_SSL, SSL_R_SSL_SECTION_EMPTY},
   #else
-    {"NO_GOST_CERTIFICATE_SENT_BY_PEER", ERR_LIB_SSL, 330},
+    {"SSL_SECTION_EMPTY", 20, 126},
   #endif
-  #ifdef SSL_R_NO_METHOD_SPECIFIED
-    {"NO_METHOD_SPECIFIED", ERR_LIB_SSL, SSL_R_NO_METHOD_SPECIFIED},
+  #ifdef SSL_R_SSL_SECTION_NOT_FOUND
+    {"SSL_SECTION_NOT_FOUND", ERR_LIB_SSL, SSL_R_SSL_SECTION_NOT_FOUND},
   #else
-    {"NO_METHOD_SPECIFIED", ERR_LIB_SSL, 188},
+    {"SSL_SECTION_NOT_FOUND", 20, 136},
   #endif
-  #ifdef SSL_R_NO_PEM_EXTENSIONS
-    {"NO_PEM_EXTENSIONS", ERR_LIB_SSL, SSL_R_NO_PEM_EXTENSIONS},
+  #ifdef SSL_R_SSL_SESSION_ID_CALLBACK_FAILED
+    {"SSL_SESSION_ID_CALLBACK_FAILED", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CALLBACK_FAILED},
   #else
-    {"NO_PEM_EXTENSIONS", ERR_LIB_SSL, 389},
+    {"SSL_SESSION_ID_CALLBACK_FAILED", 20, 301},
   #endif
-  #ifdef SSL_R_NO_PRIVATEKEY
-    {"NO_PRIVATEKEY", ERR_LIB_SSL, SSL_R_NO_PRIVATEKEY},
+  #ifdef SSL_R_SSL_SESSION_ID_CONFLICT
+    {"SSL_SESSION_ID_CONFLICT", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CONFLICT},
   #else
-    {"NO_PRIVATEKEY", ERR_LIB_SSL, 189},
+    {"SSL_SESSION_ID_CONFLICT", 20, 302},
   #endif
-  #ifdef SSL_R_NO_PRIVATE_KEY_ASSIGNED
-    {"NO_PRIVATE_KEY_ASSIGNED", ERR_LIB_SSL, SSL_R_NO_PRIVATE_KEY_ASSIGNED},
+  #ifdef SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG
+    {"SSL_SESSION_ID_CONTEXT_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG},
   #else
-    {"NO_PRIVATE_KEY_ASSIGNED", ERR_LIB_SSL, 190},
+    {"SSL_SESSION_ID_CONTEXT_TOO_LONG", 20, 273},
   #endif
-  #ifdef SSL_R_NO_PROTOCOLS_AVAILABLE
-    {"NO_PROTOCOLS_AVAILABLE", ERR_LIB_SSL, SSL_R_NO_PROTOCOLS_AVAILABLE},
+  #ifdef SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH
+    {"SSL_SESSION_ID_HAS_BAD_LENGTH", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH},
   #else
-    {"NO_PROTOCOLS_AVAILABLE", ERR_LIB_SSL, 191},
+    {"SSL_SESSION_ID_HAS_BAD_LENGTH", 20, 303},
   #endif
-  #ifdef SSL_R_NO_PUBLICKEY
-    {"NO_PUBLICKEY", ERR_LIB_SSL, SSL_R_NO_PUBLICKEY},
+  #ifdef SSL_R_SSL_SESSION_ID_TOO_LONG
+    {"SSL_SESSION_ID_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_TOO_LONG},
   #else
-    {"NO_PUBLICKEY", ERR_LIB_SSL, 192},
+    {"SSL_SESSION_ID_TOO_LONG", 20, 408},
   #endif
-  #ifdef SSL_R_NO_RENEGOTIATION
-    {"NO_RENEGOTIATION", ERR_LIB_SSL, SSL_R_NO_RENEGOTIATION},
+  #ifdef SSL_R_SSL_SESSION_VERSION_MISMATCH
+    {"SSL_SESSION_VERSION_MISMATCH", ERR_LIB_SSL, SSL_R_SSL_SESSION_VERSION_MISMATCH},
   #else
-    {"NO_RENEGOTIATION", ERR_LIB_SSL, 339},
+    {"SSL_SESSION_VERSION_MISMATCH", 20, 210},
   #endif
-  #ifdef SSL_R_NO_REQUIRED_DIGEST
-    {"NO_REQUIRED_DIGEST", ERR_LIB_SSL, SSL_R_NO_REQUIRED_DIGEST},
+  #ifdef SSL_R_STILL_IN_INIT
+    {"STILL_IN_INIT", ERR_LIB_SSL, SSL_R_STILL_IN_INIT},
   #else
-    {"NO_REQUIRED_DIGEST", ERR_LIB_SSL, 324},
+    {"STILL_IN_INIT", 20, 121},
   #endif
-  #ifdef SSL_R_NO_SHARED_CIPHER
-    {"NO_SHARED_CIPHER", ERR_LIB_SSL, SSL_R_NO_SHARED_CIPHER},
+  #ifdef SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED
+    {"TLSV13_ALERT_CERTIFICATE_REQUIRED", ERR_LIB_SSL, SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED},
   #else
-    {"NO_SHARED_CIPHER", ERR_LIB_SSL, 193},
+    {"TLSV13_ALERT_CERTIFICATE_REQUIRED", 20, 1116},
   #endif
-  #ifdef SSL_R_NO_SHARED_SIGATURE_ALGORITHMS
-    {"NO_SHARED_SIGATURE_ALGORITHMS", ERR_LIB_SSL, SSL_R_NO_SHARED_SIGATURE_ALGORITHMS},
+  #ifdef SSL_R_TLSV13_ALERT_MISSING_EXTENSION
+    {"TLSV13_ALERT_MISSING_EXTENSION", ERR_LIB_SSL, SSL_R_TLSV13_ALERT_MISSING_EXTENSION},
   #else
-    {"NO_SHARED_SIGATURE_ALGORITHMS", ERR_LIB_SSL, 376},
+    {"TLSV13_ALERT_MISSING_EXTENSION", 20, 1109},
   #endif
-  #ifdef SSL_R_NO_SRTP_PROFILES
-    {"NO_SRTP_PROFILES", ERR_LIB_SSL, SSL_R_NO_SRTP_PROFILES},
+  #ifdef SSL_R_TLSV1_ALERT_ACCESS_DENIED
+    {"TLSV1_ALERT_ACCESS_DENIED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_ACCESS_DENIED},
   #else
-    {"NO_SRTP_PROFILES", ERR_LIB_SSL, 359},
+    {"TLSV1_ALERT_ACCESS_DENIED", 20, 1049},
   #endif
-  #ifdef SSL_R_NO_VERIFY_CALLBACK
-    {"NO_VERIFY_CALLBACK", ERR_LIB_SSL, SSL_R_NO_VERIFY_CALLBACK},
+  #ifdef SSL_R_TLSV1_ALERT_DECODE_ERROR
+    {"TLSV1_ALERT_DECODE_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECODE_ERROR},
   #else
-    {"NO_VERIFY_CALLBACK", ERR_LIB_SSL, 194},
+    {"TLSV1_ALERT_DECODE_ERROR", 20, 1050},
   #endif
-  #ifdef SSL_R_NULL_SSL_CTX
-    {"NULL_SSL_CTX", ERR_LIB_SSL, SSL_R_NULL_SSL_CTX},
+  #ifdef SSL_R_TLSV1_ALERT_DECRYPTION_FAILED
+    {"TLSV1_ALERT_DECRYPTION_FAILED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECRYPTION_FAILED},
   #else
-    {"NULL_SSL_CTX", ERR_LIB_SSL, 195},
+    {"TLSV1_ALERT_DECRYPTION_FAILED", 20, 1021},
   #endif
-  #ifdef SSL_R_NULL_SSL_METHOD_PASSED
-    {"NULL_SSL_METHOD_PASSED", ERR_LIB_SSL, SSL_R_NULL_SSL_METHOD_PASSED},
+  #ifdef SSL_R_TLSV1_ALERT_DECRYPT_ERROR
+    {"TLSV1_ALERT_DECRYPT_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECRYPT_ERROR},
   #else
-    {"NULL_SSL_METHOD_PASSED", ERR_LIB_SSL, 196},
+    {"TLSV1_ALERT_DECRYPT_ERROR", 20, 1051},
   #endif
-  #ifdef SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED
-    {"OLD_SESSION_CIPHER_NOT_RETURNED", ERR_LIB_SSL, SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED},
+  #ifdef SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION
+    {"TLSV1_ALERT_EXPORT_RESTRICTION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION},
   #else
-    {"OLD_SESSION_CIPHER_NOT_RETURNED", ERR_LIB_SSL, 197},
+    {"TLSV1_ALERT_EXPORT_RESTRICTION", 20, 1060},
   #endif
-  #ifdef SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED
-    {"OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED", ERR_LIB_SSL, SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED},
+  #ifdef SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK
+    {"TLSV1_ALERT_INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK},
   #else
-    {"OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED", ERR_LIB_SSL, 344},
+    {"TLSV1_ALERT_INAPPROPRIATE_FALLBACK", 20, 1086},
   #endif
-  #ifdef SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE
-    {"ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE},
+  #ifdef SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY
+    {"TLSV1_ALERT_INSUFFICIENT_SECURITY", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY},
   #else
-    {"ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE", ERR_LIB_SSL, 387},
+    {"TLSV1_ALERT_INSUFFICIENT_SECURITY", 20, 1071},
   #endif
-  #ifdef SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE
-    {"ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE", ERR_LIB_SSL, SSL_R_ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE},
+  #ifdef SSL_R_TLSV1_ALERT_INTERNAL_ERROR
+    {"TLSV1_ALERT_INTERNAL_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INTERNAL_ERROR},
   #else
-    {"ONLY_TLS_1_2_ALLOWED_IN_SUITEB_MODE", ERR_LIB_SSL, 379},
+    {"TLSV1_ALERT_INTERNAL_ERROR", 20, 1080},
   #endif
-  #ifdef SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE
-    {"ONLY_TLS_ALLOWED_IN_FIPS_MODE", ERR_LIB_SSL, SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE},
+  #ifdef SSL_R_TLSV1_ALERT_NO_RENEGOTIATION
+    {"TLSV1_ALERT_NO_RENEGOTIATION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_NO_RENEGOTIATION},
   #else
-    {"ONLY_TLS_ALLOWED_IN_FIPS_MODE", ERR_LIB_SSL, 297},
+    {"TLSV1_ALERT_NO_RENEGOTIATION", 20, 1100},
   #endif
-  #ifdef SSL_R_OPAQUE_PRF_INPUT_TOO_LONG
-    {"OPAQUE_PRF_INPUT_TOO_LONG", ERR_LIB_SSL, SSL_R_OPAQUE_PRF_INPUT_TOO_LONG},
+  #ifdef SSL_R_TLSV1_ALERT_PROTOCOL_VERSION
+    {"TLSV1_ALERT_PROTOCOL_VERSION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_PROTOCOL_VERSION},
   #else
-    {"OPAQUE_PRF_INPUT_TOO_LONG", ERR_LIB_SSL, 327},
+    {"TLSV1_ALERT_PROTOCOL_VERSION", 20, 1070},
   #endif
-  #ifdef SSL_R_PACKET_LENGTH_TOO_LONG
-    {"PACKET_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_PACKET_LENGTH_TOO_LONG},
+  #ifdef SSL_R_TLSV1_ALERT_RECORD_OVERFLOW
+    {"TLSV1_ALERT_RECORD_OVERFLOW", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_RECORD_OVERFLOW},
   #else
-    {"PACKET_LENGTH_TOO_LONG", ERR_LIB_SSL, 198},
+    {"TLSV1_ALERT_RECORD_OVERFLOW", 20, 1022},
   #endif
-  #ifdef SSL_R_PARSE_TLSEXT
-    {"PARSE_TLSEXT", ERR_LIB_SSL, SSL_R_PARSE_TLSEXT},
+  #ifdef SSL_R_TLSV1_ALERT_UNKNOWN_CA
+    {"TLSV1_ALERT_UNKNOWN_CA", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_UNKNOWN_CA},
   #else
-    {"PARSE_TLSEXT", ERR_LIB_SSL, 227},
+    {"TLSV1_ALERT_UNKNOWN_CA", 20, 1048},
   #endif
-  #ifdef SSL_R_PATH_TOO_LONG
-    {"PATH_TOO_LONG", ERR_LIB_SSL, SSL_R_PATH_TOO_LONG},
+  #ifdef SSL_R_TLSV1_ALERT_USER_CANCELLED
+    {"TLSV1_ALERT_USER_CANCELLED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_USER_CANCELLED},
   #else
-    {"PATH_TOO_LONG", ERR_LIB_SSL, 270},
+    {"TLSV1_ALERT_USER_CANCELLED", 20, 1090},
   #endif
-  #ifdef SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE
-    {"PEER_DID_NOT_RETURN_A_CERTIFICATE", ERR_LIB_SSL, SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE},
+  #ifdef SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE
+    {"TLSV1_BAD_CERTIFICATE_HASH_VALUE", ERR_LIB_SSL, SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE},
+  #else
+    {"TLSV1_BAD_CERTIFICATE_HASH_VALUE", 20, 1114},
+  #endif
+  #ifdef SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE
+    {"TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE", ERR_LIB_SSL, SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE},
+  #else
+    {"TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE", 20, 1113},
+  #endif
+  #ifdef SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE
+    {"TLSV1_CERTIFICATE_UNOBTAINABLE", ERR_LIB_SSL, SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE},
+  #else
+    {"TLSV1_CERTIFICATE_UNOBTAINABLE", 20, 1111},
+  #endif
+  #ifdef SSL_R_TLSV1_UNRECOGNIZED_NAME
+    {"TLSV1_UNRECOGNIZED_NAME", ERR_LIB_SSL, SSL_R_TLSV1_UNRECOGNIZED_NAME},
   #else
-    {"PEER_DID_NOT_RETURN_A_CERTIFICATE", ERR_LIB_SSL, 199},
+    {"TLSV1_UNRECOGNIZED_NAME", 20, 1112},
   #endif
-  #ifdef SSL_R_PEER_ERROR
-    {"PEER_ERROR", ERR_LIB_SSL, SSL_R_PEER_ERROR},
+  #ifdef SSL_R_TLSV1_UNSUPPORTED_EXTENSION
+    {"TLSV1_UNSUPPORTED_EXTENSION", ERR_LIB_SSL, SSL_R_TLSV1_UNSUPPORTED_EXTENSION},
   #else
-    {"PEER_ERROR", ERR_LIB_SSL, 200},
+    {"TLSV1_UNSUPPORTED_EXTENSION", 20, 1110},
   #endif
-  #ifdef SSL_R_PEER_ERROR_CERTIFICATE
-    {"PEER_ERROR_CERTIFICATE", ERR_LIB_SSL, SSL_R_PEER_ERROR_CERTIFICATE},
+  #ifdef SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT
+    {"TLS_HEARTBEAT_PEER_DOESNT_ACCEPT", ERR_LIB_SSL, SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT},
   #else
-    {"PEER_ERROR_CERTIFICATE", ERR_LIB_SSL, 201},
+    {"TLS_HEARTBEAT_PEER_DOESNT_ACCEPT", 20, 365},
   #endif
-  #ifdef SSL_R_PEER_ERROR_NO_CERTIFICATE
-    {"PEER_ERROR_NO_CERTIFICATE", ERR_LIB_SSL, SSL_R_PEER_ERROR_NO_CERTIFICATE},
+  #ifdef SSL_R_TLS_HEARTBEAT_PENDING
+    {"TLS_HEARTBEAT_PENDING", ERR_LIB_SSL, SSL_R_TLS_HEARTBEAT_PENDING},
   #else
-    {"PEER_ERROR_NO_CERTIFICATE", ERR_LIB_SSL, 202},
+    {"TLS_HEARTBEAT_PENDING", 20, 366},
   #endif
-  #ifdef SSL_R_PEER_ERROR_NO_CIPHER
-    {"PEER_ERROR_NO_CIPHER", ERR_LIB_SSL, SSL_R_PEER_ERROR_NO_CIPHER},
+  #ifdef SSL_R_TLS_ILLEGAL_EXPORTER_LABEL
+    {"TLS_ILLEGAL_EXPORTER_LABEL", ERR_LIB_SSL, SSL_R_TLS_ILLEGAL_EXPORTER_LABEL},
   #else
-    {"PEER_ERROR_NO_CIPHER", ERR_LIB_SSL, 203},
+    {"TLS_ILLEGAL_EXPORTER_LABEL", 20, 367},
   #endif
-  #ifdef SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE
-    {"PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE", ERR_LIB_SSL, SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE},
+  #ifdef SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST
+    {"TLS_INVALID_ECPOINTFORMAT_LIST", ERR_LIB_SSL, SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST},
   #else
-    {"PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE", ERR_LIB_SSL, 204},
+    {"TLS_INVALID_ECPOINTFORMAT_LIST", 20, 157},
   #endif
-  #ifdef SSL_R_PEM_NAME_BAD_PREFIX
-    {"PEM_NAME_BAD_PREFIX", ERR_LIB_SSL, SSL_R_PEM_NAME_BAD_PREFIX},
+  #ifdef SSL_R_TOO_MANY_KEY_UPDATES
+    {"TOO_MANY_KEY_UPDATES", ERR_LIB_SSL, SSL_R_TOO_MANY_KEY_UPDATES},
   #else
-    {"PEM_NAME_BAD_PREFIX", ERR_LIB_SSL, 391},
+    {"TOO_MANY_KEY_UPDATES", 20, 132},
   #endif
-  #ifdef SSL_R_PEM_NAME_TOO_SHORT
-    {"PEM_NAME_TOO_SHORT", ERR_LIB_SSL, SSL_R_PEM_NAME_TOO_SHORT},
+  #ifdef SSL_R_TOO_MANY_WARN_ALERTS
+    {"TOO_MANY_WARN_ALERTS", ERR_LIB_SSL, SSL_R_TOO_MANY_WARN_ALERTS},
+  #else
+    {"TOO_MANY_WARN_ALERTS", 20, 409},
+  #endif
+  #ifdef SSL_R_TOO_MUCH_EARLY_DATA
+    {"TOO_MUCH_EARLY_DATA", ERR_LIB_SSL, SSL_R_TOO_MUCH_EARLY_DATA},
+  #else
+    {"TOO_MUCH_EARLY_DATA", 20, 164},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_DECODE_ECDH_CERTS
+    {"UNABLE_TO_DECODE_ECDH_CERTS", ERR_LIB_SSL, SSL_R_UNABLE_TO_DECODE_ECDH_CERTS},
+  #else
+    {"UNABLE_TO_DECODE_ECDH_CERTS", 20, 313},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS
+    {"UNABLE_TO_FIND_ECDH_PARAMETERS", ERR_LIB_SSL, SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS},
+  #else
+    {"UNABLE_TO_FIND_ECDH_PARAMETERS", 20, 314},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS
+    {"UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS", ERR_LIB_SSL, SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS},
+  #else
+    {"UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS", 20, 239},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES
+    {"UNABLE_TO_LOAD_SSL3_MD5_ROUTINES", ERR_LIB_SSL, SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES},
+  #else
+    {"UNABLE_TO_LOAD_SSL3_MD5_ROUTINES", 20, 242},
+  #endif
+  #ifdef SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES
+    {"UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES", ERR_LIB_SSL, SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES},
+  #else
+    {"UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES", 20, 243},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_CCS_MESSAGE
+    {"UNEXPECTED_CCS_MESSAGE", ERR_LIB_SSL, SSL_R_UNEXPECTED_CCS_MESSAGE},
+  #else
+    {"UNEXPECTED_CCS_MESSAGE", 20, 262},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_END_OF_EARLY_DATA
+    {"UNEXPECTED_END_OF_EARLY_DATA", ERR_LIB_SSL, SSL_R_UNEXPECTED_END_OF_EARLY_DATA},
+  #else
+    {"UNEXPECTED_END_OF_EARLY_DATA", 20, 178},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_MESSAGE
+    {"UNEXPECTED_MESSAGE", ERR_LIB_SSL, SSL_R_UNEXPECTED_MESSAGE},
+  #else
+    {"UNEXPECTED_MESSAGE", 20, 244},
+  #endif
+  #ifdef SSL_R_UNEXPECTED_RECORD
+    {"UNEXPECTED_RECORD", ERR_LIB_SSL, SSL_R_UNEXPECTED_RECORD},
+  #else
+    {"UNEXPECTED_RECORD", 20, 245},
+  #endif
+  #ifdef SSL_R_UNINITIALIZED
+    {"UNINITIALIZED", ERR_LIB_SSL, SSL_R_UNINITIALIZED},
+  #else
+    {"UNINITIALIZED", 20, 276},
+  #endif
+  #ifdef SSL_R_UNKNOWN_ALERT_TYPE
+    {"UNKNOWN_ALERT_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_ALERT_TYPE},
+  #else
+    {"UNKNOWN_ALERT_TYPE", 20, 246},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CERTIFICATE_TYPE
+    {"UNKNOWN_CERTIFICATE_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_CERTIFICATE_TYPE},
+  #else
+    {"UNKNOWN_CERTIFICATE_TYPE", 20, 247},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CIPHER_RETURNED
+    {"UNKNOWN_CIPHER_RETURNED", ERR_LIB_SSL, SSL_R_UNKNOWN_CIPHER_RETURNED},
+  #else
+    {"UNKNOWN_CIPHER_RETURNED", 20, 248},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CIPHER_TYPE
+    {"UNKNOWN_CIPHER_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_CIPHER_TYPE},
+  #else
+    {"UNKNOWN_CIPHER_TYPE", 20, 249},
+  #endif
+  #ifdef SSL_R_UNKNOWN_CMD_NAME
+    {"UNKNOWN_CMD_NAME", ERR_LIB_SSL, SSL_R_UNKNOWN_CMD_NAME},
+  #else
+    {"UNKNOWN_CMD_NAME", 20, 386},
+  #endif
+  #ifdef SSL_R_UNKNOWN_COMMAND
+    {"UNKNOWN_COMMAND", ERR_LIB_SSL, SSL_R_UNKNOWN_COMMAND},
+  #else
+    {"UNKNOWN_COMMAND", 20, 139},
+  #endif
+  #ifdef SSL_R_UNKNOWN_DIGEST
+    {"UNKNOWN_DIGEST", ERR_LIB_SSL, SSL_R_UNKNOWN_DIGEST},
+  #else
+    {"UNKNOWN_DIGEST", 20, 368},
+  #endif
+  #ifdef SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE
+    {"UNKNOWN_KEY_EXCHANGE_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE},
+  #else
+    {"UNKNOWN_KEY_EXCHANGE_TYPE", 20, 250},
+  #endif
+  #ifdef SSL_R_UNKNOWN_PKEY_TYPE
+    {"UNKNOWN_PKEY_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_PKEY_TYPE},
+  #else
+    {"UNKNOWN_PKEY_TYPE", 20, 251},
+  #endif
+  #ifdef SSL_R_UNKNOWN_PROTOCOL
+    {"UNKNOWN_PROTOCOL", ERR_LIB_SSL, SSL_R_UNKNOWN_PROTOCOL},
+  #else
+    {"UNKNOWN_PROTOCOL", 20, 252},
+  #endif
+  #ifdef SSL_R_UNKNOWN_SSL_VERSION
+    {"UNKNOWN_SSL_VERSION", ERR_LIB_SSL, SSL_R_UNKNOWN_SSL_VERSION},
+  #else
+    {"UNKNOWN_SSL_VERSION", 20, 254},
+  #endif
+  #ifdef SSL_R_UNKNOWN_STATE
+    {"UNKNOWN_STATE", ERR_LIB_SSL, SSL_R_UNKNOWN_STATE},
+  #else
+    {"UNKNOWN_STATE", 20, 255},
+  #endif
+  #ifdef SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED
+    {"UNSAFE_LEGACY_RENEGOTIATION_DISABLED", ERR_LIB_SSL, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED},
+  #else
+    {"UNSAFE_LEGACY_RENEGOTIATION_DISABLED", 20, 338},
+  #endif
+  #ifdef SSL_R_UNSOLICITED_EXTENSION
+    {"UNSOLICITED_EXTENSION", ERR_LIB_SSL, SSL_R_UNSOLICITED_EXTENSION},
+  #else
+    {"UNSOLICITED_EXTENSION", 20, 217},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", ERR_LIB_SSL, SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM},
+  #else
+    {"UNSUPPORTED_COMPRESSION_ALGORITHM", 20, 257},
+  #endif
+  #ifdef SSL_R_UNSUPPORTED_DIGEST_TYPE
+    {"UNSUPPORTED_DIGEST_TYPE", ERR_LIB_SSL, SSL_R_UNSUPPORTED_DIGEST_TYPE},
   #else
-    {"PEM_NAME_TOO_SHORT", ERR_LIB_SSL, 392},
+    {"UNSUPPORTED_DIGEST_TYPE", 20, 326},
   #endif
-  #ifdef SSL_R_PRE_MAC_LENGTH_TOO_LONG
-    {"PRE_MAC_LENGTH_TOO_LONG", ERR_LIB_SSL, SSL_R_PRE_MAC_LENGTH_TOO_LONG},
+  #ifdef SSL_R_UNSUPPORTED_ELLIPTIC_CURVE
+    {"UNSUPPORTED_ELLIPTIC_CURVE", ERR_LIB_SSL, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE},
   #else
-    {"PRE_MAC_LENGTH_TOO_LONG", ERR_LIB_SSL, 205},
+    {"UNSUPPORTED_ELLIPTIC_CURVE", 20, 315},
   #endif
-  #ifdef SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS
-    {"PROBLEMS_MAPPING_CIPHER_FUNCTIONS", ERR_LIB_SSL, SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS},
+  #ifdef SSL_R_UNSUPPORTED_PROTOCOL
+    {"UNSUPPORTED_PROTOCOL", ERR_LIB_SSL, SSL_R_UNSUPPORTED_PROTOCOL},
   #else
-    {"PROBLEMS_MAPPING_CIPHER_FUNCTIONS", ERR_LIB_SSL, 206},
+    {"UNSUPPORTED_PROTOCOL", 20, 258},
   #endif
-  #ifdef SSL_R_PROTOCOL_IS_SHUTDOWN
-    {"PROTOCOL_IS_SHUTDOWN", ERR_LIB_SSL, SSL_R_PROTOCOL_IS_SHUTDOWN},
+  #ifdef SSL_R_UNSUPPORTED_SSL_VERSION
+    {"UNSUPPORTED_SSL_VERSION", ERR_LIB_SSL, SSL_R_UNSUPPORTED_SSL_VERSION},
   #else
-    {"PROTOCOL_IS_SHUTDOWN", ERR_LIB_SSL, 207},
+    {"UNSUPPORTED_SSL_VERSION", 20, 259},
   #endif
-  #ifdef SSL_R_PSK_IDENTITY_NOT_FOUND
-    {"PSK_IDENTITY_NOT_FOUND", ERR_LIB_SSL, SSL_R_PSK_IDENTITY_NOT_FOUND},
+  #ifdef SSL_R_UNSUPPORTED_STATUS_TYPE
+    {"UNSUPPORTED_STATUS_TYPE", ERR_LIB_SSL, SSL_R_UNSUPPORTED_STATUS_TYPE},
   #else
-    {"PSK_IDENTITY_NOT_FOUND", ERR_LIB_SSL, 223},
+    {"UNSUPPORTED_STATUS_TYPE", 20, 329},
   #endif
-  #ifdef SSL_R_PSK_NO_CLIENT_CB
-    {"PSK_NO_CLIENT_CB", ERR_LIB_SSL, SSL_R_PSK_NO_CLIENT_CB},
+  #ifdef SSL_R_USE_SRTP_NOT_NEGOTIATED
+    {"USE_SRTP_NOT_NEGOTIATED", ERR_LIB_SSL, SSL_R_USE_SRTP_NOT_NEGOTIATED},
   #else
-    {"PSK_NO_CLIENT_CB", ERR_LIB_SSL, 224},
+    {"USE_SRTP_NOT_NEGOTIATED", 20, 369},
   #endif
-  #ifdef SSL_R_PSK_NO_SERVER_CB
-    {"PSK_NO_SERVER_CB", ERR_LIB_SSL, SSL_R_PSK_NO_SERVER_CB},
+  #ifdef SSL_R_VERSION_TOO_HIGH
+    {"VERSION_TOO_HIGH", ERR_LIB_SSL, SSL_R_VERSION_TOO_HIGH},
   #else
-    {"PSK_NO_SERVER_CB", ERR_LIB_SSL, 225},
+    {"VERSION_TOO_HIGH", 20, 166},
   #endif
-  #ifdef SSL_R_PUBLIC_KEY_ENCRYPT_ERROR
-    {"PUBLIC_KEY_ENCRYPT_ERROR", ERR_LIB_SSL, SSL_R_PUBLIC_KEY_ENCRYPT_ERROR},
+  #ifdef SSL_R_VERSION_TOO_LOW
+    {"VERSION_TOO_LOW", ERR_LIB_SSL, SSL_R_VERSION_TOO_LOW},
   #else
-    {"PUBLIC_KEY_ENCRYPT_ERROR", ERR_LIB_SSL, 208},
+    {"VERSION_TOO_LOW", 20, 396},
   #endif
-  #ifdef SSL_R_PUBLIC_KEY_IS_NOT_RSA
-    {"PUBLIC_KEY_IS_NOT_RSA", ERR_LIB_SSL, SSL_R_PUBLIC_KEY_IS_NOT_RSA},
+  #ifdef SSL_R_WRONG_CERTIFICATE_TYPE
+    {"WRONG_CERTIFICATE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_CERTIFICATE_TYPE},
   #else
-    {"PUBLIC_KEY_IS_NOT_RSA", ERR_LIB_SSL, 209},
+    {"WRONG_CERTIFICATE_TYPE", 20, 383},
   #endif
-  #ifdef SSL_R_PUBLIC_KEY_NOT_RSA
-    {"PUBLIC_KEY_NOT_RSA", ERR_LIB_SSL, SSL_R_PUBLIC_KEY_NOT_RSA},
+  #ifdef SSL_R_WRONG_CIPHER_RETURNED
+    {"WRONG_CIPHER_RETURNED", ERR_LIB_SSL, SSL_R_WRONG_CIPHER_RETURNED},
   #else
-    {"PUBLIC_KEY_NOT_RSA", ERR_LIB_SSL, 210},
+    {"WRONG_CIPHER_RETURNED", 20, 261},
   #endif
-  #ifdef SSL_R_READ_BIO_NOT_SET
-    {"READ_BIO_NOT_SET", ERR_LIB_SSL, SSL_R_READ_BIO_NOT_SET},
+  #ifdef SSL_R_WRONG_CURVE
+    {"WRONG_CURVE", ERR_LIB_SSL, SSL_R_WRONG_CURVE},
   #else
-    {"READ_BIO_NOT_SET", ERR_LIB_SSL, 211},
+    {"WRONG_CURVE", 20, 378},
   #endif
-  #ifdef SSL_R_READ_TIMEOUT_EXPIRED
-    {"READ_TIMEOUT_EXPIRED", ERR_LIB_SSL, SSL_R_READ_TIMEOUT_EXPIRED},
+  #ifdef SSL_R_WRONG_SIGNATURE_LENGTH
+    {"WRONG_SIGNATURE_LENGTH", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_LENGTH},
   #else
-    {"READ_TIMEOUT_EXPIRED", ERR_LIB_SSL, 312},
+    {"WRONG_SIGNATURE_LENGTH", 20, 264},
   #endif
-  #ifdef SSL_R_READ_WRONG_PACKET_TYPE
-    {"READ_WRONG_PACKET_TYPE", ERR_LIB_SSL, SSL_R_READ_WRONG_PACKET_TYPE},
+  #ifdef SSL_R_WRONG_SIGNATURE_SIZE
+    {"WRONG_SIGNATURE_SIZE", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_SIZE},
   #else
-    {"READ_WRONG_PACKET_TYPE", ERR_LIB_SSL, 212},
+    {"WRONG_SIGNATURE_SIZE", 20, 265},
   #endif
-  #ifdef SSL_R_RECORD_LENGTH_MISMATCH
-    {"RECORD_LENGTH_MISMATCH", ERR_LIB_SSL, SSL_R_RECORD_LENGTH_MISMATCH},
+  #ifdef SSL_R_WRONG_SIGNATURE_TYPE
+    {"WRONG_SIGNATURE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_TYPE},
   #else
-    {"RECORD_LENGTH_MISMATCH", ERR_LIB_SSL, 213},
+    {"WRONG_SIGNATURE_TYPE", 20, 370},
   #endif
-  #ifdef SSL_R_RECORD_TOO_LARGE
-    {"RECORD_TOO_LARGE", ERR_LIB_SSL, SSL_R_RECORD_TOO_LARGE},
+  #ifdef SSL_R_WRONG_SSL_VERSION
+    {"WRONG_SSL_VERSION", ERR_LIB_SSL, SSL_R_WRONG_SSL_VERSION},
   #else
-    {"RECORD_TOO_LARGE", ERR_LIB_SSL, 214},
+    {"WRONG_SSL_VERSION", 20, 266},
   #endif
-  #ifdef SSL_R_RECORD_TOO_SMALL
-    {"RECORD_TOO_SMALL", ERR_LIB_SSL, SSL_R_RECORD_TOO_SMALL},
+  #ifdef SSL_R_WRONG_VERSION_NUMBER
+    {"WRONG_VERSION_NUMBER", ERR_LIB_SSL, SSL_R_WRONG_VERSION_NUMBER},
   #else
-    {"RECORD_TOO_SMALL", ERR_LIB_SSL, 298},
+    {"WRONG_VERSION_NUMBER", 20, 267},
   #endif
-  #ifdef SSL_R_RENEGOTIATE_EXT_TOO_LONG
-    {"RENEGOTIATE_EXT_TOO_LONG", ERR_LIB_SSL, SSL_R_RENEGOTIATE_EXT_TOO_LONG},
+  #ifdef SSL_R_X509_LIB
+    {"X509_LIB", ERR_LIB_SSL, SSL_R_X509_LIB},
   #else
-    {"RENEGOTIATE_EXT_TOO_LONG", ERR_LIB_SSL, 335},
+    {"X509_LIB", 20, 268},
   #endif
-  #ifdef SSL_R_RENEGOTIATION_ENCODING_ERR
-    {"RENEGOTIATION_ENCODING_ERR", ERR_LIB_SSL, SSL_R_RENEGOTIATION_ENCODING_ERR},
+  #ifdef SSL_R_X509_VERIFICATION_SETUP_PROBLEMS
+    {"X509_VERIFICATION_SETUP_PROBLEMS", ERR_LIB_SSL, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS},
   #else
-    {"RENEGOTIATION_ENCODING_ERR", ERR_LIB_SSL, 336},
+    {"X509_VERIFICATION_SETUP_PROBLEMS", 20, 269},
   #endif
-  #ifdef SSL_R_RENEGOTIATION_MISMATCH
-    {"RENEGOTIATION_MISMATCH", ERR_LIB_SSL, SSL_R_RENEGOTIATION_MISMATCH},
+  #ifdef TS_R_BAD_PKCS7_TYPE
+    {"BAD_PKCS7_TYPE", ERR_LIB_TS, TS_R_BAD_PKCS7_TYPE},
   #else
-    {"RENEGOTIATION_MISMATCH", ERR_LIB_SSL, 337},
+    {"BAD_PKCS7_TYPE", 47, 132},
   #endif
-  #ifdef SSL_R_REQUIRED_CIPHER_MISSING
-    {"REQUIRED_CIPHER_MISSING", ERR_LIB_SSL, SSL_R_REQUIRED_CIPHER_MISSING},
+  #ifdef TS_R_BAD_TYPE
+    {"BAD_TYPE", ERR_LIB_TS, TS_R_BAD_TYPE},
   #else
-    {"REQUIRED_CIPHER_MISSING", ERR_LIB_SSL, 215},
+    {"BAD_TYPE", 47, 133},
   #endif
-  #ifdef SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING
-    {"REQUIRED_COMPRESSSION_ALGORITHM_MISSING", ERR_LIB_SSL, SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING},
+  #ifdef TS_R_CANNOT_LOAD_CERT
+    {"CANNOT_LOAD_CERT", ERR_LIB_TS, TS_R_CANNOT_LOAD_CERT},
   #else
-    {"REQUIRED_COMPRESSSION_ALGORITHM_MISSING", ERR_LIB_SSL, 342},
+    {"CANNOT_LOAD_CERT", 47, 137},
   #endif
-  #ifdef SSL_R_REUSE_CERT_LENGTH_NOT_ZERO
-    {"REUSE_CERT_LENGTH_NOT_ZERO", ERR_LIB_SSL, SSL_R_REUSE_CERT_LENGTH_NOT_ZERO},
+  #ifdef TS_R_CANNOT_LOAD_KEY
+    {"CANNOT_LOAD_KEY", ERR_LIB_TS, TS_R_CANNOT_LOAD_KEY},
   #else
-    {"REUSE_CERT_LENGTH_NOT_ZERO", ERR_LIB_SSL, 216},
+    {"CANNOT_LOAD_KEY", 47, 138},
   #endif
-  #ifdef SSL_R_REUSE_CERT_TYPE_NOT_ZERO
-    {"REUSE_CERT_TYPE_NOT_ZERO", ERR_LIB_SSL, SSL_R_REUSE_CERT_TYPE_NOT_ZERO},
+  #ifdef TS_R_CERTIFICATE_VERIFY_ERROR
+    {"CERTIFICATE_VERIFY_ERROR", ERR_LIB_TS, TS_R_CERTIFICATE_VERIFY_ERROR},
   #else
-    {"REUSE_CERT_TYPE_NOT_ZERO", ERR_LIB_SSL, 217},
+    {"CERTIFICATE_VERIFY_ERROR", 47, 100},
   #endif
-  #ifdef SSL_R_REUSE_CIPHER_LIST_NOT_ZERO
-    {"REUSE_CIPHER_LIST_NOT_ZERO", ERR_LIB_SSL, SSL_R_REUSE_CIPHER_LIST_NOT_ZERO},
+  #ifdef TS_R_COULD_NOT_SET_ENGINE
+    {"COULD_NOT_SET_ENGINE", ERR_LIB_TS, TS_R_COULD_NOT_SET_ENGINE},
   #else
-    {"REUSE_CIPHER_LIST_NOT_ZERO", ERR_LIB_SSL, 218},
+    {"COULD_NOT_SET_ENGINE", 47, 127},
   #endif
-  #ifdef SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING
-    {"SCSV_RECEIVED_WHEN_RENEGOTIATING", ERR_LIB_SSL, SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING},
+  #ifdef TS_R_COULD_NOT_SET_TIME
+    {"COULD_NOT_SET_TIME", ERR_LIB_TS, TS_R_COULD_NOT_SET_TIME},
   #else
-    {"SCSV_RECEIVED_WHEN_RENEGOTIATING", ERR_LIB_SSL, 345},
+    {"COULD_NOT_SET_TIME", 47, 115},
   #endif
-  #ifdef SSL_R_SERVERHELLO_TLSEXT
-    {"SERVERHELLO_TLSEXT", ERR_LIB_SSL, SSL_R_SERVERHELLO_TLSEXT},
+  #ifdef TS_R_DETACHED_CONTENT
+    {"DETACHED_CONTENT", ERR_LIB_TS, TS_R_DETACHED_CONTENT},
   #else
-    {"SERVERHELLO_TLSEXT", ERR_LIB_SSL, 275},
+    {"DETACHED_CONTENT", 47, 134},
   #endif
-  #ifdef SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED
-    {"SESSION_ID_CONTEXT_UNINITIALIZED", ERR_LIB_SSL, SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED},
+  #ifdef TS_R_ESS_ADD_SIGNING_CERT_ERROR
+    {"ESS_ADD_SIGNING_CERT_ERROR", ERR_LIB_TS, TS_R_ESS_ADD_SIGNING_CERT_ERROR},
   #else
-    {"SESSION_ID_CONTEXT_UNINITIALIZED", ERR_LIB_SSL, 277},
+    {"ESS_ADD_SIGNING_CERT_ERROR", 47, 116},
   #endif
-  #ifdef SSL_R_SHORT_READ
-    {"SHORT_READ", ERR_LIB_SSL, SSL_R_SHORT_READ},
+  #ifdef TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR
+    {"ESS_ADD_SIGNING_CERT_V2_ERROR", ERR_LIB_TS, TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR},
   #else
-    {"SHORT_READ", ERR_LIB_SSL, 219},
+    {"ESS_ADD_SIGNING_CERT_V2_ERROR", 47, 139},
   #endif
-  #ifdef SSL_R_SIGNATURE_ALGORITHMS_ERROR
-    {"SIGNATURE_ALGORITHMS_ERROR", ERR_LIB_SSL, SSL_R_SIGNATURE_ALGORITHMS_ERROR},
+  #ifdef TS_R_ESS_SIGNING_CERTIFICATE_ERROR
+    {"ESS_SIGNING_CERTIFICATE_ERROR", ERR_LIB_TS, TS_R_ESS_SIGNING_CERTIFICATE_ERROR},
   #else
-    {"SIGNATURE_ALGORITHMS_ERROR", ERR_LIB_SSL, 360},
+    {"ESS_SIGNING_CERTIFICATE_ERROR", 47, 101},
   #endif
-  #ifdef SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE
-    {"SIGNATURE_FOR_NON_SIGNING_CERTIFICATE", ERR_LIB_SSL, SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE},
+  #ifdef TS_R_INVALID_NULL_POINTER
+    {"INVALID_NULL_POINTER", ERR_LIB_TS, TS_R_INVALID_NULL_POINTER},
   #else
-    {"SIGNATURE_FOR_NON_SIGNING_CERTIFICATE", ERR_LIB_SSL, 220},
+    {"INVALID_NULL_POINTER", 47, 102},
   #endif
-  #ifdef SSL_R_SRP_A_CALC
-    {"SRP_A_CALC", ERR_LIB_SSL, SSL_R_SRP_A_CALC},
+  #ifdef TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE
+    {"INVALID_SIGNER_CERTIFICATE_PURPOSE", ERR_LIB_TS, TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE},
   #else
-    {"SRP_A_CALC", ERR_LIB_SSL, 361},
+    {"INVALID_SIGNER_CERTIFICATE_PURPOSE", 47, 117},
   #endif
-  #ifdef SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES
-    {"SRTP_COULD_NOT_ALLOCATE_PROFILES", ERR_LIB_SSL, SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES},
+  #ifdef TS_R_MESSAGE_IMPRINT_MISMATCH
+    {"MESSAGE_IMPRINT_MISMATCH", ERR_LIB_TS, TS_R_MESSAGE_IMPRINT_MISMATCH},
   #else
-    {"SRTP_COULD_NOT_ALLOCATE_PROFILES", ERR_LIB_SSL, 362},
+    {"MESSAGE_IMPRINT_MISMATCH", 47, 103},
   #endif
-  #ifdef SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG
-    {"SRTP_PROTECTION_PROFILE_LIST_TOO_LONG", ERR_LIB_SSL, SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG},
+  #ifdef TS_R_NONCE_MISMATCH
+    {"NONCE_MISMATCH", ERR_LIB_TS, TS_R_NONCE_MISMATCH},
   #else
-    {"SRTP_PROTECTION_PROFILE_LIST_TOO_LONG", ERR_LIB_SSL, 363},
+    {"NONCE_MISMATCH", 47, 104},
   #endif
-  #ifdef SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE
-    {"SRTP_UNKNOWN_PROTECTION_PROFILE", ERR_LIB_SSL, SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE},
+  #ifdef TS_R_NONCE_NOT_RETURNED
+    {"NONCE_NOT_RETURNED", ERR_LIB_TS, TS_R_NONCE_NOT_RETURNED},
   #else
-    {"SRTP_UNKNOWN_PROTECTION_PROFILE", ERR_LIB_SSL, 364},
+    {"NONCE_NOT_RETURNED", 47, 105},
   #endif
-  #ifdef SSL_R_SSL23_DOING_SESSION_ID_REUSE
-    {"SSL23_DOING_SESSION_ID_REUSE", ERR_LIB_SSL, SSL_R_SSL23_DOING_SESSION_ID_REUSE},
+  #ifdef TS_R_NO_CONTENT
+    {"NO_CONTENT", ERR_LIB_TS, TS_R_NO_CONTENT},
   #else
-    {"SSL23_DOING_SESSION_ID_REUSE", ERR_LIB_SSL, 221},
+    {"NO_CONTENT", 47, 106},
   #endif
-  #ifdef SSL_R_SSL2_CONNECTION_ID_TOO_LONG
-    {"SSL2_CONNECTION_ID_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL2_CONNECTION_ID_TOO_LONG},
+  #ifdef TS_R_NO_TIME_STAMP_TOKEN
+    {"NO_TIME_STAMP_TOKEN", ERR_LIB_TS, TS_R_NO_TIME_STAMP_TOKEN},
   #else
-    {"SSL2_CONNECTION_ID_TOO_LONG", ERR_LIB_SSL, 299},
+    {"NO_TIME_STAMP_TOKEN", 47, 107},
   #endif
-  #ifdef SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT
-    {"SSL3_EXT_INVALID_ECPOINTFORMAT", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT},
+  #ifdef TS_R_PKCS7_ADD_SIGNATURE_ERROR
+    {"PKCS7_ADD_SIGNATURE_ERROR", ERR_LIB_TS, TS_R_PKCS7_ADD_SIGNATURE_ERROR},
   #else
-    {"SSL3_EXT_INVALID_ECPOINTFORMAT", ERR_LIB_SSL, 321},
+    {"PKCS7_ADD_SIGNATURE_ERROR", 47, 118},
   #endif
-  #ifdef SSL_R_SSL3_EXT_INVALID_SERVERNAME
-    {"SSL3_EXT_INVALID_SERVERNAME", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME},
+  #ifdef TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR
+    {"PKCS7_ADD_SIGNED_ATTR_ERROR", ERR_LIB_TS, TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR},
   #else
-    {"SSL3_EXT_INVALID_SERVERNAME", ERR_LIB_SSL, 319},
+    {"PKCS7_ADD_SIGNED_ATTR_ERROR", 47, 119},
   #endif
-  #ifdef SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE
-    {"SSL3_EXT_INVALID_SERVERNAME_TYPE", ERR_LIB_SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE},
+  #ifdef TS_R_PKCS7_TO_TS_TST_INFO_FAILED
+    {"PKCS7_TO_TS_TST_INFO_FAILED", ERR_LIB_TS, TS_R_PKCS7_TO_TS_TST_INFO_FAILED},
   #else
-    {"SSL3_EXT_INVALID_SERVERNAME_TYPE", ERR_LIB_SSL, 320},
+    {"PKCS7_TO_TS_TST_INFO_FAILED", 47, 129},
   #endif
-  #ifdef SSL_R_SSL3_SESSION_ID_TOO_LONG
-    {"SSL3_SESSION_ID_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL3_SESSION_ID_TOO_LONG},
+  #ifdef TS_R_POLICY_MISMATCH
+    {"POLICY_MISMATCH", ERR_LIB_TS, TS_R_POLICY_MISMATCH},
   #else
-    {"SSL3_SESSION_ID_TOO_LONG", ERR_LIB_SSL, 300},
+    {"POLICY_MISMATCH", 47, 108},
   #endif
-  #ifdef SSL_R_SSL3_SESSION_ID_TOO_SHORT
-    {"SSL3_SESSION_ID_TOO_SHORT", ERR_LIB_SSL, SSL_R_SSL3_SESSION_ID_TOO_SHORT},
+  #ifdef TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", ERR_LIB_TS, TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE},
   #else
-    {"SSL3_SESSION_ID_TOO_SHORT", ERR_LIB_SSL, 222},
+    {"PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE", 47, 120},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_BAD_CERTIFICATE
-    {"SSLV3_ALERT_BAD_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_BAD_CERTIFICATE},
+  #ifdef TS_R_RESPONSE_SETUP_ERROR
+    {"RESPONSE_SETUP_ERROR", ERR_LIB_TS, TS_R_RESPONSE_SETUP_ERROR},
   #else
-    {"SSLV3_ALERT_BAD_CERTIFICATE", ERR_LIB_SSL, 1042},
+    {"RESPONSE_SETUP_ERROR", 47, 121},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_BAD_RECORD_MAC
-    {"SSLV3_ALERT_BAD_RECORD_MAC", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_BAD_RECORD_MAC},
+  #ifdef TS_R_SIGNATURE_FAILURE
+    {"SIGNATURE_FAILURE", ERR_LIB_TS, TS_R_SIGNATURE_FAILURE},
   #else
-    {"SSLV3_ALERT_BAD_RECORD_MAC", ERR_LIB_SSL, 1020},
+    {"SIGNATURE_FAILURE", 47, 109},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED
-    {"SSLV3_ALERT_CERTIFICATE_EXPIRED", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED},
+  #ifdef TS_R_THERE_MUST_BE_ONE_SIGNER
+    {"THERE_MUST_BE_ONE_SIGNER", ERR_LIB_TS, TS_R_THERE_MUST_BE_ONE_SIGNER},
   #else
-    {"SSLV3_ALERT_CERTIFICATE_EXPIRED", ERR_LIB_SSL, 1045},
+    {"THERE_MUST_BE_ONE_SIGNER", 47, 110},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED
-    {"SSLV3_ALERT_CERTIFICATE_REVOKED", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED},
+  #ifdef TS_R_TIME_SYSCALL_ERROR
+    {"TIME_SYSCALL_ERROR", ERR_LIB_TS, TS_R_TIME_SYSCALL_ERROR},
   #else
-    {"SSLV3_ALERT_CERTIFICATE_REVOKED", ERR_LIB_SSL, 1044},
+    {"TIME_SYSCALL_ERROR", 47, 122},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN
-    {"SSLV3_ALERT_CERTIFICATE_UNKNOWN", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN},
+  #ifdef TS_R_TOKEN_NOT_PRESENT
+    {"TOKEN_NOT_PRESENT", ERR_LIB_TS, TS_R_TOKEN_NOT_PRESENT},
   #else
-    {"SSLV3_ALERT_CERTIFICATE_UNKNOWN", ERR_LIB_SSL, 1046},
+    {"TOKEN_NOT_PRESENT", 47, 130},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE
-    {"SSLV3_ALERT_DECOMPRESSION_FAILURE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE},
+  #ifdef TS_R_TOKEN_PRESENT
+    {"TOKEN_PRESENT", ERR_LIB_TS, TS_R_TOKEN_PRESENT},
   #else
-    {"SSLV3_ALERT_DECOMPRESSION_FAILURE", ERR_LIB_SSL, 1030},
+    {"TOKEN_PRESENT", 47, 131},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE
-    {"SSLV3_ALERT_HANDSHAKE_FAILURE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE},
+  #ifdef TS_R_TSA_NAME_MISMATCH
+    {"TSA_NAME_MISMATCH", ERR_LIB_TS, TS_R_TSA_NAME_MISMATCH},
   #else
-    {"SSLV3_ALERT_HANDSHAKE_FAILURE", ERR_LIB_SSL, 1040},
+    {"TSA_NAME_MISMATCH", 47, 111},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER
-    {"SSLV3_ALERT_ILLEGAL_PARAMETER", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER},
+  #ifdef TS_R_TSA_UNTRUSTED
+    {"TSA_UNTRUSTED", ERR_LIB_TS, TS_R_TSA_UNTRUSTED},
   #else
-    {"SSLV3_ALERT_ILLEGAL_PARAMETER", ERR_LIB_SSL, 1047},
+    {"TSA_UNTRUSTED", 47, 112},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_NO_CERTIFICATE
-    {"SSLV3_ALERT_NO_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_NO_CERTIFICATE},
+  #ifdef TS_R_TST_INFO_SETUP_ERROR
+    {"TST_INFO_SETUP_ERROR", ERR_LIB_TS, TS_R_TST_INFO_SETUP_ERROR},
   #else
-    {"SSLV3_ALERT_NO_CERTIFICATE", ERR_LIB_SSL, 1041},
+    {"TST_INFO_SETUP_ERROR", 47, 123},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE
-    {"SSLV3_ALERT_UNEXPECTED_MESSAGE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE},
+  #ifdef TS_R_TS_DATASIGN
+    {"TS_DATASIGN", ERR_LIB_TS, TS_R_TS_DATASIGN},
   #else
-    {"SSLV3_ALERT_UNEXPECTED_MESSAGE", ERR_LIB_SSL, 1010},
+    {"TS_DATASIGN", 47, 124},
   #endif
-  #ifdef SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE
-    {"SSLV3_ALERT_UNSUPPORTED_CERTIFICATE", ERR_LIB_SSL, SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE},
+  #ifdef TS_R_UNACCEPTABLE_POLICY
+    {"UNACCEPTABLE_POLICY", ERR_LIB_TS, TS_R_UNACCEPTABLE_POLICY},
   #else
-    {"SSLV3_ALERT_UNSUPPORTED_CERTIFICATE", ERR_LIB_SSL, 1043},
+    {"UNACCEPTABLE_POLICY", 47, 125},
   #endif
-  #ifdef SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION
-    {"SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION", ERR_LIB_SSL, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION},
+  #ifdef TS_R_UNSUPPORTED_MD_ALGORITHM
+    {"UNSUPPORTED_MD_ALGORITHM", ERR_LIB_TS, TS_R_UNSUPPORTED_MD_ALGORITHM},
   #else
-    {"SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION", ERR_LIB_SSL, 228},
+    {"UNSUPPORTED_MD_ALGORITHM", 47, 126},
   #endif
-  #ifdef SSL_R_SSL_HANDSHAKE_FAILURE
-    {"SSL_HANDSHAKE_FAILURE", ERR_LIB_SSL, SSL_R_SSL_HANDSHAKE_FAILURE},
+  #ifdef TS_R_UNSUPPORTED_VERSION
+    {"UNSUPPORTED_VERSION", ERR_LIB_TS, TS_R_UNSUPPORTED_VERSION},
   #else
-    {"SSL_HANDSHAKE_FAILURE", ERR_LIB_SSL, 229},
+    {"UNSUPPORTED_VERSION", 47, 113},
   #endif
-  #ifdef SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS
-    {"SSL_LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS},
+  #ifdef TS_R_VAR_BAD_VALUE
+    {"VAR_BAD_VALUE", ERR_LIB_TS, TS_R_VAR_BAD_VALUE},
   #else
-    {"SSL_LIBRARY_HAS_NO_CIPHERS", ERR_LIB_SSL, 230},
+    {"VAR_BAD_VALUE", 47, 135},
   #endif
-  #ifdef SSL_R_SSL_NEGATIVE_LENGTH
-    {"SSL_NEGATIVE_LENGTH", ERR_LIB_SSL, SSL_R_SSL_NEGATIVE_LENGTH},
+  #ifdef TS_R_VAR_LOOKUP_FAILURE
+    {"VAR_LOOKUP_FAILURE", ERR_LIB_TS, TS_R_VAR_LOOKUP_FAILURE},
   #else
-    {"SSL_NEGATIVE_LENGTH", ERR_LIB_SSL, 372},
+    {"VAR_LOOKUP_FAILURE", 47, 136},
   #endif
-  #ifdef SSL_R_SSL_SESSION_ID_CALLBACK_FAILED
-    {"SSL_SESSION_ID_CALLBACK_FAILED", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CALLBACK_FAILED},
+  #ifdef TS_R_WRONG_CONTENT_TYPE
+    {"WRONG_CONTENT_TYPE", ERR_LIB_TS, TS_R_WRONG_CONTENT_TYPE},
   #else
-    {"SSL_SESSION_ID_CALLBACK_FAILED", ERR_LIB_SSL, 301},
+    {"WRONG_CONTENT_TYPE", 47, 114},
   #endif
-  #ifdef SSL_R_SSL_SESSION_ID_CONFLICT
-    {"SSL_SESSION_ID_CONFLICT", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CONFLICT},
+  #ifdef UI_R_COMMON_OK_AND_CANCEL_CHARACTERS
+    {"COMMON_OK_AND_CANCEL_CHARACTERS", ERR_LIB_UI, UI_R_COMMON_OK_AND_CANCEL_CHARACTERS},
   #else
-    {"SSL_SESSION_ID_CONFLICT", ERR_LIB_SSL, 302},
+    {"COMMON_OK_AND_CANCEL_CHARACTERS", 40, 104},
   #endif
-  #ifdef SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG
-    {"SSL_SESSION_ID_CONTEXT_TOO_LONG", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG},
+  #ifdef UI_R_INDEX_TOO_LARGE
+    {"INDEX_TOO_LARGE", ERR_LIB_UI, UI_R_INDEX_TOO_LARGE},
   #else
-    {"SSL_SESSION_ID_CONTEXT_TOO_LONG", ERR_LIB_SSL, 273},
+    {"INDEX_TOO_LARGE", 40, 102},
   #endif
-  #ifdef SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH
-    {"SSL_SESSION_ID_HAS_BAD_LENGTH", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH},
+  #ifdef UI_R_INDEX_TOO_SMALL
+    {"INDEX_TOO_SMALL", ERR_LIB_UI, UI_R_INDEX_TOO_SMALL},
   #else
-    {"SSL_SESSION_ID_HAS_BAD_LENGTH", ERR_LIB_SSL, 303},
+    {"INDEX_TOO_SMALL", 40, 103},
   #endif
-  #ifdef SSL_R_SSL_SESSION_ID_IS_DIFFERENT
-    {"SSL_SESSION_ID_IS_DIFFERENT", ERR_LIB_SSL, SSL_R_SSL_SESSION_ID_IS_DIFFERENT},
+  #ifdef UI_R_NO_RESULT_BUFFER
+    {"NO_RESULT_BUFFER", ERR_LIB_UI, UI_R_NO_RESULT_BUFFER},
   #else
-    {"SSL_SESSION_ID_IS_DIFFERENT", ERR_LIB_SSL, 231},
+    {"NO_RESULT_BUFFER", 40, 105},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_ACCESS_DENIED
-    {"TLSV1_ALERT_ACCESS_DENIED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_ACCESS_DENIED},
+  #ifdef UI_R_PROCESSING_ERROR
+    {"PROCESSING_ERROR", ERR_LIB_UI, UI_R_PROCESSING_ERROR},
   #else
-    {"TLSV1_ALERT_ACCESS_DENIED", ERR_LIB_SSL, 1049},
+    {"PROCESSING_ERROR", 40, 107},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_DECODE_ERROR
-    {"TLSV1_ALERT_DECODE_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECODE_ERROR},
+  #ifdef UI_R_RESULT_TOO_LARGE
+    {"RESULT_TOO_LARGE", ERR_LIB_UI, UI_R_RESULT_TOO_LARGE},
   #else
-    {"TLSV1_ALERT_DECODE_ERROR", ERR_LIB_SSL, 1050},
+    {"RESULT_TOO_LARGE", 40, 100},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_DECRYPTION_FAILED
-    {"TLSV1_ALERT_DECRYPTION_FAILED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECRYPTION_FAILED},
+  #ifdef UI_R_RESULT_TOO_SMALL
+    {"RESULT_TOO_SMALL", ERR_LIB_UI, UI_R_RESULT_TOO_SMALL},
   #else
-    {"TLSV1_ALERT_DECRYPTION_FAILED", ERR_LIB_SSL, 1021},
+    {"RESULT_TOO_SMALL", 40, 101},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_DECRYPT_ERROR
-    {"TLSV1_ALERT_DECRYPT_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_DECRYPT_ERROR},
+  #ifdef UI_R_SYSASSIGN_ERROR
+    {"SYSASSIGN_ERROR", ERR_LIB_UI, UI_R_SYSASSIGN_ERROR},
   #else
-    {"TLSV1_ALERT_DECRYPT_ERROR", ERR_LIB_SSL, 1051},
+    {"SYSASSIGN_ERROR", 40, 109},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION
-    {"TLSV1_ALERT_EXPORT_RESTRICTION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION},
+  #ifdef UI_R_SYSDASSGN_ERROR
+    {"SYSDASSGN_ERROR", ERR_LIB_UI, UI_R_SYSDASSGN_ERROR},
   #else
-    {"TLSV1_ALERT_EXPORT_RESTRICTION", ERR_LIB_SSL, 1060},
+    {"SYSDASSGN_ERROR", 40, 110},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK
-    {"TLSV1_ALERT_INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK},
+  #ifdef UI_R_SYSQIOW_ERROR
+    {"SYSQIOW_ERROR", ERR_LIB_UI, UI_R_SYSQIOW_ERROR},
   #else
-    {"TLSV1_ALERT_INAPPROPRIATE_FALLBACK", ERR_LIB_SSL, 1086},
+    {"SYSQIOW_ERROR", 40, 111},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY
-    {"TLSV1_ALERT_INSUFFICIENT_SECURITY", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY},
+  #ifdef UI_R_UNKNOWN_CONTROL_COMMAND
+    {"UNKNOWN_CONTROL_COMMAND", ERR_LIB_UI, UI_R_UNKNOWN_CONTROL_COMMAND},
   #else
-    {"TLSV1_ALERT_INSUFFICIENT_SECURITY", ERR_LIB_SSL, 1071},
+    {"UNKNOWN_CONTROL_COMMAND", 40, 106},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_INTERNAL_ERROR
-    {"TLSV1_ALERT_INTERNAL_ERROR", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_INTERNAL_ERROR},
+  #ifdef UI_R_UNKNOWN_TTYGET_ERRNO_VALUE
+    {"UNKNOWN_TTYGET_ERRNO_VALUE", ERR_LIB_UI, UI_R_UNKNOWN_TTYGET_ERRNO_VALUE},
   #else
-    {"TLSV1_ALERT_INTERNAL_ERROR", ERR_LIB_SSL, 1080},
+    {"UNKNOWN_TTYGET_ERRNO_VALUE", 40, 108},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_NO_RENEGOTIATION
-    {"TLSV1_ALERT_NO_RENEGOTIATION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_NO_RENEGOTIATION},
+  #ifdef UI_R_USER_DATA_DUPLICATION_UNSUPPORTED
+    {"USER_DATA_DUPLICATION_UNSUPPORTED", ERR_LIB_UI, UI_R_USER_DATA_DUPLICATION_UNSUPPORTED},
   #else
-    {"TLSV1_ALERT_NO_RENEGOTIATION", ERR_LIB_SSL, 1100},
+    {"USER_DATA_DUPLICATION_UNSUPPORTED", 40, 112},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_PROTOCOL_VERSION
-    {"TLSV1_ALERT_PROTOCOL_VERSION", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_PROTOCOL_VERSION},
+  #ifdef X509V3_R_BAD_IP_ADDRESS
+    {"BAD_IP_ADDRESS", ERR_LIB_X509V3, X509V3_R_BAD_IP_ADDRESS},
   #else
-    {"TLSV1_ALERT_PROTOCOL_VERSION", ERR_LIB_SSL, 1070},
+    {"BAD_IP_ADDRESS", 34, 118},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_RECORD_OVERFLOW
-    {"TLSV1_ALERT_RECORD_OVERFLOW", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_RECORD_OVERFLOW},
+  #ifdef X509V3_R_BAD_OBJECT
+    {"BAD_OBJECT", ERR_LIB_X509V3, X509V3_R_BAD_OBJECT},
   #else
-    {"TLSV1_ALERT_RECORD_OVERFLOW", ERR_LIB_SSL, 1022},
+    {"BAD_OBJECT", 34, 119},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_UNKNOWN_CA
-    {"TLSV1_ALERT_UNKNOWN_CA", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_UNKNOWN_CA},
+  #ifdef X509V3_R_BN_DEC2BN_ERROR
+    {"BN_DEC2BN_ERROR", ERR_LIB_X509V3, X509V3_R_BN_DEC2BN_ERROR},
   #else
-    {"TLSV1_ALERT_UNKNOWN_CA", ERR_LIB_SSL, 1048},
+    {"BN_DEC2BN_ERROR", 34, 100},
   #endif
-  #ifdef SSL_R_TLSV1_ALERT_USER_CANCELLED
-    {"TLSV1_ALERT_USER_CANCELLED", ERR_LIB_SSL, SSL_R_TLSV1_ALERT_USER_CANCELLED},
+  #ifdef X509V3_R_BN_TO_ASN1_INTEGER_ERROR
+    {"BN_TO_ASN1_INTEGER_ERROR", ERR_LIB_X509V3, X509V3_R_BN_TO_ASN1_INTEGER_ERROR},
   #else
-    {"TLSV1_ALERT_USER_CANCELLED", ERR_LIB_SSL, 1090},
+    {"BN_TO_ASN1_INTEGER_ERROR", 34, 101},
   #endif
-  #ifdef SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE
-    {"TLSV1_BAD_CERTIFICATE_HASH_VALUE", ERR_LIB_SSL, SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE},
+  #ifdef X509V3_R_DIRNAME_ERROR
+    {"DIRNAME_ERROR", ERR_LIB_X509V3, X509V3_R_DIRNAME_ERROR},
   #else
-    {"TLSV1_BAD_CERTIFICATE_HASH_VALUE", ERR_LIB_SSL, 1114},
+    {"DIRNAME_ERROR", 34, 149},
   #endif
-  #ifdef SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE
-    {"TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE", ERR_LIB_SSL, SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE},
+  #ifdef X509V3_R_DISTPOINT_ALREADY_SET
+    {"DISTPOINT_ALREADY_SET", ERR_LIB_X509V3, X509V3_R_DISTPOINT_ALREADY_SET},
   #else
-    {"TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE", ERR_LIB_SSL, 1113},
+    {"DISTPOINT_ALREADY_SET", 34, 160},
   #endif
-  #ifdef SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE
-    {"TLSV1_CERTIFICATE_UNOBTAINABLE", ERR_LIB_SSL, SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE},
+  #ifdef X509V3_R_DUPLICATE_ZONE_ID
+    {"DUPLICATE_ZONE_ID", ERR_LIB_X509V3, X509V3_R_DUPLICATE_ZONE_ID},
   #else
-    {"TLSV1_CERTIFICATE_UNOBTAINABLE", ERR_LIB_SSL, 1111},
+    {"DUPLICATE_ZONE_ID", 34, 133},
   #endif
-  #ifdef SSL_R_TLSV1_UNRECOGNIZED_NAME
-    {"TLSV1_UNRECOGNIZED_NAME", ERR_LIB_SSL, SSL_R_TLSV1_UNRECOGNIZED_NAME},
+  #ifdef X509V3_R_ERROR_CONVERTING_ZONE
+    {"ERROR_CONVERTING_ZONE", ERR_LIB_X509V3, X509V3_R_ERROR_CONVERTING_ZONE},
   #else
-    {"TLSV1_UNRECOGNIZED_NAME", ERR_LIB_SSL, 1112},
+    {"ERROR_CONVERTING_ZONE", 34, 131},
   #endif
-  #ifdef SSL_R_TLSV1_UNSUPPORTED_EXTENSION
-    {"TLSV1_UNSUPPORTED_EXTENSION", ERR_LIB_SSL, SSL_R_TLSV1_UNSUPPORTED_EXTENSION},
+  #ifdef X509V3_R_ERROR_CREATING_EXTENSION
+    {"ERROR_CREATING_EXTENSION", ERR_LIB_X509V3, X509V3_R_ERROR_CREATING_EXTENSION},
   #else
-    {"TLSV1_UNSUPPORTED_EXTENSION", ERR_LIB_SSL, 1110},
+    {"ERROR_CREATING_EXTENSION", 34, 144},
   #endif
-  #ifdef SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER
-    {"TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER", ERR_LIB_SSL, SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER},
+  #ifdef X509V3_R_ERROR_IN_EXTENSION
+    {"ERROR_IN_EXTENSION", ERR_LIB_X509V3, X509V3_R_ERROR_IN_EXTENSION},
   #else
-    {"TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER", ERR_LIB_SSL, 232},
+    {"ERROR_IN_EXTENSION", 34, 128},
   #endif
-  #ifdef SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT
-    {"TLS_HEARTBEAT_PEER_DOESNT_ACCEPT", ERR_LIB_SSL, SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT},
+  #ifdef X509V3_R_EXPECTED_A_SECTION_NAME
+    {"EXPECTED_A_SECTION_NAME", ERR_LIB_X509V3, X509V3_R_EXPECTED_A_SECTION_NAME},
   #else
-    {"TLS_HEARTBEAT_PEER_DOESNT_ACCEPT", ERR_LIB_SSL, 365},
+    {"EXPECTED_A_SECTION_NAME", 34, 137},
   #endif
-  #ifdef SSL_R_TLS_HEARTBEAT_PENDING
-    {"TLS_HEARTBEAT_PENDING", ERR_LIB_SSL, SSL_R_TLS_HEARTBEAT_PENDING},
+  #ifdef X509V3_R_EXTENSION_EXISTS
+    {"EXTENSION_EXISTS", ERR_LIB_X509V3, X509V3_R_EXTENSION_EXISTS},
   #else
-    {"TLS_HEARTBEAT_PENDING", ERR_LIB_SSL, 366},
+    {"EXTENSION_EXISTS", 34, 145},
   #endif
-  #ifdef SSL_R_TLS_ILLEGAL_EXPORTER_LABEL
-    {"TLS_ILLEGAL_EXPORTER_LABEL", ERR_LIB_SSL, SSL_R_TLS_ILLEGAL_EXPORTER_LABEL},
+  #ifdef X509V3_R_EXTENSION_NAME_ERROR
+    {"EXTENSION_NAME_ERROR", ERR_LIB_X509V3, X509V3_R_EXTENSION_NAME_ERROR},
   #else
-    {"TLS_ILLEGAL_EXPORTER_LABEL", ERR_LIB_SSL, 367},
+    {"EXTENSION_NAME_ERROR", 34, 115},
   #endif
-  #ifdef SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST
-    {"TLS_INVALID_ECPOINTFORMAT_LIST", ERR_LIB_SSL, SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST},
+  #ifdef X509V3_R_EXTENSION_NOT_FOUND
+    {"EXTENSION_NOT_FOUND", ERR_LIB_X509V3, X509V3_R_EXTENSION_NOT_FOUND},
   #else
-    {"TLS_INVALID_ECPOINTFORMAT_LIST", ERR_LIB_SSL, 157},
+    {"EXTENSION_NOT_FOUND", 34, 102},
   #endif
-  #ifdef SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST
-    {"TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST", ERR_LIB_SSL, SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST},
+  #ifdef X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED
+    {"EXTENSION_SETTING_NOT_SUPPORTED", ERR_LIB_X509V3, X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED},
   #else
-    {"TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST", ERR_LIB_SSL, 233},
+    {"EXTENSION_SETTING_NOT_SUPPORTED", 34, 103},
   #endif
-  #ifdef SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG
-    {"TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG", ERR_LIB_SSL, SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG},
+  #ifdef X509V3_R_EXTENSION_VALUE_ERROR
+    {"EXTENSION_VALUE_ERROR", ERR_LIB_X509V3, X509V3_R_EXTENSION_VALUE_ERROR},
   #else
-    {"TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG", ERR_LIB_SSL, 234},
+    {"EXTENSION_VALUE_ERROR", 34, 116},
   #endif
-  #ifdef SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER
-    {"TRIED_TO_USE_UNSUPPORTED_CIPHER", ERR_LIB_SSL, SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER},
+  #ifdef X509V3_R_ILLEGAL_EMPTY_EXTENSION
+    {"ILLEGAL_EMPTY_EXTENSION", ERR_LIB_X509V3, X509V3_R_ILLEGAL_EMPTY_EXTENSION},
   #else
-    {"TRIED_TO_USE_UNSUPPORTED_CIPHER", ERR_LIB_SSL, 235},
+    {"ILLEGAL_EMPTY_EXTENSION", 34, 151},
   #endif
-  #ifdef SSL_R_UNABLE_TO_DECODE_DH_CERTS
-    {"UNABLE_TO_DECODE_DH_CERTS", ERR_LIB_SSL, SSL_R_UNABLE_TO_DECODE_DH_CERTS},
+  #ifdef X509V3_R_INCORRECT_POLICY_SYNTAX_TAG
+    {"INCORRECT_POLICY_SYNTAX_TAG", ERR_LIB_X509V3, X509V3_R_INCORRECT_POLICY_SYNTAX_TAG},
   #else
-    {"UNABLE_TO_DECODE_DH_CERTS", ERR_LIB_SSL, 236},
+    {"INCORRECT_POLICY_SYNTAX_TAG", 34, 152},
   #endif
-  #ifdef SSL_R_UNABLE_TO_DECODE_ECDH_CERTS
-    {"UNABLE_TO_DECODE_ECDH_CERTS", ERR_LIB_SSL, SSL_R_UNABLE_TO_DECODE_ECDH_CERTS},
+  #ifdef X509V3_R_INVALID_ASNUMBER
+    {"INVALID_ASNUMBER", ERR_LIB_X509V3, X509V3_R_INVALID_ASNUMBER},
   #else
-    {"UNABLE_TO_DECODE_ECDH_CERTS", ERR_LIB_SSL, 313},
+    {"INVALID_ASNUMBER", 34, 162},
   #endif
-  #ifdef SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY
-    {"UNABLE_TO_EXTRACT_PUBLIC_KEY", ERR_LIB_SSL, SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY},
+  #ifdef X509V3_R_INVALID_ASRANGE
+    {"INVALID_ASRANGE", ERR_LIB_X509V3, X509V3_R_INVALID_ASRANGE},
   #else
-    {"UNABLE_TO_EXTRACT_PUBLIC_KEY", ERR_LIB_SSL, 237},
+    {"INVALID_ASRANGE", 34, 163},
   #endif
-  #ifdef SSL_R_UNABLE_TO_FIND_DH_PARAMETERS
-    {"UNABLE_TO_FIND_DH_PARAMETERS", ERR_LIB_SSL, SSL_R_UNABLE_TO_FIND_DH_PARAMETERS},
+  #ifdef X509V3_R_INVALID_BOOLEAN_STRING
+    {"INVALID_BOOLEAN_STRING", ERR_LIB_X509V3, X509V3_R_INVALID_BOOLEAN_STRING},
   #else
-    {"UNABLE_TO_FIND_DH_PARAMETERS", ERR_LIB_SSL, 238},
+    {"INVALID_BOOLEAN_STRING", 34, 104},
   #endif
-  #ifdef SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS
-    {"UNABLE_TO_FIND_ECDH_PARAMETERS", ERR_LIB_SSL, SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS},
+  #ifdef X509V3_R_INVALID_EXTENSION_STRING
+    {"INVALID_EXTENSION_STRING", ERR_LIB_X509V3, X509V3_R_INVALID_EXTENSION_STRING},
   #else
-    {"UNABLE_TO_FIND_ECDH_PARAMETERS", ERR_LIB_SSL, 314},
+    {"INVALID_EXTENSION_STRING", 34, 105},
   #endif
-  #ifdef SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS
-    {"UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS", ERR_LIB_SSL, SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS},
+  #ifdef X509V3_R_INVALID_INHERITANCE
+    {"INVALID_INHERITANCE", ERR_LIB_X509V3, X509V3_R_INVALID_INHERITANCE},
   #else
-    {"UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS", ERR_LIB_SSL, 239},
+    {"INVALID_INHERITANCE", 34, 165},
   #endif
-  #ifdef SSL_R_UNABLE_TO_FIND_SSL_METHOD
-    {"UNABLE_TO_FIND_SSL_METHOD", ERR_LIB_SSL, SSL_R_UNABLE_TO_FIND_SSL_METHOD},
+  #ifdef X509V3_R_INVALID_IPADDRESS
+    {"INVALID_IPADDRESS", ERR_LIB_X509V3, X509V3_R_INVALID_IPADDRESS},
   #else
-    {"UNABLE_TO_FIND_SSL_METHOD", ERR_LIB_SSL, 240},
+    {"INVALID_IPADDRESS", 34, 166},
   #endif
-  #ifdef SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES
-    {"UNABLE_TO_LOAD_SSL2_MD5_ROUTINES", ERR_LIB_SSL, SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES},
+  #ifdef X509V3_R_INVALID_MULTIPLE_RDNS
+    {"INVALID_MULTIPLE_RDNS", ERR_LIB_X509V3, X509V3_R_INVALID_MULTIPLE_RDNS},
   #else
-    {"UNABLE_TO_LOAD_SSL2_MD5_ROUTINES", ERR_LIB_SSL, 241},
+    {"INVALID_MULTIPLE_RDNS", 34, 161},
   #endif
-  #ifdef SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES
-    {"UNABLE_TO_LOAD_SSL3_MD5_ROUTINES", ERR_LIB_SSL, SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES},
+  #ifdef X509V3_R_INVALID_NAME
+    {"INVALID_NAME", ERR_LIB_X509V3, X509V3_R_INVALID_NAME},
   #else
-    {"UNABLE_TO_LOAD_SSL3_MD5_ROUTINES", ERR_LIB_SSL, 242},
+    {"INVALID_NAME", 34, 106},
   #endif
-  #ifdef SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES
-    {"UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES", ERR_LIB_SSL, SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES},
+  #ifdef X509V3_R_INVALID_NULL_ARGUMENT
+    {"INVALID_NULL_ARGUMENT", ERR_LIB_X509V3, X509V3_R_INVALID_NULL_ARGUMENT},
   #else
-    {"UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES", ERR_LIB_SSL, 243},
+    {"INVALID_NULL_ARGUMENT", 34, 107},
   #endif
-  #ifdef SSL_R_UNEXPECTED_MESSAGE
-    {"UNEXPECTED_MESSAGE", ERR_LIB_SSL, SSL_R_UNEXPECTED_MESSAGE},
+  #ifdef X509V3_R_INVALID_NULL_NAME
+    {"INVALID_NULL_NAME", ERR_LIB_X509V3, X509V3_R_INVALID_NULL_NAME},
   #else
-    {"UNEXPECTED_MESSAGE", ERR_LIB_SSL, 244},
+    {"INVALID_NULL_NAME", 34, 108},
   #endif
-  #ifdef SSL_R_UNEXPECTED_RECORD
-    {"UNEXPECTED_RECORD", ERR_LIB_SSL, SSL_R_UNEXPECTED_RECORD},
+  #ifdef X509V3_R_INVALID_NULL_VALUE
+    {"INVALID_NULL_VALUE", ERR_LIB_X509V3, X509V3_R_INVALID_NULL_VALUE},
   #else
-    {"UNEXPECTED_RECORD", ERR_LIB_SSL, 245},
+    {"INVALID_NULL_VALUE", 34, 109},
   #endif
-  #ifdef SSL_R_UNINITIALIZED
-    {"UNINITIALIZED", ERR_LIB_SSL, SSL_R_UNINITIALIZED},
+  #ifdef X509V3_R_INVALID_NUMBER
+    {"INVALID_NUMBER", ERR_LIB_X509V3, X509V3_R_INVALID_NUMBER},
   #else
-    {"UNINITIALIZED", ERR_LIB_SSL, 276},
+    {"INVALID_NUMBER", 34, 140},
   #endif
-  #ifdef SSL_R_UNKNOWN_ALERT_TYPE
-    {"UNKNOWN_ALERT_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_ALERT_TYPE},
+  #ifdef X509V3_R_INVALID_NUMBERS
+    {"INVALID_NUMBERS", ERR_LIB_X509V3, X509V3_R_INVALID_NUMBERS},
   #else
-    {"UNKNOWN_ALERT_TYPE", ERR_LIB_SSL, 246},
+    {"INVALID_NUMBERS", 34, 141},
   #endif
-  #ifdef SSL_R_UNKNOWN_CERTIFICATE_TYPE
-    {"UNKNOWN_CERTIFICATE_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_CERTIFICATE_TYPE},
+  #ifdef X509V3_R_INVALID_OBJECT_IDENTIFIER
+    {"INVALID_OBJECT_IDENTIFIER", ERR_LIB_X509V3, X509V3_R_INVALID_OBJECT_IDENTIFIER},
   #else
-    {"UNKNOWN_CERTIFICATE_TYPE", ERR_LIB_SSL, 247},
+    {"INVALID_OBJECT_IDENTIFIER", 34, 110},
   #endif
-  #ifdef SSL_R_UNKNOWN_CIPHER_RETURNED
-    {"UNKNOWN_CIPHER_RETURNED", ERR_LIB_SSL, SSL_R_UNKNOWN_CIPHER_RETURNED},
+  #ifdef X509V3_R_INVALID_OPTION
+    {"INVALID_OPTION", ERR_LIB_X509V3, X509V3_R_INVALID_OPTION},
   #else
-    {"UNKNOWN_CIPHER_RETURNED", ERR_LIB_SSL, 248},
+    {"INVALID_OPTION", 34, 138},
   #endif
-  #ifdef SSL_R_UNKNOWN_CIPHER_TYPE
-    {"UNKNOWN_CIPHER_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_CIPHER_TYPE},
+  #ifdef X509V3_R_INVALID_POLICY_IDENTIFIER
+    {"INVALID_POLICY_IDENTIFIER", ERR_LIB_X509V3, X509V3_R_INVALID_POLICY_IDENTIFIER},
   #else
-    {"UNKNOWN_CIPHER_TYPE", ERR_LIB_SSL, 249},
+    {"INVALID_POLICY_IDENTIFIER", 34, 134},
   #endif
-  #ifdef SSL_R_UNKNOWN_CMD_NAME
-    {"UNKNOWN_CMD_NAME", ERR_LIB_SSL, SSL_R_UNKNOWN_CMD_NAME},
+  #ifdef X509V3_R_INVALID_PROXY_POLICY_SETTING
+    {"INVALID_PROXY_POLICY_SETTING", ERR_LIB_X509V3, X509V3_R_INVALID_PROXY_POLICY_SETTING},
   #else
-    {"UNKNOWN_CMD_NAME", ERR_LIB_SSL, 386},
+    {"INVALID_PROXY_POLICY_SETTING", 34, 153},
   #endif
-  #ifdef SSL_R_UNKNOWN_DIGEST
-    {"UNKNOWN_DIGEST", ERR_LIB_SSL, SSL_R_UNKNOWN_DIGEST},
+  #ifdef X509V3_R_INVALID_PURPOSE
+    {"INVALID_PURPOSE", ERR_LIB_X509V3, X509V3_R_INVALID_PURPOSE},
   #else
-    {"UNKNOWN_DIGEST", ERR_LIB_SSL, 368},
+    {"INVALID_PURPOSE", 34, 146},
   #endif
-  #ifdef SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE
-    {"UNKNOWN_KEY_EXCHANGE_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE},
+  #ifdef X509V3_R_INVALID_SAFI
+    {"INVALID_SAFI", ERR_LIB_X509V3, X509V3_R_INVALID_SAFI},
   #else
-    {"UNKNOWN_KEY_EXCHANGE_TYPE", ERR_LIB_SSL, 250},
+    {"INVALID_SAFI", 34, 164},
   #endif
-  #ifdef SSL_R_UNKNOWN_PKEY_TYPE
-    {"UNKNOWN_PKEY_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_PKEY_TYPE},
+  #ifdef X509V3_R_INVALID_SECTION
+    {"INVALID_SECTION", ERR_LIB_X509V3, X509V3_R_INVALID_SECTION},
   #else
-    {"UNKNOWN_PKEY_TYPE", ERR_LIB_SSL, 251},
+    {"INVALID_SECTION", 34, 135},
   #endif
-  #ifdef SSL_R_UNKNOWN_PROTOCOL
-    {"UNKNOWN_PROTOCOL", ERR_LIB_SSL, SSL_R_UNKNOWN_PROTOCOL},
+  #ifdef X509V3_R_INVALID_SYNTAX
+    {"INVALID_SYNTAX", ERR_LIB_X509V3, X509V3_R_INVALID_SYNTAX},
   #else
-    {"UNKNOWN_PROTOCOL", ERR_LIB_SSL, 252},
+    {"INVALID_SYNTAX", 34, 143},
   #endif
-  #ifdef SSL_R_UNKNOWN_REMOTE_ERROR_TYPE
-    {"UNKNOWN_REMOTE_ERROR_TYPE", ERR_LIB_SSL, SSL_R_UNKNOWN_REMOTE_ERROR_TYPE},
+  #ifdef X509V3_R_ISSUER_DECODE_ERROR
+    {"ISSUER_DECODE_ERROR", ERR_LIB_X509V3, X509V3_R_ISSUER_DECODE_ERROR},
   #else
-    {"UNKNOWN_REMOTE_ERROR_TYPE", ERR_LIB_SSL, 253},
+    {"ISSUER_DECODE_ERROR", 34, 126},
   #endif
-  #ifdef SSL_R_UNKNOWN_SSL_VERSION
-    {"UNKNOWN_SSL_VERSION", ERR_LIB_SSL, SSL_R_UNKNOWN_SSL_VERSION},
+  #ifdef X509V3_R_MISSING_VALUE
+    {"MISSING_VALUE", ERR_LIB_X509V3, X509V3_R_MISSING_VALUE},
   #else
-    {"UNKNOWN_SSL_VERSION", ERR_LIB_SSL, 254},
+    {"MISSING_VALUE", 34, 124},
   #endif
-  #ifdef SSL_R_UNKNOWN_STATE
-    {"UNKNOWN_STATE", ERR_LIB_SSL, SSL_R_UNKNOWN_STATE},
+  #ifdef X509V3_R_NEED_ORGANIZATION_AND_NUMBERS
+    {"NEED_ORGANIZATION_AND_NUMBERS", ERR_LIB_X509V3, X509V3_R_NEED_ORGANIZATION_AND_NUMBERS},
   #else
-    {"UNKNOWN_STATE", ERR_LIB_SSL, 255},
+    {"NEED_ORGANIZATION_AND_NUMBERS", 34, 142},
   #endif
-  #ifdef SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED
-    {"UNSAFE_LEGACY_RENEGOTIATION_DISABLED", ERR_LIB_SSL, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED},
+  #ifdef X509V3_R_NO_CONFIG_DATABASE
+    {"NO_CONFIG_DATABASE", ERR_LIB_X509V3, X509V3_R_NO_CONFIG_DATABASE},
   #else
-    {"UNSAFE_LEGACY_RENEGOTIATION_DISABLED", ERR_LIB_SSL, 338},
+    {"NO_CONFIG_DATABASE", 34, 136},
   #endif
-  #ifdef SSL_R_UNSUPPORTED_CIPHER
-    {"UNSUPPORTED_CIPHER", ERR_LIB_SSL, SSL_R_UNSUPPORTED_CIPHER},
+  #ifdef X509V3_R_NO_ISSUER_CERTIFICATE
+    {"NO_ISSUER_CERTIFICATE", ERR_LIB_X509V3, X509V3_R_NO_ISSUER_CERTIFICATE},
   #else
-    {"UNSUPPORTED_CIPHER", ERR_LIB_SSL, 256},
+    {"NO_ISSUER_CERTIFICATE", 34, 121},
   #endif
-  #ifdef SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM
-    {"UNSUPPORTED_COMPRESSION_ALGORITHM", ERR_LIB_SSL, SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM},
+  #ifdef X509V3_R_NO_ISSUER_DETAILS
+    {"NO_ISSUER_DETAILS", ERR_LIB_X509V3, X509V3_R_NO_ISSUER_DETAILS},
   #else
-    {"UNSUPPORTED_COMPRESSION_ALGORITHM", ERR_LIB_SSL, 257},
+    {"NO_ISSUER_DETAILS", 34, 127},
   #endif
-  #ifdef SSL_R_UNSUPPORTED_DIGEST_TYPE
-    {"UNSUPPORTED_DIGEST_TYPE", ERR_LIB_SSL, SSL_R_UNSUPPORTED_DIGEST_TYPE},
+  #ifdef X509V3_R_NO_POLICY_IDENTIFIER
+    {"NO_POLICY_IDENTIFIER", ERR_LIB_X509V3, X509V3_R_NO_POLICY_IDENTIFIER},
   #else
-    {"UNSUPPORTED_DIGEST_TYPE", ERR_LIB_SSL, 326},
+    {"NO_POLICY_IDENTIFIER", 34, 139},
   #endif
-  #ifdef SSL_R_UNSUPPORTED_ELLIPTIC_CURVE
-    {"UNSUPPORTED_ELLIPTIC_CURVE", ERR_LIB_SSL, SSL_R_UNSUPPORTED_ELLIPTIC_CURVE},
+  #ifdef X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED
+    {"NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED", ERR_LIB_X509V3, X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED},
   #else
-    {"UNSUPPORTED_ELLIPTIC_CURVE", ERR_LIB_SSL, 315},
+    {"NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED", 34, 154},
   #endif
-  #ifdef SSL_R_UNSUPPORTED_PROTOCOL
-    {"UNSUPPORTED_PROTOCOL", ERR_LIB_SSL, SSL_R_UNSUPPORTED_PROTOCOL},
+  #ifdef X509V3_R_NO_PUBLIC_KEY
+    {"NO_PUBLIC_KEY", ERR_LIB_X509V3, X509V3_R_NO_PUBLIC_KEY},
   #else
-    {"UNSUPPORTED_PROTOCOL", ERR_LIB_SSL, 258},
+    {"NO_PUBLIC_KEY", 34, 114},
   #endif
-  #ifdef SSL_R_UNSUPPORTED_SSL_VERSION
-    {"UNSUPPORTED_SSL_VERSION", ERR_LIB_SSL, SSL_R_UNSUPPORTED_SSL_VERSION},
+  #ifdef X509V3_R_NO_SUBJECT_DETAILS
+    {"NO_SUBJECT_DETAILS", ERR_LIB_X509V3, X509V3_R_NO_SUBJECT_DETAILS},
   #else
-    {"UNSUPPORTED_SSL_VERSION", ERR_LIB_SSL, 259},
+    {"NO_SUBJECT_DETAILS", 34, 125},
   #endif
-  #ifdef SSL_R_UNSUPPORTED_STATUS_TYPE
-    {"UNSUPPORTED_STATUS_TYPE", ERR_LIB_SSL, SSL_R_UNSUPPORTED_STATUS_TYPE},
+  #ifdef X509V3_R_OPERATION_NOT_DEFINED
+    {"OPERATION_NOT_DEFINED", ERR_LIB_X509V3, X509V3_R_OPERATION_NOT_DEFINED},
   #else
-    {"UNSUPPORTED_STATUS_TYPE", ERR_LIB_SSL, 329},
+    {"OPERATION_NOT_DEFINED", 34, 148},
   #endif
-  #ifdef SSL_R_USE_SRTP_NOT_NEGOTIATED
-    {"USE_SRTP_NOT_NEGOTIATED", ERR_LIB_SSL, SSL_R_USE_SRTP_NOT_NEGOTIATED},
+  #ifdef X509V3_R_OTHERNAME_ERROR
+    {"OTHERNAME_ERROR", ERR_LIB_X509V3, X509V3_R_OTHERNAME_ERROR},
   #else
-    {"USE_SRTP_NOT_NEGOTIATED", ERR_LIB_SSL, 369},
+    {"OTHERNAME_ERROR", 34, 147},
   #endif
-  #ifdef SSL_R_VERSION_TOO_LOW
-    {"VERSION_TOO_LOW", ERR_LIB_SSL, SSL_R_VERSION_TOO_LOW},
+  #ifdef X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED
+    {"POLICY_LANGUAGE_ALREADY_DEFINED", ERR_LIB_X509V3, X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED},
   #else
-    {"VERSION_TOO_LOW", ERR_LIB_SSL, 396},
+    {"POLICY_LANGUAGE_ALREADY_DEFINED", 34, 155},
   #endif
-  #ifdef SSL_R_WRITE_BIO_NOT_SET
-    {"WRITE_BIO_NOT_SET", ERR_LIB_SSL, SSL_R_WRITE_BIO_NOT_SET},
+  #ifdef X509V3_R_POLICY_PATH_LENGTH
+    {"POLICY_PATH_LENGTH", ERR_LIB_X509V3, X509V3_R_POLICY_PATH_LENGTH},
   #else
-    {"WRITE_BIO_NOT_SET", ERR_LIB_SSL, 260},
+    {"POLICY_PATH_LENGTH", 34, 156},
   #endif
-  #ifdef SSL_R_WRONG_CERTIFICATE_TYPE
-    {"WRONG_CERTIFICATE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_CERTIFICATE_TYPE},
+  #ifdef X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED
+    {"POLICY_PATH_LENGTH_ALREADY_DEFINED", ERR_LIB_X509V3, X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED},
   #else
-    {"WRONG_CERTIFICATE_TYPE", ERR_LIB_SSL, 383},
+    {"POLICY_PATH_LENGTH_ALREADY_DEFINED", 34, 157},
   #endif
-  #ifdef SSL_R_WRONG_CIPHER_RETURNED
-    {"WRONG_CIPHER_RETURNED", ERR_LIB_SSL, SSL_R_WRONG_CIPHER_RETURNED},
+  #ifdef X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY
+    {"POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY", ERR_LIB_X509V3, X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY},
   #else
-    {"WRONG_CIPHER_RETURNED", ERR_LIB_SSL, 261},
+    {"POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY", 34, 159},
   #endif
-  #ifdef SSL_R_WRONG_CURVE
-    {"WRONG_CURVE", ERR_LIB_SSL, SSL_R_WRONG_CURVE},
+  #ifdef X509V3_R_SECTION_NOT_FOUND
+    {"SECTION_NOT_FOUND", ERR_LIB_X509V3, X509V3_R_SECTION_NOT_FOUND},
   #else
-    {"WRONG_CURVE", ERR_LIB_SSL, 378},
+    {"SECTION_NOT_FOUND", 34, 150},
   #endif
-  #ifdef SSL_R_WRONG_MESSAGE_TYPE
-    {"WRONG_MESSAGE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_MESSAGE_TYPE},
+  #ifdef X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS
+    {"UNABLE_TO_GET_ISSUER_DETAILS", ERR_LIB_X509V3, X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS},
   #else
-    {"WRONG_MESSAGE_TYPE", ERR_LIB_SSL, 262},
+    {"UNABLE_TO_GET_ISSUER_DETAILS", 34, 122},
   #endif
-  #ifdef SSL_R_WRONG_NUMBER_OF_KEY_BITS
-    {"WRONG_NUMBER_OF_KEY_BITS", ERR_LIB_SSL, SSL_R_WRONG_NUMBER_OF_KEY_BITS},
+  #ifdef X509V3_R_UNABLE_TO_GET_ISSUER_KEYID
+    {"UNABLE_TO_GET_ISSUER_KEYID", ERR_LIB_X509V3, X509V3_R_UNABLE_TO_GET_ISSUER_KEYID},
   #else
-    {"WRONG_NUMBER_OF_KEY_BITS", ERR_LIB_SSL, 263},
+    {"UNABLE_TO_GET_ISSUER_KEYID", 34, 123},
   #endif
-  #ifdef SSL_R_WRONG_SIGNATURE_LENGTH
-    {"WRONG_SIGNATURE_LENGTH", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_LENGTH},
+  #ifdef X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT
+    {"UNKNOWN_BIT_STRING_ARGUMENT", ERR_LIB_X509V3, X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT},
   #else
-    {"WRONG_SIGNATURE_LENGTH", ERR_LIB_SSL, 264},
+    {"UNKNOWN_BIT_STRING_ARGUMENT", 34, 111},
   #endif
-  #ifdef SSL_R_WRONG_SIGNATURE_SIZE
-    {"WRONG_SIGNATURE_SIZE", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_SIZE},
+  #ifdef X509V3_R_UNKNOWN_EXTENSION
+    {"UNKNOWN_EXTENSION", ERR_LIB_X509V3, X509V3_R_UNKNOWN_EXTENSION},
   #else
-    {"WRONG_SIGNATURE_SIZE", ERR_LIB_SSL, 265},
+    {"UNKNOWN_EXTENSION", 34, 129},
   #endif
-  #ifdef SSL_R_WRONG_SIGNATURE_TYPE
-    {"WRONG_SIGNATURE_TYPE", ERR_LIB_SSL, SSL_R_WRONG_SIGNATURE_TYPE},
+  #ifdef X509V3_R_UNKNOWN_EXTENSION_NAME
+    {"UNKNOWN_EXTENSION_NAME", ERR_LIB_X509V3, X509V3_R_UNKNOWN_EXTENSION_NAME},
   #else
-    {"WRONG_SIGNATURE_TYPE", ERR_LIB_SSL, 370},
+    {"UNKNOWN_EXTENSION_NAME", 34, 130},
   #endif
-  #ifdef SSL_R_WRONG_SSL_VERSION
-    {"WRONG_SSL_VERSION", ERR_LIB_SSL, SSL_R_WRONG_SSL_VERSION},
+  #ifdef X509V3_R_UNKNOWN_OPTION
+    {"UNKNOWN_OPTION", ERR_LIB_X509V3, X509V3_R_UNKNOWN_OPTION},
   #else
-    {"WRONG_SSL_VERSION", ERR_LIB_SSL, 266},
+    {"UNKNOWN_OPTION", 34, 120},
   #endif
-  #ifdef SSL_R_WRONG_VERSION_NUMBER
-    {"WRONG_VERSION_NUMBER", ERR_LIB_SSL, SSL_R_WRONG_VERSION_NUMBER},
+  #ifdef X509V3_R_UNSUPPORTED_OPTION
+    {"UNSUPPORTED_OPTION", ERR_LIB_X509V3, X509V3_R_UNSUPPORTED_OPTION},
   #else
-    {"WRONG_VERSION_NUMBER", ERR_LIB_SSL, 267},
+    {"UNSUPPORTED_OPTION", 34, 117},
   #endif
-  #ifdef SSL_R_X509_LIB
-    {"X509_LIB", ERR_LIB_SSL, SSL_R_X509_LIB},
+  #ifdef X509V3_R_UNSUPPORTED_TYPE
+    {"UNSUPPORTED_TYPE", ERR_LIB_X509V3, X509V3_R_UNSUPPORTED_TYPE},
   #else
-    {"X509_LIB", ERR_LIB_SSL, 268},
+    {"UNSUPPORTED_TYPE", 34, 167},
   #endif
-  #ifdef SSL_R_X509_VERIFICATION_SETUP_PROBLEMS
-    {"X509_VERIFICATION_SETUP_PROBLEMS", ERR_LIB_SSL, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS},
+  #ifdef X509V3_R_USER_TOO_LONG
+    {"USER_TOO_LONG", ERR_LIB_X509V3, X509V3_R_USER_TOO_LONG},
   #else
-    {"X509_VERIFICATION_SETUP_PROBLEMS", ERR_LIB_SSL, 269},
+    {"USER_TOO_LONG", 34, 132},
   #endif
   #ifdef X509_R_AKID_MISMATCH
     {"AKID_MISMATCH", ERR_LIB_X509, X509_R_AKID_MISMATCH},
   #else
-    {"AKID_MISMATCH", ERR_LIB_X509, 110},
+    {"AKID_MISMATCH", 11, 110},
+  #endif
+  #ifdef X509_R_BAD_SELECTOR
+    {"BAD_SELECTOR", ERR_LIB_X509, X509_R_BAD_SELECTOR},
+  #else
+    {"BAD_SELECTOR", 11, 133},
   #endif
   #ifdef X509_R_BAD_X509_FILETYPE
     {"BAD_X509_FILETYPE", ERR_LIB_X509, X509_R_BAD_X509_FILETYPE},
   #else
-    {"BAD_X509_FILETYPE", ERR_LIB_X509, 100},
+    {"BAD_X509_FILETYPE", 11, 100},
   #endif
   #ifdef X509_R_BASE64_DECODE_ERROR
     {"BASE64_DECODE_ERROR", ERR_LIB_X509, X509_R_BASE64_DECODE_ERROR},
   #else
-    {"BASE64_DECODE_ERROR", ERR_LIB_X509, 118},
+    {"BASE64_DECODE_ERROR", 11, 118},
   #endif
   #ifdef X509_R_CANT_CHECK_DH_KEY
     {"CANT_CHECK_DH_KEY", ERR_LIB_X509, X509_R_CANT_CHECK_DH_KEY},
   #else
-    {"CANT_CHECK_DH_KEY", ERR_LIB_X509, 114},
+    {"CANT_CHECK_DH_KEY", 11, 114},
   #endif
   #ifdef X509_R_CERT_ALREADY_IN_HASH_TABLE
     {"CERT_ALREADY_IN_HASH_TABLE", ERR_LIB_X509, X509_R_CERT_ALREADY_IN_HASH_TABLE},
   #else
-    {"CERT_ALREADY_IN_HASH_TABLE", ERR_LIB_X509, 101},
+    {"CERT_ALREADY_IN_HASH_TABLE", 11, 101},
   #endif
   #ifdef X509_R_CRL_ALREADY_DELTA
     {"CRL_ALREADY_DELTA", ERR_LIB_X509, X509_R_CRL_ALREADY_DELTA},
   #else
-    {"CRL_ALREADY_DELTA", ERR_LIB_X509, 127},
+    {"CRL_ALREADY_DELTA", 11, 127},
   #endif
   #ifdef X509_R_CRL_VERIFY_FAILURE
     {"CRL_VERIFY_FAILURE", ERR_LIB_X509, X509_R_CRL_VERIFY_FAILURE},
   #else
-    {"CRL_VERIFY_FAILURE", ERR_LIB_X509, 131},
+    {"CRL_VERIFY_FAILURE", 11, 131},
   #endif
   #ifdef X509_R_ERR_ASN1_LIB
     {"ERR_ASN1_LIB", ERR_LIB_X509, X509_R_ERR_ASN1_LIB},
   #else
-    {"ERR_ASN1_LIB", ERR_LIB_X509, 102},
+    {"ERR_ASN1_LIB", 11, 102},
   #endif
   #ifdef X509_R_IDP_MISMATCH
     {"IDP_MISMATCH", ERR_LIB_X509, X509_R_IDP_MISMATCH},
   #else
-    {"IDP_MISMATCH", ERR_LIB_X509, 128},
+    {"IDP_MISMATCH", 11, 128},
+  #endif
+  #ifdef X509_R_INVALID_ATTRIBUTES
+    {"INVALID_ATTRIBUTES", ERR_LIB_X509, X509_R_INVALID_ATTRIBUTES},
+  #else
+    {"INVALID_ATTRIBUTES", 11, 138},
   #endif
   #ifdef X509_R_INVALID_DIRECTORY
     {"INVALID_DIRECTORY", ERR_LIB_X509, X509_R_INVALID_DIRECTORY},
   #else
-    {"INVALID_DIRECTORY", ERR_LIB_X509, 113},
+    {"INVALID_DIRECTORY", 11, 113},
   #endif
   #ifdef X509_R_INVALID_FIELD_NAME
     {"INVALID_FIELD_NAME", ERR_LIB_X509, X509_R_INVALID_FIELD_NAME},
   #else
-    {"INVALID_FIELD_NAME", ERR_LIB_X509, 119},
+    {"INVALID_FIELD_NAME", 11, 119},
   #endif
   #ifdef X509_R_INVALID_TRUST
     {"INVALID_TRUST", ERR_LIB_X509, X509_R_INVALID_TRUST},
   #else
-    {"INVALID_TRUST", ERR_LIB_X509, 123},
+    {"INVALID_TRUST", 11, 123},
   #endif
   #ifdef X509_R_ISSUER_MISMATCH
     {"ISSUER_MISMATCH", ERR_LIB_X509, X509_R_ISSUER_MISMATCH},
   #else
-    {"ISSUER_MISMATCH", ERR_LIB_X509, 129},
+    {"ISSUER_MISMATCH", 11, 129},
   #endif
   #ifdef X509_R_KEY_TYPE_MISMATCH
     {"KEY_TYPE_MISMATCH", ERR_LIB_X509, X509_R_KEY_TYPE_MISMATCH},
   #else
-    {"KEY_TYPE_MISMATCH", ERR_LIB_X509, 115},
+    {"KEY_TYPE_MISMATCH", 11, 115},
   #endif
   #ifdef X509_R_KEY_VALUES_MISMATCH
     {"KEY_VALUES_MISMATCH", ERR_LIB_X509, X509_R_KEY_VALUES_MISMATCH},
   #else
-    {"KEY_VALUES_MISMATCH", ERR_LIB_X509, 116},
+    {"KEY_VALUES_MISMATCH", 11, 116},
   #endif
   #ifdef X509_R_LOADING_CERT_DIR
     {"LOADING_CERT_DIR", ERR_LIB_X509, X509_R_LOADING_CERT_DIR},
   #else
-    {"LOADING_CERT_DIR", ERR_LIB_X509, 103},
+    {"LOADING_CERT_DIR", 11, 103},
   #endif
   #ifdef X509_R_LOADING_DEFAULTS
     {"LOADING_DEFAULTS", ERR_LIB_X509, X509_R_LOADING_DEFAULTS},
   #else
-    {"LOADING_DEFAULTS", ERR_LIB_X509, 104},
+    {"LOADING_DEFAULTS", 11, 104},
   #endif
   #ifdef X509_R_METHOD_NOT_SUPPORTED
     {"METHOD_NOT_SUPPORTED", ERR_LIB_X509, X509_R_METHOD_NOT_SUPPORTED},
   #else
-    {"METHOD_NOT_SUPPORTED", ERR_LIB_X509, 124},
+    {"METHOD_NOT_SUPPORTED", 11, 124},
+  #endif
+  #ifdef X509_R_NAME_TOO_LONG
+    {"NAME_TOO_LONG", ERR_LIB_X509, X509_R_NAME_TOO_LONG},
+  #else
+    {"NAME_TOO_LONG", 11, 134},
   #endif
   #ifdef X509_R_NEWER_CRL_NOT_NEWER
     {"NEWER_CRL_NOT_NEWER", ERR_LIB_X509, X509_R_NEWER_CRL_NOT_NEWER},
   #else
-    {"NEWER_CRL_NOT_NEWER", ERR_LIB_X509, 132},
+    {"NEWER_CRL_NOT_NEWER", 11, 132},
+  #endif
+  #ifdef X509_R_NO_CERTIFICATE_FOUND
+    {"NO_CERTIFICATE_FOUND", ERR_LIB_X509, X509_R_NO_CERTIFICATE_FOUND},
+  #else
+    {"NO_CERTIFICATE_FOUND", 11, 135},
+  #endif
+  #ifdef X509_R_NO_CERTIFICATE_OR_CRL_FOUND
+    {"NO_CERTIFICATE_OR_CRL_FOUND", ERR_LIB_X509, X509_R_NO_CERTIFICATE_OR_CRL_FOUND},
+  #else
+    {"NO_CERTIFICATE_OR_CRL_FOUND", 11, 136},
   #endif
   #ifdef X509_R_NO_CERT_SET_FOR_US_TO_VERIFY
     {"NO_CERT_SET_FOR_US_TO_VERIFY", ERR_LIB_X509, X509_R_NO_CERT_SET_FOR_US_TO_VERIFY},
   #else
-    {"NO_CERT_SET_FOR_US_TO_VERIFY", ERR_LIB_X509, 105},
+    {"NO_CERT_SET_FOR_US_TO_VERIFY", 11, 105},
+  #endif
+  #ifdef X509_R_NO_CRL_FOUND
+    {"NO_CRL_FOUND", ERR_LIB_X509, X509_R_NO_CRL_FOUND},
+  #else
+    {"NO_CRL_FOUND", 11, 137},
   #endif
   #ifdef X509_R_NO_CRL_NUMBER
     {"NO_CRL_NUMBER", ERR_LIB_X509, X509_R_NO_CRL_NUMBER},
   #else
-    {"NO_CRL_NUMBER", ERR_LIB_X509, 130},
+    {"NO_CRL_NUMBER", 11, 130},
   #endif
   #ifdef X509_R_PUBLIC_KEY_DECODE_ERROR
     {"PUBLIC_KEY_DECODE_ERROR", ERR_LIB_X509, X509_R_PUBLIC_KEY_DECODE_ERROR},
   #else
-    {"PUBLIC_KEY_DECODE_ERROR", ERR_LIB_X509, 125},
+    {"PUBLIC_KEY_DECODE_ERROR", 11, 125},
   #endif
   #ifdef X509_R_PUBLIC_KEY_ENCODE_ERROR
     {"PUBLIC_KEY_ENCODE_ERROR", ERR_LIB_X509, X509_R_PUBLIC_KEY_ENCODE_ERROR},
   #else
-    {"PUBLIC_KEY_ENCODE_ERROR", ERR_LIB_X509, 126},
+    {"PUBLIC_KEY_ENCODE_ERROR", 11, 126},
   #endif
   #ifdef X509_R_SHOULD_RETRY
     {"SHOULD_RETRY", ERR_LIB_X509, X509_R_SHOULD_RETRY},
   #else
-    {"SHOULD_RETRY", ERR_LIB_X509, 106},
+    {"SHOULD_RETRY", 11, 106},
   #endif
   #ifdef X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN
     {"UNABLE_TO_FIND_PARAMETERS_IN_CHAIN", ERR_LIB_X509, X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN},
   #else
-    {"UNABLE_TO_FIND_PARAMETERS_IN_CHAIN", ERR_LIB_X509, 107},
+    {"UNABLE_TO_FIND_PARAMETERS_IN_CHAIN", 11, 107},
   #endif
   #ifdef X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY
     {"UNABLE_TO_GET_CERTS_PUBLIC_KEY", ERR_LIB_X509, X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY},
   #else
-    {"UNABLE_TO_GET_CERTS_PUBLIC_KEY", ERR_LIB_X509, 108},
+    {"UNABLE_TO_GET_CERTS_PUBLIC_KEY", 11, 108},
   #endif
   #ifdef X509_R_UNKNOWN_KEY_TYPE
     {"UNKNOWN_KEY_TYPE", ERR_LIB_X509, X509_R_UNKNOWN_KEY_TYPE},
   #else
-    {"UNKNOWN_KEY_TYPE", ERR_LIB_X509, 117},
+    {"UNKNOWN_KEY_TYPE", 11, 117},
   #endif
   #ifdef X509_R_UNKNOWN_NID
     {"UNKNOWN_NID", ERR_LIB_X509, X509_R_UNKNOWN_NID},
   #else
-    {"UNKNOWN_NID", ERR_LIB_X509, 109},
+    {"UNKNOWN_NID", 11, 109},
   #endif
   #ifdef X509_R_UNKNOWN_PURPOSE_ID
     {"UNKNOWN_PURPOSE_ID", ERR_LIB_X509, X509_R_UNKNOWN_PURPOSE_ID},
   #else
-    {"UNKNOWN_PURPOSE_ID", ERR_LIB_X509, 121},
+    {"UNKNOWN_PURPOSE_ID", 11, 121},
   #endif
   #ifdef X509_R_UNKNOWN_TRUST_ID
     {"UNKNOWN_TRUST_ID", ERR_LIB_X509, X509_R_UNKNOWN_TRUST_ID},
   #else
-    {"UNKNOWN_TRUST_ID", ERR_LIB_X509, 120},
+    {"UNKNOWN_TRUST_ID", 11, 120},
   #endif
   #ifdef X509_R_UNSUPPORTED_ALGORITHM
     {"UNSUPPORTED_ALGORITHM", ERR_LIB_X509, X509_R_UNSUPPORTED_ALGORITHM},
   #else
-    {"UNSUPPORTED_ALGORITHM", ERR_LIB_X509, 111},
+    {"UNSUPPORTED_ALGORITHM", 11, 111},
   #endif
   #ifdef X509_R_WRONG_LOOKUP_TYPE
     {"WRONG_LOOKUP_TYPE", ERR_LIB_X509, X509_R_WRONG_LOOKUP_TYPE},
   #else
-    {"WRONG_LOOKUP_TYPE", ERR_LIB_X509, 112},
+    {"WRONG_LOOKUP_TYPE", 11, 112},
   #endif
   #ifdef X509_R_WRONG_TYPE
     {"WRONG_TYPE", ERR_LIB_X509, X509_R_WRONG_TYPE},
   #else
-    {"WRONG_TYPE", ERR_LIB_X509, 122},
+    {"WRONG_TYPE", 11, 122},
   #endif
     { NULL }
 };
index 9281c6803f3a68da66b8b4d7a0160238b1cc0b09..1c917b7513f46724b523a3ddc47e99f0f0c8a89b 100644 (file)
@@ -2365,6 +2365,9 @@ PyInit__struct(void)
                        "unknown" float format */
                     if (ptr->format == 'd' || ptr->format == 'f')
                         break;
+                    /* Skip _Bool, semantics are different for standard size */
+                    if (ptr->format == '?')
+                        break;
                     ptr->pack = native->pack;
                     ptr->unpack = native->unpack;
                     break;
index b54071669cf9972c64def3238519be576dcc35e5..da3579c2cc6fdc9085d0355adc098356d3c5a784 100644 (file)
@@ -5063,6 +5063,21 @@ test_write_unraisable_exc(PyObject *self, PyObject *args)
 }
 
 
+static PyObject*
+pynumber_tobase(PyObject *module, PyObject *args)
+{
+    PyObject *obj;
+    int base;
+    if (!PyArg_ParseTuple(args, "Oi:pynumber_tobase",
+                          &obj, &base)) {
+        return NULL;
+    }
+    return PyNumber_ToBase(obj, base);
+}
+
+
+static PyObject *test_buildvalue_issue38913(PyObject *, PyObject *);
+
 static PyMethodDef TestMethods[] = {
     {"raise_exception",         raise_exception,                 METH_VARARGS},
     {"raise_memoryerror",       raise_memoryerror,               METH_NOARGS},
@@ -5122,6 +5137,7 @@ static PyMethodDef TestMethods[] = {
 #endif
     {"getbuffer_with_null_view", getbuffer_with_null_view, METH_O},
     {"test_buildvalue_N",       test_buildvalue_N,               METH_NOARGS},
+    {"test_buildvalue_issue38913", test_buildvalue_issue38913,   METH_NOARGS},
     {"get_args", get_args, METH_VARARGS},
     {"get_kwargs", (PyCFunction)(void(*)(void))get_kwargs, METH_VARARGS|METH_KEYWORDS},
     {"getargs_tuple",           getargs_tuple,                   METH_VARARGS},
@@ -5306,6 +5322,7 @@ static PyMethodDef TestMethods[] = {
     {"negative_refcount", negative_refcount, METH_NOARGS},
 #endif
     {"write_unraisable_exc", test_write_unraisable_exc, METH_VARARGS},
+    {"pynumber_tobase", pynumber_tobase, METH_VARARGS},
     {NULL, NULL} /* sentinel */
 };
 
@@ -6332,3 +6349,42 @@ PyInit__testcapi(void)
     PyState_AddModule(m, &_testcapimodule);
     return m;
 }
+
+
+/* Test the C API exposed when PY_SSIZE_T_CLEAN is not defined */
+
+#undef Py_BuildValue
+PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
+
+static PyObject *
+test_buildvalue_issue38913(PyObject *self, PyObject *Py_UNUSED(ignored))
+{
+    PyObject *res;
+    const char str[] = "string";
+    const Py_UNICODE unicode[] = L"unicode";
+    PyErr_SetNone(PyExc_ZeroDivisionError);
+
+    res = Py_BuildValue("(s#O)", str, 1, Py_None);
+    assert(res == NULL);
+    if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) {
+        return NULL;
+    }
+    res = Py_BuildValue("(z#O)", str, 1, Py_None);
+    assert(res == NULL);
+    if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) {
+        return NULL;
+    }
+    res = Py_BuildValue("(y#O)", str, 1, Py_None);
+    assert(res == NULL);
+    if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) {
+        return NULL;
+    }
+    res = Py_BuildValue("(u#O)", unicode, 1, Py_None);
+    assert(res == NULL);
+    if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) {
+        return NULL;
+    }
+
+    PyErr_Clear();
+    Py_RETURN_NONE;
+}
index 7842947e54ac56c35245162953cf8c3e41b3acb5..db1116ac6e352dcb7ea4a41f5f046fea89909679 100644 (file)
@@ -221,8 +221,9 @@ _sharedexception_bind(PyObject *exctype, PyObject *exc, PyObject *tb)
     if (err->name == NULL) {
         if (PyErr_ExceptionMatches(PyExc_MemoryError)) {
             failure = "out of memory copying exception type name";
+        } else {
+            failure = "unable to encode and copy exception type name";
         }
-        failure = "unable to encode and copy exception type name";
         goto finally;
     }
 
@@ -237,8 +238,9 @@ _sharedexception_bind(PyObject *exctype, PyObject *exc, PyObject *tb)
         if (err->msg == NULL) {
             if (PyErr_ExceptionMatches(PyExc_MemoryError)) {
                 failure = "out of memory copying exception message";
+            } else {
+                failure = "unable to encode and copy exception message";
             }
-            failure = "unable to encode and copy exception message";
             goto finally;
         }
     }
index 9da3f1195a3bf2052a23c6cce391506507389382..0457a433e79fb04c725975eca730fee8d5663b50 100644 (file)
@@ -69,8 +69,9 @@ PyDoc_STRVAR(_pickle_Pickler___init____doc__,
 "This takes a binary file for writing a pickle data stream.\n"
 "\n"
 "The optional *protocol* argument tells the pickler to use the given\n"
-"protocol; supported protocols are 0, 1, 2, 3 and 4.  The default\n"
-"protocol is 3; a backward-incompatible protocol designed for Python 3.\n"
+"protocol; supported protocols are 0, 1, 2, 3, 4 and 5.  The default\n"
+"protocol is 4. It was introduced in Python 3.4, and is incompatible\n"
+"with previous versions.\n"
 "\n"
 "Specifying a negative protocol version selects the highest protocol\n"
 "version supported.  The higher the protocol used, the more recent the\n"
@@ -463,8 +464,8 @@ PyDoc_STRVAR(_pickle_dump__doc__,
 "be more efficient.\n"
 "\n"
 "The optional *protocol* argument tells the pickler to use the given\n"
-"protocol; supported protocols are 0, 1, 2, 3 and 4.  The default\n"
-"protocol is 4. It was introduced in Python 3.4, it is incompatible\n"
+"protocol; supported protocols are 0, 1, 2, 3, 4 and 5.  The default\n"
+"protocol is 4. It was introduced in Python 3.4, and is incompatible\n"
 "with previous versions.\n"
 "\n"
 "Specifying a negative protocol version selects the highest protocol\n"
@@ -550,8 +551,8 @@ PyDoc_STRVAR(_pickle_dumps__doc__,
 "Return the pickled representation of the object as a bytes object.\n"
 "\n"
 "The optional *protocol* argument tells the pickler to use the given\n"
-"protocol; supported protocols are 0, 1, 2, 3 and 4.  The default\n"
-"protocol is 4. It was introduced in Python 3.4, it is incompatible\n"
+"protocol; supported protocols are 0, 1, 2, 3, 4 and 5.  The default\n"
+"protocol is 4. It was introduced in Python 3.4, and is incompatible\n"
 "with previous versions.\n"
 "\n"
 "Specifying a negative protocol version selects the highest protocol\n"
@@ -835,4 +836,4 @@ skip_optional_kwonly:
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=de075ec48d4ee0e1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e2506823be1960c5 input=a9049054013a1b77]*/
index c0d1d4df7957f6800abb0800d78b409e8481be3d..09ecdb358e27dc3df6f6327e765102e0f270226b 100644 (file)
@@ -3900,7 +3900,7 @@ exit:
 
 #endif /* defined(HAVE_WAITPID) */
 
-#if defined(HAVE_CWAIT)
+#if !defined(HAVE_WAITPID) && defined(HAVE_CWAIT)
 
 PyDoc_STRVAR(os_waitpid__doc__,
 "waitpid($module, pid, options, /)\n"
@@ -3936,7 +3936,7 @@ exit:
     return return_value;
 }
 
-#endif /* defined(HAVE_CWAIT) */
+#endif /* !defined(HAVE_WAITPID) && defined(HAVE_CWAIT) */
 
 #if defined(HAVE_WAIT)
 
@@ -8723,4 +8723,4 @@ exit:
 #ifndef OS__REMOVE_DLL_DIRECTORY_METHODDEF
     #define OS__REMOVE_DLL_DIRECTORY_METHODDEF
 #endif /* !defined(OS__REMOVE_DLL_DIRECTORY_METHODDEF) */
-/*[clinic end generated code: output=1ded1fbc8fd37b27 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=edb5a840b51fcaa8 input=a9049054013a1b77]*/
index 0fbf7876c3e207a2815ca497cc89830b1f982d21..a7d2193022e982b0b1712346166c11730fd135c6 100644 (file)
@@ -66,6 +66,10 @@ fcntl_fcntl_impl(PyObject *module, int fd, int code, PyObject *arg)
     char buf[1024];
     int async_err = 0;
 
+    if (PySys_Audit("fcntl.fcntl", "iiO", fd, code, arg ? arg : Py_None) < 0) {
+        return NULL;
+    }
+
     if (arg != NULL) {
         int parse_result;
 
@@ -171,6 +175,11 @@ fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code,
     Py_ssize_t len;
     char buf[IOCTL_BUFSZ+1];  /* argument plus NUL byte */
 
+    if (PySys_Audit("fcntl.ioctl", "iIO", fd, code,
+                    ob_arg ? ob_arg : Py_None) < 0) {
+        return NULL;
+    }
+
     if (ob_arg != NULL) {
         if (PyArg_Parse(ob_arg, "w*:ioctl", &pstr)) {
             char *arg;
@@ -288,6 +297,10 @@ fcntl_flock_impl(PyObject *module, int fd, int code)
     int ret;
     int async_err = 0;
 
+    if (PySys_Audit("fcntl.flock", "ii", fd, code) < 0) {
+        return NULL;
+    }
+
 #ifdef HAVE_FLOCK
     do {
         Py_BEGIN_ALLOW_THREADS
@@ -372,6 +385,11 @@ fcntl_lockf_impl(PyObject *module, int fd, int code, PyObject *lenobj,
     int ret;
     int async_err = 0;
 
+    if (PySys_Audit("fcntl.lockf", "iiOOi", fd, code, lenobj ? lenobj : Py_None,
+                    startobj ? startobj : Py_None, whence) < 0) {
+        return NULL;
+    }
+
 #ifndef LOCK_SH
 #define LOCK_SH         1       /* shared lock */
 #define LOCK_EX         2       /* exclusive lock */
index 4e97337811113d2700319f4cc0197662d90c520d..b78fcedd03de5fd2c0cda356c39ef0c89da6e9d1 100644 (file)
@@ -1027,9 +1027,13 @@ math_2(PyObject *const *args, Py_ssize_t nargs,
     if (!_PyArg_CheckPositional(funcname, nargs, 2, 2))
         return NULL;
     x = PyFloat_AsDouble(args[0]);
+    if (x == -1.0 && PyErr_Occurred()) {
+        return NULL;
+    }
     y = PyFloat_AsDouble(args[1]);
-    if ((x == -1.0 || y == -1.0) && PyErr_Occurred())
+    if (y == -1.0 && PyErr_Occurred()) {
         return NULL;
+    }
     errno = 0;
     PyFPE_START_PROTECT("in math_2", return 0);
     r = (*func)(x, y);
index b9a351a8c1cdd28f49a8cd7b2f85c96911d23bcc..c2ebaaf61f91c6926d6170a85ab69df6805c03a4 100644 (file)
@@ -119,7 +119,7 @@ typedef struct {
     a = (a + I(b,c,d) + M + t); a = ROLc(a, s) + b;
 
 
-static void md5_compress(struct md5_state *md5, unsigned char *buf)
+static void md5_compress(struct md5_state *md5, const unsigned char *buf)
 {
     MD5_INT32 i, W[16], a, b, c, d;
 
@@ -242,7 +242,7 @@ md5_process(struct md5_state *md5, const unsigned char *in, Py_ssize_t inlen)
 
     while (inlen > 0) {
         if (md5->curlen == 0 && inlen >= MD5_BLOCKSIZE) {
-           md5_compress(md5, (unsigned char *)in);
+           md5_compress(md5, in);
            md5->length    += MD5_BLOCKSIZE * 8;
            in             += MD5_BLOCKSIZE;
            inlen          -= MD5_BLOCKSIZE;
index affaf1d9680be2a47e1f8483efb30cceeec462f8..f7712d97c2d724f1c1f95e783d7a79fac4f88f56 100644 (file)
@@ -242,7 +242,7 @@ static int _is_fd_valid(int fd)
      arg = dsp.xxx(arg)
 */
 static PyObject *
-_do_ioctl_1(int fd, PyObject *args, char *fname, int cmd)
+_do_ioctl_1(int fd, PyObject *args, char *fname, unsigned long cmd)
 {
     char argfmt[33] = "i:";
     int arg;
@@ -267,7 +267,7 @@ _do_ioctl_1(int fd, PyObject *args, char *fname, int cmd)
    way.
 */
 static PyObject *
-_do_ioctl_1_internal(int fd, PyObject *args, char *fname, int cmd)
+_do_ioctl_1_internal(int fd, PyObject *args, char *fname, unsigned long cmd)
 {
     char argfmt[32] = ":";
     int arg = 0;
@@ -287,7 +287,7 @@ _do_ioctl_1_internal(int fd, PyObject *args, char *fname, int cmd)
 /* _do_ioctl_0() is a private helper for the no-argument ioctls:
    SNDCTL_DSP_{SYNC,RESET,POST}. */
 static PyObject *
-_do_ioctl_0(int fd, PyObject *args, char *fname, int cmd)
+_do_ioctl_0(int fd, PyObject *args, char *fname, unsigned long cmd)
 {
     char argfmt[32] = ":";
     int rv;
index 850769fd95eef7506f61577c33538981ed5c7fc3..eb0b56aebbaa36454cda9ba9bd1550e21373f3a3 100644 (file)
@@ -2827,6 +2827,10 @@ os_chdir_impl(PyObject *module, path_t *path)
 {
     int result;
 
+    if (PySys_Audit("os.chdir", "(O)", path->object) < 0) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS
 #ifdef MS_WINDOWS
     /* on unix, success = 0, on windows, success = !0 */
@@ -2866,6 +2870,9 @@ static PyObject *
 os_fchdir_impl(PyObject *module, int fd)
 /*[clinic end generated code: output=42e064ec4dc00ab0 input=18e816479a2fa985]*/
 {
+    if (PySys_Audit("os.chdir", "(i)", fd) < 0) {
+        return NULL;
+    }
     return posix_fildes_fd(fd, fchdir);
 }
 #endif /* HAVE_FCHDIR */
@@ -2923,6 +2930,11 @@ os_chmod_impl(PyObject *module, path_t *path, int mode, int dir_fd,
         return NULL;
 #endif
 
+    if (PySys_Audit("os.chmod", "Oii", path->object, mode,
+                    dir_fd == DEFAULT_DIR_FD ? -1 : dir_fd) < 0) {
+        return NULL;
+    }
+
 #ifdef MS_WINDOWS
     Py_BEGIN_ALLOW_THREADS
     attr = GetFileAttributesW(path->wide);
@@ -3019,6 +3031,10 @@ os_fchmod_impl(PyObject *module, int fd, int mode)
     int res;
     int async_err = 0;
 
+    if (PySys_Audit("os.chmod", "iii", fd, mode, -1) < 0) {
+        return NULL;
+    }
+
     do {
         Py_BEGIN_ALLOW_THREADS
         res = fchmod(fd, mode);
@@ -3050,6 +3066,9 @@ os_lchmod_impl(PyObject *module, path_t *path, int mode)
 /*[clinic end generated code: output=082344022b51a1d5 input=90c5663c7465d24f]*/
 {
     int res;
+    if (PySys_Audit("os.chmod", "Oii", path->object, mode, -1) < 0) {
+        return NULL;
+    }
     Py_BEGIN_ALLOW_THREADS
     res = lchmod(path->narrow, mode);
     Py_END_ALLOW_THREADS
@@ -3092,6 +3111,10 @@ os_chflags_impl(PyObject *module, path_t *path, unsigned long flags,
         return NULL;
 #endif
 
+    if (PySys_Audit("os.chflags", "Ok", path->object, flags) < 0) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS
 #ifdef HAVE_LCHFLAGS
     if (!follow_symlinks)
@@ -3127,6 +3150,9 @@ os_lchflags_impl(PyObject *module, path_t *path, unsigned long flags)
 /*[clinic end generated code: output=30ae958695c07316 input=f9f82ea8b585ca9d]*/
 {
     int res;
+    if (PySys_Audit("os.chflags", "Ok", path->object, flags) < 0) {
+        return NULL;
+    }
     Py_BEGIN_ALLOW_THREADS
     res = lchflags(path->narrow, flags);
     Py_END_ALLOW_THREADS
@@ -3289,6 +3315,11 @@ os_chown_impl(PyObject *module, path_t *path, uid_t uid, gid_t gid,
     }
 #endif
 
+    if (PySys_Audit("os.chown", "OIIi", path->object, uid, gid,
+                    dir_fd == DEFAULT_DIR_FD ? -1 : dir_fd) < 0) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS
 #ifdef HAVE_FCHOWN
     if (path->fd != -1)
@@ -3338,6 +3369,10 @@ os_fchown_impl(PyObject *module, int fd, uid_t uid, gid_t gid)
     int res;
     int async_err = 0;
 
+    if (PySys_Audit("os.chown", "iIIi", fd, uid, gid, -1) < 0) {
+        return NULL;
+    }
+
     do {
         Py_BEGIN_ALLOW_THREADS
         res = fchown(fd, uid, gid);
@@ -3370,6 +3405,9 @@ os_lchown_impl(PyObject *module, path_t *path, uid_t uid, gid_t gid)
 /*[clinic end generated code: output=25eaf6af412fdf2f input=b1c6014d563a7161]*/
 {
     int res;
+    if (PySys_Audit("os.chown", "OIIi", path->object, uid, gid, -1) < 0) {
+        return NULL;
+    }
     Py_BEGIN_ALLOW_THREADS
     res = lchown(path->narrow, uid, gid);
     Py_END_ALLOW_THREADS
@@ -3563,6 +3601,12 @@ os_link_impl(PyObject *module, path_t *src, path_t *dst, int src_dir_fd,
     }
 #endif
 
+    if (PySys_Audit("os.link", "OOii", src->object, dst->object,
+                    src_dir_fd == DEFAULT_DIR_FD ? -1 : src_dir_fd,
+                    dst_dir_fd == DEFAULT_DIR_FD ? -1 : dst_dir_fd) < 0) {
+        return NULL;
+    }
+
 #ifdef MS_WINDOWS
     Py_BEGIN_ALLOW_THREADS
     result = CreateHardLinkW(dst->wide, src->wide, NULL);
@@ -4034,6 +4078,11 @@ os_mkdir_impl(PyObject *module, path_t *path, int mode, int dir_fd)
 {
     int result;
 
+    if (PySys_Audit("os.mkdir", "Oii", path->object, mode,
+                    dir_fd == DEFAULT_DIR_FD ? -1 : dir_fd) < 0) {
+        return NULL;
+    }
+
 #ifdef MS_WINDOWS
     Py_BEGIN_ALLOW_THREADS
     result = CreateDirectoryW(path->wide, NULL);
@@ -4179,6 +4228,12 @@ internal_rename(path_t *src, path_t *dst, int src_dir_fd, int dst_dir_fd, int is
     }
 #endif
 
+    if (PySys_Audit("os.rename", "OOii", src->object, dst->object,
+                    src_dir_fd == DEFAULT_DIR_FD ? -1 : src_dir_fd,
+                    dst_dir_fd == DEFAULT_DIR_FD ? -1 : dst_dir_fd) < 0) {
+        return NULL;
+    }
+
 #ifdef MS_WINDOWS
     Py_BEGIN_ALLOW_THREADS
     result = MoveFileExW(src->wide, dst->wide, flags);
@@ -4279,6 +4334,11 @@ os_rmdir_impl(PyObject *module, path_t *path, int dir_fd)
 {
     int result;
 
+    if (PySys_Audit("os.rmdir", "Oi", path->object,
+                    dir_fd == DEFAULT_DIR_FD ? -1 : dir_fd) < 0) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS
 #ifdef MS_WINDOWS
     /* Windows, success=1, UNIX, success=0 */
@@ -4437,6 +4497,11 @@ os_unlink_impl(PyObject *module, path_t *path, int dir_fd)
 {
     int result;
 
+    if (PySys_Audit("os.remove", "Oi", path->object,
+                    dir_fd == DEFAULT_DIR_FD ? -1 : dir_fd) < 0) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS
     _Py_BEGIN_SUPPRESS_IPH
 #ifdef MS_WINDOWS
@@ -4855,6 +4920,11 @@ os_utime_impl(PyObject *module, path_t *path, PyObject *times, PyObject *ns,
     }
 #endif
 
+    if (PySys_Audit("os.utime", "OOOi", path->object, times, ns ? ns : Py_None,
+                    dir_fd == DEFAULT_DIR_FD ? -1 : dir_fd) < 0) {
+        return NULL;
+    }
+
 #ifdef MS_WINDOWS
     Py_BEGIN_ALLOW_THREADS
     hFile = CreateFileW(path->wide, FILE_WRITE_ATTRIBUTES, 0,
@@ -5156,6 +5226,11 @@ os_execv_impl(PyObject *module, path_t *path, PyObject *argv)
         return NULL;
     }
 
+    if (PySys_Audit("os.exec", "OOO", path->object, argv, Py_None) < 0) {
+        free_string_array(argvlist, argc);
+        return NULL;
+    }
+
     _Py_BEGIN_SUPPRESS_IPH
 #ifdef HAVE_WEXECV
     _wexecv(path->wide, argvlist);
@@ -5199,7 +5274,7 @@ os_execve_impl(PyObject *module, path_t *path, PyObject *argv, PyObject *env)
     if (!PyList_Check(argv) && !PyTuple_Check(argv)) {
         PyErr_SetString(PyExc_TypeError,
                         "execve: argv must be a tuple or list");
-        goto fail;
+        goto fail_0;
     }
     argc = PySequence_Size(argv);
     if (argc < 1) {
@@ -5210,22 +5285,26 @@ os_execve_impl(PyObject *module, path_t *path, PyObject *argv, PyObject *env)
     if (!PyMapping_Check(env)) {
         PyErr_SetString(PyExc_TypeError,
                         "execve: environment must be a mapping object");
-        goto fail;
+        goto fail_0;
     }
 
     argvlist = parse_arglist(argv, &argc);
     if (argvlist == NULL) {
-        goto fail;
+        goto fail_0;
     }
     if (!argvlist[0][0]) {
         PyErr_SetString(PyExc_ValueError,
             "execve: argv first element cannot be empty");
-        goto fail;
+        goto fail_0;
     }
 
     envlist = parse_envlist(env, &envc);
     if (envlist == NULL)
-        goto fail;
+        goto fail_0;
+
+    if (PySys_Audit("os.exec", "OOO", path->object, argv, env) < 0) {
+        goto fail_1;
+    }
 
     _Py_BEGIN_SUPPRESS_IPH
 #ifdef HAVE_FEXECVE
@@ -5243,9 +5322,9 @@ os_execve_impl(PyObject *module, path_t *path, PyObject *argv, PyObject *env)
     /* If we get here it's definitely an error */
 
     posix_path_error(path);
-
+  fail_1:
     free_string_array(envlist, envc);
-  fail:
+  fail_0:
     if (argvlist)
         free_string_array(argvlist, argc);
     return NULL;
@@ -5576,6 +5655,10 @@ py_posix_spawn(int use_posix_spawnp, PyObject *module, path_t *path, PyObject *a
     }
     attrp = &attr;
 
+    if (PySys_Audit("os.posix_spawn", "OOO", path->object, argv, env) < 0) {
+        goto exit;
+    }
+
     _Py_BEGIN_SUPPRESS_IPH
 #ifdef HAVE_POSIX_SPAWNP
     if (use_posix_spawnp) {
@@ -5816,6 +5899,12 @@ os_spawnv_impl(PyObject *module, int mode, path_t *path, PyObject *argv)
         mode = _P_OVERLAY;
 #endif
 
+    if (PySys_Audit("os.spawn", "iOOO", mode, path->object, argv,
+                    Py_None) < 0) {
+        free_string_array(argvlist, argc);
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS
     _Py_BEGIN_SUPPRESS_IPH
 #ifdef HAVE_WSPAWNV
@@ -5925,6 +6014,10 @@ os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv,
         mode = _P_OVERLAY;
 #endif
 
+    if (PySys_Audit("os.spawn", "iOOO", mode, path->object, argv, env) < 0) {
+        goto fail_2;
+    }
+
     Py_BEGIN_ALLOW_THREADS
     _Py_BEGIN_SUPPRESS_IPH
 #ifdef HAVE_WSPAWNV
@@ -5943,6 +6036,7 @@ os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv,
     else
         res = Py_BuildValue(_Py_PARSE_INTPTR, spawnval);
 
+  fail_2:
     while (--envc >= 0)
         PyMem_DEL(envlist[envc]);
     PyMem_DEL(envlist);
@@ -6075,6 +6169,9 @@ os_fork_impl(PyObject *module)
         PyErr_SetString(PyExc_RuntimeError, "fork not supported for subinterpreters");
         return NULL;
     }
+    if (PySys_Audit("os.fork", NULL) < 0) {
+        return NULL;
+    }
     PyOS_BeforeFork();
     pid = fork();
     if (pid == 0) {
@@ -6680,6 +6777,9 @@ os_forkpty_impl(PyObject *module)
         PyErr_SetString(PyExc_RuntimeError, "fork not supported for subinterpreters");
         return NULL;
     }
+    if (PySys_Audit("os.forkpty", NULL) < 0) {
+        return NULL;
+    }
     PyOS_BeforeFork();
     pid = forkpty(&master_fd, NULL, NULL, NULL);
     if (pid == 0) {
@@ -6806,17 +6906,39 @@ posix_getgrouplist(PyObject *self, PyObject *args)
         return NULL;
 #endif
 
+    while (1) {
 #ifdef __APPLE__
-    groups = PyMem_New(int, ngroups);
+        groups = PyMem_New(int, ngroups);
 #else
-    groups = PyMem_New(gid_t, ngroups);
+        groups = PyMem_New(gid_t, ngroups);
 #endif
-    if (groups == NULL)
-        return PyErr_NoMemory();
+        if (groups == NULL) {
+            return PyErr_NoMemory();
+        }
 
-    if (getgrouplist(user, basegid, groups, &ngroups) == -1) {
-        PyMem_Del(groups);
-        return posix_error();
+        int old_ngroups = ngroups;
+        if (getgrouplist(user, basegid, groups, &ngroups) != -1) {
+            /* Success */
+            break;
+        }
+
+        /* getgrouplist() fails if the group list is too small */
+        PyMem_Free(groups);
+
+        if (ngroups > old_ngroups) {
+            /* If the group list is too small, the glibc implementation of
+               getgrouplist() sets ngroups to the total number of groups and
+               returns -1. */
+        }
+        else {
+            /* Double the group list size */
+            if (ngroups > INT_MAX / 2) {
+                return PyErr_NoMemory();
+            }
+            ngroups *= 2;
+        }
+
+        /* Retry getgrouplist() with a larger group list */
     }
 
 #ifdef _Py_MEMORY_SANITIZER
@@ -7201,14 +7323,15 @@ Kill a process with a signal.
 static PyObject *
 os_kill_impl(PyObject *module, pid_t pid, Py_ssize_t signal)
 /*[clinic end generated code: output=8e346a6701c88568 input=61a36b86ca275ab9]*/
-#ifndef MS_WINDOWS
 {
+    if (PySys_Audit("os.kill", "in", pid, signal) < 0) {
+        return NULL;
+    }
+#ifndef MS_WINDOWS
     if (kill(pid, (int)signal) == -1)
         return posix_error();
     Py_RETURN_NONE;
-}
 #else /* !MS_WINDOWS */
-{
     PyObject *result;
     DWORD sig = (DWORD)signal;
     DWORD err;
@@ -7243,8 +7366,8 @@ os_kill_impl(PyObject *module, pid_t pid, Py_ssize_t signal)
 
     CloseHandle(handle);
     return result;
-}
 #endif /* !MS_WINDOWS */
+}
 #endif /* HAVE_KILL */
 
 
@@ -7263,6 +7386,9 @@ static PyObject *
 os_killpg_impl(PyObject *module, pid_t pgid, int signal)
 /*[clinic end generated code: output=6dbcd2f1fdf5fdba input=38b5449eb8faec19]*/
 {
+    if (PySys_Audit("os.killpg", "ii", pgid, signal) < 0) {
+        return NULL;
+    }
     /* XXX some man pages make the `pgid` parameter an int, others
        a pid_t. Since getpgrp() returns a pid_t, we assume killpg should
        take the same type. Moreover, pid_t is always at least as wide as
@@ -7741,8 +7867,10 @@ os_waitpid_impl(PyObject *module, intptr_t pid, int options)
     if (res < 0)
         return (!async_err) ? posix_error() : NULL;
 
+    unsigned long long ustatus = (unsigned int)status;
+
     /* shift the status left a byte so this is more like the POSIX waitpid */
-    return Py_BuildValue(_Py_PARSE_INTPTR "i", res, status << 8);
+    return Py_BuildValue(_Py_PARSE_INTPTR "K", res, ustatus << 8);
 }
 #endif
 
@@ -8006,6 +8134,11 @@ os_symlink_impl(PyObject *module, path_t *src, path_t *dst,
     int result;
 #endif
 
+    if (PySys_Audit("os.symlink", "OOi", src->object, dst->object,
+                    dir_fd == DEFAULT_DIR_FD ? -1 : dir_fd) < 0) {
+        return NULL;
+    }
+
 #ifdef MS_WINDOWS
 
     if (windows_has_symlink_unprivileged_flag) {
@@ -8609,6 +8742,10 @@ os_lockf_impl(PyObject *module, int fd, int command, Py_off_t length)
 {
     int res;
 
+    if (PySys_Audit("os.lockf", "iiL", fd, command, length) < 0) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS
     res = lockf(fd, command, length);
     Py_END_ALLOW_THREADS
@@ -10041,6 +10178,9 @@ os_putenv_impl(PyObject *module, PyObject *name, PyObject *value)
         PyErr_SetString(PyExc_ValueError, "illegal environment variable name");
         return NULL;
     }
+    if (PySys_Audit("os.putenv", "OO", name, value) < 0) {
+        return NULL;
+    }
     bytes = PyBytes_FromFormat("%s=%s", name_string, value_string);
     if (bytes == NULL) {
         return NULL;
@@ -10076,6 +10216,10 @@ os_unsetenv_impl(PyObject *module, PyObject *name)
     int err;
 #endif
 
+    if (PySys_Audit("os.unsetenv", "(O)", name) < 0) {
+        return NULL;
+    }
+
 #ifdef HAVE_BROKEN_UNSETENV
     unsetenv(PyBytes_AS_STRING(name));
 #else
@@ -11608,6 +11752,10 @@ os_startfile_impl(PyObject *module, path_t *filepath,
             "startfile not available on this platform");
     }
 
+    if (PySys_Audit("os.startfile", "Ou", filepath->object, operation) < 0) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS
     rc = Py_ShellExecuteW((HWND)0, operation, filepath->wide,
                           NULL, NULL, SW_SHOWNORMAL);
@@ -11782,6 +11930,10 @@ os_getxattr_impl(PyObject *module, path_t *path, path_t *attribute,
     if (fd_and_follow_symlinks_invalid("getxattr", path->fd, follow_symlinks))
         return NULL;
 
+    if (PySys_Audit("os.getxattr", "OO", path->object, attribute->object) < 0) {
+        return NULL;
+    }
+
     for (i = 0; ; i++) {
         void *ptr;
         ssize_t result;
@@ -11853,6 +12005,11 @@ os_setxattr_impl(PyObject *module, path_t *path, path_t *attribute,
     if (fd_and_follow_symlinks_invalid("setxattr", path->fd, follow_symlinks))
         return NULL;
 
+    if (PySys_Audit("os.setxattr", "OOy#i", path->object, attribute->object,
+                    value->buf, value->len, flags) < 0) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS;
     if (path->fd > -1)
         result = fsetxattr(path->fd, attribute->narrow,
@@ -11901,6 +12058,10 @@ os_removexattr_impl(PyObject *module, path_t *path, path_t *attribute,
     if (fd_and_follow_symlinks_invalid("removexattr", path->fd, follow_symlinks))
         return NULL;
 
+    if (PySys_Audit("os.removexattr", "OO", path->object, attribute->object) < 0) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS;
     if (path->fd > -1)
         result = fremovexattr(path->fd, attribute->narrow);
@@ -11946,6 +12107,11 @@ os_listxattr_impl(PyObject *module, path_t *path, int follow_symlinks)
     if (fd_and_follow_symlinks_invalid("listxattr", path->fd, follow_symlinks))
         goto exit;
 
+    if (PySys_Audit("os.listxattr", "(O)",
+                    path->object ? path->object : Py_None) < 0) {
+        return NULL;
+    }
+
     name = path->narrow ? path->narrow : ".";
 
     for (i = 0; ; i++) {
@@ -13459,6 +13625,10 @@ os__add_dll_directory_impl(PyObject *module, path_t *path)
     DLL_DIRECTORY_COOKIE cookie = 0;
     DWORD err = 0;
 
+    if (PySys_Audit("os.add_dll_directory", "(O)", path->object) < 0) {
+        return NULL;
+    }
+
     /* For Windows 7, we have to load this. As this will be a fairly
        infrequent operation, just do it each time. Kernel32 is always
        loaded. */
index 87c72e7409895cf1ca6f112624e3c0f0d2e68a45..afde03c6c7e55983ff3f8fa615e8d840a453de2b 100644 (file)
@@ -224,6 +224,11 @@ resource_setrlimit_impl(PyObject *module, int resource, PyObject *limits)
         return NULL;
     }
 
+    if (PySys_Audit("resource.setrlimit", "iO", resource,
+                    limits ? limits : Py_None) < 0) {
+        return NULL;
+    }
+
     if (py2rlimit(limits, &rl) < 0) {
         return NULL;
     }
@@ -269,6 +274,11 @@ resource_prlimit_impl(PyObject *module, pid_t pid, int resource,
         return NULL;
     }
 
+    if (PySys_Audit("resource.prlimit", "iiO", pid, resource,
+                    limits ? limits : Py_None) < 0) {
+        return NULL;
+    }
+
     if (group_right_1) {
         if (py2rlimit(limits, &new_limit) < 0) {
             return NULL;
index 9aca70599689b6c0cbf74c92a24c3ca26e339815..0c9a2671fe19b20f9cd0a71cb91988e9a42b5a58 100644 (file)
@@ -1233,6 +1233,10 @@ signal_pthread_kill_impl(PyObject *module, unsigned long thread_id,
 {
     int err;
 
+    if (PySys_Audit("signal.pthread_kill", "ki", thread_id, signalnum) < 0) {
+        return NULL;
+    }
+
     err = pthread_kill((pthread_t)thread_id, signalnum);
     if (err != 0) {
         errno = err;
index 594a0d6efad197f0bfc4331a75f13f39027f6f5f..5dc5f4e0d397b4e0c91beb1c6af6f8c73ca240c5 100644 (file)
@@ -5069,7 +5069,7 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds)
 
 #ifdef MS_WINDOWS
     /* In this case, we don't use the family, type and proto args */
-    if (fdobj != NULL && fdobj != Py_None)
+    if (fdobj == NULL || fdobj == Py_None)
 #endif
     {
         if (PySys_Audit("socket.__new__", "Oiii",
@@ -5091,8 +5091,9 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds)
             }
             memcpy(&info, PyBytes_AS_STRING(fdobj), sizeof(info));
 
-            if (PySys_Audit("socket()", "iii", info.iAddressFamily,
-                            info.iSocketType, info.iProtocol) < 0) {
+            if (PySys_Audit("socket.__new__", "Oiii", s,
+                            info.iAddressFamily, info.iSocketType,
+                            info.iProtocol) < 0) {
                 return -1;
             }
 
index b2ea73baa1be4862f64eb1f749fa5842d88e56d9..66ea2703fc84a7e8bdd5b271d4cdc1cd021ff080 100644 (file)
@@ -144,6 +144,10 @@ syslog_openlog(PyObject * self, PyObject * args, PyObject *kwds)
             return NULL;
     }
 
+    if (PySys_Audit("syslog.openlog", "sll", ident, logopt, facility) < 0) {
+        return NULL;
+    }
+
     openlog(ident, logopt, facility);
     S_log_open = 1;
 
@@ -170,6 +174,10 @@ syslog_syslog(PyObject * self, PyObject * args)
     if (message == NULL)
         return NULL;
 
+    if (PySys_Audit("syslog.syslog", "is", priority, message) < 0) {
+        return NULL;
+    }
+
     /*  if log is not opened, open it now  */
     if (!S_log_open) {
         PyObject *openargs;
@@ -194,6 +202,9 @@ syslog_syslog(PyObject * self, PyObject * args)
 static PyObject *
 syslog_closelog(PyObject *self, PyObject *unused)
 {
+    if (PySys_Audit("syslog.closelog", NULL) < 0) {
+        return NULL;
+    }
     if (S_log_open) {
         closelog();
         Py_CLEAR(S_ident_o);
@@ -209,6 +220,9 @@ syslog_setlogmask(PyObject *self, PyObject *args)
 
     if (!PyArg_ParseTuple(args, "l;mask for priority", &maskpri))
         return NULL;
+    if (PySys_Audit("syslog.setlogmask", "(O)", args ? args : Py_None) < 0) {
+        return NULL;
+    }
     omaskpri = setlogmask(maskpri);
     return PyLong_FromLong(omaskpri);
 }
index 77d09143aa0764f46c62e1896666d8021c20747e..4fabfd762f0413e241592ebddecc09c850a7481f 100644 (file)
@@ -1509,18 +1509,15 @@ PyNumber_Float(PyObject *o)
 PyObject *
 PyNumber_ToBase(PyObject *n, int base)
 {
-    PyObject *res = NULL;
+    if (!(base == 2 || base == 8 || base == 10 || base == 16)) {
+        PyErr_SetString(PyExc_SystemError,
+                        "PyNumber_ToBase: base must be 2, 8, 10 or 16");
+        return NULL;
+    }
     PyObject *index = PyNumber_Index(n);
-
     if (!index)
         return NULL;
-    if (PyLong_Check(index))
-        res = _PyLong_Format(index, base);
-    else
-        /* It should not be possible to get here, as
-           PyNumber_Index already has a check for the same
-           condition */
-        PyErr_SetString(PyExc_ValueError, "PyNumber_ToBase: index not int");
+    PyObject *res = _PyLong_Format(index, base);
     Py_DECREF(index);
     return res;
 }
@@ -2336,9 +2333,16 @@ abstract_issubclass(PyObject *derived, PyObject *cls)
     int r = 0;
 
     while (1) {
-        if (derived == cls)
+        if (derived == cls) {
+            Py_XDECREF(bases); /* See below comment */
             return 1;
-        bases = abstract_get_bases(derived);
+        }
+        /* Use XSETREF to drop bases reference *after* finishing with
+           derived; bases might be the only reference to it.
+           XSETREF is used instead of SETREF, because bases is NULL on the
+           first iteration of the loop.
+        */
+        Py_XSETREF(bases, abstract_get_bases(derived));
         if (bases == NULL) {
             if (PyErr_Occurred())
                 return -1;
@@ -2352,7 +2356,6 @@ abstract_issubclass(PyObject *derived, PyObject *cls)
         /* Avoid recursivity in the single inheritance case */
         if (n == 1) {
             derived = PyTuple_GET_ITEM(bases, 0);
-            Py_DECREF(bases);
             continue;
         }
         for (i = 0; i < n; i++) {
index 7d131842059228598cd5cb952cec002978c7acb1..db030be4fe7561600e8c968759e073981bc8d776 100644 (file)
@@ -12,7 +12,7 @@ PyObject*
 _Py_bytes_isspace(const char *cptr, Py_ssize_t len)
 {
     const unsigned char *p
-        = (unsigned char *) cptr;
+        = (const unsigned char *) cptr;
     const unsigned char *e;
 
     /* Shortcut for single character strings */
@@ -42,7 +42,7 @@ PyObject*
 _Py_bytes_isalpha(const char *cptr, Py_ssize_t len)
 {
     const unsigned char *p
-        = (unsigned char *) cptr;
+        = (const unsigned char *) cptr;
     const unsigned char *e;
 
     /* Shortcut for single character strings */
@@ -72,7 +72,7 @@ PyObject*
 _Py_bytes_isalnum(const char *cptr, Py_ssize_t len)
 {
     const unsigned char *p
-        = (unsigned char *) cptr;
+        = (const unsigned char *) cptr;
     const unsigned char *e;
 
     /* Shortcut for single character strings */
@@ -123,7 +123,7 @@ _Py_bytes_isascii(const char *cptr, Py_ssize_t len)
             /* Help allocation */
             const char *_p = p;
             while (_p < aligned_end) {
-                unsigned long value = *(unsigned long *) _p;
+                unsigned long value = *(const unsigned long *) _p;
                 if (value & ASCII_CHAR_MASK) {
                     Py_RETURN_FALSE;
                 }
@@ -154,7 +154,7 @@ PyObject*
 _Py_bytes_isdigit(const char *cptr, Py_ssize_t len)
 {
     const unsigned char *p
-        = (unsigned char *) cptr;
+        = (const unsigned char *) cptr;
     const unsigned char *e;
 
     /* Shortcut for single character strings */
@@ -184,7 +184,7 @@ PyObject*
 _Py_bytes_islower(const char *cptr, Py_ssize_t len)
 {
     const unsigned char *p
-        = (unsigned char *) cptr;
+        = (const unsigned char *) cptr;
     const unsigned char *e;
     int cased;
 
@@ -218,7 +218,7 @@ PyObject*
 _Py_bytes_isupper(const char *cptr, Py_ssize_t len)
 {
     const unsigned char *p
-        = (unsigned char *) cptr;
+        = (const unsigned char *) cptr;
     const unsigned char *e;
     int cased;
 
@@ -254,7 +254,7 @@ PyObject*
 _Py_bytes_istitle(const char *cptr, Py_ssize_t len)
 {
     const unsigned char *p
-        = (unsigned char *) cptr;
+        = (const unsigned char *) cptr;
     const unsigned char *e;
     int cased, previous_is_cased;
 
index 6596de051cacb3172b4dc035483399415ed45b8e..1dd82278cf3d52cd7320447e84fa037ecbfed9c8 100644 (file)
@@ -11,7 +11,7 @@ PyDoc_STRVAR(code_replace__doc__,
 "        co_lnotab=None)\n"
 "--\n"
 "\n"
-"Return a new code object with new specified fields.");
+"Return a copy of the code object with new values for the specified fields.");
 
 #define CODE_REPLACE_METHODDEF    \
     {"replace", (PyCFunction)(void(*)(void))code_replace, METH_FASTCALL|METH_KEYWORDS, code_replace__doc__},
@@ -253,4 +253,4 @@ skip_optional_kwonly:
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=fade581d6313a0c2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=27fe34e82106b220 input=a9049054013a1b77]*/
index f0b62ec94148d66f05a3eef485e6353fa1dd13e7..522e1a9f2a41956089f535efc84e11e771126407 100644 (file)
@@ -610,7 +610,7 @@ code.replace
     co_name: unicode(c_default="self->co_name") = None
     co_lnotab: PyBytesObject(c_default="(PyBytesObject *)self->co_lnotab") = None
 
-Return a new code object with new specified fields.
+Return a copy of the code object with new values for the specified fields.
 [clinic start generated code]*/
 
 static PyObject *
@@ -622,7 +622,7 @@ code_replace_impl(PyCodeObject *self, int co_argcount,
                   PyObject *co_varnames, PyObject *co_freevars,
                   PyObject *co_cellvars, PyObject *co_filename,
                   PyObject *co_name, PyBytesObject *co_lnotab)
-/*[clinic end generated code: output=25c8e303913bcace input=77189e46579ec426]*/
+/*[clinic end generated code: output=25c8e303913bcace input=d9051bc8f24e6b28]*/
 {
 #define CHECK_INT_ARG(ARG) \
         if (ARG < 0) { \
index a49da4018411e70b1b8ac4d13c7bcfa78675b9f8..e01409b971b0e16a73ae791e0d4467c3aa856bd3 100644 (file)
@@ -743,29 +743,9 @@ complex__format__(PyObject* self, PyObject* args)
     return _PyUnicodeWriter_Finish(&writer);
 }
 
-#if 0
-static PyObject *
-complex_is_finite(PyObject *self)
-{
-    Py_complex c;
-    c = ((PyComplexObject *)self)->cval;
-    return PyBool_FromLong((long)(Py_IS_FINITE(c.real) &&
-                                  Py_IS_FINITE(c.imag)));
-}
-
-PyDoc_STRVAR(complex_is_finite_doc,
-"complex.is_finite() -> bool\n"
-"\n"
-"Returns True if the real and the imaginary part is finite.");
-#endif
-
 static PyMethodDef complex_methods[] = {
     {"conjugate",       (PyCFunction)complex_conjugate, METH_NOARGS,
      complex_conjugate_doc},
-#if 0
-    {"is_finite",       (PyCFunction)complex_is_finite, METH_NOARGS,
-     complex_is_finite_doc},
-#endif
     {"__getnewargs__",          (PyCFunction)complex_getnewargs,        METH_NOARGS},
     {"__format__",          (PyCFunction)complex__format__,
                                        METH_VARARGS, complex__format__doc},
index 119be35db08d8ace574b98a04ec7f5eae3730f11..729f42c50c81432f525a5909c467571757b78ed6 100644 (file)
@@ -892,7 +892,8 @@ PyDescr_NewMethod(PyTypeObject *type, PyMethodDef *method)
             vectorcall = method_vectorcall_O;
             break;
         default:
-            PyErr_SetString(PyExc_SystemError, "bad call flags");
+            PyErr_Format(PyExc_SystemError,
+                         "%s() method: bad call flags", method->ml_name);
             return NULL;
     }
 
index 76f4fefe0979ffacdef43c1e74d09c9cee655323..3c56f4a515e8a46be237dfc121866de0709e0789 100644 (file)
@@ -2773,9 +2773,11 @@ dict_equal(PyDictObject *a, PyDictObject *b)
                     return -1;
                 return 0;
             }
+            Py_INCREF(bval);
             cmp = PyObject_RichCompareBool(aval, bval, Py_EQ);
             Py_DECREF(key);
             Py_DECREF(aval);
+            Py_DECREF(bval);
             if (cmp <= 0)  /* error or not equal */
                 return cmp;
         }
index 1cb8ff795fb87f0ae383642f3040f4f22c88ff5b..609f66f8b32ca93a3ec38bbf4e45b0069a55d5eb 100644 (file)
@@ -861,35 +861,6 @@ float_is_integer_impl(PyObject *self)
     return o;
 }
 
-#if 0
-static PyObject *
-float_is_inf(PyObject *v)
-{
-    double x = PyFloat_AsDouble(v);
-    if (x == -1.0 && PyErr_Occurred())
-        return NULL;
-    return PyBool_FromLong((long)Py_IS_INFINITY(x));
-}
-
-static PyObject *
-float_is_nan(PyObject *v)
-{
-    double x = PyFloat_AsDouble(v);
-    if (x == -1.0 && PyErr_Occurred())
-        return NULL;
-    return PyBool_FromLong((long)Py_IS_NAN(x));
-}
-
-static PyObject *
-float_is_finite(PyObject *v)
-{
-    double x = PyFloat_AsDouble(v);
-    if (x == -1.0 && PyErr_Occurred())
-        return NULL;
-    return PyBool_FromLong((long)Py_IS_FINITE(x));
-}
-#endif
-
 /*[clinic input]
 float.__trunc__
 
@@ -1852,14 +1823,6 @@ static PyMethodDef float_methods[] = {
     FLOAT_FROMHEX_METHODDEF
     FLOAT_HEX_METHODDEF
     FLOAT_IS_INTEGER_METHODDEF
-#if 0
-    {"is_inf",          (PyCFunction)float_is_inf,      METH_NOARGS,
-     "Return True if the float is positive or negative infinite."},
-    {"is_finite",       (PyCFunction)float_is_finite,   METH_NOARGS,
-     "Return True if the float is finite, neither infinite nor NaN."},
-    {"is_nan",          (PyCFunction)float_is_nan,      METH_NOARGS,
-     "Return True if the float is not a number (NaN)."},
-#endif
     FLOAT___GETNEWARGS___METHODDEF
     FLOAT___GETFORMAT___METHODDEF
     FLOAT___SET_FORMAT___METHODDEF
index 5643553b708d15e83392222a22b172964bbf4083..ce7dd48a17cfb6ae36b36c99726520942b0a0c72 100644 (file)
@@ -11,10 +11,10 @@ static PyObject *gen_close(PyGenObject *, PyObject *);
 static PyObject *async_gen_asend_new(PyAsyncGenObject *, PyObject *);
 static PyObject *async_gen_athrow_new(PyAsyncGenObject *, PyObject *);
 
-static char *NON_INIT_CORO_MSG = "can't send non-None value to a "
+static const char *NON_INIT_CORO_MSG = "can't send non-None value to a "
                                  "just-started coroutine";
 
-static char *ASYNC_GEN_IGNORED_EXIT_MSG =
+static const char *ASYNC_GEN_IGNORED_EXIT_MSG =
                                  "async generator ignored GeneratorExit";
 
 static inline int
@@ -1533,7 +1533,9 @@ async_gen_asend_send(PyAsyncGenASend *o, PyObject *arg)
     PyObject *result;
 
     if (o->ags_state == AWAITABLE_STATE_CLOSED) {
-        PyErr_SetNone(PyExc_StopIteration);
+        PyErr_SetString(
+            PyExc_RuntimeError,
+            "cannot reuse already awaited __anext__()/asend()");
         return NULL;
     }
 
@@ -1576,7 +1578,9 @@ async_gen_asend_throw(PyAsyncGenASend *o, PyObject *args)
     PyObject *result;
 
     if (o->ags_state == AWAITABLE_STATE_CLOSED) {
-        PyErr_SetNone(PyExc_StopIteration);
+        PyErr_SetString(
+            PyExc_RuntimeError,
+            "cannot reuse already awaited __anext__()/asend()");
         return NULL;
     }
 
@@ -1808,14 +1812,22 @@ async_gen_athrow_send(PyAsyncGenAThrow *o, PyObject *arg)
     PyFrameObject *f = gen->gi_frame;
     PyObject *retval;
 
-    if (f == NULL || f->f_stacktop == NULL ||
-            o->agt_state == AWAITABLE_STATE_CLOSED) {
+    if (o->agt_state == AWAITABLE_STATE_CLOSED) {
+        PyErr_SetString(
+            PyExc_RuntimeError,
+            "cannot reuse already awaited aclose()/athrow()");
+        return NULL;
+    }
+
+    if (f == NULL || f->f_stacktop == NULL) {
+        o->agt_state = AWAITABLE_STATE_CLOSED;
         PyErr_SetNone(PyExc_StopIteration);
         return NULL;
     }
 
     if (o->agt_state == AWAITABLE_STATE_INIT) {
         if (o->agt_gen->ag_running_async) {
+            o->agt_state = AWAITABLE_STATE_CLOSED;
             if (o->agt_args == NULL) {
                 PyErr_SetString(
                     PyExc_RuntimeError,
@@ -1887,7 +1899,6 @@ async_gen_athrow_send(PyAsyncGenAThrow *o, PyObject *arg)
         /* aclose() mode */
         if (retval) {
             if (_PyAsyncGenWrappedValue_CheckExact(retval)) {
-                o->agt_gen->ag_running_async = 0;
                 Py_DECREF(retval);
                 goto yield_close;
             }
@@ -1902,16 +1913,17 @@ async_gen_athrow_send(PyAsyncGenAThrow *o, PyObject *arg)
 
 yield_close:
     o->agt_gen->ag_running_async = 0;
+    o->agt_state = AWAITABLE_STATE_CLOSED;
     PyErr_SetString(
         PyExc_RuntimeError, ASYNC_GEN_IGNORED_EXIT_MSG);
     return NULL;
 
 check_error:
     o->agt_gen->ag_running_async = 0;
+    o->agt_state = AWAITABLE_STATE_CLOSED;
     if (PyErr_ExceptionMatches(PyExc_StopAsyncIteration) ||
             PyErr_ExceptionMatches(PyExc_GeneratorExit))
     {
-        o->agt_state = AWAITABLE_STATE_CLOSED;
         if (o->agt_args == NULL) {
             /* when aclose() is called we don't want to propagate
                StopAsyncIteration or GeneratorExit; just raise
@@ -1932,7 +1944,9 @@ async_gen_athrow_throw(PyAsyncGenAThrow *o, PyObject *args)
     PyObject *retval;
 
     if (o->agt_state == AWAITABLE_STATE_CLOSED) {
-        PyErr_SetNone(PyExc_StopIteration);
+        PyErr_SetString(
+            PyExc_RuntimeError,
+            "cannot reuse already awaited aclose()/athrow()");
         return NULL;
     }
 
@@ -1943,6 +1957,7 @@ async_gen_athrow_throw(PyAsyncGenAThrow *o, PyObject *args)
         /* aclose() mode */
         if (retval && _PyAsyncGenWrappedValue_CheckExact(retval)) {
             o->agt_gen->ag_running_async = 0;
+            o->agt_state = AWAITABLE_STATE_CLOSED;
             Py_DECREF(retval);
             PyErr_SetString(PyExc_RuntimeError, ASYNC_GEN_IGNORED_EXIT_MSG);
             return NULL;
index f8bf45e5f8cda262d263d173b6b20ec873a5d96c..30444089ffaf96122b581dff08caf8a25f5d8311 100644 (file)
@@ -445,12 +445,16 @@ list_length(PyListObject *a)
 static int
 list_contains(PyListObject *a, PyObject *el)
 {
+    PyObject *item;
     Py_ssize_t i;
     int cmp;
 
-    for (i = 0, cmp = 0 ; cmp == 0 && i < Py_SIZE(a); ++i)
-        cmp = PyObject_RichCompareBool(el, PyList_GET_ITEM(a, i),
-                                           Py_EQ);
+    for (i = 0, cmp = 0 ; cmp == 0 && i < Py_SIZE(a); ++i) {
+        item = PyList_GET_ITEM(a, i);
+        Py_INCREF(item);
+        cmp = PyObject_RichCompareBool(el, item, Py_EQ);
+        Py_DECREF(item);
+    }
     return cmp;
 }
 
@@ -2555,7 +2559,10 @@ list_index_impl(PyListObject *self, PyObject *value, Py_ssize_t start,
             stop = 0;
     }
     for (i = start; i < stop && i < Py_SIZE(self); i++) {
-        int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ);
+        PyObject *obj = self->ob_item[i];
+        Py_INCREF(obj);
+        int cmp = PyObject_RichCompareBool(obj, value, Py_EQ);
+        Py_DECREF(obj);
         if (cmp > 0)
             return PyLong_FromSsize_t(i);
         else if (cmp < 0)
@@ -2582,7 +2589,14 @@ list_count(PyListObject *self, PyObject *value)
     Py_ssize_t i;
 
     for (i = 0; i < Py_SIZE(self); i++) {
-        int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ);
+        PyObject *obj = self->ob_item[i];
+        if (obj == value) {
+           count++;
+           continue;
+        }
+        Py_INCREF(obj);
+        int cmp = PyObject_RichCompareBool(obj, value, Py_EQ);
+        Py_DECREF(obj);
         if (cmp > 0)
             count++;
         else if (cmp < 0)
@@ -2609,7 +2623,10 @@ list_remove(PyListObject *self, PyObject *value)
     Py_ssize_t i;
 
     for (i = 0; i < Py_SIZE(self); i++) {
-        int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ);
+        PyObject *obj = self->ob_item[i];
+        Py_INCREF(obj);
+        int cmp = PyObject_RichCompareBool(obj, value, Py_EQ);
+        Py_DECREF(obj);
         if (cmp > 0) {
             if (list_ass_slice(self, i, i+1,
                                (PyObject *)NULL) == 0)
@@ -2655,8 +2672,18 @@ list_richcompare(PyObject *v, PyObject *w, int op)
 
     /* Search for the first index where items are different */
     for (i = 0; i < Py_SIZE(vl) && i < Py_SIZE(wl); i++) {
+        PyObject *vitem = vl->ob_item[i];
+        PyObject *witem = wl->ob_item[i];
+        if (vitem == witem) {
+            continue;
+        }
+
+        Py_INCREF(vitem);
+        Py_INCREF(witem);
         int k = PyObject_RichCompareBool(vl->ob_item[i],
                                          wl->ob_item[i], Py_EQ);
+        Py_DECREF(vitem);
+        Py_DECREF(witem);
         if (k < 0)
             return NULL;
         if (!k)
index 43fe1574c323934c38d95b12f97552f27b6d6228..174777a2658dc60eeebec775f5c14fb476378f4c 100644 (file)
@@ -319,13 +319,13 @@ So merging is always done on two consecutive runs at a time, and in-place,
 although this may require some temp memory (more on that later).
 
 When a run is identified, its base address and length are pushed on a stack
-in the MergeState struct.  merge_collapse() is then called to see whether it
-should merge it with preceding run(s).  We would like to delay merging as
-long as possible in order to exploit patterns that may come up later, but we
-like even more to do merging as soon as possible to exploit that the run just
-found is still high in the memory hierarchy.  We also can't delay merging
-"too long" because it consumes memory to remember the runs that are still
-unmerged, and the stack has a fixed size.
+in the MergeState struct.  merge_collapse() is then called to potentially
+merge runs on that stack.  We would like to delay merging as long as possible
+in order to exploit patterns that may come up later, but we like even more to
+do merging as soon as possible to exploit that the run just found is still
+high in the memory hierarchy.  We also can't delay merging "too long" because
+it consumes memory to remember the runs that are still unmerged, and the
+stack has a fixed size.
 
 What turned out to be a good compromise maintains two invariants on the
 stack entries, where A, B and C are the lengths of the three rightmost not-yet
@@ -739,7 +739,7 @@ slice (leaving off both endpoints) (2**(k-1)-1)+1 through (2**k-1)-1
 inclusive = 2**(k-1) through (2**k-1)-1 inclusive, which has
     (2**k-1)-1 - 2**(k-1) + 1 =
     2**k-1 - 2**(k-1) =
-    2*2**k-1 - 2**(k-1) =
+    2*2**(k-1)-1 - 2**(k-1) =
     (2-1)*2**(k-1) - 1 =
     2**(k-1) - 1
 elements.
index 708934c51fe25089c231973006b2f2a53e35593c..67dce97471522c575b72eb2140ad5bd59a6f327c 100644 (file)
@@ -5464,13 +5464,6 @@ int_bit_length_impl(PyObject *self)
     return NULL;
 }
 
-#if 0
-static PyObject *
-long_is_finite(PyObject *v)
-{
-    Py_RETURN_TRUE;
-}
-#endif
 
 /*[clinic input]
 int.as_integer_ratio
@@ -5628,10 +5621,6 @@ static PyMethodDef long_methods[] = {
     {"conjugate",       long_long_meth, METH_NOARGS,
      "Returns self, the complex conjugate of any int."},
     INT_BIT_LENGTH_METHODDEF
-#if 0
-    {"is_finite",       (PyCFunction)long_is_finite,    METH_NOARGS,
-     "Returns always True."},
-#endif
     INT_TO_BYTES_METHODDEF
     INT_FROM_BYTES_METHODDEF
     INT_AS_INTEGER_RATIO_METHODDEF
index a873ac1ec1ea5f325ba27654158aaf254b9099ff..0bbcbb2e7eefa7db595e7a418f3410ed2c3f8c1a 100644 (file)
@@ -1,4 +1,14 @@
-/* Memoryview object implementation */
+/*
+ * Memoryview object implementation
+ * --------------------------------
+ *
+ *   This implementation is a complete rewrite contributed by Stefan Krah in
+ *   Python 3.3.  Substantial credit goes to Antoine Pitrou (who had already
+ *   fortified and rewritten the previous implementation) and Nick Coghlan
+ *   (who came up with the idea of the ManagedBuffer) for analyzing the complex
+ *   ownership rules.
+ *
+ */
 
 #include "Python.h"
 #include "pycore_object.h"
@@ -1681,8 +1691,8 @@ unpack_single(const char *ptr, const char *fmt)
     switch (fmt[0]) {
 
     /* signed integers and fast path for 'B' */
-    case 'B': uc = *((unsigned char *)ptr); goto convert_uc;
-    case 'b': ld =   *((signed char *)ptr); goto convert_ld;
+    case 'B': uc = *((const unsigned char *)ptr); goto convert_uc;
+    case 'b': ld =   *((const signed char *)ptr); goto convert_ld;
     case 'h': UNPACK_SINGLE(ld, ptr, short); goto convert_ld;
     case 'i': UNPACK_SINGLE(ld, ptr, int); goto convert_ld;
     case 'l': UNPACK_SINGLE(ld, ptr, long); goto convert_ld;
@@ -2683,8 +2693,8 @@ unpack_cmp(const char *p, const char *q, char fmt,
     switch (fmt) {
 
     /* signed integers and fast path for 'B' */
-    case 'B': return *((unsigned char *)p) == *((unsigned char *)q);
-    case 'b': return *((signed char *)p) == *((signed char *)q);
+    case 'B': return *((const unsigned char *)p) == *((const unsigned char *)q);
+    case 'b': return *((const signed char *)p) == *((const signed char *)q);
     case 'h': CMP_SINGLE(p, q, short); return equal;
     case 'i': CMP_SINGLE(p, q, int); return equal;
     case 'l': CMP_SINGLE(p, q, long); return equal;
index 3494f11d80fe75967ce0601b08ab4e1ce1598963..3604a55e5a1dc9458346a619f3811737aa698c31 100644 (file)
@@ -62,7 +62,8 @@ PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
             vectorcall = cfunction_vectorcall_O;
             break;
         default:
-            PyErr_SetString(PyExc_SystemError, "bad call flags");
+            PyErr_Format(PyExc_SystemError,
+                         "%s() method: bad call flags", ml->ml_name);
             return NULL;
     }
 
index 566593a9c67cc35d2b824183aeb554a99208fae8..74b1b15d30bbf57254907d064807e79d2ed103f8 100644 (file)
@@ -454,9 +454,12 @@ _PyObject_IsFreed(PyObject *op)
     /* ignore op->ob_ref: its value can have be modified
        by Py_INCREF() and Py_DECREF(). */
 #ifdef Py_TRACE_REFS
-    if (_PyMem_IsPtrFreed(op->_ob_next) || _PyMem_IsPtrFreed(op->_ob_prev)) {
+    if (op->_ob_next != NULL && _PyMem_IsPtrFreed(op->_ob_next)) {
         return 1;
     }
+    if (op->_ob_prev != NULL && _PyMem_IsPtrFreed(op->_ob_prev)) {
+         return 1;
+     }
 #endif
     return 0;
 }
index bd6480a625e8a845fdc93b40f79a0c23eec22087..c483ff3e3b7018ef89222a757f5a5211fdc81602 100644 (file)
@@ -31,8 +31,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain);
 
 #if defined(__has_feature)  /* Clang */
 #  if __has_feature(address_sanitizer) /* is ASAN enabled? */
-#    define _Py_NO_ADDRESS_SAFETY_ANALYSIS \
-        __attribute__((no_address_safety_analysis))
+#    define _Py_NO_SANITIZE_ADDRESS \
+        __attribute__((no_sanitize("address")))
 #  endif
 #  if __has_feature(thread_sanitizer)  /* is TSAN enabled? */
 #    define _Py_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread))
@@ -42,8 +42,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain);
 #  endif
 #elif defined(__GNUC__)
 #  if defined(__SANITIZE_ADDRESS__)    /* GCC 4.8+, is ASAN enabled? */
-#    define _Py_NO_ADDRESS_SAFETY_ANALYSIS \
-        __attribute__((no_address_safety_analysis))
+#    define _Py_NO_SANITIZE_ADDRESS \
+        __attribute__((no_sanitize_address))
 #  endif
    // TSAN is supported since GCC 5.1, but __SANITIZE_THREAD__ macro
    // is provided only since GCC 7.
@@ -52,8 +52,8 @@ static void _PyMem_SetupDebugHooksDomain(PyMemAllocatorDomain domain);
 #  endif
 #endif
 
-#ifndef _Py_NO_ADDRESS_SAFETY_ANALYSIS
-#  define _Py_NO_ADDRESS_SAFETY_ANALYSIS
+#ifndef _Py_NO_SANITIZE_ADDRESS
+#  define _Py_NO_SANITIZE_ADDRESS
 #endif
 #ifndef _Py_NO_SANITIZE_THREAD
 #  define _Py_NO_SANITIZE_THREAD
@@ -1388,7 +1388,7 @@ obmalloc controls.  Since this test is needed at every entry point, it's
 extremely desirable that it be this fast.
 */
 
-static bool _Py_NO_ADDRESS_SAFETY_ANALYSIS
+static bool _Py_NO_SANITIZE_ADDRESS
             _Py_NO_SANITIZE_THREAD
             _Py_NO_SANITIZE_MEMORY
 address_in_range(void *p, poolp pool)
index 4c9ae3bc934686daae2d11653e093088b0e0d38a..ac0da9bd5bae3049a8bba3615c701986d81507d8 100644 (file)
@@ -1453,7 +1453,6 @@ odict_traverse(PyODictObject *od, visitproc visit, void *arg)
     _ODictNode *node;
 
     Py_VISIT(od->od_inst_dict);
-    Py_VISIT(od->od_weakreflist);
     _odict_FOREACH(od, node) {
         Py_VISIT(_odictnode_KEY(node));
     }
@@ -1466,7 +1465,6 @@ static int
 odict_tp_clear(PyODictObject *od)
 {
     Py_CLEAR(od->od_inst_dict);
-    Py_CLEAR(od->od_weakreflist);
     PyDict_Clear((PyObject *)od);
     _odict_clear_nodes(od);
     return 0;
index d0fc18d22fa5f36b59176fcf1f47569b9a44e2fa..8f83614488e844c0d830b739456fe9870fb730d8 100644 (file)
@@ -18,7 +18,7 @@
 #define STRINGLIB_TODECIMAL      Py_UNICODE_TODECIMAL
 #define STRINGLIB_STR            PyUnicode_1BYTE_DATA
 #define STRINGLIB_LEN            PyUnicode_GET_LENGTH
-#define STRINGLIB_NEW(STR,LEN)   _PyUnicode_FromASCII((char*)(STR),(LEN))
+#define STRINGLIB_NEW(STR,LEN)   _PyUnicode_FromASCII((const char*)(STR),(LEN))
 #define STRINGLIB_CHECK          PyUnicode_Check
 #define STRINGLIB_CHECK_EXACT    PyUnicode_CheckExact
 
index d6f2b98f2b30a33f9e69243f720cc8ce3db9d015..269a5581f70055261bbdf753a85a33fa4a9e85c4 100644 (file)
@@ -46,7 +46,7 @@ STRINGLIB(utf8_decode)(const char **inptr, const char *end,
                     /* Read a whole long at a time (either 4 or 8 bytes),
                        and do a fast unrolled copy if it only contains ASCII
                        characters. */
-                    unsigned long value = *(unsigned long *) _s;
+                    unsigned long value = *(const unsigned long *) _s;
                     if (value & ASCII_CHAR_MASK)
                         break;
 #if PY_LITTLE_ENDIAN
@@ -515,7 +515,7 @@ STRINGLIB(utf16_decode)(const unsigned char **inptr, const unsigned char *e,
             /* Fast path for runs of in-range non-surrogate chars. */
             const unsigned char *_q = q;
             while (_q < aligned_end) {
-                unsigned long block = * (unsigned long *) _q;
+                unsigned long block = * (const unsigned long *) _q;
                 if (native_ordering) {
                     /* Can use buffer directly */
                     if (block & FAST_CHAR_MASK)
index 8ccbc3094463df3123873d44f32f7dc2fbf58ee6..f4e0a7761d31198bf426dc8b7cbcb70b940ffc0b 100644 (file)
@@ -28,7 +28,7 @@ STRINGLIB(find_max_char)(const STRINGLIB_CHAR *begin, const STRINGLIB_CHAR *end)
             /* Help register allocation */
             const unsigned char *_p = p;
             while (_p < aligned_end) {
-                unsigned long value = *(unsigned long *) _p;
+                unsigned long value = *(const unsigned long *) _p;
                 if (value & UCS1_ASCII_CHAR_MASK)
                     return 255;
                 _p += SIZEOF_LONG;
index fc2d2742dd2ca69adf3b96c39565c624d637e6a4..bd580946b7eb9992ecb568a3034d057552c57c72 100644 (file)
@@ -719,8 +719,10 @@ tuple_subtype_new(PyTypeObject *type, PyObject *iterable)
         return NULL;
     assert(PyTuple_Check(tmp));
     newobj = type->tp_alloc(type, n = PyTuple_GET_SIZE(tmp));
-    if (newobj == NULL)
+    if (newobj == NULL) {
+        Py_DECREF(tmp);
         return NULL;
+    }
     for (i = 0; i < n; i++) {
         item = PyTuple_GET_ITEM(tmp, i);
         Py_INCREF(item);
index 0556eff8d07132f703b5f510663b8c9d0f023602..4c2b42f959b838b56d4dc5f33af012d030fc3a6f 100644 (file)
@@ -171,8 +171,8 @@ extern "C" {
 #define _PyUnicode_CONVERT_BYTES(from_type, to_type, begin, end, to) \
     do {                                                \
         to_type *_to = (to_type *)(to);                \
-        const from_type *_iter = (from_type *)(begin);  \
-        const from_type *_end = (from_type *)(end);     \
+        const from_type *_iter = (const from_type *)(begin);\
+        const from_type *_end = (const from_type *)(end);\
         Py_ssize_t n = (_end) - (_iter);                \
         const from_type *_unrolled_end =                \
             _iter + _Py_SIZE_ROUND_DOWN(n, 4);          \
@@ -919,21 +919,21 @@ findchar(const void *s, int kind,
         if ((Py_UCS1) ch != ch)
             return -1;
         if (direction > 0)
-            return ucs1lib_find_char((Py_UCS1 *) s, size, (Py_UCS1) ch);
+            return ucs1lib_find_char((const Py_UCS1 *) s, size, (Py_UCS1) ch);
         else
-            return ucs1lib_rfind_char((Py_UCS1 *) s, size, (Py_UCS1) ch);
+            return ucs1lib_rfind_char((const Py_UCS1 *) s, size, (Py_UCS1) ch);
     case PyUnicode_2BYTE_KIND:
         if ((Py_UCS2) ch != ch)
             return -1;
         if (direction > 0)
-            return ucs2lib_find_char((Py_UCS2 *) s, size, (Py_UCS2) ch);
+            return ucs2lib_find_char((const Py_UCS2 *) s, size, (Py_UCS2) ch);
         else
-            return ucs2lib_rfind_char((Py_UCS2 *) s, size, (Py_UCS2) ch);
+            return ucs2lib_rfind_char((const Py_UCS2 *) s, size, (Py_UCS2) ch);
     case PyUnicode_4BYTE_KIND:
         if (direction > 0)
-            return ucs4lib_find_char((Py_UCS4 *) s, size, ch);
+            return ucs4lib_find_char((const Py_UCS4 *) s, size, ch);
         else
-            return ucs4lib_rfind_char((Py_UCS4 *) s, size, ch);
+            return ucs4lib_rfind_char((const Py_UCS4 *) s, size, ch);
     default:
         Py_UNREACHABLE();
     }
@@ -4861,7 +4861,7 @@ ascii_decode(const char *start, const char *end, Py_UCS1 *dest)
             /* Help allocation */
             const char *_p = p;
             while (_p < aligned_end) {
-                unsigned long value = *(unsigned long *) _p;
+                unsigned long value = *(const unsigned long *) _p;
                 if (value & ASCII_CHAR_MASK)
                     break;
                 _p += SIZEOF_LONG;
@@ -5406,7 +5406,7 @@ PyUnicode_DecodeUTF32Stateful(const char *s,
     PyObject *errorHandler = NULL;
     PyObject *exc = NULL;
 
-    q = (unsigned char *)s;
+    q = (const unsigned char *)s;
     e = q + size;
 
     if (byteorder)
@@ -5731,7 +5731,7 @@ PyUnicode_DecodeUTF16Stateful(const char *s,
     PyObject *exc = NULL;
     const char *encoding;
 
-    q = (unsigned char *)s;
+    q = (const unsigned char *)s;
     e = q + size;
 
     if (byteorder)
@@ -6660,7 +6660,7 @@ PyUnicode_DecodeLatin1(const char *s,
                        const char *errors)
 {
     /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */
-    return _PyUnicode_FromUCS1((unsigned char*)s, size);
+    return _PyUnicode_FromUCS1((const unsigned char*)s, size);
 }
 
 /* create or adjust a UnicodeEncodeError */
@@ -13708,7 +13708,7 @@ _PyUnicodeWriter_WriteASCIIString(_PyUnicodeWriter *writer,
     if (len == -1)
         len = strlen(ascii);
 
-    assert(ucs1lib_find_max_char((Py_UCS1*)ascii, (Py_UCS1*)ascii + len) < 128);
+    assert(ucs1lib_find_max_char((const Py_UCS1*)ascii, (const Py_UCS1*)ascii + len) < 128);
 
     if (writer->buffer == NULL && !writer->overallocate) {
         PyObject *str;
@@ -13767,7 +13767,7 @@ _PyUnicodeWriter_WriteLatin1String(_PyUnicodeWriter *writer,
 {
     Py_UCS4 maxchar;
 
-    maxchar = ucs1lib_find_max_char((Py_UCS1*)str, (Py_UCS1*)str + len);
+    maxchar = ucs1lib_find_max_char((const Py_UCS1*)str, (const Py_UCS1*)str + len);
     if (_PyUnicodeWriter_Prepare(writer, len, maxchar) == -1)
         return -1;
     unicode_write_cstr(writer->buffer, writer->pos, str, len);
index 04f24d986f667c0c7d73d5d8b13110dcadc5a295..3747ffb2d89f093fe72814107223ea36633cd50b 100644 (file)
@@ -251,7 +251,8 @@ static void
 join(wchar_t *buffer, const wchar_t *stuff)
 {
     if (_PathCchCombineEx_Initialized == 0) {
-        HMODULE pathapi = LoadLibraryW(L"api-ms-win-core-path-l1-1-0.dll");
+        HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
+                                         LOAD_LIBRARY_SEARCH_SYSTEM32);
         if (pathapi) {
             _PathCchCombineEx = (PPathCchCombineEx)GetProcAddress(pathapi, "PathCchCombineEx");
         }
@@ -287,7 +288,8 @@ canonicalize(wchar_t *buffer, const wchar_t *path)
     }
 
     if (_PathCchCanonicalizeEx_Initialized == 0) {
-        HMODULE pathapi = LoadLibraryW(L"api-ms-win-core-path-l1-1-0.dll");
+        HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
+                                         LOAD_LIBRARY_SEARCH_SYSTEM32);
         if (pathapi) {
             _PathCchCanonicalizeEx = (PPathCchCanonicalizeEx)GetProcAddress(pathapi, "PathCchCanonicalizeEx");
         }
diff --git a/PC/icons/logo.svg b/PC/icons/logo.svg
new file mode 100644 (file)
index 0000000..6f52150
--- /dev/null
@@ -0,0 +1 @@
+<svg width="238" height="237" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" overflow="hidden"><defs><clipPath id="clip0"><path d="M706-314 944-314 944-77 706-77Z" fill-rule="evenodd" clip-rule="evenodd"/></clipPath></defs><g clip-path="url(#clip0)" transform="translate(-706 314)"><path d="M792.441-295.763C786.496-295.763 781.697-290.979 781.697-285.062 781.697-279.166 786.496-274.382 792.441-274.382 798.365-274.382 803.184-279.166 803.184-285.062 803.184-290.979 798.365-295.763 792.441-295.763ZM823.472-312.998C833.277-313.043 843.484-312.329 853.336-310.724 868.899-308.185 882-296.728 882-281.516L882-228.072C882-212.398 869.282-199.557 853.336-199.557L796.03-199.557C776.58-199.557 760.189-183.169 760.189-164.641L760.189-139 740.485-139C723.817-139 714.114-150.877 710.037-167.494 704.538-189.82 704.772-203.124 710.037-224.505 714.602-243.159 729.189-253 745.857-253L767.365-253 824.693-253 824.693-260.134 767.365-260.134 767.365-281.516C767.365-297.715 771.76-306.527 796.03-310.724 804.268-312.151 813.668-312.953 823.472-312.998Z" fill="#366A96" fill-rule="evenodd"/><path d="M857.377-117.071C851.466-117.071 846.655-112.267 846.655-106.348 846.655-100.406 851.466-95.6026 857.377-95.6026 863.31-95.6026 868.099-100.406 868.099-106.348 868.099-112.267 863.31-117.071 857.377-117.071ZM889.563-253 911.007-253C927.662-253 935.502-240.696 939.614-224.39 945.334-201.743 945.589-184.804 939.614-167.148 933.828-150 927.642-138.539 911.007-138.539L882.402-138.539 825.211-138.539 825.211-131.375 882.402-131.375 882.402-109.908C882.402-93.6435 868.205-85.4055 853.796-81.2973 832.12-75.1034 814.722-76.0513 796.606-81.2973 781.476-85.6801 768-94.6332 768-109.908L768-163.568C768-179.01 780.947-192.199 796.606-192.199L853.796-192.199C872.846-192.199 889.563-208.568 889.563-227.971Z" fill="#FFC836" fill-rule="evenodd"/></g></svg>
\ No newline at end of file
diff --git a/PC/icons/logox128.png b/PC/icons/logox128.png
new file mode 100644 (file)
index 0000000..d2655c7
Binary files /dev/null and b/PC/icons/logox128.png differ
index 305cb517d0f71d3bf6322af391ed965a3bffde3f..3eef7556299cf2c113363815c59c20d50dfa7459 100644 (file)
@@ -173,8 +173,12 @@ def get_layout(ns):
     if ns.include_stable:
         yield from in_build(PYTHON_STABLE_DLL_NAME)
 
+    found_any = False
     for dest, src in rglob(ns.build, "vcruntime*.dll"):
+        found_any = True
         yield dest, src
+    if not found_any:
+        log_error("Failed to locate vcruntime DLL in the build.")
 
     yield "LICENSE.txt", ns.build / "LICENSE.txt"
 
index b85095c555fe0a19c3490c2c37663295b87ab375..dbcb713ef9d0c00c0153bb3b98b739a98abdc709 100644 (file)
@@ -3,6 +3,7 @@ Provides .props file.
 """
 
 import os
+import sys
 
 from .constants import *
 
@@ -13,7 +14,8 @@ PYTHON_NUSPEC_NAME = "python.nuspec"
 NUSPEC_DATA = {
     "PYTHON_TAG": VER_DOT,
     "PYTHON_VERSION": os.getenv("PYTHON_NUSPEC_VERSION"),
-    "FILELIST": r'    <file src="**\*" target="tools" />',
+    "FILELIST": r'    <file src="**\*" exclude="python.png" target="tools" />',
+    "GIT": sys._git,
 }
 
 NUSPEC_PLATFORM_DATA = dict(
@@ -29,7 +31,7 @@ if not NUSPEC_DATA["PYTHON_VERSION"]:
         VER_DOT, VER_MICRO, "-" if VER_SUFFIX else "", VER_SUFFIX
     )
 
-FILELIST_WITH_PROPS = r"""    <file src="**\*" exclude="python.props" target="tools" />
+FILELIST_WITH_PROPS = r"""    <file src="**\*" exclude="python.png;python.props" target="tools" />
     <file src="python.props" target="build\native" />"""
 
 NUSPEC_TEMPLATE = r"""<?xml version="1.0"?>
@@ -42,10 +44,13 @@ NUSPEC_TEMPLATE = r"""<?xml version="1.0"?>
     <license type="file">tools\LICENSE.txt</license>
     <projectUrl>https://www.python.org/</projectUrl>
     <description>Installs {PYTHON_BITNESS} Python for use in build scenarios.</description>
+    <icon>images\python.png</icon>
     <iconUrl>https://www.python.org/static/favicon.ico</iconUrl>
     <tags>python</tags>
+    <repository type="git" url="https://github.com/Python/CPython.git" commit="{GIT[2]}" />
   </metadata>
   <files>
+    <file src="python.png" target="images" />
 {FILELIST}
   </files>
 </package>
@@ -70,3 +75,4 @@ def get_nuspec_layout(ns):
             data["FILELIST"] = FILELIST_WITH_PROPS
         nuspec = NUSPEC_TEMPLATE.format_map(data)
         yield "python.nuspec", ("python.nuspec", nuspec.encode("utf-8"))
+        yield "python.png", ns.source / "PC" / "icons" / "logox128.png"
index b1560b5244762f209122e5dfcd5653fa6f9d1fc1..1eb9b7c06da513ff61cd61dca272e07b6225d1d8 100644 (file)
@@ -29,8 +29,7 @@ PROPS_DATA["PYTHON_TARGET"] = "_GetPythonRuntimeFilesDependsOn{}{}_{}".format(
 PROPS_TEMPLATE = r"""<?xml version="1.0" encoding="utf-8"?>
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup Condition="$(Platform) == '{PYTHON_PLATFORM}'">
-    <PythonHome Condition="$(Configuration) == 'Debug'">$([msbuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), "python_d.exe")</PythonHome>
-    <PythonHome Condition="$(PythonHome) == ''">$([msbuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), "python.exe")</PythonHome>
+    <PythonHome Condition="$(PythonHome) == ''">$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)\..\..\tools"))</PythonHome>
     <PythonInclude>$(PythonHome)\include</PythonInclude>
     <PythonLibs>$(PythonHome)\libs</PythonLibs>
     <PythonTag>{PYTHON_TAG}</PythonTag>
index c4113e54c2b8fed06163a2f4bfaede5856f95306..faceb03fba39d1aa9808ed819a73c989eff49cc5 100644 (file)
@@ -116,6 +116,10 @@ msvcrt_locking_impl(PyObject *module, int fd, int mode, long nbytes)
 {
     int err;
 
+    if (PySys_Audit("msvcrt.locking", "iil", fd, mode, nbytes) < 0) {
+        return NULL;
+    }
+
     Py_BEGIN_ALLOW_THREADS
     _Py_BEGIN_SUPPRESS_IPH
     err = _locking(fd, mode, nbytes);
@@ -175,6 +179,10 @@ msvcrt_open_osfhandle_impl(PyObject *module, void *handle, int flags)
 {
     int fd;
 
+    if (PySys_Audit("msvcrt.open_osfhandle", "Ki", handle, flags) < 0) {
+        return -1;
+    }
+
     _Py_BEGIN_SUPPRESS_IPH
     fd = _open_osfhandle((intptr_t)handle, flags);
     _Py_END_SUPPRESS_IPH
@@ -201,6 +209,10 @@ msvcrt_get_osfhandle_impl(PyObject *module, int fd)
 {
     intptr_t handle = -1;
 
+    if (PySys_Audit("msvcrt.get_osfhandle", "(i)", fd) < 0) {
+        return NULL;
+    }
+
     _Py_BEGIN_SUPPRESS_IPH
     handle = _get_osfhandle(fd);
     _Py_END_SUPPRESS_IPH
index b40e24f438ef604652cfdb6c58a0422278d4f8b4..b6b8d445869bcfe1cc38015a54e299866835ce59 100644 (file)
@@ -470,6 +470,10 @@ Py_NO_ENABLE_SHARED to find out.  Also support MS_NO_COREDLL for b/w compat */
    (which you can't on SCO ODT 3.0). */
 /* #undef SYS_SELECT_WITH_SYS_TIME */
 
+/* Define if you want build the _decimal module using a coroutine-local rather
+   than a thread-local context */
+#define WITH_DECIMAL_CONTEXTVAR 1
+
 /* Define if you want documentation strings in extension modules */
 #define WITH_DOC_STRINGS 1
 
index 5e71113fa45b550514a92f9643ccf692ce87ce7d..e2f8f873c58bdf6e2790e308d2894dfed96f8879 100644 (file)
@@ -27,6 +27,8 @@ echo.      building externals.
 echo.  -m  Enable parallel build (enabled by default)\r
 echo.  -M  Disable parallel build\r
 echo.  -v  Increased output messages\r
+echo.  -vv Verbose output messages\r
+echo.  -q  Quiet output messages (errors and warnings only)\r
 echo.  -k  Attempt to kill any running Pythons before building (usually done\r
 echo.      automatically by the pythoncore project)\r
 echo.  --pgo          Build with Profile-Guided Optimization.  This flag\r
@@ -72,6 +74,8 @@ if "%~1"=="-d" (set conf=Debug) & shift & goto CheckOpts
 if "%~1"=="-m" (set parallel=/m) & shift & goto CheckOpts\r
 if "%~1"=="-M" (set parallel=) & shift & goto CheckOpts\r
 if "%~1"=="-v" (set verbose=/v:n) & shift & goto CheckOpts\r
+if "%~1"=="-vv" (set verbose=/v:d /ds) & shift & goto CheckOpts\r
+if "%~1"=="-q" (set verbose=/v:q /nologo /clp:summary) & shift & goto CheckOpts\r
 if "%~1"=="-k" (set kill=true) & shift & goto CheckOpts\r
 if "%~1"=="--pgo" (set do_pgo=true) & shift & goto CheckOpts\r
 if "%~1"=="--pgo-job" (set do_pgo=true) & (set pgo_job=%~2) & shift & shift & goto CheckOpts\r
index 4034819bd16e2a5d4abcfff3297ff347ed5c4a8c..61e613581a17d3bc184357cc32aae3f22cc44896 100644 (file)
 @rem VS 2017 and later provide vswhere.exe, which can be used\r
 @if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" goto :skip_vswhere\r
 @set _Py_MSBuild_Root=\r
-@for /F "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -prerelease') DO @(set _Py_MSBuild_Root=%%i\MSBuild)\r
+@for /F "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64') DO @(set _Py_MSBuild_Root=%%i\MSBuild)\r
 @if not defined _Py_MSBuild_Root goto :skip_vswhere\r
 @for %%j in (Current 15.0) DO @if exist "%_Py_MSBuild_Root%\%%j\Bin\msbuild.exe" (set MSBUILD="%_Py_MSBuild_Root%\%%j\Bin\msbuild.exe")\r
 @set _Py_MSBuild_Root=\r
 @if defined MSBUILD @if exist %MSBUILD% (set _Py_MSBuild_Source=Visual Studio installation) & goto :found\r
 :skip_vswhere\r
 \r
-@rem VS 2017 sets exactly one install as the "main" install, so we may find MSBuild in there.\r
-@reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32 >nul 2>nul\r
-@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 @(\r
-    @if "%%i"=="15.0" @if exist "%%k\MSBuild\15.0\Bin\msbuild.exe" @(set MSBUILD="%%k\MSBuild\15.0\Bin\msbuild.exe")\r
-)\r
-@if exist %MSBUILD% (set _Py_MSBuild_Source=Visual Studio 2017 registry) & goto :found\r
-\r
 @rem VS 2015 and earlier register MSBuild separately, so we can find it.\r
 @reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath /reg:32 >nul 2>nul\r
 @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 @(\r
index 6d4599f9ed8579945b8536f86327ac8dec4792e0..88ab3479c1aaef5e6f30f01bddf86c1a41a5f493 100644 (file)
@@ -53,8 +53,8 @@ echo.Fetching external libraries...
 set libraries=\r
 set libraries=%libraries%                                       bzip2-1.0.6\r
 if NOT "%IncludeLibffiSrc%"=="false" set libraries=%libraries%  libffi-3.3.0-rc0-r1\r
-if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries%     openssl-1.1.1d\r
-set libraries=%libraries%                                       sqlite-3.28.0.0\r
+if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries%     openssl-1.1.1f\r
+set libraries=%libraries%                                       sqlite-3.31.1.0\r
 if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.9.0\r
 if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.9.0\r
 if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tix-8.4.3.6\r
@@ -77,7 +77,7 @@ echo.Fetching external binaries...
 \r
 set binaries=\r
 if NOT "%IncludeLibffi%"=="false"  set binaries=%binaries% libffi\r
-if NOT "%IncludeSSL%"=="false"     set binaries=%binaries% openssl-bin-1.1.1d\r
+if NOT "%IncludeSSL%"=="false"     set binaries=%binaries% openssl-bin-1.1.1f\r
 if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.9.0\r
 if NOT "%IncludeSSLSrc%"=="false"  set binaries=%binaries% nasm-2.11.06\r
 \r
index 7ed71bd819cb5f632a0e1312589f817b4c958bfa..6e9d54511fef168dbe93de74dde9c7f08308e27e 100644 (file)
     <Content Include="idlelib\Icons\idle_32.png" />
     <Content Include="idlelib\Icons\idle_48.gif" />
     <Content Include="idlelib\Icons\idle_48.png" />
+    <Content Include="idlelib\Icons\idle_256.png" />
     <Content Include="idlelib\Icons\minusnode.gif" />
     <Content Include="idlelib\Icons\openfolder.gif" />
     <Content Include="idlelib\Icons\plusnode.gif" />
index dc962f00575d97d44171541a87b5239d3dba052d..edeb17372a06e5d79c5506854ec1b5d4734001de 100644 (file)
@@ -200,4 +200,43 @@ public override bool Execute() {
     <Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" />\r
     <Exec Command='$(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)"' ContinueOnError="false" />\r
   </Target>\r
+\r
+\r
+  <Target Name="FindVCRedistDir">\r
+    <!-- Hard coded path for VS 2015 -->\r
+    <PropertyGroup Condition="$(PlatformToolset) == 'v140'">\r
+      <VCRedistDir>$(VCInstallDir)\redist\</VCRedistDir>\r
+    </PropertyGroup>\r
+\r
+    <!-- Search for version number in some broken Build Tools installs -->\r
+    <ItemGroup Condition="$(VCRedistDir) == '' and $(VCToolsRedistVersion) == ''">\r
+      <_RedistFiles Include="$(VCInstallDir)\Redist\MSVC\*\*.*" />\r
+    </ItemGroup>\r
+    <PropertyGroup Condition="$(VCRedistDir) == '' and $(VCToolsRedistVersion) == ''">\r
+      <_RedistDir>%(_RedistFiles.Directory)</_RedistDir>\r
+      <VCToolsRedistVersion>$([System.IO.Path]::GetFileName($(_RedistDir.Trim(`\`))))</VCToolsRedistVersion>\r
+    </PropertyGroup>\r
+\r
+    <!-- Use correct path for VS 2017 and later -->\r
+    <PropertyGroup Condition="$(VCRedistDir) == ''">\r
+      <VCRedistDir>$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir>\r
+    </PropertyGroup>\r
+\r
+    <PropertyGroup>\r
+      <VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>\r
+      <VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>\r
+    </PropertyGroup>\r
+\r
+    <Message Text="VC Redist Directory: $(VCRedistDir)" />\r
+    <Message Text="VC Redist Version: $(VCToolsRedistVersion)" />\r
+  </Target>\r
+\r
+  <Target Name="FindVCRuntime" Returns="VCRuntimeDLL" DependsOnTargets="FindVCRedistDir">\r
+    <ItemGroup Condition="$(VCInstallDir) != ''">\r
+      <VCRuntimeDLL Include="$(VCRedistDir)\Microsoft.VC*.CRT\vcruntime*.dll" />\r
+    </ItemGroup>\r
+\r
+    <Warning Text="vcruntime*.dll not found under $(VCRedistDir)." Condition="@(VCRuntimeDLL) == ''" />\r
+    <Message Text="VC Runtime DLL(s):%0A- @(VCRuntimeDLL,'%0A- ')" />\r
+  </Target>\r
 </Project>\r
index 8884c0a73c50c5461f3b56f8774926f684a91f1d..2c8555a33b622cb9533331053fc04aca60159d21 100644 (file)
     <ExternalsDir>$(EXTERNALS_DIR)</ExternalsDir>\r
     <ExternalsDir Condition="$(ExternalsDir) == ''">$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`))</ExternalsDir>\r
     <ExternalsDir Condition="!HasTrailingSlash($(ExternalsDir))">$(ExternalsDir)\</ExternalsDir>\r
-    <sqlite3Dir>$(ExternalsDir)sqlite-3.28.0.0\</sqlite3Dir>\r
+    <sqlite3Dir>$(ExternalsDir)sqlite-3.31.1.0\</sqlite3Dir>\r
     <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>\r
     <lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>\r
     <libffiDir>$(ExternalsDir)libffi\</libffiDir>\r
     <libffiOutDir>$(ExternalsDir)libffi\$(ArchName)\</libffiOutDir>\r
     <libffiIncludeDir>$(libffiOutDir)include</libffiIncludeDir>\r
-    <opensslDir>$(ExternalsDir)openssl-1.1.1d\</opensslDir>\r
-    <opensslOutDir>$(ExternalsDir)openssl-bin-1.1.1d\$(ArchName)\</opensslOutDir>\r
+    <opensslDir>$(ExternalsDir)openssl-1.1.1f\</opensslDir>\r
+    <opensslOutDir>$(ExternalsDir)openssl-bin-1.1.1f\$(ArchName)\</opensslOutDir>\r
     <opensslIncludeDir>$(opensslOutDir)include</opensslIncludeDir>\r
     <nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>\r
     <zlibDir>$(ExternalsDir)\zlib-1.2.11\</zlibDir>\r
index 5acf26b8dac347eb11fc6b71f5bbddc4d94c482c..a7352747fcd9c6833f3b962cbc014332e14c111e 100644 (file)
@@ -95,6 +95,7 @@
     <Link>\r
       <AdditionalDependencies>windowsapp.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
       <SubSystem>Console</SubSystem>\r
+      <StackReserveSize>2000000</StackReserveSize>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="$(Configuration) != 'Debug'">\r
index 3976d5b7b39c4ce4b1bab9c74efef8f1e3041397..178d9b9f2ee9333ffc340679548721eb7158dabb 100644 (file)
     <Warning Text="Not including zlib is not a supported configuration." />\r
   </Target>\r
 \r
-  <PropertyGroup>\r
-    <VCRedistDir>$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir>\r
-    <VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>\r
-    <VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>\r
-  </PropertyGroup>\r
-  <ItemGroup Condition="$(VCInstallDir) != ''">\r
-    <VCRuntimeDLL Include="$(VCRedistDir)\**\vcruntime*.dll" />\r
-  </ItemGroup>\r
-  <Target Name="_CopyVCRuntime" AfterTargets="Build" Inputs="@(VCRuntimeDLL)" Outputs="$(OutDir)%(Filename)%(Extension)">\r
+  <Target Name="_CopyVCRuntime" AfterTargets="Build" Inputs="@(VCRuntimeDLL)" Outputs="$(OutDir)%(Filename)%(Extension)" DependsOnTargets="FindVCRuntime">\r
+    <!-- bpo-38597: When we switch to another VCRuntime DLL, include vcruntime140.dll as well -->\r
+    <Warning Text="A copy of vcruntime140.dll is also required" Condition="!$(VCToolsRedistVersion.StartsWith(`14.`))" />\r
     <Copy SourceFiles="%(VCRuntimeDLL.FullPath)" DestinationFolder="$(OutDir)" />\r
   </Target>\r
   <Target Name="_CleanVCRuntime" AfterTargets="Clean">\r
index a07dcbaeaeb8f0f7b7bb27c851f971c0f2af82f0..7f4d3142ae5f7a24672e0dc0c44e19ef9973226e 100644 (file)
@@ -95,6 +95,7 @@
     <Link>\r
       <AdditionalDependencies>windowsapp.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
       <SubSystem>Windows</SubSystem>\r
+      <StackReserveSize>2000000</StackReserveSize>\r
     </Link>\r
   </ItemDefinitionGroup>\r
   <ItemDefinitionGroup Condition="$(Configuration) != 'Debug'">\r
index 88045d18b6fed3926ad646f3a77f74e614d57345..1462e6f454e65e1b67fd192a0bcfb7db894ff564 100644 (file)
@@ -184,7 +184,7 @@ _ssl
     again when building.\r
 \r
 _sqlite3\r
-    Wraps SQLite 3.28.0.0, which is itself built by sqlite3.vcxproj\r
+    Wraps SQLite 3.31.1.0, which is itself built by sqlite3.vcxproj\r
     Homepage:\r
         http://www.sqlite.org/\r
 _tkinter\r
index a5d78974b871b3e975d140ba43e09895336c9d1b..2bb733d0dcd66bc66eab1569c1335ec3511c4a35 100644 (file)
@@ -246,6 +246,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
 
     if ((ps = PyParser_New(g, start)) == NULL) {
         err_ret->error = E_NOMEM;
+        growable_comment_array_deallocate(&type_ignores);
         PyTokenizer_Free(tok);
         return NULL;
     }
index f84093dae5b62ebe682c00df1614bb2ad641443b..aecbcebb917e8370327940e7a98b40684ad5d303 100644 (file)
@@ -1,6 +1,7 @@
 
 /* Tokenizer implementation */
 
+#define PY_SSIZE_T_CLEAN
 #include "Python.h"
 
 #include <ctype.h>
@@ -886,6 +887,7 @@ tok_nextc(struct tok_state *tok)
                 size_t start = tok->start - tok->buf;
                 size_t oldlen = tok->cur - tok->buf;
                 size_t newlen = oldlen + strlen(newtok);
+                Py_ssize_t cur_multi_line_start = tok->multi_line_start - tok->buf;
                 char *buf = tok->buf;
                 buf = (char *)PyMem_REALLOC(buf, newlen+1);
                 tok->lineno++;
@@ -898,6 +900,7 @@ tok_nextc(struct tok_state *tok)
                 }
                 tok->buf = buf;
                 tok->cur = tok->buf + oldlen;
+                tok->multi_line_start = tok->buf + cur_multi_line_start;
                 tok->line_start = tok->cur;
                 strcpy(tok->buf + oldlen, newtok);
                 PyMem_FREE(newtok);
@@ -1032,17 +1035,44 @@ tok_backup(struct tok_state *tok, int c)
 static int
 syntaxerror(struct tok_state *tok, const char *format, ...)
 {
+    PyObject *errmsg, *errtext, *args;
     va_list vargs;
 #ifdef HAVE_STDARG_PROTOTYPES
     va_start(vargs, format);
 #else
     va_start(vargs);
 #endif
-    PyErr_FormatV(PyExc_SyntaxError, format, vargs);
+    errmsg = PyUnicode_FromFormatV(format, vargs);
     va_end(vargs);
-    PyErr_SyntaxLocationObject(tok->filename,
-                               tok->lineno,
-                               (int)(tok->cur - tok->line_start));
+    if (!errmsg) {
+        goto error;
+    }
+
+    errtext = PyUnicode_DecodeUTF8(tok->line_start, tok->cur - tok->line_start,
+                                   "replace");
+    if (!errtext) {
+        goto error;
+    }
+    int offset = (int)PyUnicode_GET_LENGTH(errtext);
+    Py_ssize_t line_len = strcspn(tok->line_start, "\n");
+    if (line_len != tok->cur - tok->line_start) {
+        Py_DECREF(errtext);
+        errtext = PyUnicode_DecodeUTF8(tok->line_start, line_len,
+                                       "replace");
+    }
+    if (!errtext) {
+        goto error;
+    }
+
+    args = Py_BuildValue("(O(OiiN))", errmsg,
+                         tok->filename, tok->lineno, offset, errtext);
+    if (args) {
+        PyErr_SetObject(PyExc_SyntaxError, args);
+        Py_DECREF(args);
+    }
+
+error:
+    Py_XDECREF(errmsg);
     tok->done = E_ERROR;
     return ERRORTOKEN;
 }
index e02d28305126dfbe98d2d7715819a9bb41ac1f85..52a13dfc62ccca8c0b19dc27bce7ff53714eb55d 100644 (file)
@@ -856,11 +856,11 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
         int rc;
 
         if (PyErr_Occurred()) {
-            return 0;
+            goto handle_error;
         }
         *registry = PyDict_New();
         if (*registry == NULL)
-            return 0;
+            goto handle_error;
 
          rc = _PyDict_SetItemId(globals, &PyId___warningregistry__, *registry);
          if (rc < 0)
@@ -886,10 +886,9 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno,
     return 1;
 
  handle_error:
-    /* filename not XDECREF'ed here as there is no way to jump here with a
-       dangling reference. */
     Py_XDECREF(*registry);
     Py_XDECREF(*module);
+    Py_DECREF(*filename);
     return 0;
 }
 
index e70ab519e66e1b4d40a609e3e507668d117c3d92..f70d48ba3a15daa289ff0c3f1033594589a53855 100644 (file)
@@ -583,7 +583,7 @@ static stmt_ty ast_for_for_stmt(struct compiling *, const node *, bool);
 
 /* Note different signature for ast_for_call */
 static expr_ty ast_for_call(struct compiling *, const node *, expr_ty,
-                            const node *, const node *);
+                            const node *, const node *, const node *);
 
 static PyObject *parsenumber(struct compiling *, const char *);
 static expr_ty parsestrplus(struct compiling *, const node *n);
@@ -1028,13 +1028,13 @@ forbidden_name(struct compiling *c, identifier name, const node *n,
 }
 
 static expr_ty
-copy_location(expr_ty e, const node *n)
+copy_location(expr_ty e, const node *n, const node *end)
 {
     if (e) {
         e->lineno = LINENO(n);
         e->col_offset = n->n_col_offset;
-        e->end_lineno = n->n_end_lineno;
-        e->end_col_offset = n->n_end_col_offset;
+        e->end_lineno = end->n_end_lineno;
+        e->end_col_offset = end->n_end_col_offset;
     }
     return e;
 }
@@ -1715,11 +1715,12 @@ ast_for_dotted_name(struct compiling *c, const node *n)
         return NULL;
 
     for (i = 2; i < NCH(n); i+=2) {
-        id = NEW_IDENTIFIER(CHILD(n, i));
+        const node *child = CHILD(n, i);
+        id = NEW_IDENTIFIER(child);
         if (!id)
             return NULL;
         e = Attribute(e, id, Load, lineno, col_offset,
-                      n->n_end_lineno, n->n_end_col_offset, c->c_arena);
+                      child->n_end_lineno, child->n_end_col_offset, c->c_arena);
         if (!e)
             return NULL;
     }
@@ -1756,7 +1757,8 @@ ast_for_decorator(struct compiling *c, const node *n)
         name_expr = NULL;
     }
     else {
-        d = ast_for_call(c, CHILD(n, 3), name_expr, CHILD(n, 2), CHILD(n, 4));
+        d = ast_for_call(c, CHILD(n, 3), name_expr,
+                         CHILD(n, 1), CHILD(n, 2), CHILD(n, 4));
         if (!d)
             return NULL;
         name_expr = NULL;
@@ -1955,7 +1957,7 @@ ast_for_namedexpr(struct compiling *c, const node *n)
     if (target->kind != Name_kind) {
         const char *expr_name = get_expr_name(target);
         if (expr_name != NULL) {
-            ast_error(c, n, "cannot use named assignment with %s", expr_name);
+            ast_error(c, n, "cannot use assignment expressions with %s", expr_name);
         }
         return NULL;
     }
@@ -2464,10 +2466,10 @@ ast_for_atom(struct compiling *c, const node *n)
         }
 
         if (TYPE(CHILD(ch, 1)) == comp_for) {
-            return copy_location(ast_for_genexp(c, ch), n);
+            return copy_location(ast_for_genexp(c, ch), n, n);
         }
         else {
-            return copy_location(ast_for_testlist(c, ch), n);
+            return copy_location(ast_for_testlist(c, ch), n, n);
         }
     case LSQB: /* list (or list comprehension) */
         ch = CHILD(n, 1);
@@ -2486,7 +2488,7 @@ ast_for_atom(struct compiling *c, const node *n)
                         n->n_end_lineno, n->n_end_col_offset, c->c_arena);
         }
         else {
-            return copy_location(ast_for_listcomp(c, ch), n);
+            return copy_location(ast_for_listcomp(c, ch), n, n);
         }
     case LBRACE: {
         /* dictorsetmaker: ( ((test ':' test | '**' test)
@@ -2527,7 +2529,7 @@ ast_for_atom(struct compiling *c, const node *n)
                 /* It's a dictionary display. */
                 res = ast_for_dictdisplay(c, ch);
             }
-            return copy_location(res, n);
+            return copy_location(res, n, n);
         }
     }
     default:
@@ -2657,7 +2659,7 @@ ast_for_binop(struct compiling *c, const node *n)
 }
 
 static expr_ty
-ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
+ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr, const node *start)
 {
     /* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME
        subscriptlist: subscript (',' subscript)* [',']
@@ -2667,17 +2669,18 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
     REQ(n, trailer);
     if (TYPE(CHILD(n, 0)) == LPAR) {
         if (NCH(n) == 2)
-            return Call(left_expr, NULL, NULL, LINENO(n), n->n_col_offset,
+            return Call(left_expr, NULL, NULL, LINENO(start), start->n_col_offset,
                         n->n_end_lineno, n->n_end_col_offset, c->c_arena);
         else
-            return ast_for_call(c, CHILD(n, 1), left_expr, CHILD(n, 0), CHILD(n, 2));
+            return ast_for_call(c, CHILD(n, 1), left_expr,
+                                start, CHILD(n, 0), CHILD(n, 2));
     }
     else if (TYPE(CHILD(n, 0)) == DOT) {
         PyObject *attr_id = NEW_IDENTIFIER(CHILD(n, 1));
         if (!attr_id)
             return NULL;
         return Attribute(left_expr, attr_id, Load,
-                         LINENO(n), n->n_col_offset,
+                         LINENO(start), start->n_col_offset,
                          n->n_end_lineno, n->n_end_col_offset, c->c_arena);
     }
     else {
@@ -2688,7 +2691,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
             slice_ty slc = ast_for_slice(c, CHILD(n, 0));
             if (!slc)
                 return NULL;
-            return Subscript(left_expr, slc, Load, LINENO(n), n->n_col_offset,
+            return Subscript(left_expr, slc, Load, LINENO(start), start->n_col_offset,
                              n_copy->n_end_lineno, n_copy->n_end_col_offset,
                              c->c_arena);
         }
@@ -2715,7 +2718,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
             }
             if (!simple) {
                 return Subscript(left_expr, ExtSlice(slices, c->c_arena),
-                                 Load, LINENO(n), n->n_col_offset,
+                                 Load, LINENO(start), start->n_col_offset,
                                  n_copy->n_end_lineno, n_copy->n_end_col_offset, c->c_arena);
             }
             /* extract Index values and put them in a Tuple */
@@ -2732,7 +2735,7 @@ ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr)
             if (!e)
                 return NULL;
             return Subscript(left_expr, Index(e, c->c_arena),
-                             Load, LINENO(n), n->n_col_offset,
+                             Load, LINENO(start), start->n_col_offset,
                              n_copy->n_end_lineno, n_copy->n_end_col_offset, c->c_arena);
         }
     }
@@ -2770,7 +2773,7 @@ static expr_ty
 ast_for_atom_expr(struct compiling *c, const node *n)
 {
     int i, nch, start = 0;
-    expr_ty e, tmp;
+    expr_ty e;
 
     REQ(n, atom_expr);
     nch = NCH(n);
@@ -2799,12 +2802,9 @@ ast_for_atom_expr(struct compiling *c, const node *n)
         node *ch = CHILD(n, i);
         if (TYPE(ch) != trailer)
             break;
-        tmp = ast_for_trailer(c, ch, e);
-        if (!tmp)
+        e = ast_for_trailer(c, ch, e, CHILD(n, start));
+        if (!e)
             return NULL;
-        tmp->lineno = e->lineno;
-        tmp->col_offset = e->col_offset;
-        e = tmp;
     }
 
     if (start) {
@@ -3034,7 +3034,7 @@ ast_for_expr(struct compiling *c, const node *n)
 
 static expr_ty
 ast_for_call(struct compiling *c, const node *n, expr_ty func,
-             const node *maybegenbeg, const node *closepar)
+             const node *start, const node *maybegenbeg, const node *closepar)
 {
     /*
       arglist: argument (',' argument)*  [',']
@@ -3146,7 +3146,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func,
             }
             else if (TYPE(CHILD(ch, 1)) == comp_for) {
                 /* the lone generator expression */
-                e = copy_location(ast_for_genexp(c, ch), maybegenbeg);
+                e = copy_location(ast_for_genexp(c, ch), maybegenbeg, closepar);
                 if (!e)
                     return NULL;
                 asdl_seq_SET(args, nargs++, e);
@@ -3238,7 +3238,7 @@ ast_for_call(struct compiling *c, const node *n, expr_ty func,
         }
     }
 
-    return Call(func, args, keywords, func->lineno, func->col_offset,
+    return Call(func, args, keywords, LINENO(start), start->n_col_offset,
                 closepar->n_end_lineno, closepar->n_end_col_offset, c->c_arena);
 }
 
@@ -4488,7 +4488,8 @@ ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq)
         dummy = Name(dummy_name, Load, LINENO(n), n->n_col_offset,
                      CHILD(n, 1)->n_end_lineno, CHILD(n, 1)->n_end_col_offset,
                      c->c_arena);
-        call = ast_for_call(c, CHILD(n, 3), dummy, NULL, CHILD(n, 4));
+        call = ast_for_call(c, CHILD(n, 3), dummy,
+                            CHILD(n, 1), NULL, CHILD(n, 4));
         if (!call)
             return NULL;
     }
index 96c766fc0957d491f1614f45ae347c3d6d5978cb..f2a2c259149932e8a4c0377c4bb5d8a7a70f51f1 100644 (file)
@@ -617,6 +617,7 @@ astfold_comprehension(comprehension_ty node_, PyArena *ctx_, int optimize_)
 static int
 astfold_arguments(arguments_ty node_, PyArena *ctx_, int optimize_)
 {
+    CALL_SEQ(astfold_arg, arg_ty, node_->posonlyargs);
     CALL_SEQ(astfold_arg, arg_ty, node_->args);
     CALL_OPT(astfold_arg, arg_ty, node_->vararg);
     CALL_SEQ(astfold_arg, arg_ty, node_->kwonlyargs);
index f376e86ddc4c0d87af9df3703d17c51851fe69b6..1a7cd236aafa19c5c4fb5abf458d002ac879d6f6 100644 (file)
@@ -746,6 +746,7 @@ append_ast_ext_slice(_PyUnicodeWriter *writer, slice_ty slice)
         APPEND_STR_IF(i > 0, ", ");
         APPEND(slice, (slice_ty)asdl_seq_GET(slice->v.ExtSlice.dims, i));
     }
+    APPEND_STR_IF(dims_count == 1, ",");
     return 0;
 }
 
index 33f969094e7d15994583abbae2a9cb8489e19737..fe22bbdde4e91fb297674a30b72ff3b4e3888d51 100644 (file)
@@ -738,7 +738,7 @@ builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
     }
 
     if (flags &
-        ~(PyCF_MASK | PyCF_MASK_OBSOLETE | PyCF_DONT_IMPLY_DEDENT | PyCF_ONLY_AST | PyCF_TYPE_COMMENTS))
+        ~(PyCF_MASK | PyCF_MASK_OBSOLETE | PyCF_COMPILE_MASK))
     {
         PyErr_SetString(PyExc_ValueError,
                         "compile(): unrecognised flags");
index 3306fb9728e8cde545aac6a7c807f04403c2c2bd..1873e37cf608e88e93b2351b37aa906fc71e75df 100644 (file)
@@ -1159,7 +1159,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
         co->co_opcache_flag++;
         if (co->co_opcache_flag == OPCACHE_MIN_RUNS) {
             if (_PyCode_InitOpcache(co) < 0) {
-                return NULL;
+                goto exit_eval_frame;
             }
 #if OPCACHE_STATS
             opcache_code_objects_extra_mem +=
@@ -4686,6 +4686,7 @@ void
 PyEval_SetProfile(Py_tracefunc func, PyObject *arg)
 {
     if (PySys_Audit("sys.setprofile", NULL) < 0) {
+        _PyErr_WriteUnraisableMsg("in PyEval_SetProfile", NULL);
         return;
     }
 
@@ -4707,6 +4708,7 @@ void
 PyEval_SetTrace(Py_tracefunc func, PyObject *arg)
 {
     if (PySys_Audit("sys.settrace", NULL) < 0) {
+        _PyErr_WriteUnraisableMsg("in PyEval_SetTrace", NULL);
         return;
     }
 
@@ -4742,19 +4744,6 @@ _PyEval_GetCoroutineOriginTrackingDepth(void)
     return tstate->coroutine_origin_tracking_depth;
 }
 
-void
-_PyEval_SetAsyncGenFirstiter(PyObject *firstiter)
-{
-    PyThreadState *tstate = _PyThreadState_GET();
-
-    if (PySys_Audit("sys.set_asyncgen_hook_firstiter", NULL) < 0) {
-        return;
-    }
-
-    Py_XINCREF(firstiter);
-    Py_XSETREF(tstate->async_gen_firstiter, firstiter);
-}
-
 PyObject *
 _PyEval_GetAsyncGenFirstiter(void)
 {
@@ -4762,19 +4751,6 @@ _PyEval_GetAsyncGenFirstiter(void)
     return tstate->async_gen_firstiter;
 }
 
-void
-_PyEval_SetAsyncGenFinalizer(PyObject *finalizer)
-{
-    PyThreadState *tstate = _PyThreadState_GET();
-
-    if (PySys_Audit("sys.set_asyncgen_hook_finalizer", NULL) < 0) {
-        return;
-    }
-
-    Py_XINCREF(finalizer);
-    Py_XSETREF(tstate->async_gen_finalizer, finalizer);
-}
-
 PyObject *
 _PyEval_GetAsyncGenFinalizer(void)
 {
index d4b34f8397f05a09fc3c158e689b2225a42ea434..4bd28ec9c761cae99ddef8047ac759ea38cf7828 100644 (file)
@@ -1415,7 +1415,7 @@ static PyObject *surrogateescape_errors(PyObject *self, PyObject *exc)
 static int _PyCodecRegistry_Init(void)
 {
     static struct {
-        char *name;
+        const char *name;
         PyMethodDef def;
     } methods[] =
     {
index f09e99fd4a43d3c9af424522ce3b8167db47e56d..913ec992395a06a8f7712c086d2956af36370066 100644 (file)
@@ -23,8 +23,8 @@
 
 #include "Python.h"
 
-#include "Python-ast.h"
 #include "pycore_pystate.h"   /* _PyInterpreterState_GET_UNSAFE() */
+#include "Python-ast.h"
 #include "ast.h"
 #include "code.h"
 #include "symtable.h"
 #define COMP_SETCOMP  2
 #define COMP_DICTCOMP 3
 
+#define IS_TOP_LEVEL_AWAIT(c) ( \
+        (c->c_flags->cf_flags & PyCF_ALLOW_TOP_LEVEL_AWAIT) \
+        && (c->u->u_ste->ste_type == ModuleBlock))
+
 struct instr {
     unsigned i_jabs : 1;
     unsigned i_jrel : 1;
@@ -2682,7 +2686,7 @@ static int
 compiler_async_for(struct compiler *c, stmt_ty s)
 {
     basicblock *start, *except, *end;
-    if (c->c_flags->cf_flags & PyCF_ALLOW_TOP_LEVEL_AWAIT){
+    if (IS_TOP_LEVEL_AWAIT(c)){
         c->u->u_ste->ste_coroutine = 1;
     } else if (c->u->u_scope_type != COMPILER_SCOPE_ASYNC_FUNCTION) {
         return compiler_error(c, "'async for' outside async function");
@@ -4465,11 +4469,14 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
     PyCodeObject *co = NULL;
     comprehension_ty outermost;
     PyObject *qualname = NULL;
-    int is_async_function = c->u->u_ste->ste_coroutine;
     int is_async_generator = 0;
 
-    outermost = (comprehension_ty) asdl_seq_GET(generators, 0);
+    if (IS_TOP_LEVEL_AWAIT(c)) {
+        c->u->u_ste->ste_coroutine = 1;
+    }
+    int is_async_function = c->u->u_ste->ste_coroutine;
 
+    outermost = (comprehension_ty) asdl_seq_GET(generators, 0);
     if (!compiler_enter_scope(c, name, COMPILER_SCOPE_COMPREHENSION,
                               (void *)e, e->lineno))
     {
@@ -4666,7 +4673,7 @@ compiler_async_with(struct compiler *c, stmt_ty s, int pos)
     withitem_ty item = asdl_seq_GET(s->v.AsyncWith.items, pos);
 
     assert(s->kind == AsyncWith_kind);
-    if (c->c_flags->cf_flags & PyCF_ALLOW_TOP_LEVEL_AWAIT){
+    if (IS_TOP_LEVEL_AWAIT(c)){
         c->u->u_ste->ste_coroutine = 1;
     } else if (c->u->u_scope_type != COMPILER_SCOPE_ASYNC_FUNCTION){
         return compiler_error(c, "'async with' outside async function");
@@ -4877,7 +4884,7 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
         ADDOP(c, YIELD_FROM);
         break;
     case Await_kind:
-        if (!(c->c_flags->cf_flags & PyCF_ALLOW_TOP_LEVEL_AWAIT)){
+        if (!IS_TOP_LEVEL_AWAIT(c)){
             if (c->u->u_ste->ste_type != FunctionBlock){
                 return compiler_error(c, "'await' outside function");
             }
@@ -5820,7 +5827,7 @@ compute_code_flags(struct compiler *c)
     /* (Only) inherit compilerflags in PyCF_MASK */
     flags |= (c->c_flags->cf_flags & PyCF_MASK);
 
-    if ((c->c_flags->cf_flags & PyCF_ALLOW_TOP_LEVEL_AWAIT) &&
+    if ((IS_TOP_LEVEL_AWAIT(c)) &&
          ste->ste_coroutine &&
          !ste->ste_generator) {
         flags |= CO_COROUTINE;
index 197d9779b390c7c469acd86c90c4b8343a01041f..1360c0d91a33fa3ccced80aa0fb09df9da34fd6d 100644 (file)
@@ -584,7 +584,7 @@ PyErr_SetFromErrnoWithFilenameObjects(PyObject *exc, PyObject *filenameObject, P
 
 #ifndef MS_WINDOWS
     if (i != 0) {
-        char *s = strerror(i);
+        const char *s = strerror(i);
         message = PyUnicode_DecodeLocale(s, "surrogateescape");
     }
     else {
index 27a1731f46ded490c47b1dbf0120e92643c36d8e..299ccc08c44f8348ae3a13bbe69b9401eb607090 100644 (file)
@@ -4,7 +4,7 @@
 
 static const char cprt[] =
 "\
-Copyright (c) 2001-2019 Python Software Foundation.\n\
+Copyright (c) 2001-2020 Python Software Foundation.\n\
 All Rights Reserved.\n\
 \n\
 Copyright (c) 2000 BeOpen.com.\n\
index 1a7db3fce888ee5e9aa603411e097034203b1836..249ad1e8736075eedcf3331a4eb06493db75fd00 100644 (file)
@@ -105,7 +105,9 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
     if (option == L'-') {
         // Parse long option.
         if (*opt_ptr == L'\0') {
-            fprintf(stderr, "expected long option\n");
+            if (_PyOS_opterr) {
+                fprintf(stderr, "expected long option\n");
+            }
             return -1;
         }
         *longindex = 0;
@@ -115,7 +117,9 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
                 break;
         }
         if (!opt->name) {
-            fprintf(stderr, "unknown option %ls\n", argv[_PyOS_optind - 1]);
+            if (_PyOS_opterr) {
+                fprintf(stderr, "unknown option %ls\n", argv[_PyOS_optind - 1]);
+            }
             return '_';
         }
         opt_ptr = L"";
@@ -123,8 +127,10 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
             return opt->val;
         }
         if (_PyOS_optind >= argc) {
-            fprintf(stderr, "Argument expected for the %ls options\n",
-                    argv[_PyOS_optind - 1]);
+            if (_PyOS_opterr) {
+                fprintf(stderr, "Argument expected for the %ls options\n",
+                        argv[_PyOS_optind - 1]);
+            }
             return '_';
         }
         _PyOS_optarg = argv[_PyOS_optind++];
@@ -132,14 +138,16 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
     }
 
     if (option == 'J') {
-        if (_PyOS_opterr)
+        if (_PyOS_opterr) {
             fprintf(stderr, "-J is reserved for Jython\n");
+        }
         return '_';
     }
 
     if ((ptr = wcschr(SHORT_OPTS, option)) == NULL) {
-        if (_PyOS_opterr)
+        if (_PyOS_opterr) {
             fprintf(stderr, "Unknown option: -%c\n", (char)option);
+        }
         return '_';
     }
 
@@ -151,9 +159,10 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
 
         else {
             if (_PyOS_optind >= argc) {
-                if (_PyOS_opterr)
+                if (_PyOS_opterr) {
                     fprintf(stderr,
                         "Argument expected for the -%c option\n", (char)option);
+                }
                 return '_';
             }
 
index 38412596a37b024f76aeba044ff2f9afaade6af6..5efc8d7fabe8e33322b7179892967b1b8190a11b 100644 (file)
@@ -1864,7 +1864,7 @@ hamt_node_array_without(PyHamtNode_Array *self,
                     continue;
                 }
 
-                bitmap |= 1 << i;
+                bitmap |= 1U << i;
 
                 if (IS_BITMAP_NODE(node)) {
                     PyHamtNode_Bitmap *child = (PyHamtNode_Bitmap *)node;
index 495012d1c7da6642c900d2045a65a1941e23376a..b73fe2f93e26c293188f8d56289e1bad47e2683d 100644 (file)
@@ -300,6 +300,7 @@ _PyImport_Fini2(void)
 
     /* Free memory allocated by PyImport_ExtendInittab() */
     PyMem_RawFree(inittab_copy);
+    inittab_copy = NULL;
 
     PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
 }
@@ -1907,23 +1908,23 @@ PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals
 PyObject *
 PyImport_ReloadModule(PyObject *m)
 {
-    _Py_IDENTIFIER(imp);
+    _Py_IDENTIFIER(importlib);
     _Py_IDENTIFIER(reload);
     PyObject *reloaded_module = NULL;
-    PyObject *imp = _PyImport_GetModuleId(&PyId_imp);
-    if (imp == NULL) {
+    PyObject *importlib = _PyImport_GetModuleId(&PyId_importlib);
+    if (importlib == NULL) {
         if (PyErr_Occurred()) {
             return NULL;
         }
 
-        imp = PyImport_ImportModule("imp");
-        if (imp == NULL) {
+        importlib = PyImport_ImportModule("importlib");
+        if (importlib == NULL) {
             return NULL;
         }
     }
 
-    reloaded_module = _PyObject_CallMethodIdObjArgs(imp, &PyId_reload, m, NULL);
-    Py_DECREF(imp);
+    reloaded_module = _PyObject_CallMethodIdObjArgs(importlib, &PyId_reload, m, NULL);
+    Py_DECREF(importlib);
     return reloaded_module;
 }
 
index 6c9c4e8465523d8891a464055043f26fec388123..f013b41457fd4343be4e489572f9b360ef366889 100644 (file)
@@ -792,17 +792,17 @@ const unsigned char _Py_M__zipimport[] = {
     100,5,107,3,114,180,124,8,115,104,116,3,106,4,100,6,
     107,2,114,180,116,5,124,0,124,2,131,2,125,9,124,9,
     100,0,107,9,114,180,116,3,160,6,116,0,106,7,124,9,
-    161,2,125,10,122,20,116,8,160,9,124,4,124,10,124,3,
+    161,2,125,10,122,20,116,0,160,8,124,4,124,10,124,3,
     124,5,161,4,1,0,87,0,110,22,4,0,116,2,107,10,
     114,178,1,0,1,0,1,0,89,0,100,0,83,0,88,0,
-    110,84,116,10,124,0,124,2,131,2,92,2,125,11,125,12,
-    124,11,144,1,114,10,116,11,116,12,124,4,100,7,100,8,
-    133,2,25,0,131,1,124,11,131,2,114,246,116,12,124,4,
+    110,84,116,9,124,0,124,2,131,2,92,2,125,11,125,12,
+    124,11,144,1,114,10,116,10,116,11,124,4,100,7,100,8,
+    133,2,25,0,131,1,124,11,131,2,114,246,116,11,124,4,
     100,8,100,9,133,2,25,0,131,1,124,12,107,3,144,1,
-    114,10,116,13,160,14,100,10,124,3,155,2,157,2,161,1,
-    1,0,100,0,83,0,116,15,160,16,124,4,100,9,100,0,
-    133,2,25,0,161,1,125,13,116,17,124,13,116,18,131,2,
-    144,1,115,56,116,19,100,11,124,1,155,2,100,12,157,3,
+    114,10,116,12,160,13,100,10,124,3,155,2,157,2,161,1,
+    1,0,100,0,83,0,116,14,160,15,124,4,100,9,100,0,
+    133,2,25,0,161,1,125,13,116,16,124,13,116,17,131,2,
+    144,1,115,56,116,18,100,11,124,1,155,2,100,12,157,3,
     131,1,130,1,124,13,83,0,41,13,78,41,2,114,59,0,
     0,0,114,13,0,0,0,114,5,0,0,0,114,0,0,0,
     0,114,86,0,0,0,90,5,110,101,118,101,114,90,6,97,
@@ -811,273 +811,271 @@ const unsigned char _Py_M__zipimport[] = {
     115,32,115,116,97,108,101,32,102,111,114,32,122,16,99,111,
     109,112,105,108,101,100,32,109,111,100,117,108,101,32,122,21,
     32,105,115,32,110,111,116,32,97,32,99,111,100,101,32,111,
-    98,106,101,99,116,41,20,114,21,0,0,0,90,13,95,99,
+    98,106,101,99,116,41,19,114,21,0,0,0,90,13,95,99,
     108,97,115,115,105,102,121,95,112,121,99,114,75,0,0,0,
     218,4,95,105,109,112,90,21,99,104,101,99,107,95,104,97,
     115,104,95,98,97,115,101,100,95,112,121,99,115,218,15,95,
     103,101,116,95,112,121,99,95,115,111,117,114,99,101,218,11,
     115,111,117,114,99,101,95,104,97,115,104,90,17,95,82,65,
     87,95,77,65,71,73,67,95,78,85,77,66,69,82,90,18,
-    95,98,111,111,115,116,114,97,112,95,101,120,116,101,114,110,
-    97,108,90,18,95,118,97,108,105,100,97,116,101,95,104,97,
-    115,104,95,112,121,99,218,29,95,103,101,116,95,109,116,105,
-    109,101,95,97,110,100,95,115,105,122,101,95,111,102,95,115,
-    111,117,114,99,101,114,147,0,0,0,114,2,0,0,0,114,
-    76,0,0,0,114,77,0,0,0,218,7,109,97,114,115,104,
-    97,108,90,5,108,111,97,100,115,114,15,0,0,0,218,10,
-    95,99,111,100,101,95,116,121,112,101,218,9,84,121,112,101,
-    69,114,114,111,114,41,14,114,32,0,0,0,114,53,0,0,
-    0,114,63,0,0,0,114,38,0,0,0,114,126,0,0,0,
-    90,11,101,120,99,95,100,101,116,97,105,108,115,114,129,0,
-    0,0,90,10,104,97,115,104,95,98,97,115,101,100,90,12,
-    99,104,101,99,107,95,115,111,117,114,99,101,90,12,115,111,
-    117,114,99,101,95,98,121,116,101,115,114,150,0,0,0,90,
-    12,115,111,117,114,99,101,95,109,116,105,109,101,90,11,115,
-    111,117,114,99,101,95,115,105,122,101,114,46,0,0,0,114,
-    9,0,0,0,114,9,0,0,0,114,10,0,0,0,218,15,
-    95,117,110,109,97,114,115,104,97,108,95,99,111,100,101,75,
-    2,0,0,115,88,0,0,0,0,2,2,1,2,254,6,5,
-    2,1,18,1,14,1,8,2,12,1,4,1,12,1,10,1,
-    2,255,2,1,8,255,2,2,10,1,8,1,4,1,4,1,
-    2,254,4,5,2,1,4,1,2,0,2,0,2,0,2,255,
-    8,2,14,1,10,3,8,255,6,3,6,3,22,1,18,255,
-    4,2,4,1,8,255,4,2,4,2,18,1,12,1,16,1,
-    114,155,0,0,0,99,1,0,0,0,0,0,0,0,0,0,
-    0,0,1,0,0,0,4,0,0,0,67,0,0,0,115,28,
-    0,0,0,124,0,160,0,100,1,100,2,161,2,125,0,124,
-    0,160,0,100,3,100,2,161,2,125,0,124,0,83,0,41,
-    4,78,115,2,0,0,0,13,10,243,1,0,0,0,10,243,
-    1,0,0,0,13,41,1,114,19,0,0,0,41,1,218,6,
-    115,111,117,114,99,101,114,9,0,0,0,114,9,0,0,0,
-    114,10,0,0,0,218,23,95,110,111,114,109,97,108,105,122,
-    101,95,108,105,110,101,95,101,110,100,105,110,103,115,126,2,
-    0,0,115,6,0,0,0,0,1,12,1,12,1,114,159,0,
-    0,0,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
-    0,0,0,6,0,0,0,67,0,0,0,115,24,0,0,0,
-    116,0,124,1,131,1,125,1,116,1,124,1,124,0,100,1,
-    100,2,100,3,141,4,83,0,41,4,78,114,74,0,0,0,
-    84,41,1,90,12,100,111,110,116,95,105,110,104,101,114,105,
-    116,41,2,114,159,0,0,0,218,7,99,111,109,112,105,108,
-    101,41,2,114,53,0,0,0,114,158,0,0,0,114,9,0,
-    0,0,114,9,0,0,0,114,10,0,0,0,218,15,95,99,
-    111,109,112,105,108,101,95,115,111,117,114,99,101,133,2,0,
-    0,115,4,0,0,0,0,1,8,1,114,161,0,0,0,99,
-    2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,
-    11,0,0,0,67,0,0,0,115,68,0,0,0,116,0,160,
-    1,124,0,100,1,63,0,100,2,23,0,124,0,100,3,63,
-    0,100,4,64,0,124,0,100,5,64,0,124,1,100,6,63,
-    0,124,1,100,3,63,0,100,7,64,0,124,1,100,5,64,
-    0,100,8,20,0,100,9,100,9,100,9,102,9,161,1,83,
-    0,41,10,78,233,9,0,0,0,105,188,7,0,0,233,5,
-    0,0,0,233,15,0,0,0,233,31,0,0,0,233,11,0,
-    0,0,233,63,0,0,0,114,86,0,0,0,114,14,0,0,
-    0,41,2,114,131,0,0,0,90,6,109,107,116,105,109,101,
-    41,2,218,1,100,114,138,0,0,0,114,9,0,0,0,114,
-    9,0,0,0,114,10,0,0,0,218,14,95,112,97,114,115,
-    101,95,100,111,115,116,105,109,101,139,2,0,0,115,22,0,
-    0,0,0,1,4,1,10,1,10,1,6,1,6,1,10,1,
-    10,1,2,0,2,0,2,249,114,169,0,0,0,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,6,0,0,0,10,0,
-    0,0,67,0,0,0,115,116,0,0,0,122,82,124,1,100,
-    1,100,0,133,2,25,0,100,2,107,6,115,22,116,0,130,
-    1,124,1,100,0,100,1,133,2,25,0,125,1,124,0,106,
-    1,124,1,25,0,125,2,124,2,100,3,25,0,125,3,124,
-    2,100,4,25,0,125,4,124,2,100,5,25,0,125,5,116,
-    2,124,4,124,3,131,2,124,5,102,2,87,0,83,0,4,
-    0,116,3,116,4,116,5,102,3,107,10,114,110,1,0,1,
-    0,1,0,89,0,100,6,83,0,88,0,100,0,83,0,41,
-    7,78,114,14,0,0,0,169,2,218,1,99,218,1,111,114,
-    163,0,0,0,233,6,0,0,0,233,3,0,0,0,41,2,
-    114,0,0,0,0,114,0,0,0,0,41,6,218,14,65,115,
-    115,101,114,116,105,111,110,69,114,114,111,114,114,28,0,0,
-    0,114,169,0,0,0,114,26,0,0,0,218,10,73,110,100,
-    101,120,69,114,114,111,114,114,154,0,0,0,41,6,114,32,
-    0,0,0,114,13,0,0,0,114,54,0,0,0,114,131,0,
-    0,0,114,132,0,0,0,90,17,117,110,99,111,109,112,114,
-    101,115,115,101,100,95,115,105,122,101,114,9,0,0,0,114,
-    9,0,0,0,114,10,0,0,0,114,151,0,0,0,152,2,
-    0,0,115,20,0,0,0,0,1,2,2,20,1,12,1,10,
-    3,8,1,8,1,8,1,16,1,20,1,114,151,0,0,0,
-    99,2,0,0,0,0,0,0,0,0,0,0,0,3,0,0,
-    0,8,0,0,0,67,0,0,0,115,86,0,0,0,124,1,
-    100,1,100,0,133,2,25,0,100,2,107,6,115,20,116,0,
-    130,1,124,1,100,0,100,1,133,2,25,0,125,1,122,14,
-    124,0,106,1,124,1,25,0,125,2,87,0,110,22,4,0,
-    116,2,107,10,114,68,1,0,1,0,1,0,89,0,100,0,
-    83,0,88,0,116,3,124,0,106,4,124,2,131,2,83,0,
-    100,0,83,0,41,3,78,114,14,0,0,0,114,170,0,0,
-    0,41,5,114,175,0,0,0,114,28,0,0,0,114,26,0,
-    0,0,114,52,0,0,0,114,29,0,0,0,41,3,114,32,
-    0,0,0,114,13,0,0,0,114,54,0,0,0,114,9,0,
-    0,0,114,9,0,0,0,114,10,0,0,0,114,149,0,0,
-    0,171,2,0,0,115,14,0,0,0,0,2,20,1,12,2,
-    2,1,14,1,14,1,8,2,114,149,0,0,0,99,2,0,
-    0,0,0,0,0,0,0,0,0,0,11,0,0,0,9,0,
-    0,0,67,0,0,0,115,198,0,0,0,116,0,124,0,124,
-    1,131,2,125,2,116,1,68,0,93,160,92,3,125,3,125,
-    4,125,5,124,2,124,3,23,0,125,6,116,2,106,3,100,
-    1,124,0,106,4,116,5,124,6,100,2,100,3,141,5,1,
-    0,122,14,124,0,106,6,124,6,25,0,125,7,87,0,110,
-    20,4,0,116,7,107,10,114,88,1,0,1,0,1,0,89,
-    0,113,14,88,0,124,7,100,4,25,0,125,8,116,8,124,
-    0,106,4,124,7,131,2,125,9,124,4,114,132,116,9,124,
-    0,124,8,124,6,124,1,124,9,131,5,125,10,110,10,116,
-    10,124,8,124,9,131,2,125,10,124,10,100,0,107,8,114,
-    152,113,14,124,7,100,4,25,0,125,8,124,10,124,5,124,
-    8,102,3,2,0,1,0,83,0,113,14,116,11,100,5,124,
-    1,155,2,157,2,124,1,100,6,141,2,130,1,100,0,83,
-    0,41,7,78,122,13,116,114,121,105,110,103,32,123,125,123,
-    125,123,125,114,86,0,0,0,41,1,90,9,118,101,114,98,
-    111,115,105,116,121,114,0,0,0,0,114,57,0,0,0,114,
-    58,0,0,0,41,12,114,36,0,0,0,114,89,0,0,0,
-    114,76,0,0,0,114,77,0,0,0,114,29,0,0,0,114,
-    20,0,0,0,114,28,0,0,0,114,26,0,0,0,114,52,
-    0,0,0,114,155,0,0,0,114,161,0,0,0,114,3,0,
-    0,0,41,11,114,32,0,0,0,114,38,0,0,0,114,13,
-    0,0,0,114,90,0,0,0,114,91,0,0,0,114,47,0,
-    0,0,114,63,0,0,0,114,54,0,0,0,114,40,0,0,
-    0,114,126,0,0,0,114,46,0,0,0,114,9,0,0,0,
-    114,9,0,0,0,114,10,0,0,0,114,44,0,0,0,186,
-    2,0,0,115,36,0,0,0,0,1,10,1,14,1,8,1,
-    22,1,2,1,14,1,14,1,6,2,8,1,12,1,4,1,
-    18,2,10,1,8,3,2,1,8,1,16,2,114,44,0,0,
-    0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,2,0,0,0,64,0,0,0,115,60,0,0,0,101,
-    0,90,1,100,0,90,2,100,1,90,3,100,2,90,4,100,
-    3,100,4,132,0,90,5,100,5,100,6,132,0,90,6,100,
-    7,100,8,132,0,90,7,100,9,100,10,132,0,90,8,100,
-    11,100,12,132,0,90,9,100,13,83,0,41,14,114,80,0,
-    0,0,122,165,80,114,105,118,97,116,101,32,99,108,97,115,
-    115,32,117,115,101,100,32,116,111,32,115,117,112,112,111,114,
-    116,32,90,105,112,73,109,112,111,114,116,46,103,101,116,95,
-    114,101,115,111,117,114,99,101,95,114,101,97,100,101,114,40,
-    41,46,10,10,32,32,32,32,84,104,105,115,32,99,108,97,
-    115,115,32,105,115,32,97,108,108,111,119,101,100,32,116,111,
-    32,114,101,102,101,114,101,110,99,101,32,97,108,108,32,116,
-    104,101,32,105,110,110,97,114,100,115,32,97,110,100,32,112,
-    114,105,118,97,116,101,32,112,97,114,116,115,32,111,102,10,
-    32,32,32,32,116,104,101,32,122,105,112,105,109,112,111,114,
-    116,101,114,46,10,32,32,32,32,70,99,3,0,0,0,0,
-    0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,67,
-    0,0,0,115,16,0,0,0,124,1,124,0,95,0,124,2,
-    124,0,95,1,100,0,83,0,114,88,0,0,0,41,2,114,
-    4,0,0,0,114,38,0,0,0,41,3,114,32,0,0,0,
-    114,4,0,0,0,114,38,0,0,0,114,9,0,0,0,114,
-    9,0,0,0,114,10,0,0,0,114,34,0,0,0,220,2,
-    0,0,115,4,0,0,0,0,1,6,1,122,33,95,90,105,
-    112,73,109,112,111,114,116,82,101,115,111,117,114,99,101,82,
-    101,97,100,101,114,46,95,95,105,110,105,116,95,95,99,2,
-    0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,8,
-    0,0,0,67,0,0,0,115,92,0,0,0,124,0,106,0,
-    160,1,100,1,100,2,161,2,125,2,124,2,155,0,100,2,
-    124,1,155,0,157,3,125,3,100,3,100,4,108,2,109,3,
-    125,4,1,0,122,18,124,4,124,0,106,4,160,5,124,3,
-    161,1,131,1,87,0,83,0,4,0,116,6,107,10,114,86,
-    1,0,1,0,1,0,116,7,124,3,131,1,130,1,89,0,
-    110,2,88,0,100,0,83,0,41,5,78,114,85,0,0,0,
-    114,109,0,0,0,114,0,0,0,0,41,1,218,7,66,121,
-    116,101,115,73,79,41,8,114,38,0,0,0,114,19,0,0,
-    0,90,2,105,111,114,177,0,0,0,114,4,0,0,0,114,
-    55,0,0,0,114,22,0,0,0,218,17,70,105,108,101,78,
-    111,116,70,111,117,110,100,69,114,114,111,114,41,5,114,32,
-    0,0,0,218,8,114,101,115,111,117,114,99,101,218,16,102,
-    117,108,108,110,97,109,101,95,97,115,95,112,97,116,104,114,
-    13,0,0,0,114,177,0,0,0,114,9,0,0,0,114,9,
-    0,0,0,114,10,0,0,0,218,13,111,112,101,110,95,114,
-    101,115,111,117,114,99,101,224,2,0,0,115,14,0,0,0,
-    0,1,14,1,14,1,12,1,2,1,18,1,14,1,122,38,
-    95,90,105,112,73,109,112,111,114,116,82,101,115,111,117,114,
-    99,101,82,101,97,100,101,114,46,111,112,101,110,95,114,101,
-    115,111,117,114,99,101,99,2,0,0,0,0,0,0,0,0,
-    0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,
-    8,0,0,0,116,0,130,1,100,0,83,0,114,88,0,0,
-    0,41,1,114,178,0,0,0,41,2,114,32,0,0,0,114,
-    179,0,0,0,114,9,0,0,0,114,9,0,0,0,114,10,
-    0,0,0,218,13,114,101,115,111,117,114,99,101,95,112,97,
-    116,104,233,2,0,0,115,2,0,0,0,0,4,122,38,95,
-    90,105,112,73,109,112,111,114,116,82,101,115,111,117,114,99,
-    101,82,101,97,100,101,114,46,114,101,115,111,117,114,99,101,
-    95,112,97,116,104,99,2,0,0,0,0,0,0,0,0,0,
-    0,0,4,0,0,0,8,0,0,0,67,0,0,0,115,72,
-    0,0,0,124,0,106,0,160,1,100,1,100,2,161,2,125,
-    2,124,2,155,0,100,2,124,1,155,0,157,3,125,3,122,
-    16,124,0,106,2,160,3,124,3,161,1,1,0,87,0,110,
-    22,4,0,116,4,107,10,114,66,1,0,1,0,1,0,89,
-    0,100,3,83,0,88,0,100,4,83,0,41,5,78,114,85,
-    0,0,0,114,109,0,0,0,70,84,41,5,114,38,0,0,
-    0,114,19,0,0,0,114,4,0,0,0,114,55,0,0,0,
-    114,22,0,0,0,41,4,114,32,0,0,0,114,59,0,0,
-    0,114,180,0,0,0,114,13,0,0,0,114,9,0,0,0,
-    114,9,0,0,0,114,10,0,0,0,218,11,105,115,95,114,
-    101,115,111,117,114,99,101,239,2,0,0,115,14,0,0,0,
-    0,3,14,1,14,1,2,1,16,1,14,1,8,1,122,36,
-    95,90,105,112,73,109,112,111,114,116,82,101,115,111,117,114,
-    99,101,82,101,97,100,101,114,46,105,115,95,114,101,115,111,
-    117,114,99,101,99,1,0,0,0,0,0,0,0,0,0,0,
-    0,9,0,0,0,9,0,0,0,99,0,0,0,115,186,0,
-    0,0,100,1,100,2,108,0,109,1,125,1,1,0,124,1,
-    124,0,106,2,160,3,124,0,106,4,161,1,131,1,125,2,
-    124,2,160,5,124,0,106,2,106,6,161,1,125,3,124,3,
-    106,7,100,3,107,2,115,58,116,8,130,1,124,3,106,9,
-    125,4,116,10,131,0,125,5,124,0,106,2,106,11,68,0,
-    93,102,125,6,122,18,124,1,124,6,131,1,160,5,124,4,
-    161,1,125,7,87,0,110,24,4,0,116,12,107,10,114,124,
-    1,0,1,0,1,0,89,0,113,78,89,0,110,2,88,0,
-    124,7,106,9,106,7,125,8,116,13,124,8,131,1,100,1,
-    107,2,114,156,124,7,106,7,86,0,1,0,113,78,124,8,
-    124,5,107,7,114,78,124,5,160,14,124,8,161,1,1,0,
-    124,8,86,0,1,0,113,78,100,0,83,0,41,4,78,114,
-    0,0,0,0,41,1,218,4,80,97,116,104,114,60,0,0,
-    0,41,15,90,7,112,97,116,104,108,105,98,114,184,0,0,
-    0,114,4,0,0,0,114,56,0,0,0,114,38,0,0,0,
-    90,11,114,101,108,97,116,105,118,101,95,116,111,114,29,0,
-    0,0,114,59,0,0,0,114,175,0,0,0,90,6,112,97,
-    114,101,110,116,218,3,115,101,116,114,28,0,0,0,114,23,
-    0,0,0,114,51,0,0,0,218,3,97,100,100,41,9,114,
-    32,0,0,0,114,184,0,0,0,90,13,102,117,108,108,110,
-    97,109,101,95,112,97,116,104,90,13,114,101,108,97,116,105,
-    118,101,95,112,97,116,104,90,12,112,97,99,107,97,103,101,
-    95,112,97,116,104,90,12,115,117,98,100,105,114,115,95,115,
-    101,101,110,218,8,102,105,108,101,110,97,109,101,90,8,114,
-    101,108,97,116,105,118,101,90,11,112,97,114,101,110,116,95,
-    110,97,109,101,114,9,0,0,0,114,9,0,0,0,114,10,
-    0,0,0,218,8,99,111,110,116,101,110,116,115,250,2,0,
-    0,115,34,0,0,0,0,8,12,1,18,1,14,3,14,1,
-    6,1,6,1,12,1,2,1,18,1,14,1,10,5,8,1,
-    12,1,10,1,8,1,10,1,122,33,95,90,105,112,73,109,
-    112,111,114,116,82,101,115,111,117,114,99,101,82,101,97,100,
-    101,114,46,99,111,110,116,101,110,116,115,78,41,10,114,6,
-    0,0,0,114,7,0,0,0,114,8,0,0,0,114,84,0,
-    0,0,114,81,0,0,0,114,34,0,0,0,114,181,0,0,
-    0,114,182,0,0,0,114,183,0,0,0,114,188,0,0,0,
-    114,9,0,0,0,114,9,0,0,0,114,9,0,0,0,114,
-    10,0,0,0,114,80,0,0,0,212,2,0,0,115,14,0,
-    0,0,8,1,4,5,4,2,8,4,8,9,8,6,8,11,
-    114,80,0,0,0,41,45,114,84,0,0,0,90,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,21,0,0,0,114,1,0,
-    0,0,114,2,0,0,0,90,17,95,102,114,111,122,101,110,
-    95,105,109,112,111,114,116,108,105,98,114,76,0,0,0,114,
-    148,0,0,0,114,110,0,0,0,114,152,0,0,0,114,67,
-    0,0,0,114,131,0,0,0,90,7,95,95,97,108,108,95,
-    95,114,20,0,0,0,90,15,112,97,116,104,95,115,101,112,
-    97,114,97,116,111,114,115,114,18,0,0,0,114,75,0,0,
-    0,114,3,0,0,0,114,25,0,0,0,218,4,116,121,112,
-    101,114,70,0,0,0,114,113,0,0,0,114,115,0,0,0,
-    114,117,0,0,0,114,4,0,0,0,114,89,0,0,0,114,
-    36,0,0,0,114,37,0,0,0,114,35,0,0,0,114,27,
-    0,0,0,114,122,0,0,0,114,142,0,0,0,114,144,0,
-    0,0,114,52,0,0,0,114,147,0,0,0,114,155,0,0,
-    0,218,8,95,95,99,111,100,101,95,95,114,153,0,0,0,
-    114,159,0,0,0,114,161,0,0,0,114,169,0,0,0,114,
-    151,0,0,0,114,149,0,0,0,114,44,0,0,0,114,80,
-    0,0,0,114,9,0,0,0,114,9,0,0,0,114,9,0,
-    0,0,114,10,0,0,0,218,8,60,109,111,100,117,108,101,
-    62,1,0,0,0,115,88,0,0,0,4,16,8,1,16,1,
-    8,1,8,1,8,1,8,1,8,1,8,2,8,3,6,1,
-    14,3,16,4,4,2,8,2,4,1,4,1,4,2,14,127,
-    0,127,0,1,12,1,12,1,2,1,2,252,4,9,8,4,
-    8,9,8,31,8,126,2,254,2,29,4,5,8,21,8,46,
-    8,10,8,46,10,5,8,7,8,6,8,13,8,19,8,15,
-    8,26,
+    95,118,97,108,105,100,97,116,101,95,104,97,115,104,95,112,
+    121,99,218,29,95,103,101,116,95,109,116,105,109,101,95,97,
+    110,100,95,115,105,122,101,95,111,102,95,115,111,117,114,99,
+    101,114,147,0,0,0,114,2,0,0,0,114,76,0,0,0,
+    114,77,0,0,0,218,7,109,97,114,115,104,97,108,90,5,
+    108,111,97,100,115,114,15,0,0,0,218,10,95,99,111,100,
+    101,95,116,121,112,101,218,9,84,121,112,101,69,114,114,111,
+    114,41,14,114,32,0,0,0,114,53,0,0,0,114,63,0,
+    0,0,114,38,0,0,0,114,126,0,0,0,90,11,101,120,
+    99,95,100,101,116,97,105,108,115,114,129,0,0,0,90,10,
+    104,97,115,104,95,98,97,115,101,100,90,12,99,104,101,99,
+    107,95,115,111,117,114,99,101,90,12,115,111,117,114,99,101,
+    95,98,121,116,101,115,114,150,0,0,0,90,12,115,111,117,
+    114,99,101,95,109,116,105,109,101,90,11,115,111,117,114,99,
+    101,95,115,105,122,101,114,46,0,0,0,114,9,0,0,0,
+    114,9,0,0,0,114,10,0,0,0,218,15,95,117,110,109,
+    97,114,115,104,97,108,95,99,111,100,101,75,2,0,0,115,
+    88,0,0,0,0,2,2,1,2,254,6,5,2,1,18,1,
+    14,1,8,2,12,1,4,1,12,1,10,1,2,255,2,1,
+    8,255,2,2,10,1,8,1,4,1,4,1,2,254,4,5,
+    2,1,4,1,2,0,2,0,2,0,2,255,8,2,14,1,
+    10,3,8,255,6,3,6,3,22,1,18,255,4,2,4,1,
+    8,255,4,2,4,2,18,1,12,1,16,1,114,155,0,0,
+    0,99,1,0,0,0,0,0,0,0,0,0,0,0,1,0,
+    0,0,4,0,0,0,67,0,0,0,115,28,0,0,0,124,
+    0,160,0,100,1,100,2,161,2,125,0,124,0,160,0,100,
+    3,100,2,161,2,125,0,124,0,83,0,41,4,78,115,2,
+    0,0,0,13,10,243,1,0,0,0,10,243,1,0,0,0,
+    13,41,1,114,19,0,0,0,41,1,218,6,115,111,117,114,
+    99,101,114,9,0,0,0,114,9,0,0,0,114,10,0,0,
+    0,218,23,95,110,111,114,109,97,108,105,122,101,95,108,105,
+    110,101,95,101,110,100,105,110,103,115,126,2,0,0,115,6,
+    0,0,0,0,1,12,1,12,1,114,159,0,0,0,99,2,
+    0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,6,
+    0,0,0,67,0,0,0,115,24,0,0,0,116,0,124,1,
+    131,1,125,1,116,1,124,1,124,0,100,1,100,2,100,3,
+    141,4,83,0,41,4,78,114,74,0,0,0,84,41,1,90,
+    12,100,111,110,116,95,105,110,104,101,114,105,116,41,2,114,
+    159,0,0,0,218,7,99,111,109,112,105,108,101,41,2,114,
+    53,0,0,0,114,158,0,0,0,114,9,0,0,0,114,9,
+    0,0,0,114,10,0,0,0,218,15,95,99,111,109,112,105,
+    108,101,95,115,111,117,114,99,101,133,2,0,0,115,4,0,
+    0,0,0,1,8,1,114,161,0,0,0,99,2,0,0,0,
+    0,0,0,0,0,0,0,0,2,0,0,0,11,0,0,0,
+    67,0,0,0,115,68,0,0,0,116,0,160,1,124,0,100,
+    1,63,0,100,2,23,0,124,0,100,3,63,0,100,4,64,
+    0,124,0,100,5,64,0,124,1,100,6,63,0,124,1,100,
+    3,63,0,100,7,64,0,124,1,100,5,64,0,100,8,20,
+    0,100,9,100,9,100,9,102,9,161,1,83,0,41,10,78,
+    233,9,0,0,0,105,188,7,0,0,233,5,0,0,0,233,
+    15,0,0,0,233,31,0,0,0,233,11,0,0,0,233,63,
+    0,0,0,114,86,0,0,0,114,14,0,0,0,41,2,114,
+    131,0,0,0,90,6,109,107,116,105,109,101,41,2,218,1,
+    100,114,138,0,0,0,114,9,0,0,0,114,9,0,0,0,
+    114,10,0,0,0,218,14,95,112,97,114,115,101,95,100,111,
+    115,116,105,109,101,139,2,0,0,115,22,0,0,0,0,1,
+    4,1,10,1,10,1,6,1,6,1,10,1,10,1,2,0,
+    2,0,2,249,114,169,0,0,0,99,2,0,0,0,0,0,
+    0,0,0,0,0,0,6,0,0,0,10,0,0,0,67,0,
+    0,0,115,116,0,0,0,122,82,124,1,100,1,100,0,133,
+    2,25,0,100,2,107,6,115,22,116,0,130,1,124,1,100,
+    0,100,1,133,2,25,0,125,1,124,0,106,1,124,1,25,
+    0,125,2,124,2,100,3,25,0,125,3,124,2,100,4,25,
+    0,125,4,124,2,100,5,25,0,125,5,116,2,124,4,124,
+    3,131,2,124,5,102,2,87,0,83,0,4,0,116,3,116,
+    4,116,5,102,3,107,10,114,110,1,0,1,0,1,0,89,
+    0,100,6,83,0,88,0,100,0,83,0,41,7,78,114,14,
+    0,0,0,169,2,218,1,99,218,1,111,114,163,0,0,0,
+    233,6,0,0,0,233,3,0,0,0,41,2,114,0,0,0,
+    0,114,0,0,0,0,41,6,218,14,65,115,115,101,114,116,
+    105,111,110,69,114,114,111,114,114,28,0,0,0,114,169,0,
+    0,0,114,26,0,0,0,218,10,73,110,100,101,120,69,114,
+    114,111,114,114,154,0,0,0,41,6,114,32,0,0,0,114,
+    13,0,0,0,114,54,0,0,0,114,131,0,0,0,114,132,
+    0,0,0,90,17,117,110,99,111,109,112,114,101,115,115,101,
+    100,95,115,105,122,101,114,9,0,0,0,114,9,0,0,0,
+    114,10,0,0,0,114,151,0,0,0,152,2,0,0,115,20,
+    0,0,0,0,1,2,2,20,1,12,1,10,3,8,1,8,
+    1,8,1,16,1,20,1,114,151,0,0,0,99,2,0,0,
+    0,0,0,0,0,0,0,0,0,3,0,0,0,8,0,0,
+    0,67,0,0,0,115,86,0,0,0,124,1,100,1,100,0,
+    133,2,25,0,100,2,107,6,115,20,116,0,130,1,124,1,
+    100,0,100,1,133,2,25,0,125,1,122,14,124,0,106,1,
+    124,1,25,0,125,2,87,0,110,22,4,0,116,2,107,10,
+    114,68,1,0,1,0,1,0,89,0,100,0,83,0,88,0,
+    116,3,124,0,106,4,124,2,131,2,83,0,100,0,83,0,
+    41,3,78,114,14,0,0,0,114,170,0,0,0,41,5,114,
+    175,0,0,0,114,28,0,0,0,114,26,0,0,0,114,52,
+    0,0,0,114,29,0,0,0,41,3,114,32,0,0,0,114,
+    13,0,0,0,114,54,0,0,0,114,9,0,0,0,114,9,
+    0,0,0,114,10,0,0,0,114,149,0,0,0,171,2,0,
+    0,115,14,0,0,0,0,2,20,1,12,2,2,1,14,1,
+    14,1,8,2,114,149,0,0,0,99,2,0,0,0,0,0,
+    0,0,0,0,0,0,11,0,0,0,9,0,0,0,67,0,
+    0,0,115,198,0,0,0,116,0,124,0,124,1,131,2,125,
+    2,116,1,68,0,93,160,92,3,125,3,125,4,125,5,124,
+    2,124,3,23,0,125,6,116,2,106,3,100,1,124,0,106,
+    4,116,5,124,6,100,2,100,3,141,5,1,0,122,14,124,
+    0,106,6,124,6,25,0,125,7,87,0,110,20,4,0,116,
+    7,107,10,114,88,1,0,1,0,1,0,89,0,113,14,88,
+    0,124,7,100,4,25,0,125,8,116,8,124,0,106,4,124,
+    7,131,2,125,9,124,4,114,132,116,9,124,0,124,8,124,
+    6,124,1,124,9,131,5,125,10,110,10,116,10,124,8,124,
+    9,131,2,125,10,124,10,100,0,107,8,114,152,113,14,124,
+    7,100,4,25,0,125,8,124,10,124,5,124,8,102,3,2,
+    0,1,0,83,0,113,14,116,11,100,5,124,1,155,2,157,
+    2,124,1,100,6,141,2,130,1,100,0,83,0,41,7,78,
+    122,13,116,114,121,105,110,103,32,123,125,123,125,123,125,114,
+    86,0,0,0,41,1,90,9,118,101,114,98,111,115,105,116,
+    121,114,0,0,0,0,114,57,0,0,0,114,58,0,0,0,
+    41,12,114,36,0,0,0,114,89,0,0,0,114,76,0,0,
+    0,114,77,0,0,0,114,29,0,0,0,114,20,0,0,0,
+    114,28,0,0,0,114,26,0,0,0,114,52,0,0,0,114,
+    155,0,0,0,114,161,0,0,0,114,3,0,0,0,41,11,
+    114,32,0,0,0,114,38,0,0,0,114,13,0,0,0,114,
+    90,0,0,0,114,91,0,0,0,114,47,0,0,0,114,63,
+    0,0,0,114,54,0,0,0,114,40,0,0,0,114,126,0,
+    0,0,114,46,0,0,0,114,9,0,0,0,114,9,0,0,
+    0,114,10,0,0,0,114,44,0,0,0,186,2,0,0,115,
+    36,0,0,0,0,1,10,1,14,1,8,1,22,1,2,1,
+    14,1,14,1,6,2,8,1,12,1,4,1,18,2,10,1,
+    8,3,2,1,8,1,16,2,114,44,0,0,0,99,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,
+    0,0,64,0,0,0,115,60,0,0,0,101,0,90,1,100,
+    0,90,2,100,1,90,3,100,2,90,4,100,3,100,4,132,
+    0,90,5,100,5,100,6,132,0,90,6,100,7,100,8,132,
+    0,90,7,100,9,100,10,132,0,90,8,100,11,100,12,132,
+    0,90,9,100,13,83,0,41,14,114,80,0,0,0,122,165,
+    80,114,105,118,97,116,101,32,99,108,97,115,115,32,117,115,
+    101,100,32,116,111,32,115,117,112,112,111,114,116,32,90,105,
+    112,73,109,112,111,114,116,46,103,101,116,95,114,101,115,111,
+    117,114,99,101,95,114,101,97,100,101,114,40,41,46,10,10,
+    32,32,32,32,84,104,105,115,32,99,108,97,115,115,32,105,
+    115,32,97,108,108,111,119,101,100,32,116,111,32,114,101,102,
+    101,114,101,110,99,101,32,97,108,108,32,116,104,101,32,105,
+    110,110,97,114,100,115,32,97,110,100,32,112,114,105,118,97,
+    116,101,32,112,97,114,116,115,32,111,102,10,32,32,32,32,
+    116,104,101,32,122,105,112,105,109,112,111,114,116,101,114,46,
+    10,32,32,32,32,70,99,3,0,0,0,0,0,0,0,0,
+    0,0,0,3,0,0,0,2,0,0,0,67,0,0,0,115,
+    16,0,0,0,124,1,124,0,95,0,124,2,124,0,95,1,
+    100,0,83,0,114,88,0,0,0,41,2,114,4,0,0,0,
+    114,38,0,0,0,41,3,114,32,0,0,0,114,4,0,0,
+    0,114,38,0,0,0,114,9,0,0,0,114,9,0,0,0,
+    114,10,0,0,0,114,34,0,0,0,220,2,0,0,115,4,
+    0,0,0,0,1,6,1,122,33,95,90,105,112,73,109,112,
+    111,114,116,82,101,115,111,117,114,99,101,82,101,97,100,101,
+    114,46,95,95,105,110,105,116,95,95,99,2,0,0,0,0,
+    0,0,0,0,0,0,0,5,0,0,0,8,0,0,0,67,
+    0,0,0,115,92,0,0,0,124,0,106,0,160,1,100,1,
+    100,2,161,2,125,2,124,2,155,0,100,2,124,1,155,0,
+    157,3,125,3,100,3,100,4,108,2,109,3,125,4,1,0,
+    122,18,124,4,124,0,106,4,160,5,124,3,161,1,131,1,
+    87,0,83,0,4,0,116,6,107,10,114,86,1,0,1,0,
+    1,0,116,7,124,3,131,1,130,1,89,0,110,2,88,0,
+    100,0,83,0,41,5,78,114,85,0,0,0,114,109,0,0,
+    0,114,0,0,0,0,41,1,218,7,66,121,116,101,115,73,
+    79,41,8,114,38,0,0,0,114,19,0,0,0,90,2,105,
+    111,114,177,0,0,0,114,4,0,0,0,114,55,0,0,0,
+    114,22,0,0,0,218,17,70,105,108,101,78,111,116,70,111,
+    117,110,100,69,114,114,111,114,41,5,114,32,0,0,0,218,
+    8,114,101,115,111,117,114,99,101,218,16,102,117,108,108,110,
+    97,109,101,95,97,115,95,112,97,116,104,114,13,0,0,0,
+    114,177,0,0,0,114,9,0,0,0,114,9,0,0,0,114,
+    10,0,0,0,218,13,111,112,101,110,95,114,101,115,111,117,
+    114,99,101,224,2,0,0,115,14,0,0,0,0,1,14,1,
+    14,1,12,1,2,1,18,1,14,1,122,38,95,90,105,112,
+    73,109,112,111,114,116,82,101,115,111,117,114,99,101,82,101,
+    97,100,101,114,46,111,112,101,110,95,114,101,115,111,117,114,
+    99,101,99,2,0,0,0,0,0,0,0,0,0,0,0,2,
+    0,0,0,1,0,0,0,67,0,0,0,115,8,0,0,0,
+    116,0,130,1,100,0,83,0,114,88,0,0,0,41,1,114,
+    178,0,0,0,41,2,114,32,0,0,0,114,179,0,0,0,
+    114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,218,
+    13,114,101,115,111,117,114,99,101,95,112,97,116,104,233,2,
+    0,0,115,2,0,0,0,0,4,122,38,95,90,105,112,73,
+    109,112,111,114,116,82,101,115,111,117,114,99,101,82,101,97,
+    100,101,114,46,114,101,115,111,117,114,99,101,95,112,97,116,
+    104,99,2,0,0,0,0,0,0,0,0,0,0,0,4,0,
+    0,0,8,0,0,0,67,0,0,0,115,72,0,0,0,124,
+    0,106,0,160,1,100,1,100,2,161,2,125,2,124,2,155,
+    0,100,2,124,1,155,0,157,3,125,3,122,16,124,0,106,
+    2,160,3,124,3,161,1,1,0,87,0,110,22,4,0,116,
+    4,107,10,114,66,1,0,1,0,1,0,89,0,100,3,83,
+    0,88,0,100,4,83,0,41,5,78,114,85,0,0,0,114,
+    109,0,0,0,70,84,41,5,114,38,0,0,0,114,19,0,
+    0,0,114,4,0,0,0,114,55,0,0,0,114,22,0,0,
+    0,41,4,114,32,0,0,0,114,59,0,0,0,114,180,0,
+    0,0,114,13,0,0,0,114,9,0,0,0,114,9,0,0,
+    0,114,10,0,0,0,218,11,105,115,95,114,101,115,111,117,
+    114,99,101,239,2,0,0,115,14,0,0,0,0,3,14,1,
+    14,1,2,1,16,1,14,1,8,1,122,36,95,90,105,112,
+    73,109,112,111,114,116,82,101,115,111,117,114,99,101,82,101,
+    97,100,101,114,46,105,115,95,114,101,115,111,117,114,99,101,
+    99,1,0,0,0,0,0,0,0,0,0,0,0,9,0,0,
+    0,9,0,0,0,99,0,0,0,115,186,0,0,0,100,1,
+    100,2,108,0,109,1,125,1,1,0,124,1,124,0,106,2,
+    160,3,124,0,106,4,161,1,131,1,125,2,124,2,160,5,
+    124,0,106,2,106,6,161,1,125,3,124,3,106,7,100,3,
+    107,2,115,58,116,8,130,1,124,3,106,9,125,4,116,10,
+    131,0,125,5,124,0,106,2,106,11,68,0,93,102,125,6,
+    122,18,124,1,124,6,131,1,160,5,124,4,161,1,125,7,
+    87,0,110,24,4,0,116,12,107,10,114,124,1,0,1,0,
+    1,0,89,0,113,78,89,0,110,2,88,0,124,7,106,9,
+    106,7,125,8,116,13,124,8,131,1,100,1,107,2,114,156,
+    124,7,106,7,86,0,1,0,113,78,124,8,124,5,107,7,
+    114,78,124,5,160,14,124,8,161,1,1,0,124,8,86,0,
+    1,0,113,78,100,0,83,0,41,4,78,114,0,0,0,0,
+    41,1,218,4,80,97,116,104,114,60,0,0,0,41,15,90,
+    7,112,97,116,104,108,105,98,114,184,0,0,0,114,4,0,
+    0,0,114,56,0,0,0,114,38,0,0,0,90,11,114,101,
+    108,97,116,105,118,101,95,116,111,114,29,0,0,0,114,59,
+    0,0,0,114,175,0,0,0,90,6,112,97,114,101,110,116,
+    218,3,115,101,116,114,28,0,0,0,114,23,0,0,0,114,
+    51,0,0,0,218,3,97,100,100,41,9,114,32,0,0,0,
+    114,184,0,0,0,90,13,102,117,108,108,110,97,109,101,95,
+    112,97,116,104,90,13,114,101,108,97,116,105,118,101,95,112,
+    97,116,104,90,12,112,97,99,107,97,103,101,95,112,97,116,
+    104,90,12,115,117,98,100,105,114,115,95,115,101,101,110,218,
+    8,102,105,108,101,110,97,109,101,90,8,114,101,108,97,116,
+    105,118,101,90,11,112,97,114,101,110,116,95,110,97,109,101,
+    114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,218,
+    8,99,111,110,116,101,110,116,115,250,2,0,0,115,34,0,
+    0,0,0,8,12,1,18,1,14,3,14,1,6,1,6,1,
+    12,1,2,1,18,1,14,1,10,5,8,1,12,1,10,1,
+    8,1,10,1,122,33,95,90,105,112,73,109,112,111,114,116,
+    82,101,115,111,117,114,99,101,82,101,97,100,101,114,46,99,
+    111,110,116,101,110,116,115,78,41,10,114,6,0,0,0,114,
+    7,0,0,0,114,8,0,0,0,114,84,0,0,0,114,81,
+    0,0,0,114,34,0,0,0,114,181,0,0,0,114,182,0,
+    0,0,114,183,0,0,0,114,188,0,0,0,114,9,0,0,
+    0,114,9,0,0,0,114,9,0,0,0,114,10,0,0,0,
+    114,80,0,0,0,212,2,0,0,115,14,0,0,0,8,1,
+    4,5,4,2,8,4,8,9,8,6,8,11,114,80,0,0,
+    0,41,45,114,84,0,0,0,90,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,21,0,0,0,114,1,0,0,0,114,2,
+    0,0,0,90,17,95,102,114,111,122,101,110,95,105,109,112,
+    111,114,116,108,105,98,114,76,0,0,0,114,148,0,0,0,
+    114,110,0,0,0,114,152,0,0,0,114,67,0,0,0,114,
+    131,0,0,0,90,7,95,95,97,108,108,95,95,114,20,0,
+    0,0,90,15,112,97,116,104,95,115,101,112,97,114,97,116,
+    111,114,115,114,18,0,0,0,114,75,0,0,0,114,3,0,
+    0,0,114,25,0,0,0,218,4,116,121,112,101,114,70,0,
+    0,0,114,113,0,0,0,114,115,0,0,0,114,117,0,0,
+    0,114,4,0,0,0,114,89,0,0,0,114,36,0,0,0,
+    114,37,0,0,0,114,35,0,0,0,114,27,0,0,0,114,
+    122,0,0,0,114,142,0,0,0,114,144,0,0,0,114,52,
+    0,0,0,114,147,0,0,0,114,155,0,0,0,218,8,95,
+    95,99,111,100,101,95,95,114,153,0,0,0,114,159,0,0,
+    0,114,161,0,0,0,114,169,0,0,0,114,151,0,0,0,
+    114,149,0,0,0,114,44,0,0,0,114,80,0,0,0,114,
+    9,0,0,0,114,9,0,0,0,114,9,0,0,0,114,10,
+    0,0,0,218,8,60,109,111,100,117,108,101,62,1,0,0,
+    0,115,88,0,0,0,4,16,8,1,16,1,8,1,8,1,
+    8,1,8,1,8,1,8,2,8,3,6,1,14,3,16,4,
+    4,2,8,2,4,1,4,1,4,2,14,127,0,127,0,1,
+    12,1,12,1,2,1,2,252,4,9,8,4,8,9,8,31,
+    8,126,2,254,2,29,4,5,8,21,8,46,8,10,8,46,
+    10,5,8,7,8,6,8,13,8,19,8,15,8,26,
 };
index a30fdd1bab95423820671364c00e8d601ff50da7..a930b5d38fa26ba9ae16b98bddbd11efff35d08f 100644 (file)
@@ -63,7 +63,38 @@ static const char usage_3[] = "\
 -W arg : warning control; arg is action:message:category:module:lineno\n\
          also PYTHONWARNINGS=arg\n\
 -x     : skip first line of source, allowing use of non-Unix forms of #!cmd\n\
--X opt : set implementation-specific option\n\
+-X opt : set implementation-specific option. The following options are available:\n\
+\n\
+         -X faulthandler: enable faulthandler\n\
+         -X showrefcount: output the total reference count and number of used\n\
+             memory blocks when the program finishes or after each statement in the\n\
+             interactive interpreter. This only works on debug builds\n\
+         -X tracemalloc: start tracing Python memory allocations using the\n\
+             tracemalloc module. By default, only the most recent frame is stored in a\n\
+             traceback of a trace. Use -X tracemalloc=NFRAME to start tracing with a\n\
+             traceback limit of NFRAME frames\n\
+         -X showalloccount: output the total count of allocated objects for each\n\
+             type when the program finishes. This only works when Python was built with\n\
+             COUNT_ALLOCS defined\n\
+         -X importtime: show how long each import takes. It shows module name,\n\
+             cumulative time (including nested imports) and self time (excluding\n\
+             nested imports). Note that its output may be broken in multi-threaded\n\
+             application. Typical usage is python3 -X importtime -c 'import asyncio'\n\
+         -X dev: enable CPython’s “development mode”, introducing additional runtime\n\
+             checks which are too expensive to be enabled by default. Effect of the\n\
+             developer mode:\n\
+                * Add default warning filter, as -W default\n\
+                * Install debug hooks on memory allocators: see the PyMem_SetupDebugHooks() C function\n\
+                * Enable the faulthandler module to dump the Python traceback on a crash\n\
+                * Enable asyncio debug mode\n\
+                * Set the dev_mode attribute of sys.flags to True\n\
+                * io.IOBase destructor logs close() exceptions\n\
+         -X utf8: enable UTF-8 mode for operating system interfaces, overriding the default\n\
+             locale-aware mode. -X utf8=0 explicitly disables UTF-8 mode (even when it would\n\
+             otherwise activate automatically)\n\
+         -X pycache_prefix=PATH: enable writing .pyc files to a parallel tree rooted at the\n\
+             given directory instead of to the code tree\n\
+\n\
 --check-hash-based-pycs always|default|never:\n\
     control how Python invalidates hash-based .pyc files\n\
 ";
@@ -1113,6 +1144,17 @@ config_init_program_name(PyConfig *config)
             if (_PyStatus_EXCEPTION(status)) {
                 return status;
             }
+
+            /*
+             * This environment variable is used to communicate between
+             * the stub launcher and the real interpreter and isn't needed
+             * beyond this point.
+             *
+             * Clean up to avoid problems when launching other programs
+             * later on.
+             */
+            (void)unsetenv("__PYVENV_LAUNCHER__");
+
             return _PyStatus_OK();
         }
     }
index c6a06e8c239764a8688ac107d3474be61a591fd1..d3fee32380b58b814cdf69bad9211d4c252b1d39 100644 (file)
@@ -734,7 +734,7 @@ r_byte(RFILE *p)
     else {
         const char *ptr = r_string(1, p);
         if (ptr != NULL)
-            c = *(unsigned char *) ptr;
+            c = *(const unsigned char *) ptr;
     }
     return c;
 }
index 62558221077468a7e9a7768b5e05dac1c88c916d..7271af3ac5332f7b103ff39fca903e76ffadc479 100644 (file)
@@ -343,11 +343,11 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
                 if (flags & FLAG_SIZE_T)
                     n = va_arg(*p_va, Py_ssize_t);
                 else {
+                    n = va_arg(*p_va, int);
                     if (PyErr_WarnEx(PyExc_DeprecationWarning,
                                 "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) {
                         return NULL;
                     }
-                    n = va_arg(*p_va, int);
                 }
             }
             else
@@ -396,11 +396,11 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
                 if (flags & FLAG_SIZE_T)
                     n = va_arg(*p_va, Py_ssize_t);
                 else {
+                    n = va_arg(*p_va, int);
                     if (PyErr_WarnEx(PyExc_DeprecationWarning,
                                 "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) {
                         return NULL;
                     }
-                    n = va_arg(*p_va, int);
                 }
             }
             else
@@ -434,11 +434,11 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
                 if (flags & FLAG_SIZE_T)
                     n = va_arg(*p_va, Py_ssize_t);
                 else {
+                    n = va_arg(*p_va, int);
                     if (PyErr_WarnEx(PyExc_DeprecationWarning,
                                 "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) {
                         return NULL;
                     }
-                    n = va_arg(*p_va, int);
                 }
             }
             else
index 7f3fdcc103f7b01eb19a08679ff36d078351d420..258ff613a066c1ce2828ab817d8e5be2c17d2146 100644 (file)
@@ -150,7 +150,7 @@ _PyWideStringList_Join(const PyWideStringList *list, wchar_t sep)
 static PyStatus
 _PyPathConfig_InitDLLPath(void)
 {
-    if (_Py_dll_path == NULL) {
+    if (_Py_dll_path != NULL) {
         /* Already set: nothing to do */
         return _PyStatus_OK();
     }
index 4c0b929586fc16e59f6917dfe6c9c1c858299275..c0355ae686afd2272b2ad1639b2021544b8b4bae 100644 (file)
@@ -366,7 +366,7 @@ static PyHash_FuncDef PyHash_Func = {fnv, "fnv", 8 * SIZEOF_PY_HASH_T,
 static uint64_t
 siphash24(uint64_t k0, uint64_t k1, const void *src, Py_ssize_t src_sz) {
     uint64_t b = (uint64_t)src_sz << 56;
-    const uint8_t *in = (uint8_t*)src;
+    const uint8_t *in = (const uint8_t*)src;
 
     uint64_t v0 = k0 ^ 0x736f6d6570736575ULL;
     uint64_t v1 = k1 ^ 0x646f72616e646f6dULL;
@@ -412,13 +412,6 @@ siphash24(uint64_t k0, uint64_t k1, const void *src, Py_ssize_t src_sz) {
     return t;
 }
 
-static Py_hash_t
-pysiphash(const void *src, Py_ssize_t src_sz) {
-    return (Py_hash_t)siphash24(
-        _le64toh(_Py_HashSecret.siphash.k0), _le64toh(_Py_HashSecret.siphash.k1),
-        src, src_sz);
-}
-
 uint64_t
 _Py_KeyedHash(uint64_t key, const void *src, Py_ssize_t src_sz)
 {
@@ -427,6 +420,13 @@ _Py_KeyedHash(uint64_t key, const void *src, Py_ssize_t src_sz)
 
 
 #if Py_HASH_ALGORITHM == Py_HASH_SIPHASH24
+static Py_hash_t
+pysiphash(const void *src, Py_ssize_t src_sz) {
+    return (Py_hash_t)siphash24(
+        _le64toh(_Py_HashSecret.siphash.k0), _le64toh(_Py_HashSecret.siphash.k1),
+        src, src_sz);
+}
+
 static PyHash_FuncDef PyHash_Func = {pysiphash, "siphash24", 64, 128};
 #endif
 
index feb928523924010ae3dedfb8f253a722e66a1c12..27cebf33da544b79bbe7c0e5664aeeb4a5dcb7e8 100644 (file)
@@ -2311,7 +2311,7 @@ init_signals(void)
 #ifdef SIGXFSZ
     PyOS_setsig(SIGXFSZ, SIG_IGN);
 #endif
-    PyOS_InitInterrupts(); /* May imply initsignal() */
+    PyOS_InitInterrupts(); /* May imply init_signals() */
     if (PyErr_Occurred()) {
         return _PyStatus_ERR("can't import signal");
     }
index aba673c00a432233d38700718e3d5797b8b45a5a..3e1085568b61a4220f6eced52ac563442fc4d929 100644 (file)
@@ -606,13 +606,12 @@ new_threadstate(PyInterpreterState *interp, int init)
     tstate->context = NULL;
     tstate->context_ver = 1;
 
-    tstate->id = ++interp->tstate_next_unique_id;
-
     if (init) {
         _PyThreadState_Init(runtime, tstate);
     }
 
     HEAD_LOCK(runtime);
+    tstate->id = ++interp->tstate_next_unique_id;
     tstate->prev = NULL;
     tstate->next = interp->tstate_head;
     if (tstate->next)
@@ -763,11 +762,19 @@ PyThreadState_Clear(PyThreadState *tstate)
 {
     int verbose = tstate->interp->config.verbose;
 
-    if (verbose && tstate->frame != NULL)
+    if (verbose && tstate->frame != NULL) {
+        /* bpo-20526: After the main thread calls
+           _PyRuntimeState_SetFinalizing() in Py_FinalizeEx(), threads must
+           exit when trying to take the GIL. If a thread exit in the middle of
+           _PyEval_EvalFrameDefault(), tstate->frame is not reset to its
+           previous value. It is more likely with daemon threads, but it can
+           happen with regular threads if threading._shutdown() fails
+           (ex: interrupted by CTRL+C). */
         fprintf(stderr,
           "PyThreadState_Clear: warning: thread still has a frame\n");
+    }
 
-    Py_CLEAR(tstate->frame);
+    /* Don't clear tstate->frame: it is a borrowed reference */
 
     Py_CLEAR(tstate->dict);
     Py_CLEAR(tstate->async_exc);
index b8713588b9a91495c9c9a0702fa03d1970cfee36..30482d99b3ca927c2034c0e3e84fb202179b2756 100644 (file)
@@ -1717,6 +1717,8 @@ static int
 symtable_visit_annotations(struct symtable *st, stmt_ty s,
                            arguments_ty a, expr_ty returns)
 {
+    if (a->posonlyargs && !symtable_visit_argannotations(st, a->posonlyargs))
+        return 0;
     if (a->args && !symtable_visit_argannotations(st, a->args))
         return 0;
     if (a->vararg && a->vararg->annotation)
index da4b6e1a7806b0e4c04b82fcbf0ee6c9130bb56e..b544f2b793ec99860ed2c5d61a8ae6d9e6ed80f1 100644 (file)
@@ -1178,6 +1178,51 @@ static PyStructSequence_Desc asyncgen_hooks_desc = {
     2
 };
 
+static int
+set_async_gen_firstiter(PyObject *firstiter)
+{
+    PyThreadState *tstate = _PyThreadState_GET();
+
+    if (PySys_Audit("sys.set_asyncgen_hook_firstiter", NULL) < 0) {
+        return -1;
+    }
+
+    Py_XINCREF(firstiter);
+    Py_XSETREF(tstate->async_gen_firstiter, firstiter);
+    return 0;
+}
+
+void
+_PyEval_SetAsyncGenFirstiter(PyObject *firstiter)
+{
+    if (set_async_gen_firstiter(firstiter) < 0) {
+        PyErr_WriteUnraisable(NULL);
+    }
+}
+
+static int
+set_async_gen_finalizer(PyObject *finalizer)
+{
+    PyThreadState *tstate = _PyThreadState_GET();
+
+    if (PySys_Audit("sys.set_asyncgen_hook_finalizer", NULL) < 0) {
+        return -1;
+    }
+
+    Py_XINCREF(finalizer);
+    Py_XSETREF(tstate->async_gen_finalizer, finalizer);
+    return 0;
+}
+
+void
+_PyEval_SetAsyncGenFinalizer(PyObject *finalizer)
+{
+    if (set_async_gen_finalizer(finalizer) < 0) {
+        PyErr_WriteUnraisable(NULL);
+    }
+}
+
+
 static PyObject *
 sys_set_asyncgen_hooks(PyObject *self, PyObject *args, PyObject *kw)
 {
@@ -1198,10 +1243,12 @@ sys_set_asyncgen_hooks(PyObject *self, PyObject *args, PyObject *kw)
                          Py_TYPE(finalizer)->tp_name);
             return NULL;
         }
-        _PyEval_SetAsyncGenFinalizer(finalizer);
+        if (set_async_gen_finalizer(finalizer) < 0) {
+            return NULL;
+        }
     }
-    else if (finalizer == Py_None) {
-        _PyEval_SetAsyncGenFinalizer(NULL);
+    else if (finalizer == Py_None && set_async_gen_finalizer(NULL) < 0) {
+        return NULL;
     }
 
     if (firstiter && firstiter != Py_None) {
@@ -1211,10 +1258,12 @@ sys_set_asyncgen_hooks(PyObject *self, PyObject *args, PyObject *kw)
                          Py_TYPE(firstiter)->tp_name);
             return NULL;
         }
-        _PyEval_SetAsyncGenFirstiter(firstiter);
+        if (set_async_gen_firstiter(firstiter) < 0) {
+            return NULL;
+        }
     }
-    else if (firstiter == Py_None) {
-        _PyEval_SetAsyncGenFirstiter(NULL);
+    else if (firstiter == Py_None && set_async_gen_firstiter(NULL) < 0) {
+        return NULL;
     }
 
     Py_RETURN_NONE;
index a5246dd0504dbb7722147563d49e183cc32084d5..23d585cf9fa6c00f3038ef48a83a5b9fac236440 100644 (file)
@@ -75,16 +75,16 @@ EnterNonRecursiveMutex(PNRMUTEX mutex, DWORD milliseconds)
         }
     } else if (milliseconds != 0) {
         /* wait at least until the target */
-        DWORD now, target = GetTickCount() + milliseconds;
+        ULONGLONG now, target = GetTickCount64() + milliseconds;
         while (mutex->locked) {
             if (PyCOND_TIMEDWAIT(&mutex->cv, &mutex->cs, (long long)milliseconds*1000) < 0) {
                 result = WAIT_FAILED;
                 break;
             }
-            now = GetTickCount();
+            now = GetTickCount64();
             if (target <= now)
                 break;
-            milliseconds = target-now;
+            milliseconds = (DWORD)(target-now);
         }
     }
     if (!mutex->locked) {
index d14f2b3ad99a68cbc08e4d9e933e97b5e3e28315..ae71b671111de7e37a80ae3ad753a398a5bce9ad 100644 (file)
@@ -1,4 +1,4 @@
-This is Python version 3.8.1
+This is Python version 3.8.3
 ============================
 
 .. image:: https://travis-ci.org/python/cpython.svg?branch=3.8
@@ -18,7 +18,7 @@ This is Python version 3.8.1
    :target: https://python.zulipchat.com
 
 
-Copyright (c) 2001-2019 Python Software Foundation.  All rights reserved.
+Copyright (c) 2001-2020 Python Software Foundation.  All rights reserved.
 
 See the end of this file for further copyright and license information.
 
@@ -246,7 +246,7 @@ See :pep:`569` for Python 3.8 release details.
 Copyright and License Information
 ---------------------------------
 
-Copyright (c) 2001-2019 Python Software Foundation.  All rights reserved.
+Copyright (c) 2001-2020 Python Software Foundation.  All rights reserved.
 
 Copyright (c) 2000 BeOpen.com.  All rights reserved.
 
index e099590a3326c0753a0eaabd652045691408d47b..77f5f9696a6d848f92558b7210e2b4593a96f4fb 100644 (file)
@@ -141,23 +141,15 @@ class Monitor:
         token = fields[0].lower()
         condition = ' '.join(fields[1:]).strip()
 
-        if_tokens = {'if', 'ifdef', 'ifndef'}
-        all_tokens = if_tokens | {'elif', 'else', 'endif'}
-
-        if token not in all_tokens:
-            return
-
-        # cheat a little here, to reuse the implementation of if
-        if token == 'elif':
-            pop_stack()
-            token = 'if'
-
-        if token in if_tokens:
+        if token in {'if', 'ifdef', 'ifndef', 'elif'}:
             if not condition:
                 self.fail("Invalid format for #" + token + " line: no argument!")
-            if token == 'if':
+            if token in {'if', 'elif'}:
                 if not self.is_a_simple_defined(condition):
                     condition = "(" + condition + ")"
+                if token == 'elif':
+                    previous_token, previous_condition = pop_stack()
+                    self.stack.append((previous_token, negate(previous_condition)))
             else:
                 fields = condition.split()
                 if len(fields) != 1:
@@ -166,18 +158,21 @@ class Monitor:
                 condition = 'defined(' + symbol + ')'
                 if token == 'ifndef':
                     condition = '!' + condition
+                token = 'if'
 
-            self.stack.append(("if", condition))
-            if self.verbose:
-                print(self.status())
-            return
+            self.stack.append((token, condition))
 
-        previous_token, previous_condition = pop_stack()
+        elif token == 'else':
+            previous_token, previous_condition = pop_stack()
+            self.stack.append((previous_token, negate(previous_condition)))
 
-        if token == 'else':
-            self.stack.append(('else', negate(previous_condition)))
         elif token == 'endif':
-            pass
+            while pop_stack()[0] != 'if':
+                pass
+
+        else:
+            return
+
         if self.verbose:
             print(self.status())
 
index 93f997c21e7706dbb90df78f0ae0c89593c892d1..ffb1813720e45b8c6a8f626b77b025c70a353d93 100755 (executable)
@@ -99,6 +99,8 @@ hexdigits = "0123456789abcdef"
 
 ENCODING = locale.getpreferredencoding()
 
+FRAME_INFO_OPTIMIZED_OUT = '(frame information optimized out)'
+UNABLE_READ_INFO_PYTHON_FRAME = 'Unable to read information on python frame'
 EVALFRAME = '_PyEval_EvalFrameDefault'
 
 class NullPyObjectPtr(RuntimeError):
@@ -918,7 +920,7 @@ class PyFrameObjectPtr(PyObjectPtr):
     def filename(self):
         '''Get the path of the current Python source file, as a string'''
         if self.is_optimized_out():
-            return '(frame information optimized out)'
+            return FRAME_INFO_OPTIMIZED_OUT
         return self.co_filename.proxyval(set())
 
     def current_line_num(self):
@@ -949,7 +951,7 @@ class PyFrameObjectPtr(PyObjectPtr):
         '''Get the text of the current source line as a string, with a trailing
         newline character'''
         if self.is_optimized_out():
-            return '(frame information optimized out)'
+            return FRAME_INFO_OPTIMIZED_OUT
 
         lineno = self.current_line_num()
         if lineno is None:
@@ -970,7 +972,7 @@ class PyFrameObjectPtr(PyObjectPtr):
 
     def write_repr(self, out, visited):
         if self.is_optimized_out():
-            out.write('(frame information optimized out)')
+            out.write(FRAME_INFO_OPTIMIZED_OUT)
             return
         lineno = self.current_line_num()
         lineno = str(lineno) if lineno is not None else "?"
@@ -993,7 +995,7 @@ class PyFrameObjectPtr(PyObjectPtr):
 
     def print_traceback(self):
         if self.is_optimized_out():
-            sys.stdout.write('  (frame information optimized out)\n')
+            sys.stdout.write('  %s\n' % FRAME_INFO_OPTIMIZED_OUT)
             return
         visited = set()
         lineno = self.current_line_num()
@@ -1600,7 +1602,7 @@ class Frame(object):
         # This assumes the _POSIX_THREADS version of Python/ceval_gil.h:
         name = self._gdbframe.name()
         if name:
-            return 'pthread_cond_timedwait' in name
+            return (name == 'take_gil')
 
     def is_gc_collect(self):
         '''Is this frame "collect" within the garbage-collector?'''
@@ -1744,7 +1746,7 @@ class PyList(gdb.Command):
 
         pyop = frame.get_pyop()
         if not pyop or pyop.is_optimized_out():
-            print('Unable to read information on python frame')
+            print(UNABLE_READ_INFO_PYTHON_FRAME)
             return
 
         filename = pyop.filename()
@@ -1904,7 +1906,7 @@ class PyPrint(gdb.Command):
 
         pyop_frame = frame.get_pyop()
         if not pyop_frame:
-            print('Unable to read information on python frame')
+            print(UNABLE_READ_INFO_PYTHON_FRAME)
             return
 
         pyop_var, scope = pyop_frame.get_var_by_name(name)
@@ -1938,7 +1940,7 @@ class PyLocals(gdb.Command):
 
         pyop_frame = frame.get_pyop()
         if not pyop_frame:
-            print('Unable to read information on python frame')
+            print(UNABLE_READ_INFO_PYTHON_FRAME)
             return
 
         for pyop_name, pyop_value in pyop_frame.iter_locals():
index 326766bf2d473fd2aa179a8b0cdff633e811b9b3..be44f442f7c9d8a5112979476d5cb6962f9ab1c7 100644 (file)
@@ -11,6 +11,9 @@
         <SuppressICEs>ICE43</SuppressICEs>
     </PropertyGroup>
     <Import Project="..\msi.props" />
+    <PropertyGroup Condition="exists('$(BuildPath)vcruntime140_1.dll')">
+        <DefineConstants>$(DefineConstants);Include_Vcruntime140_1_dll=1</DefineConstants>
+    </PropertyGroup>
     <ItemGroup>
         <Compile Include="exe.wxs" />
         <Compile Include="exe_files.wxs" />
index 483d06c65b2e573c76f79678d74d737f89806db4..15bf6a06634bf208fd34a8817ad108ffc906cd5f 100644 (file)
                 </RegistryKey>
             </Component>
             <Component Id="vcruntime140.dll" Directory="InstallDirectory" Guid="*">
-                <File Name="vcruntime140.dll" Source="!(bindpath.redist)vcruntime140.dll" KeyPath="yes" />
+                <File Name="vcruntime140.dll" Source="vcruntime140.dll" KeyPath="yes" />
             </Component>
+<?ifdef Include_Vcruntime140_1_dll ?>
+            <Component Id="vcruntime140_1.dll" Directory="InstallDirectory" Guid="*">
+                <File Name="vcruntime140_1.dll" Source="vcruntime140_1.dll" KeyPath="yes" />
+            </Component>
+<?endif ?>
         </ComponentGroup>
     </Fragment>
 
index 79617c4ea83c0ec71d4309916d8b88704b57df35..0fd0d30416cad408b0cb10cf78c4042cd97205c2 100644 (file)
@@ -33,7 +33,7 @@
         \r
         <PackageArguments Condition="$(Packages) != ''">"$(IntermediateOutputPath)pkg\pip.exe" -B -m pip install -U $(Packages)</PackageArguments>\r
         \r
-        <NugetPackCommand>"$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" -BasePath "$(IntermediateOutputPath)pkg"</NugetPackCommand>\r
+        <NugetPackCommand>"$(Nuget)" pack "$(IntermediateOutputPath)pkg\python.nuspec" -BasePath "$(IntermediateOutputPath)pkg"</NugetPackCommand>\r
         <NugetPackSymbolsCommand Condition="Exists('$(MSBuildThisFileDirectory)\$(OutputName).symbols.nuspec')">"$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).symbols.nuspec" -BasePath "$(BuildPath.TrimEnd(`\`))"</NugetPackSymbolsCommand>\r
         <NugetArguments>$(NugetArguments) -OutputDirectory "$(OutputPath.Trim(`\`))"</NugetArguments>\r
         <NugetArguments>$(NugetArguments) -Version "$(NuspecVersion)"</NugetArguments>\r
index a5cc000676b0227e961213ca76f6219ac34bb5b4..0642b84dcfc8288741df547a249d36ecdc69ea47 100644 (file)
@@ -556,7 +556,17 @@ class Unparser:
     def _Subscript(self, t):
         self.dispatch(t.value)
         self.write("[")
-        self.dispatch(t.slice)
+        if (isinstance(t.slice, ast.Index)
+                and isinstance(t.slice.value, ast.Tuple)
+                and t.slice.value.elts):
+            if len(t.slice.value.elts) == 1:
+                elt = t.slice.value.elts[0]
+                self.dispatch(elt)
+                self.write(",")
+            else:
+                interleave(lambda: self.write(", "), self.dispatch, t.slice.value.elts)
+        else:
+            self.dispatch(t.slice)
         self.write("]")
 
     def _Starred(self, t):
@@ -581,7 +591,12 @@ class Unparser:
             self.dispatch(t.step)
 
     def _ExtSlice(self, t):
-        interleave(lambda: self.write(', '), self.dispatch, t.dims)
+        if len(t.dims) == 1:
+            elt = t.dims[0]
+            self.dispatch(elt)
+            self.write(",")
+        else:
+            interleave(lambda: self.write(', '), self.dispatch, t.dims)
 
     # argument
     def _arg(self, t):
index 3fb49852f4c25f3917ea5c1f49cbdb4c68e1fbb9..d60f352882e3069b3f4fb3fc34adcb44ab336813 100755 (executable)
@@ -11,6 +11,7 @@ It takes two arguments:
 """
 
 import datetime
+import glob
 import os
 import re
 import sys
@@ -18,7 +19,7 @@ import _ssl
 
 
 def parse_error_codes(h_file, prefix, libcode):
-    pat = re.compile(r"#define\W+(%s([\w]+))\W+(\d+)\b" % re.escape(prefix))
+    pat = re.compile(r"#\s*define\W+(%s([\w]+))\W+(\d+)\b" % re.escape(prefix))
     codes = []
     with open(h_file, "r", encoding="latin1") as f:
         for line in f:
@@ -28,6 +29,7 @@ def parse_error_codes(h_file, prefix, libcode):
                 num = int(num)
                 # e.g. ("SSL_R_BAD_DATA", ("ERR_LIB_SSL", "BAD_DATA", 390))
                 codes.append((code, (libcode, name, num)))
+    assert codes, f"no codes found in {h_file}"
     return codes
 
 if __name__ == "__main__":
@@ -35,18 +37,27 @@ if __name__ == "__main__":
     outfile = sys.argv[2]
     use_stdout = outfile == '-'
     f = sys.stdout if use_stdout else open(outfile, "w")
-    error_libraries = {
-        # mnemonic -> (library code, error prefix, header file)
-        'PEM': ('ERR_LIB_PEM', 'PEM_R_', 'crypto/pem/pem.h'),
-        'SSL': ('ERR_LIB_SSL', 'SSL_R_', 'ssl/ssl.h'),
-        'X509': ('ERR_LIB_X509', 'X509_R_', 'crypto/x509/x509.h'),
-        }
+    # mnemonic -> (library code, error prefix, header file)
+    error_libraries = {}
+    for error_header in glob.glob(os.path.join(openssl_inc, 'include/openssl/*err.h')):
+        base = os.path.basename(error_header)
+        if base in ('buffererr.h', 'objectserr.h', 'storeerr.h'):
+            # Deprecated in 3.0.
+            continue
+        mnemonic = base[:-5].upper()
+        if mnemonic == "":
+            # err.h
+            lib_codes = {
+                code: num
+                for (code, (_, _, num)) in parse_error_codes(error_header, 'ERR_LIB_', None)
+            }
+        else:
+            error_libraries[mnemonic] = (f'ERR_LIB_{mnemonic}', f'{mnemonic}_R_', error_header)
 
     # Read codes from libraries
     new_codes = []
     for libcode, prefix, h_file in sorted(error_libraries.values()):
-        new_codes += parse_error_codes(os.path.join(openssl_inc, h_file),
-                                       prefix, libcode)
+        new_codes += parse_error_codes(h_file, prefix, libcode)
     new_code_nums = set((libcode, num)
                         for (code, (libcode, name, num)) in new_codes)
 
@@ -69,7 +80,9 @@ if __name__ == "__main__":
 
     w("static struct py_ssl_library_code library_codes[] = {")
     for mnemo, (libcode, _, _) in sorted(error_libraries.items()):
+        w(f'#ifdef {libcode}')
         w('    {"%s", %s},' % (mnemo, libcode))
+        w('#endif')
     w('    { NULL }')
     w('};')
     w("")
@@ -79,7 +92,7 @@ if __name__ == "__main__":
         w('  #ifdef %s' % (errcode))
         w('    {"%s", %s, %s},' % (name, libcode, errcode))
         w('  #else')
-        w('    {"%s", %s, %d},' % (name, libcode, num))
+        w('    {"%s", %s, %d},' % (name, lib_codes[libcode], num))
         w('  #endif')
     w('    { NULL }')
     w('};')
index d816810d57078d70307cd1a7ffc1d8db5e1c5a2e..05d6d7de296db9fdc22a973198522448fa97fd82 100755 (executable)
@@ -47,7 +47,7 @@ OPENSSL_OLD_VERSIONS = [
 OPENSSL_RECENT_VERSIONS = [
     "1.0.2t",
     "1.1.0l",
-    "1.1.1d",
+    "1.1.1f",
 ]
 
 LIBRESSL_OLD_VERSIONS = [
index 85f00dd5fac7f29e62deeec32f203a48231a6b08..f98db73656d305f38cefecb8e2765e655d6c6f80 100644 (file)
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.15 -*- Autoconf -*-
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index 0914e24704383237f966248a165a264bdccff244..88865616457621571e73667a72002e20df34e9b3 100755 (executable)
--- a/configure
+++ b/configure
@@ -782,6 +782,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -825,6 +826,7 @@ with_libs
 with_system_expat
 with_system_ffi
 with_system_libmpdec
+with_decimal_contextvar
 enable_loadable_sqlite_extensions
 with_tcltk_includes
 with_tcltk_libs
@@ -895,6 +897,7 @@ 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}'
@@ -1147,6 +1150,15 @@ 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=* \
@@ -1284,7 +1296,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
+               libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1437,6 +1449,7 @@ 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]
@@ -1517,6 +1530,9 @@ Optional Packages:
   --with-system-ffi       build _ctypes module using an installed ffi library
   --with-system-libmpdec  build _decimal module using an installed libmpdec
                           library
+  --with-decimal-contextvar
+                          build _decimal module using a coroutine-local rather
+                          than a thread-local context (default is yes)
   --with-tcltk-includes='-I...'
                           override search for Tcl and Tk include files
   --with-tcltk-libs='-L...'
@@ -3405,6 +3421,12 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h
     define_xopen_source=no
     ;;
 
+  # On HP-UX, defining _XOPEN_SOURCE to 600 or greater hides
+  # chroot() and other functions
+  hp*|HP*)
+    define_xopen_source=no
+    ;;
+
 esac
 
 if test $define_xopen_source = yes
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_system_libmpdec" >&5
 $as_echo "$with_system_libmpdec" >&6; }
 
+# Check whether _decimal should use a coroutine-local or thread-local context
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-decimal-contextvar" >&5
+$as_echo_n "checking for --with-decimal-contextvar... " >&6; }
+
+# Check whether --with-decimal_contextvar was given.
+if test "${with_decimal_contextvar+set}" = set; then :
+  withval=$with_decimal_contextvar;
+else
+  with_decimal_contextvar="yes"
+fi
+
+
+if test "$with_decimal_contextvar" != "no"
+then
+
+$as_echo "#define WITH_DECIMAL_CONTEXTVAR 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_decimal_contextvar" >&5
+$as_echo "$with_decimal_contextvar" >&6; }
+
 # Check for support for loadable sqlite extensions
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-loadable-sqlite-extensions" >&5
 $as_echo_n "checking for --enable-loadable-sqlite-extensions... " >&6; }
@@ -14259,10 +14303,10 @@ _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
 
-if grep noonsees conftest.$ac_objext >/dev/null ; then
+if $GREP noonsees conftest.$ac_objext >/dev/null ; then
   ax_cv_c_float_words_bigendian=yes
 fi
-if grep seesnoon conftest.$ac_objext >/dev/null ; then
+if $GREP seesnoon conftest.$ac_objext >/dev/null ; then
   if test "$ax_cv_c_float_words_bigendian" = unknown; then
     ax_cv_c_float_words_bigendian=no
   else
index 7051dc109a725d614a754fce26f6af123fea9bec..d8de9d49439c31ac21dc80b2a1c1968606970a7c 100644 (file)
@@ -521,6 +521,12 @@ case $ac_sys_system/$ac_sys_release in
     define_xopen_source=no
     ;;
 
+  # On HP-UX, defining _XOPEN_SOURCE to 600 or greater hides
+  # chroot() and other functions
+  hp*|HP*)
+    define_xopen_source=no
+    ;;
+
 esac
 
 if test $define_xopen_source = yes
@@ -2998,6 +3004,21 @@ AC_ARG_WITH(system_libmpdec,
 
 AC_MSG_RESULT($with_system_libmpdec)
 
+# Check whether _decimal should use a coroutine-local or thread-local context
+AC_MSG_CHECKING(for --with-decimal-contextvar)
+AC_ARG_WITH(decimal_contextvar,
+            AS_HELP_STRING([--with-decimal-contextvar], [build _decimal module using a coroutine-local rather than a thread-local context (default is yes)]),
+            [],
+            [with_decimal_contextvar="yes"])
+
+if test "$with_decimal_contextvar" != "no"
+then
+    AC_DEFINE(WITH_DECIMAL_CONTEXTVAR, 1,
+      [Define if you want build the _decimal module using a coroutine-local rather than a thread-local context])
+fi
+
+AC_MSG_RESULT($with_decimal_contextvar)
+
 # Check for support for loadable sqlite extensions
 AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
 AC_ARG_ENABLE(loadable-sqlite-extensions,
index 216b90d803187087d1a28768b81162804ed5a4d6..746228c2c98df4d320b36bd0dc725396ee28d423 100644 (file)
@@ -49,10 +49,10 @@ double d = 909042349670368103374704789055050114762116927356156320147971208440534
 
 ]])], [
 
-if grep noonsees conftest.$ac_objext >/dev/null ; then
+if $GREP noonsees conftest.$ac_objext >/dev/null ; then
   ax_cv_c_float_words_bigendian=yes
 fi
-if grep seesnoon conftest.$ac_objext >/dev/null ; then
+if $GREP seesnoon conftest.$ac_objext >/dev/null ; then
   if test "$ax_cv_c_float_words_bigendian" = unknown; then
     ax_cv_c_float_words_bigendian=no
   else
index aaa7b72cac8840645aa62d313fb7e850c8fbb860..4263a712c3278f5399d98067167d24afc7a9c0e6 100644 (file)
 /* Define if WINDOW in curses.h offers a field _flags. */
 #undef WINDOW_HAS_FLAGS
 
+/* Define if you want build the _decimal module using a coroutine-local rather
+   than a thread-local context */
+#undef WITH_DECIMAL_CONTEXTVAR
+
 /* Define if you want documentation strings in extension modules */
 #undef WITH_DOC_STRINGS
 
index 20d7f35652fe500c0ca5d5a82d3b0449515422a7..b168ed4082fd3f07c733447649b04de52911f453 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -146,7 +146,7 @@ def macosx_sdk_root():
         return MACOS_SDK_ROOT
 
     cflags = sysconfig.get_config_var('CFLAGS')
-    m = re.search(r'-isysroot\s+(\S+)', cflags)
+    m = re.search(r'-isysroot\s*(\S+)', cflags)
     if m is not None:
         MACOS_SDK_ROOT = m.group(1)
     else: