From fa4ca40f5cda089473dd4dc5d1ec2c1753e1c11d Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Thu, 29 Feb 2024 11:03:36 +0300 Subject: [PATCH] Fix `_operator.attrgetter` pos-only params (#11504) There cannot be any keywords: ```c static PyObject * attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { attrgetterobject *ag; PyObject *attr; Py_ssize_t nattrs, idx, char_idx; if (!_PyArg_NoKeywords("attrgetter", kwds)) return NULL; // ... ``` --- stdlib/_operator.pyi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/_operator.pyi b/stdlib/_operator.pyi index acc4a6fb5..9b24e086a 100644 --- a/stdlib/_operator.pyi +++ b/stdlib/_operator.pyi @@ -95,16 +95,16 @@ def length_hint(__obj: object, __default: int = 0) -> int: ... @final class attrgetter(Generic[_T_co]): @overload - def __new__(cls, attr: str) -> attrgetter[Any]: ... + def __new__(cls, attr: str, /) -> attrgetter[Any]: ... @overload - def __new__(cls, attr: str, __attr2: str) -> attrgetter[tuple[Any, Any]]: ... + def __new__(cls, attr: str, attr2: str, /) -> attrgetter[tuple[Any, Any]]: ... @overload - def __new__(cls, attr: str, __attr2: str, __attr3: str) -> attrgetter[tuple[Any, Any, Any]]: ... + def __new__(cls, attr: str, attr2: str, attr3: str, /) -> attrgetter[tuple[Any, Any, Any]]: ... @overload - def __new__(cls, attr: str, __attr2: str, __attr3: str, __attr4: str) -> attrgetter[tuple[Any, Any, Any, Any]]: ... + def __new__(cls, attr: str, attr2: str, attr3: str, attr4: str, /) -> attrgetter[tuple[Any, Any, Any, Any]]: ... @overload - def __new__(cls, attr: str, *attrs: str) -> attrgetter[tuple[Any, ...]]: ... - def __call__(self, obj: Any) -> _T_co: ... + def __new__(cls, attr: str, /, *attrs: str) -> attrgetter[tuple[Any, ...]]: ... + def __call__(self, obj: Any, /) -> _T_co: ... @final class itemgetter(Generic[_T_co]):