Repository navigation
Fix inaccurate wording in multiple decimal module docstrings - #155688
Conversation
|
Hi, I’m not sure which core developers are most familiar with this module. Would it be possible to invite someone with relevant experience to take a look at this PR? I’m concerned it might otherwise be overlooked :) @skirpichev |
…88-conflict-resolution
|
Thanks @lpyu001 for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
|
Sorry, @lpyu001 and @JelleZijlstra, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
|
Sorry, @lpyu001 and @JelleZijlstra, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
|
GH-160658 is a backport of this pull request to the 3.15 branch. |
|
GH-160657 is a backport of this pull request to the 3.14 branch. |
Summary
Fix five inaccurate or misleading
decimal.Contextdocstrings. These changes only update documentation and generated Argument Clinic output; runtime behavior is unchanged.1.Context.Etop()can return a negative valueRemove the statement that
Etop()must not be negative. A valid custom context can haveEmax < prec - 1, soEmax - prec + 1can be negative.2.
Context.power()exactness depends on exponentbCorrect the exactness condition from base
abeing integral to exponentbbeing integral. A non-integral base raised to an integral exponent can produce an exact result.3.
Context.canonical()returns its argument unchangedClarify that
canonical()returnsxunchanged. The C implementation returns another reference to the original object rather than creating a newDecimalinstance.4.
_pydecimal.Context.number_class()returns unsigned NaN class namesCorrect the documented class names from
-NaNand-sNaNtoNaNandsNaN. The sign of a NaN is not included in the returned classification string.5.
_pydecimal.Context.to_integral_value()can signal other conditionsClarify that
to_integral_value()suppresses only theInexactandRoundedflags, not all flags. For example, ansNaNstill signalsInvalidOperation.Argument Clinic output is regenerated for the C docstring changes.