File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 ``sys.modules['__main__'] `` namespace to avoid issues w/e.g. pickling
88 (#423)
99* CHANGE: Drop support for Python 3.8 and Python 3.9
10+ * FIX: ``ScopingPolicy `` members now type-check properly as instances
11+ thereof -- at least on Python versions (3.11+) where ``enum.StrEnum ``
12+ is available (#427)
1013* FIX: Bytecodes of profiled functions now always labeled to prevent
1114 confusion with non-profiled "twins" (#425)
1215
Original file line number Diff line number Diff line change @@ -600,15 +600,9 @@ def _add_namespace(
600600 namespace : type | types .ModuleType ,
601601 * ,
602602 seen : set [int ] | None = None ,
603- func_scoping_policy : ScopingPolicy = cast (
604- ScopingPolicy , ScopingPolicy .NONE
605- ),
606- class_scoping_policy : ScopingPolicy = cast (
607- ScopingPolicy , ScopingPolicy .NONE
608- ),
609- module_scoping_policy : ScopingPolicy = cast (
610- ScopingPolicy , ScopingPolicy .NONE
611- ),
603+ func_scoping_policy : ScopingPolicy = ScopingPolicy .NONE ,
604+ class_scoping_policy : ScopingPolicy = ScopingPolicy .NONE ,
605+ module_scoping_policy : ScopingPolicy = ScopingPolicy .NONE ,
612606 wrap : bool = False ,
613607 name : str | None = None ,
614608 ) -> int :
Original file line number Diff line number Diff line change @@ -46,7 +46,14 @@ def __str__(self) -> str:
4646 return self .value
4747
4848
49- class StringEnum (getattr (enum , 'StrEnum' , _StrEnumBase )): # type: ignore[misc]
49+ try :
50+ from enum import StrEnum as _StrEnum
51+ except ImportError :
52+ if not typing .TYPE_CHECKING : # Don't confuse the typechecker
53+ _StrEnum = _StrEnumBase
54+
55+
56+ class StringEnum (_StrEnum ):
5057 """
5158 Convenience wrapper around :py:class:`enum.StrEnum`.
5259
You can’t perform that action at this time.
0 commit comments