Skip to content

Commit 0ff0444

Browse files
committed
gh-105376: Remove logging.Logger.warn() method
1 parent 3907de1 commit 0ff0444

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

Doc/library/logging.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ is the module's name in the Python package namespace.
275275
.. versionchanged:: 3.8
276276
The *stacklevel* parameter was added.
277277

278+
.. versionchanged:: 3.13
279+
Remove the undocumented ``warn()`` method which was an alias to the
280+
:meth:`warning` method.
281+
278282

279283
.. method:: Logger.info(msg, *args, **kwargs)
280284

@@ -287,10 +291,6 @@ is the module's name in the Python package namespace.
287291
Logs a message with level :const:`WARNING` on this logger. The arguments are
288292
interpreted as for :meth:`debug`.
289293

290-
.. note:: There is an obsolete method ``warn`` which is functionally
291-
identical to ``warning``. As ``warn`` is deprecated, please do not use
292-
it - use ``warning`` instead.
293-
294294
.. method:: Logger.error(msg, *args, **kwargs)
295295

296296
Logs a message with level :const:`ERROR` on this logger. The arguments are

Doc/whatsnew/3.13.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ Removed
310310
use ``locale.setlocale(locale.LC_ALL, "")`` instead.
311311
(Contributed by Victor Stinner in :gh:`104783`.)
312312

313+
* Remove the undocumented and untested ``logging.Logger.warn()`` method,
314+
deprecated since Python 3.3, which was an alias to the
315+
:meth:`logging.Logger.warning` method: use the :meth:`logging.Logger.warning`
316+
method instead.
317+
(Contributed by Victor Stinner in :gh:`105376`.)
318+
313319

314320
Porting to Python 3.13
315321
======================

Lib/logging/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,11 +1550,6 @@ def warning(self, msg, *args, **kwargs):
15501550
if self.isEnabledFor(WARNING):
15511551
self._log(WARNING, msg, args, **kwargs)
15521552

1553-
def warn(self, msg, *args, **kwargs):
1554-
warnings.warn("The 'warn' method is deprecated, "
1555-
"use 'warning' instead", DeprecationWarning, 2)
1556-
self.warning(msg, *args, **kwargs)
1557-
15581553
def error(self, msg, *args, **kwargs):
15591554
"""
15601555
Log 'msg % args' with severity 'ERROR'.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Remove the undocumented and untested ``logging.Logger.warn()`` method,
2+
deprecated since Python 3.3, which was an alias to the
3+
:meth:`logging.Logger.warning` method: use the :meth:`logging.Logger.warning`
4+
method instead. Patch by Victor Stinner.

0 commit comments

Comments
 (0)