https://github.com/python/cpython/commit/da3378a6a441089de2577e74645c523aab93e25f
commit: da3378a6a441089de2577e74645c523aab93e25f
branch: 3.14
author: Pengyu <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2026-11-14T12:18:20-08:00
summary:

[3.14] Fix inaccurate wording in multiple decimal module docstrings (GH-155688) 
(#160657)

files:
M Lib/_pydecimal.py
M Modules/_decimal/docstrings.h

diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py
index f4e849d889a3009..158409ef6ff6cf3 100644
--- a/Lib/_pydecimal.py
+++ b/Lib/_pydecimal.py
@@ -5155,8 +5155,8 @@ def number_class(self, a):
         """Returns an indication of the class of the operand.
 
         The class is one of the following strings:
-          -sNaN
-          -NaN
+          sNaN
+          NaN
           -Infinity
           -Normal
           -Subnormal
@@ -5665,8 +5665,9 @@ def to_integral_value(self, a):
         When the operand has a negative exponent, the result is the same
         as using the quantize() operation using the given operand as the
         left-hand-operand, 1E+0 as the right-hand-operand, and the precision
-        of the operand as the precision setting, except that no flags will
-        be set.  The rounding mode is taken from the context.
+        of the operand as the precision setting, except that the Inexact and
+        Rounded flags will not be set.  The rounding mode is taken from the
+        context.
 
         >>> ExtendedContext.to_integral_value(Decimal('2.1'))
         Decimal('2')
diff --git a/Modules/_decimal/docstrings.h b/Modules/_decimal/docstrings.h
index 3a0d54e1f9a957b..9d13d641e866743 100644
--- a/Modules/_decimal/docstrings.h
+++ b/Modules/_decimal/docstrings.h
@@ -586,7 +586,13 @@ Return the sum of x and y.\n\
 
 PyDoc_STRVAR(doc_ctx_canonical,
 "canonical($self, x, /)\n--\n\n\
-Return a new instance of x.\n\
+Returns the same Decimal object.\n\
+\n\
+As we do not have different encodings for the same number, the\n\
+received object already is in its canonical form.\n\
+\n\
+>>> ExtendedContext.canonical(Decimal('2.50'))\n\
+Decimal('2.50')\n\
 \n");
 
 PyDoc_STRVAR(doc_ctx_compare,
@@ -867,7 +873,7 @@ the context to the result.\n\
 PyDoc_STRVAR(doc_ctx_power,
 "power($self, /, a, b, modulo=None)\n--\n\n\
 Compute a**b. If 'a' is negative, then 'b' must be integral. The result\n\
-will be inexact unless 'a' is integral and the result is finite and can\n\
+will be inexact unless 'b' is integral and the result is finite and can\n\
 be expressed exactly in 'precision' digits.  In the Python version the\n\
 result is always correctly rounded, in the C version the result is almost\n\
 always correctly rounded.\n\

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to