]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109861: Fix a doctest in Lib/_pydecimal.py which was failing when running its...
authorMark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
Thu, 6 Aug 2026 14:49:24 +0000 (16:49 +0200)
committerGitHub <noreply@github.com>
Thu, 6 Aug 2026 14:49:24 +0000 (17:49 +0300)
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 <skirpichev@gmail.com>
Lib/_pydecimal.py

index e0b32b7a5e21139f9d42ff77002c89d23a1d65a3..57d6143daea43a33cd02c4fcb59df8d7113791b6 100644 (file)
@@ -1824,9 +1824,10 @@ class Decimal(object):
         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')
 
         """