Skip to content

Commit 97694de

Browse files
authored
[3.13] gh-143331: Schedule to remove format "N" for Decimal (GH-143372) (#143477)
(cherry picked from commit dd750b3)
1 parent f2665b6 commit 97694de

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

Doc/deprecations/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Deprecations
99

1010
.. include:: pending-removal-in-3.17.rst
1111

12+
.. include:: pending-removal-in-3.18.rst
13+
1214
.. include:: pending-removal-in-future.rst
1315

1416
C API Deprecations
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Pending removal in Python 3.18
2+
------------------------------
3+
4+
* :mod:`decimal`:
5+
6+
* The non-standard and undocumented :class:`~decimal.Decimal` format
7+
specifier ``'N'``, which is only supported in the :mod:`!decimal` module's
8+
C implementation, has been deprecated since Python 3.13.
9+
(Contributed by Serhiy Storchaka in :gh:`89902`.)

Doc/whatsnew/3.13.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,7 @@ New Deprecations
18701870
* Deprecate the non-standard and undocumented :class:`~decimal.Decimal`
18711871
format specifier ``'N'``,
18721872
which is only supported in the :mod:`!decimal` module's C implementation.
1873+
Scheduled to be removed in Python 3.18.
18731874
(Contributed by Serhiy Storchaka in :gh:`89902`.)
18741875

18751876
* :mod:`dis`:
@@ -2034,6 +2035,8 @@ New Deprecations
20342035

20352036
.. include:: ../deprecations/pending-removal-in-3.17.rst
20362037

2038+
.. include:: ../deprecations/pending-removal-in-3.18.rst
2039+
20372040
.. include:: ../deprecations/pending-removal-in-future.rst
20382041

20392042
CPython Bytecode Changes

Modules/_decimal/_decimal.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3462,7 +3462,8 @@ dec_format(PyObject *dec, PyObject *args)
34623462

34633463
if (size > 0 && fmt[size-1] == 'N') {
34643464
if (PyErr_WarnEx(PyExc_DeprecationWarning,
3465-
"Format specifier 'N' is deprecated", 1) < 0) {
3465+
"Format specifier 'N' is deprecated and "
3466+
"slated for removal in Python 3.18", 1) < 0) {
34663467
return NULL;
34673468
}
34683469
}

0 commit comments

Comments
 (0)