]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-143331: Schedule to remove format "N" for Decimal (GH-143372) (#143477)
authorSemyon Moroz <donbarbos@proton.me>
Tue, 6 Jan 2026 14:02:32 +0000 (14:02 +0000)
committerGitHub <noreply@github.com>
Tue, 6 Jan 2026 14:02:32 +0000 (14:02 +0000)
(cherry picked from commit dd750b348501247d458ea8d454213d4959a8f8b9)

Doc/deprecations/index.rst
Doc/deprecations/pending-removal-in-3.18.rst [new file with mode: 0644]
Doc/whatsnew/3.13.rst
Modules/_decimal/_decimal.c

index e3adce995659e716c890cc32267c859e633b0f59..f004724fac08ba02b01b6e461979f3997b65c47b 100644 (file)
@@ -9,6 +9,8 @@ Deprecations
 
 .. include:: pending-removal-in-3.17.rst
 
+.. include:: pending-removal-in-3.18.rst
+
 .. include:: pending-removal-in-future.rst
 
 C API Deprecations
diff --git a/Doc/deprecations/pending-removal-in-3.18.rst b/Doc/deprecations/pending-removal-in-3.18.rst
new file mode 100644 (file)
index 0000000..3e79921
--- /dev/null
@@ -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`.)
index 21873e3a1d42cede2c761a9b6e210013fdcaa53e..6f1e4487009c08dd35555e4cb2656b581c007508 100644 (file)
@@ -1870,6 +1870,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`:
@@ -2034,6 +2035,8 @@ New Deprecations
 
 .. include:: ../deprecations/pending-removal-in-3.17.rst
 
+.. include:: ../deprecations/pending-removal-in-3.18.rst
+
 .. include:: ../deprecations/pending-removal-in-future.rst
 
 CPython Bytecode Changes
index 59ee32ab77076fa6b786d55af4136c95bd8e02e8..cbe7af132409a020371053892c8f24f93d6b860b 100644 (file)
@@ -3462,7 +3462,8 @@ dec_format(PyObject *dec, PyObject *args)
 
         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;
             }
         }