Bump decimal to 3.14 (#14017)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Semyon Moroz
2025-05-12 05:23:21 +00:00
committed by GitHub
parent 30b7b679f5
commit d01b052dad
4 changed files with 17 additions and 5 deletions
@@ -8,9 +8,6 @@ _asyncio.future_discard_from_awaited_by
_ctypes.POINTER
_ctypes.byref
_ctypes.pointer
_decimal.Decimal.from_number
_decimal.IEEEContext
_decimal.IEEE_CONTEXT_MAX_BITS
_heapq.heapify_max
_heapq.heappop_max
_heapq.heappush_max
@@ -103,8 +100,6 @@ dataclasses.Field.__init__
dataclasses.Field.doc
dataclasses.field
dataclasses.make_dataclass
decimal.Decimal.from_number
decimal.IEEE_CONTEXT_MAX_BITS
dis.Instruction.make
enum.Enum.__signature__
enum.EnumMeta.__signature__
+5
View File
@@ -41,6 +41,8 @@ MAX_EMAX: Final[int]
MAX_PREC: Final[int]
MIN_EMIN: Final[int]
MIN_ETINY: Final[int]
if sys.version_info >= (3, 14):
IEEE_CONTEXT_MAX_BITS: Final[int]
def setcontext(context: Context, /) -> None: ...
def getcontext() -> Context: ...
@@ -62,6 +64,9 @@ if sys.version_info >= (3, 11):
else:
def localcontext(ctx: Context | None = None) -> _ContextManager: ...
if sys.version_info >= (3, 14):
def IEEEContext(bits: int, /) -> Context: ...
DefaultContext: Context
BasicContext: Context
ExtendedContext: Context
+4
View File
@@ -1,5 +1,6 @@
# This is a slight lie, the implementations aren't exactly identical
# However, in all likelihood, the differences are inconsequential
import sys
from _decimal import *
__all__ = [
@@ -41,3 +42,6 @@ __all__ = [
"HAVE_THREADS",
"HAVE_CONTEXTVAR",
]
if sys.version_info >= (3, 14):
__all__ += ["IEEEContext", "IEEE_CONTEXT_MAX_BITS"]
+8
View File
@@ -1,4 +1,5 @@
import numbers
import sys
from _decimal import (
HAVE_CONTEXTVAR as HAVE_CONTEXTVAR,
HAVE_THREADS as HAVE_THREADS,
@@ -28,6 +29,9 @@ from types import TracebackType
from typing import Any, ClassVar, Literal, NamedTuple, final, overload, type_check_only
from typing_extensions import Self, TypeAlias
if sys.version_info >= (3, 14):
from _decimal import IEEE_CONTEXT_MAX_BITS as IEEE_CONTEXT_MAX_BITS, IEEEContext as IEEEContext
_Decimal: TypeAlias = Decimal | int
_DecimalNew: TypeAlias = Decimal | float | str | tuple[int, Sequence[int], int]
_ComparableNum: TypeAlias = Decimal | float | numbers.Rational
@@ -66,6 +70,10 @@ class FloatOperation(DecimalException, TypeError): ...
class Decimal:
def __new__(cls, value: _DecimalNew = "0", context: Context | None = None) -> Self: ...
if sys.version_info >= (3, 14):
@classmethod
def from_number(cls, number: Decimal | float, /) -> Self: ...
@classmethod
def from_float(cls, f: float, /) -> Self: ...
def __bool__(self) -> bool: ...