From ba321e7748676a4ab44736e36f1dd53f29c15ca6 Mon Sep 17 00:00:00 2001 From: donbarbos Date: Sat, 3 Jan 2026 00:09:15 +0400 Subject: [PATCH 1/5] gh-143331: Schedule to remove format "N" for Decimal --- Doc/deprecations/index.rst | 2 ++ Doc/deprecations/pending-removal-in-3.18.rst | 9 +++++++++ Doc/whatsnew/3.13.rst | 1 + 3 files changed, 12 insertions(+) create mode 100644 Doc/deprecations/pending-removal-in-3.18.rst diff --git a/Doc/deprecations/index.rst b/Doc/deprecations/index.rst index f3cecb321d633f..c91c64a1092457 100644 --- a/Doc/deprecations/index.rst +++ b/Doc/deprecations/index.rst @@ -7,6 +7,8 @@ Deprecations .. include:: pending-removal-in-3.17.rst +.. include:: pending-removal-in-3.18.rst + .. include:: pending-removal-in-3.19.rst .. include:: pending-removal-in-3.20.rst diff --git a/Doc/deprecations/pending-removal-in-3.18.rst b/Doc/deprecations/pending-removal-in-3.18.rst new file mode 100644 index 00000000000000..3e799219478424 --- /dev/null +++ b/Doc/deprecations/pending-removal-in-3.18.rst @@ -0,0 +1,9 @@ +Pending removal in Python 3.18 +------------------------------ + +* :mod:`decimal`: + + * The non-standard and undocumented :class:`~decimal.Decimal` format + specifier ``'N'``, which is only supported in the :mod:`!decimal` module's + C implementation, has been deprecated since Python 3.13. + (Contributed by Serhiy Storchaka in :gh:`89902`.) diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index dc105156f33080..59a5152dfd7bf5 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -1861,6 +1861,7 @@ New Deprecations * Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C implementation. + Scheduled to be removed in Python 3.18. (Contributed by Serhiy Storchaka in :gh:`89902`.) * :mod:`dis`: From a2edb3cd761c73ea619cd72d0aa7f3547534c5d1 Mon Sep 17 00:00:00 2001 From: donbarbos Date: Sun, 4 Jan 2026 13:49:16 +0400 Subject: [PATCH 2/5] Update Doc/whatsnew/3.13.rst --- Doc/whatsnew/3.13.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 59a5152dfd7bf5..3be6dcb3eacad2 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -2025,6 +2025,8 @@ New Deprecations .. include:: ../deprecations/pending-removal-in-3.17.rst +.. include:: ../deprecations/pending-removal-in-3.18.rst + .. include:: ../deprecations/pending-removal-in-3.19.rst .. include:: ../deprecations/pending-removal-in-3.20.rst From 1cad56b54571c731a72e871d88b6952aeba60280 Mon Sep 17 00:00:00 2001 From: donbarbos Date: Sun, 4 Jan 2026 13:54:47 +0400 Subject: [PATCH 3/5] include pending-removal-in-3.18 to whatsnew/3.15 .rst --- Doc/whatsnew/3.15.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index afefcc15ab2d55..ab05541eee556f 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -1048,6 +1048,8 @@ New deprecations .. include:: ../deprecations/pending-removal-in-3.17.rst +.. include:: ../deprecations/pending-removal-in-3.18.rst + .. include:: ../deprecations/pending-removal-in-3.19.rst .. include:: ../deprecations/pending-removal-in-3.20.rst From d17f21ad5c905cfc55d87508bdd1b92c201a523d Mon Sep 17 00:00:00 2001 From: donbarbos Date: Sun, 4 Jan 2026 22:15:03 +0400 Subject: [PATCH 4/5] update 3.14 --- Doc/whatsnew/3.14.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 9459b73bcb502f..568e2d51bd6d51 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -2709,6 +2709,8 @@ New deprecations .. include:: ../deprecations/pending-removal-in-3.17.rst +.. include:: ../deprecations/pending-removal-in-3.18.rst + .. include:: ../deprecations/pending-removal-in-3.19.rst .. include:: ../deprecations/pending-removal-in-3.20.rst From 81304ef2f25fa3cb2e27df7877a208691d4e601a Mon Sep 17 00:00:00 2001 From: donbarbos Date: Mon, 5 Jan 2026 21:21:39 +0400 Subject: [PATCH 5/5] Update deprecation message --- Modules/_decimal/_decimal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index 6ed8c0f3beb277..0fb7ffbcc43211 100644 --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -3764,7 +3764,8 @@ _decimal_Decimal___format___impl(PyObject *dec, PyTypeObject *cls, if (size > 0 && fmt[size-1] == 'N') { if (PyErr_WarnEx(PyExc_DeprecationWarning, - "Format specifier 'N' is deprecated", 1) < 0) { + "Format specifier 'N' is deprecated and " + "slated for removal in Python 3.18", 1) < 0) { return NULL; } }