diff options
author | Victor Stinner <vstinner@python.org> | 2023-06-06 18:35:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-06 18:35:51 (GMT) |
commit | 6c54e5d72166d012b52155cbf13af9e533290e06 (patch) | |
tree | 11a9c5c58f5b04f1818321d5f7a385d667fb7f8c | |
parent | 221d703498d84e363070c89c28f839edceaac9b2 (diff) | |
download | cpython-6c54e5d72166d012b52155cbf13af9e533290e06.zip cpython-6c54e5d72166d012b52155cbf13af9e533290e06.tar.gz cpython-6c54e5d72166d012b52155cbf13af9e533290e06.tar.bz2 |
gh-105376: Remove logging.Logger.warn() method (#105377)
-rw-r--r-- | Doc/library/logging.rst | 8 | ||||
-rw-r--r-- | Doc/whatsnew/3.13.rst | 6 | ||||
-rw-r--r-- | Lib/logging/__init__.py | 5 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2023-06-06-15-32-44.gh-issue-105376.W4oDQp.rst | 4 |
4 files changed, 14 insertions, 9 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index 22412e1..d7a389f 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -275,6 +275,10 @@ is the module's name in the Python package namespace. .. versionchanged:: 3.8 The *stacklevel* parameter was added. + .. versionchanged:: 3.13 + Remove the undocumented ``warn()`` method which was an alias to the + :meth:`warning` method. + .. method:: Logger.info(msg, *args, **kwargs) @@ -287,10 +291,6 @@ is the module's name in the Python package namespace. Logs a message with level :const:`WARNING` on this logger. The arguments are interpreted as for :meth:`debug`. - .. note:: There is an obsolete method ``warn`` which is functionally - identical to ``warning``. As ``warn`` is deprecated, please do not use - it - use ``warning`` instead. - .. method:: Logger.error(msg, *args, **kwargs) Logs a message with level :const:`ERROR` on this logger. The arguments are diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 35e6303..1eb859f 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -310,6 +310,12 @@ Removed use ``locale.setlocale(locale.LC_ALL, "")`` instead. (Contributed by Victor Stinner in :gh:`104783`.) +* Remove the undocumented and untested ``logging.Logger.warn()`` method, + deprecated since Python 3.3, which was an alias to the + :meth:`logging.Logger.warning` method: use the :meth:`logging.Logger.warning` + method instead. + (Contributed by Victor Stinner in :gh:`105376`.) + Porting to Python 3.13 ====================== diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 056380f..ba2ed44 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1550,11 +1550,6 @@ class Logger(Filterer): if self.isEnabledFor(WARNING): self._log(WARNING, msg, args, **kwargs) - def warn(self, msg, *args, **kwargs): - warnings.warn("The 'warn' method is deprecated, " - "use 'warning' instead", DeprecationWarning, 2) - self.warning(msg, *args, **kwargs) - def error(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'ERROR'. diff --git a/Misc/NEWS.d/next/Library/2023-06-06-15-32-44.gh-issue-105376.W4oDQp.rst b/Misc/NEWS.d/next/Library/2023-06-06-15-32-44.gh-issue-105376.W4oDQp.rst new file mode 100644 index 0000000..a7d3172 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-06-06-15-32-44.gh-issue-105376.W4oDQp.rst @@ -0,0 +1,4 @@ +Remove the undocumented and untested ``logging.Logger.warn()`` method, +deprecated since Python 3.3, which was an alias to the +:meth:`logging.Logger.warning` method: use the :meth:`logging.Logger.warning` +method instead. Patch by Victor Stinner. |