From a0d1f466fb77afd073eccad602259ed343090110 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 10 Aug 2022 19:53:47 +0100 Subject: [PATCH] `decimal.Context`: Improve comments (#8525) --- stdlib/_decimal.pyi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index f4b377c22..50c0f2373 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -178,6 +178,11 @@ class _ContextManager: _TrapType: TypeAlias = type[DecimalException] class Context: + # TODO: Context doesn't allow you to delete *any* attributes from instances of the class at runtime, + # even settable attributes like `prec` and `rounding`, + # but that's inexpressable in the stub. + # Type checkers either ignore it or misinterpret it + # if you add a `def __delattr__(self, __name: str) -> NoReturn` method to the stub prec: int rounding: str Emin: int @@ -198,8 +203,6 @@ class Context: traps: None | dict[_TrapType, bool] | Container[_TrapType] = ..., _ignored_flags: list[_TrapType] | None = ..., ) -> None: ... - # __setattr__() only allows to set a specific set of attributes, - # already defined above. def __reduce__(self: Self) -> tuple[type[Self], tuple[Any, ...]]: ... def clear_flags(self) -> None: ... def clear_traps(self) -> None: ...