Skip to content

Commit d01b052

Browse files
Bump decimal to 3.14 (#14017)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
1 parent 30b7b67 commit d01b052

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

stdlib/@tests/stubtest_allowlists/py314.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ _asyncio.future_discard_from_awaited_by
88
_ctypes.POINTER
99
_ctypes.byref
1010
_ctypes.pointer
11-
_decimal.Decimal.from_number
12-
_decimal.IEEEContext
13-
_decimal.IEEE_CONTEXT_MAX_BITS
1411
_heapq.heapify_max
1512
_heapq.heappop_max
1613
_heapq.heappush_max
@@ -103,8 +100,6 @@ dataclasses.Field.__init__
103100
dataclasses.Field.doc
104101
dataclasses.field
105102
dataclasses.make_dataclass
106-
decimal.Decimal.from_number
107-
decimal.IEEE_CONTEXT_MAX_BITS
108103
dis.Instruction.make
109104
enum.Enum.__signature__
110105
enum.EnumMeta.__signature__

stdlib/_decimal.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ MAX_EMAX: Final[int]
4141
MAX_PREC: Final[int]
4242
MIN_EMIN: Final[int]
4343
MIN_ETINY: Final[int]
44+
if sys.version_info >= (3, 14):
45+
IEEE_CONTEXT_MAX_BITS: Final[int]
4446

4547
def setcontext(context: Context, /) -> None: ...
4648
def getcontext() -> Context: ...
@@ -62,6 +64,9 @@ if sys.version_info >= (3, 11):
6264
else:
6365
def localcontext(ctx: Context | None = None) -> _ContextManager: ...
6466

67+
if sys.version_info >= (3, 14):
68+
def IEEEContext(bits: int, /) -> Context: ...
69+
6570
DefaultContext: Context
6671
BasicContext: Context
6772
ExtendedContext: Context

stdlib/_pydecimal.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This is a slight lie, the implementations aren't exactly identical
22
# However, in all likelihood, the differences are inconsequential
3+
import sys
34
from _decimal import *
45

56
__all__ = [
@@ -41,3 +42,6 @@ __all__ = [
4142
"HAVE_THREADS",
4243
"HAVE_CONTEXTVAR",
4344
]
45+
46+
if sys.version_info >= (3, 14):
47+
__all__ += ["IEEEContext", "IEEE_CONTEXT_MAX_BITS"]

stdlib/decimal.pyi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import numbers
2+
import sys
23
from _decimal import (
34
HAVE_CONTEXTVAR as HAVE_CONTEXTVAR,
45
HAVE_THREADS as HAVE_THREADS,
@@ -28,6 +29,9 @@ from types import TracebackType
2829
from typing import Any, ClassVar, Literal, NamedTuple, final, overload, type_check_only
2930
from typing_extensions import Self, TypeAlias
3031

32+
if sys.version_info >= (3, 14):
33+
from _decimal import IEEE_CONTEXT_MAX_BITS as IEEE_CONTEXT_MAX_BITS, IEEEContext as IEEEContext
34+
3135
_Decimal: TypeAlias = Decimal | int
3236
_DecimalNew: TypeAlias = Decimal | float | str | tuple[int, Sequence[int], int]
3337
_ComparableNum: TypeAlias = Decimal | float | numbers.Rational
@@ -66,6 +70,10 @@ class FloatOperation(DecimalException, TypeError): ...
6670

6771
class Decimal:
6872
def __new__(cls, value: _DecimalNew = "0", context: Context | None = None) -> Self: ...
73+
if sys.version_info >= (3, 14):
74+
@classmethod
75+
def from_number(cls, number: Decimal | float, /) -> Self: ...
76+
6977
@classmethod
7078
def from_float(cls, f: float, /) -> Self: ...
7179
def __bool__(self) -> bool: ...

0 commit comments

Comments
 (0)