@@ -99,7 +99,9 @@ class Slotted:
9999class Metaclass (type ): ...
100100
101101
102- PY312_PLUS = sys .version_info >= (3 , 12 )
102+ # The interpreter reports NoneType instead of None for an unset ParamSpec bound before CPython gh-151955 (fixed at
103+ # patch level, e.g. present in 3.13.15 but not 3.14.7), so probe the runtime instead of the version.
104+ _NONE_BOUND = ", bound= :py:obj:`None`" if P .__bound__ is not None else ""
103105
104106
105107@pytest .mark .parametrize (
@@ -372,17 +374,15 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
372374 pytest .param (Y , r":py:class:`~typing.TypeVar`\ \(``Y``, bound= :py:class:`str`)" , id = "Y" ),
373375 pytest .param (Z , r":py:class:`~typing.TypeVar`\ \(``Z``, bound= A)" , id = "Z" ),
374376 pytest .param (S , r":py:class:`~typing.TypeVar`\ \(``S``, bound= miss)" , id = "S" ),
375- pytest .param (
376- P , rf":py:class:`~typing.ParamSpec`\ \(``P``{ ', bound= :py:obj:`None`' if PY312_PLUS else '' } )" , id = "P"
377- ),
377+ pytest .param (P , rf":py:class:`~typing.ParamSpec`\ \(``P``{ _NONE_BOUND } )" , id = "P" ),
378378 pytest .param (
379379 P_co ,
380- rf":py:class:`~typing.ParamSpec`\ \(``P_co``{ ', bound= :py:obj:`None`' if PY312_PLUS else '' } , covariant=True)" ,
380+ rf":py:class:`~typing.ParamSpec`\ \(``P_co``{ _NONE_BOUND } , covariant=True)" ,
381381 id = "P_co" ,
382382 ),
383383 pytest .param (
384384 P_contra ,
385- rf":py:class:`~typing.ParamSpec`\ \(``P_contra``{ ', bound= :py:obj:`None`' if PY312_PLUS else '' } "
385+ rf":py:class:`~typing.ParamSpec`\ \(``P_contra``{ _NONE_BOUND } "
386386 ", contravariant=True)" ,
387387 id = "P-contra" ,
388388 ),
0 commit comments