Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
On Python 3.12.3 and 3.11.9, it looks like theinspect.Signature object for operator'sattrgetter,itemgetter, andmethodcaller classes doesn't match their__call__ method signature:
>>>import inspect>>>import operator>>> inspect.signature(operator.attrgetter("spam"))<Signature (*args, **kwargs)>>>> inspect.signature(operator.itemgetter("spam"))<Signature (*args, **kwargs)>>>> inspect.signature(operator.methodcaller("spam"))<Signature (*args, **kwargs)>
but their__call__ methods only accept a single argument:
# attrgetter / itemgetterdef__call__(self,obj):returnself._call(obj)# methodcallerdef__call__(self,obj):returngetattr(obj,self._name)(*self._args,**self._kwargs)
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
macOS