https://github.com/python/cpython/commit/5965f08d702aadfc5ae51134c22261cefbc82da5
commit: 5965f08d702aadfc5ae51134c22261cefbc82da5
branch: main
author: Mark Byrne <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-08-06T17:49:24+03:00
summary:

gh-109861: Fix a doctest in Lib/_pydecimal.py which was failing when running 
its doctests directly (GH-125479)

Fix a doctest in ``Lib/_pydecimal.py`` which was failing when run
directly on the module via the command:

  ./python.exe -m doctest Lib/_pydecimal.py

Co-authored-by: Sergey B Kirpichev <[email protected]>

files:
M Lib/_pydecimal.py

diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py
index e0b32b7a5e2113..57d6143daea43a 100644
--- a/Lib/_pydecimal.py
+++ b/Lib/_pydecimal.py
@@ -1824,9 +1824,10 @@ def __round__(self, n=None):
         Decimal('123.46')
         >>> round(Decimal('123.456'), -2)
         Decimal('1E+2')
-        >>> round(Decimal('-Infinity'), 37)
+        >>> with localcontext(ExtendedContext):
+        ...     round(Decimal('-Infinity'), 37)
+        ...     round(Decimal('sNaN123'), 0)
         Decimal('NaN')
-        >>> round(Decimal('sNaN123'), 0)
         Decimal('NaN123')
 
         """

_______________________________________________
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