From ed0540bf315d9d6981783c37a600efe449e6039e Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 16 Jun 2022 18:18:33 +0200 Subject: [PATCH 01/11] GHA, Docs: Add PR annotations for failed Sphinx references --- .github/workflows/doc.yml | 13 +++++++++++++ Doc/tools/warnings-to-gh-actions.py | 24 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Doc/tools/warnings-to-gh-actions.py diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 465da12fa1be80..66c9acdaefa633 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -53,6 +53,19 @@ jobs: - name: 'Build HTML documentation' run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html + # Add pull request annotations for Sphinx nitpicks (missing references) + - name: Get list of changed files + id: changed_files + uses: jitterbit/get-changed-files@v1 + - name: 'Build with nitpicks' + continue-on-error: true + run: | + # Mark files the pull request modified + touch ${{ steps.changed_files.outputs.added_modified }} + # Build docs with the '-n' (nitpicky) option, convert warnings + make -C Doc/ PYTHON=../python SPHINXOPTS="-q --keep-going -n" html 2>&1 | + python Doc/tools/warnings-to-gh-actions.py + # Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release doctest: name: 'Doctest' diff --git a/Doc/tools/warnings-to-gh-actions.py b/Doc/tools/warnings-to-gh-actions.py new file mode 100644 index 00000000000000..1c78e4797c0e83 --- /dev/null +++ b/Doc/tools/warnings-to-gh-actions.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +"""Convert Sphinx warning messages to GitHub Actions + +Converts lines like: + .../Doc/library/cgi.rst:98: WARNING: reference target not found +to: + ::warning file=.../Doc/library/cgi.rst,line=98::reference target not found + +Non-matching lines are echoed unchanged. + +see: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message +""" + +import sys +import re + +pattern = re.compile(r'(?P[^:]+):(?P\d+): WARNING: (?P.+)') + +for line in sys.stdin: + if match := pattern.fullmatch(line.strip()): + print('::warning file={file},line={line}::{msg}'.format_map(match)) + else: + print(line) From 4e2ef71fe4f57206aeaad25a369a2a258dd7890c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 6 Mar 2023 16:14:34 +0200 Subject: [PATCH 02/11] GHA, Docs: Ensure some files always pass Sphinx nitpicks --- .github/workflows/doc.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 66c9acdaefa633..2ddbecb8ae9679 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -57,15 +57,23 @@ jobs: - name: Get list of changed files id: changed_files uses: jitterbit/get-changed-files@v1 - - name: 'Build with nitpicks' + - name: 'Build changed files with nitpicks' continue-on-error: true run: | # Mark files the pull request modified touch ${{ steps.changed_files.outputs.added_modified }} - # Build docs with the '-n' (nitpicky) option, convert warnings - make -C Doc/ PYTHON=../python SPHINXOPTS="-q --keep-going -n" html 2>&1 | + # Build docs with the '-n' (nit-picky) option, convert warnings + make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n --keep-going" html 2>&1 | python Doc/tools/warnings-to-gh-actions.py + # Ensure some files always pass Sphinx nitpicks (missing references) + - name: 'Build others with nitpicks' + run: | + # Mark files that must pass nit-picky + touch Doc/whatsnew/3.12.rst + # Build docs with the '-n' (nit-picky) option, convert warnings to errors (-W) + make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going" html 2>&1 + # Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release doctest: name: 'Doctest' From d1ce7f9ab0c58b097edfdb2e544d1ef98eec00dd Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 6 Mar 2023 21:34:30 +0200 Subject: [PATCH 03/11] Fix Sphinx warnings in 'What's New In Python 3.12' --- Doc/library/gzip.rst | 4 ++ Doc/whatsnew/3.12.rst | 84 ++++++++++++++++++++-------------------- Misc/NEWS.d/3.10.0a2.rst | 2 +- 3 files changed, 47 insertions(+), 43 deletions(-) diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index 1a2582d6a904b2..f05a6e68e19cdb 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -143,6 +143,10 @@ The module defines the following items: :func:`time.time` and the :attr:`~os.stat_result.st_mtime` attribute of the object returned by :func:`os.stat`. + .. attribute:: name + + The filename. + .. versionchanged:: 3.1 Support for the :keyword:`with` statement was added, along with the *mtime* constructor argument and :attr:`mtime` attribute. diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index c0c021c679147f..1a6c72954604ce 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -239,7 +239,7 @@ inspect ------- * Add :func:`inspect.markcoroutinefunction` to mark sync functions that return - a :term:`coroutine` for use with :func:`iscoroutinefunction`. + a :term:`coroutine` for use with :func:`inspect.iscoroutinefunction`. (Contributed Carlton Gibson in :gh:`99247`.) pathlib @@ -264,7 +264,7 @@ dis * Pseudo instruction opcodes (which are used by the compiler but do not appear in executable bytecode) are now exposed in the :mod:`dis` module. - :data:`~dis.HAVE_ARGUMENT` is still relevant to real opcodes, + :opcode:`HAVE_ARGUMENT` is still relevant to real opcodes, but it is not useful for pseudo instructions. Use the new :data:`~dis.hasarg` collection instead. (Contributed by Irit Katriel in :gh:`94216`.) @@ -383,7 +383,7 @@ Optimizations (Contributed by Kevin Modzelewski in :gh:`90536`.) * Speed up the regular expression substitution (functions :func:`re.sub` and - :func:`re.subn` and corresponding :class:`re.Pattern` methods) for + :func:`re.subn` and corresponding :class:`!re.Pattern` methods) for replacement strings containing group references by 2--3 times. (Contributed by Serhiy Storchaka in :gh:`91524`.) @@ -440,7 +440,7 @@ Deprecated :exc:`ImportWarning`). (Contributed by Brett Cannon in :gh:`65961`.) -* The :meth:`~asyncio.DefaultEventLoopPolicy.get_event_loop` method of the +* The :meth:`~asyncio.get_event_loop` method of the default event loop policy now emits a :exc:`DeprecationWarning` if there is no current event loop set and it decides to create one. (Contributed by Serhiy Storchaka and Guido van Rossum in :gh:`100160`.) @@ -485,13 +485,13 @@ Modules (see :pep:`594`): APIs: -* :class:`configparser.LegacyInterpolation` (:gh:`90765`) +* :class:`!configparser.LegacyInterpolation` (:gh:`90765`) * :func:`locale.getdefaultlocale` (:gh:`90817`) -* :meth:`turtle.RawTurtle.settiltangle` (:gh:`50096`) -* :func:`unittest.findTestCases` (:gh:`50096`) -* :func:`unittest.makeSuite` (:gh:`50096`) -* :func:`unittest.getTestCaseNames` (:gh:`50096`) -* :class:`webbrowser.MacOSX` (:gh:`86421`) +* :meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`) +* :func:`!unittest.findTestCases` (:gh:`50096`) +* :func:`!unittest.makeSuite` (:gh:`50096`) +* :func:`!unittest.getTestCaseNames` (:gh:`50096`) +* :class:`!webbrowser.MacOSX` (:gh:`86421`) Pending Removal in Python 3.14 ------------------------------ @@ -499,9 +499,9 @@ Pending Removal in Python 3.14 * Deprecated the following :mod:`importlib.abc` classes, scheduled for removal in Python 3.14: - * :class:`importlib.abc.ResourceReader` - * :class:`importlib.abc.Traversable` - * :class:`importlib.abc.TraversableResources` + * :class:`!importlib.abc.ResourceReader` + * :class:`!importlib.abc.Traversable` + * :class:`!importlib.abc.TraversableResources` Use :mod:`importlib.resources.abc` classes instead: @@ -510,7 +510,7 @@ Pending Removal in Python 3.14 (Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.) -* Creating :c:data:`immutable types ` with mutable +* Creating immutable types (:data:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable bases using the C API. * ``__package__`` and ``__cached__`` will cease to be set or taken @@ -639,11 +639,11 @@ Removed * Remove ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io.open`) - function is a built-in function. Since Python 3.10, :func:`_pyio.open` is + function is a built-in function. Since Python 3.10, :func:`!_pyio.open` is also a static method. (Contributed by Victor Stinner in :gh:`94169`.) -* Remove the :func:`ssl.RAND_pseudo_bytes` function, deprecated in Python 3.6: +* Remove the :func:`!ssl.RAND_pseudo_bytes` function, deprecated in Python 3.6: use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. (Contributed by Victor Stinner in :gh:`94199`.) @@ -653,13 +653,13 @@ Removed extension if it was not present. (Contributed by Victor Stinner in :gh:`94196`.) -* Remove the :func:`ssl.match_hostname` function. The - :func:`ssl.match_hostname` was deprecated in Python 3.7. OpenSSL performs +* Remove the :func:`!ssl.match_hostname` function. + It was deprecated in Python 3.7. OpenSSL performs hostname matching since Python 3.7, Python no longer uses the - :func:`ssl.match_hostname` function. + :func:`!ssl.match_hostname` function. (Contributed by Victor Stinner in :gh:`94199`.) -* Remove the :func:`locale.format` function, deprecated in Python 3.7: +* Remove the :func:`!locale.format` function, deprecated in Python 3.7: use :func:`locale.format_string` instead. (Contributed by Victor Stinner in :gh:`94226`.) @@ -669,9 +669,9 @@ Removed a C implementation of :func:`~hashlib.pbkdf2_hmac()` which is faster. (Contributed by Victor Stinner in :gh:`94199`.) -* :mod:`xml.etree`: Remove the ``ElementTree.Element.copy()`` method of the +* :mod:`xml.etree.ElementTree`: Remove the ``ElementTree.Element.copy()`` method of the pure Python implementation, deprecated in Python 3.10, use the - :func:`copy.copy` function instead. The C implementation of :mod:`xml.etree` + :func:`copy.copy` function instead. The C implementation of :mod:`xml.etree.ElementTree` has no ``copy()`` method, only a ``__copy__()`` method. (Contributed by Victor Stinner in :gh:`94383`.) @@ -680,10 +680,10 @@ Removed :pep:`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.) -* Remove the :func:`ssl.wrap_socket` function, deprecated in Python 3.7: +* Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl.SSLContext.wrap_socket` method. Any package that still uses - :func:`ssl.wrap_socket` is broken and insecure. The function neither sends a + :func:`!ssl.wrap_socket` is broken and insecure. The function neither sends a SNI TLS extension nor validates server hostname. Code is subject to `CWE-295 `_: Improper Certificate Validation. @@ -850,7 +850,7 @@ New Features The :const:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class when the class's :py:meth:`~object.__call__` method is reassigned. This makes vectorcall safe to use with mutable types (i.e. heap types - without the :const:`immutable ` flag). + without the immutable flag, :const:`Py_TPFLAGS_IMMUTABLETYPE`). Mutable types that do not override :c:member:`~PyTypeObject.tp_call` now inherit the ``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin in :gh:`93274`.) @@ -883,7 +883,7 @@ New Features (Contributed by Andrew Frost in :gh:`92257`.) * The C API now permits registering callbacks via :c:func:`PyDict_AddWatcher`, - :c:func:`PyDict_AddWatch` and related APIs to be called whenever a dictionary + :c:func:`PyDict_Watch` and related APIs to be called whenever a dictionary is modified. This is intended for use by optimizing interpreters, JIT compilers, or debuggers. (Contributed by Carl Meyer in :gh:`91052`.) @@ -958,9 +958,9 @@ Porting to Python 3.12 supported, but does not fully support multiple inheritance (:gh:`95589`), and performance may be worse. Classes declaring :const:`Py_TPFLAGS_MANAGED_DICT` should call - :c:func:`_PyObject_VisitManagedDict` and :c:func:`_PyObject_ClearManagedDict` + :c:func:`!_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to traverse and clear their instance's dictionaries. - To clear weakrefs, call :c:func:`PyObject_ClearWeakRefs`, as before. + To clear weakrefs, call :c:func:`!PyObject_ClearWeakRefs`, as before. * The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like paths, like :class:`bytearray` and :class:`memoryview` types: only the exact @@ -993,17 +993,17 @@ Deprecated * :c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` and :c:member:`PyConfig.hash_seed` * :c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated` - * :c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyConfig.legacy_windows_fs_encoding` + * :c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig.legacy_windows_fs_encoding` * :c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig.legacy_windows_stdio` - * :c:var:`Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig.filesystem_encoding` - * :c:var:`Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig.filesystem_errors` - * :c:var:`Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:`Py_PreInitialize`) + * :c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig.filesystem_encoding` + * :c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig.filesystem_errors` + * :c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:`Py_PreInitialize`) The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.) -* Creating :c:data:`immutable types ` with mutable +* Creating :const:`immutable types ` with mutable bases is deprecated and will be disabled in Python 3.14. * The ``structmember.h`` header is deprecated, though it continues to be @@ -1053,15 +1053,15 @@ Removed * Legacy Unicode APIs have been removed. See :pep:`623` for detail. - * :c:macro:`PyUnicode_WCHAR_KIND` - * :c:func:`PyUnicode_AS_UNICODE` - * :c:func:`PyUnicode_AsUnicode` - * :c:func:`PyUnicode_AsUnicodeAndSize` - * :c:func:`PyUnicode_AS_DATA` - * :c:func:`PyUnicode_FromUnicode` - * :c:func:`PyUnicode_GET_SIZE` - * :c:func:`PyUnicode_GetSize` - * :c:func:`PyUnicode_GET_DATA_SIZE` + * :c:macro:`!PyUnicode_WCHAR_KIND` + * :c:func:`!PyUnicode_AS_UNICODE` + * :c:func:`!PyUnicode_AsUnicode` + * :c:func:`!PyUnicode_AsUnicodeAndSize` + * :c:func:`!PyUnicode_AS_DATA` + * :c:func:`!PyUnicode_FromUnicode` + * :c:func:`!PyUnicode_GET_SIZE` + * :c:func:`!PyUnicode_GetSize` + * :c:func:`!PyUnicode_GET_DATA_SIZE` * Remove the ``PyUnicode_InternImmortal()`` function and the ``SSTATE_INTERNED_IMMORTAL`` macro. diff --git a/Misc/NEWS.d/3.10.0a2.rst b/Misc/NEWS.d/3.10.0a2.rst index 61a291914f9333..061a82e90afd6b 100644 --- a/Misc/NEWS.d/3.10.0a2.rst +++ b/Misc/NEWS.d/3.10.0a2.rst @@ -888,7 +888,7 @@ file descriptors. .. nonce: JUPE59 .. section: C API -:c:data:`Py_FileSystemDefaultEncodeErrors` and :c:data:`Py_UTF8Mode` are +:c:data:`!Py_FileSystemDefaultEncodeErrors` and :c:data:`!Py_UTF8Mode` are available again in limited API. .. From 238dfc2bf2981ec29a95eea736df5b9e16cca8c9 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 8 Mar 2023 00:06:31 +0200 Subject: [PATCH 04/11] Use Ana06/get-changed-files to fix 'The head commit for this pull_request event is not ahead of the base commit' Re: https://github.com/jitterbit/get-changed-files/issues/11 --- .github/workflows/doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 2ddbecb8ae9679..250905539847da 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -56,7 +56,7 @@ jobs: # Add pull request annotations for Sphinx nitpicks (missing references) - name: Get list of changed files id: changed_files - uses: jitterbit/get-changed-files@v1 + uses: Ana06/get-changed-files@v2.2.0 - name: 'Build changed files with nitpicks' continue-on-error: true run: | From b97f25be3a5f47b518c8d2ff7c882da5a2036f22 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 9 Mar 2023 22:34:43 +0200 Subject: [PATCH 05/11] Apply suggestions from code review Co-authored-by: C.A.M. Gerlach --- .github/workflows/doc.yml | 9 +++++---- Doc/tools/warnings-to-gh-actions.py | 5 +++-- Doc/whatsnew/3.12.rst | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 250905539847da..f595bf016b778d 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -57,20 +57,21 @@ jobs: - name: Get list of changed files id: changed_files uses: Ana06/get-changed-files@v2.2.0 - - name: 'Build changed files with nitpicks' + - name: 'Build changed files in nit-picky mode' continue-on-error: true run: | # Mark files the pull request modified touch ${{ steps.changed_files.outputs.added_modified }} - # Build docs with the '-n' (nit-picky) option, convert warnings + # Build docs with the '-n' (nit-picky) option; convert warnings to annotations make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n --keep-going" html 2>&1 | python Doc/tools/warnings-to-gh-actions.py - # Ensure some files always pass Sphinx nitpicks (missing references) - - name: 'Build others with nitpicks' + # Ensure some files always pass Sphinx nit-picky mode (no missing references) + - name: 'Build known-good files in nit-picky mode' run: | # Mark files that must pass nit-picky touch Doc/whatsnew/3.12.rst + touch Doc/library/sqlite3.rst # Build docs with the '-n' (nit-picky) option, convert warnings to errors (-W) make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going" html 2>&1 diff --git a/Doc/tools/warnings-to-gh-actions.py b/Doc/tools/warnings-to-gh-actions.py index 1c78e4797c0e83..da33a4ede07abc 100644 --- a/Doc/tools/warnings-to-gh-actions.py +++ b/Doc/tools/warnings-to-gh-actions.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 -"""Convert Sphinx warning messages to GitHub Actions +""" +Convert Sphinx warning messages to GitHub Actions. Converts lines like: .../Doc/library/cgi.rst:98: WARNING: reference target not found @@ -12,8 +13,8 @@ see: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message """ -import sys import re +import sys pattern = re.compile(r'(?P[^:]+):(?P\d+): WARNING: (?P.+)') diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 1a6c72954604ce..ae64b529ed9370 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -1003,7 +1003,7 @@ Deprecated :c:type:`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.) -* Creating :const:`immutable types ` with mutable +* Creating immutable types (:const:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable bases is deprecated and will be disabled in Python 3.14. * The ``structmember.h`` header is deprecated, though it continues to be From 1465769be3d869b2be2770ab9b81c85aafc40872 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 11 Mar 2023 22:26:26 +0200 Subject: [PATCH 06/11] Document PyObject_ClearWeakRefs --- Doc/c-api/weakref.rst | 10 ++++++++++ Doc/whatsnew/3.12.rst | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Doc/c-api/weakref.rst b/Doc/c-api/weakref.rst index ace743ba01c5f5..f27ec4411b4a26 100644 --- a/Doc/c-api/weakref.rst +++ b/Doc/c-api/weakref.rst @@ -67,3 +67,13 @@ as much as it can. .. c:function:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref) Similar to :c:func:`PyWeakref_GetObject`, but does no error checking. + + +.. c:function:: void PyObject_ClearWeakRefs(PyObject *object) + + This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler + to clear weak references. + + This iterates through the weak references for *object* and calls callbacks + for those references which have one. It returns when all callbacks have + been attempted. diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index ae64b529ed9370..73d42e71403968 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -960,7 +960,7 @@ Porting to Python 3.12 Classes declaring :const:`Py_TPFLAGS_MANAGED_DICT` should call :c:func:`!_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to traverse and clear their instance's dictionaries. - To clear weakrefs, call :c:func:`!PyObject_ClearWeakRefs`, as before. + To clear weakrefs, call :c:func:`PyObject_ClearWeakRefs`, as before. * The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like paths, like :class:`bytearray` and :class:`memoryview` types: only the exact From 460d83fd49572626101a9936cb2856ce879a50d8 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 11 Mar 2023 22:34:10 +0200 Subject: [PATCH 07/11] Document gzip's filename Co-authored-by: C.A.M. Gerlach --- Doc/library/gzip.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index f05a6e68e19cdb..06cbd2567a0bc6 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -145,7 +145,9 @@ The module defines the following items: .. attribute:: name - The filename. + The path to the gzip file on disk, as a :class:`str` or :class:`bytes`. + Equivalent to the output of :func:`os.fspath` on the original input path, + with no other normalization, resolution or expansion. .. versionchanged:: 3.1 Support for the :keyword:`with` statement was added, along with the From bd7dbd63d7f17b931463ec22d5e654d3f6f1df1d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 23 Mar 2023 13:16:02 +0200 Subject: [PATCH 08/11] Consistent quotes Co-authored-by: C.A.M. Gerlach --- .github/workflows/doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index f595bf016b778d..9ec60c198eb3b6 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -54,7 +54,7 @@ jobs: run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html # Add pull request annotations for Sphinx nitpicks (missing references) - - name: Get list of changed files + - name: 'Get list of changed files' id: changed_files uses: Ana06/get-changed-files@v2.2.0 - name: 'Build changed files in nit-picky mode' From dded66d82e0b7eb384a2093273256193d95ba09b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 23 Mar 2023 13:35:55 +0200 Subject: [PATCH 09/11] Fix reference warnings to removed opcodes --- Doc/whatsnew/3.12.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 5f85eddbefba4d..7467dcf07ca0d7 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -435,7 +435,7 @@ CPython bytecode changes :opcode:`LOAD_METHOD` instruction if the low bit of its oparg is set. (Contributed by Ken Jin in :gh:`93429`.) -* Removed the :opcode:`JUMP_IF_FALSE_OR_POP` and :opcode:`JUMP_IF_TRUE_OR_POP` +* Removed the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:`102859`.) From e14191bd02fc5853097c985db375ee705cdc1db4 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 23 Mar 2023 22:53:01 +0200 Subject: [PATCH 10/11] Fix PyErr_DisplayException reference, skip linking to undocumented and deprecated PyErr_Display --- Doc/c-api/exceptions.rst | 2 +- Doc/whatsnew/3.12.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index ddf7dc780b2745..49d2f18d4573b0 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -86,7 +86,7 @@ Printing and clearing An exception must be set when calling this function. -.. c:function: void PyErr_DisplayException(PyObject *exc) +.. c:function:: void PyErr_DisplayException(PyObject *exc) Print the standard traceback display of ``exc`` to ``sys.stderr``, including chained exceptions and notes. diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 7467dcf07ca0d7..e5bcfdecd9a487 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -977,7 +977,7 @@ New Features (Contributed by Mark Shannon in :gh:`101578`.) * Add :c:func:`PyErr_DisplayException`, which takes an exception instance, - to replace the legacy-api :c:func:`PyErr_Display`. (Contributed by + to replace the legacy-api :c:func:`!PyErr_Display`. (Contributed by Irit Katriel in :gh:`102755`). Porting to Python 3.12 @@ -1118,7 +1118,7 @@ Deprecated :c:func:`PyErr_SetRaisedException` instead. (Contributed by Mark Shannon in :gh:`101578`.) -* :c:func:`PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException` +* :c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException` instead. (Contributed by Irit Katriel in :gh:`102755`). From 255a67fa4f122205b6eee45d3012fd845f28886e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 23 Mar 2023 23:17:46 +0200 Subject: [PATCH 11/11] Document asyncio.iscoroutine --- Doc/library/asyncio-task.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index d908e45b3c8d8b..2d4a10ce16b1fc 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -966,6 +966,13 @@ Introspection .. versionadded:: 3.7 +.. function:: iscoroutine(obj) + + Return ``True`` if *obj* is a coroutine object. + + .. versionadded:: 3.4 + + Task Object ===========