From a4b5e7be794b19880e9c5234d9d28c0bb6e0d1fb Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 28 Jul 2022 13:14:32 +0300 Subject: [PATCH 1/7] PEP 565: Fix footnotes --- pep-0565.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pep-0565.rst b/pep-0565.rst index ee7a0b0e4bb..8cb6b230af8 100644 --- a/pep-0565.rst +++ b/pep-0565.rst @@ -164,7 +164,7 @@ no changes are needed beyond those in this PEP. Interactive shell implementations which use a namespace other than ``__main__`` will need to add their own filter. For example, IPython uses the -following command ([8_]) to set up a suitable filter:: +following command ([8]_) to set up a suitable filter:: warnings.filterwarnings("default", category=DeprecationWarning, module=self.user_ns.get("__name__")) @@ -215,8 +215,8 @@ of the related documentation. Reference Implementation ======================== -A reference implementation is available in the PR [4_] linked from the -related tracker issue for this PEP [5_]. +A reference implementation is available in the PR [4]_ linked from the +related tracker issue for this PEP [5]_. As a side-effect of implementing this PEP, the internal warnings filter list will start allowing the use of plain strings as part of filter definitions (in @@ -229,7 +229,7 @@ early access to the ``re`` module. Motivation ========== -As discussed in [1_] and mentioned in [2_], Python 2.7 and Python 3.2 changed +As discussed in [1]_ and mentioned in [2]_, Python 2.7 and Python 3.2 changed the default handling of ``DeprecationWarning`` such that: * the warning was hidden by default during normal code execution @@ -289,7 +289,7 @@ deprecation warnings. Most notably: variable. * The standard library doesn't provide a straightforward way to opt-in to seeing all warnings emitted *by* a particular dependency prior to upgrading it - (the third-party ``warn`` module [3_] does provide this, but enabling it + (the third-party ``warn`` module [3]_ does provide this, but enabling it involves monkeypatching the standard library's ``warnings`` module). * When software has been factored out into support modules, but those modules have little or no automated test coverage, re-enabling deprecation warnings @@ -326,7 +326,7 @@ changes in 3.7: off by default in regular interpreter builds: https://bugs.python.org/issue32088 Independently of the proposed changes to the default filters in this PEP, -issue 32229 [9_] is a proposal to add a ``warnings.hide_warnings`` API to +issue 32229 [9]_ is a proposal to add a ``warnings.hide_warnings`` API to make it simpler for application developers to hide warnings during normal operation, while easily making them visible when testing. From 3e09c601b6541c3b92201bba25e6ca716286ffef Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 28 Jul 2022 13:14:54 +0300 Subject: [PATCH 2/7] PEP 565: Fix footnotes --- pep-0565.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pep-0565.rst b/pep-0565.rst index 8cb6b230af8..7b1b71fb6aa 100644 --- a/pep-0565.rst +++ b/pep-0565.rst @@ -349,18 +349,18 @@ References .. [5] Tracker issue for PEP 565 implementation (https://bugs.python.org/issue31975) -.. [6] First python-dev discussion thread - (https://mail.python.org/pipermail/python-dev/2017-November/150477.html) - -.. [7] Second python-dev discussion thread - (https://mail.python.org/pipermail/python-dev/2017-November/150819.html) - .. [8] IPython's DeprecationWarning auto-configuration (https://github.com/ipython/ipython/blob/6.2.x/IPython/core/interactiveshell.py#L619) .. [9] ``warnings.hide_warnings`` API proposal (https://bugs.python.org/issue32229) +* First python-dev discussion thread + (https://mail.python.org/pipermail/python-dev/2017-November/150477.html) + +* Second python-dev discussion thread + (https://mail.python.org/pipermail/python-dev/2017-November/150819.html) + Copyright ========= From 09f2db0c6abce3cb53efb271433223805275a4f4 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 28 Jul 2022 13:16:02 +0300 Subject: [PATCH 3/7] PEP 565: Fix footnotes --- pep-0565.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pep-0565.rst b/pep-0565.rst index 7b1b71fb6aa..90833fb3209 100644 --- a/pep-0565.rst +++ b/pep-0565.rst @@ -164,7 +164,7 @@ no changes are needed beyond those in this PEP. Interactive shell implementations which use a namespace other than ``__main__`` will need to add their own filter. For example, IPython uses the -following command ([8]_) to set up a suitable filter:: +following command ([6]_) to set up a suitable filter:: warnings.filterwarnings("default", category=DeprecationWarning, module=self.user_ns.get("__name__")) @@ -326,7 +326,7 @@ changes in 3.7: off by default in regular interpreter builds: https://bugs.python.org/issue32088 Independently of the proposed changes to the default filters in this PEP, -issue 32229 [9]_ is a proposal to add a ``warnings.hide_warnings`` API to +issue 32229 [7]_ is a proposal to add a ``warnings.hide_warnings`` API to make it simpler for application developers to hide warnings during normal operation, while easily making them visible when testing. @@ -349,10 +349,10 @@ References .. [5] Tracker issue for PEP 565 implementation (https://bugs.python.org/issue31975) -.. [8] IPython's DeprecationWarning auto-configuration +.. [6] IPython's DeprecationWarning auto-configuration (https://github.com/ipython/ipython/blob/6.2.x/IPython/core/interactiveshell.py#L619) -.. [9] ``warnings.hide_warnings`` API proposal +.. [7] ``warnings.hide_warnings`` API proposal (https://bugs.python.org/issue32229) * First python-dev discussion thread From aa707c88f8886d1d56d333224715182fcd23c7ab Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 28 Jul 2022 13:34:51 +0300 Subject: [PATCH 4/7] PEP 565: Consistently format DeprecationWarning --- pep-0565.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pep-0565.rst b/pep-0565.rst index 90833fb3209..66178631df1 100644 --- a/pep-0565.rst +++ b/pep-0565.rst @@ -14,14 +14,14 @@ Abstract ======== In Python 2.7 and Python 3.2, the default warning filters were updated to hide -DeprecationWarning by default, such that deprecation warnings in development +``DeprecationWarning`` by default, such that deprecation warnings in development tools that were themselves written in Python (e.g. linters, static analysers, test runners, code generators), as well as any other applications that merely happened to be written in Python, wouldn't be visible to their users unless those users explicitly opted in to seeing them. However, this change has had the unfortunate side effect of making -DeprecationWarning markedly less effective at its primary intended purpose: +``DeprecationWarning`` markedly less effective at its primary intended purpose: providing advance notice of breaking changes in APIs (whether in CPython, the standard library, or in third party libraries) to users of those APIs. @@ -74,10 +74,10 @@ to be:: This means that in cases where the nominal location of the warning (as determined by the ``stacklevel`` parameter to ``warnings.warn``) is in the -``__main__`` module, the first occurrence of each DeprecationWarning will once +``__main__`` module, the first occurrence of each ``DeprecationWarning`` will once again be reported. -This change will lead to DeprecationWarning being displayed by default for: +This change will lead to ``DeprecationWarning`` being displayed by default for: * code executed directly at the interactive prompt * code executed directly as part of a single-file script @@ -274,7 +274,7 @@ Limitations on PEP Scope This PEP exists specifically to explain both the proposed addition to the default warnings filter for 3.7, *and* to more clearly articulate the rationale -for the original change to the handling of DeprecationWarning back in Python 2.7 +for the original change to the handling of ``DeprecationWarning`` back in Python 2.7 and 3.2. This PEP does not solve all known problems with the current approach to handling @@ -349,7 +349,7 @@ References .. [5] Tracker issue for PEP 565 implementation (https://bugs.python.org/issue31975) -.. [6] IPython's DeprecationWarning auto-configuration +.. [6] IPython's ``DeprecationWarning`` auto-configuration (https://github.com/ipython/ipython/blob/6.2.x/IPython/core/interactiveshell.py#L619) .. [7] ``warnings.hide_warnings`` API proposal From a1a0d48f8e47428f6c3d6e6a2cf5ee7c7b446e4c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 28 Jul 2022 13:35:31 +0300 Subject: [PATCH 5/7] PEP 565: Replace BPO links with GitHub --- pep-0565.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pep-0565.rst b/pep-0565.rst index 66178631df1..0e81310c6ca 100644 --- a/pep-0565.rst +++ b/pep-0565.rst @@ -321,9 +321,9 @@ changes in 3.7: * a new ``-X dev`` command line option that combines several developer centric settings (including ``-Wd``) into one command line flag: - https://bugs.python.org/issue32043 + https://github.com/python/cpython/issues/76224 * changing the behaviour in debug builds to show more of the warnings that are - off by default in regular interpreter builds: https://bugs.python.org/issue32088 + off by default in regular interpreter builds: https://github.com/python/cpython/issues/76269 Independently of the proposed changes to the default filters in this PEP, issue 32229 [7]_ is a proposal to add a ``warnings.hide_warnings`` API to @@ -347,13 +347,13 @@ References (https://github.com/python/cpython/pull/4458) .. [5] Tracker issue for PEP 565 implementation - (https://bugs.python.org/issue31975) + (https://github.com/python/cpython/issues/76156) .. [6] IPython's ``DeprecationWarning`` auto-configuration (https://github.com/ipython/ipython/blob/6.2.x/IPython/core/interactiveshell.py#L619) .. [7] ``warnings.hide_warnings`` API proposal - (https://bugs.python.org/issue32229) + (https://github.com/python/cpython/issues/76410) * First python-dev discussion thread (https://mail.python.org/pipermail/python-dev/2017-November/150477.html) From 8abea8cea16b3ecd20acde82896b4280f6edf31b Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 28 Jul 2022 13:48:41 +0300 Subject: [PATCH 6/7] PEP 565: Remove redundant emacs metadata --- pep-0565.rst | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pep-0565.rst b/pep-0565.rst index 0e81310c6ca..0ca638537ff 100644 --- a/pep-0565.rst +++ b/pep-0565.rst @@ -365,14 +365,3 @@ Copyright ========= This document has been placed in the public domain. - - - -.. - Local Variables: - mode: indented-text - indent-tabs-mode: nil - sentence-end-double-space: t - fill-column: 70 - coding: utf-8 - End: From d08f7be8de97eeb80932ba86f754e2b730da53a7 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 29 Jul 2022 09:48:58 +0300 Subject: [PATCH 7/7] PEP 565: Make hyperlinks Co-authored-by: CAM Gerlach --- pep-0565.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pep-0565.rst b/pep-0565.rst index 0ca638537ff..9082e2d3d79 100644 --- a/pep-0565.rst +++ b/pep-0565.rst @@ -355,11 +355,11 @@ References .. [7] ``warnings.hide_warnings`` API proposal (https://github.com/python/cpython/issues/76410) -* First python-dev discussion thread - (https://mail.python.org/pipermail/python-dev/2017-November/150477.html) +* `First python-dev discussion thread + `__ -* Second python-dev discussion thread - (https://mail.python.org/pipermail/python-dev/2017-November/150819.html) +* `Second python-dev discussion thread + `__ Copyright =========