File pydash_signatures_fix.patch of Package python-pydash.33743

--- pydash-6.0.2/src/pydash/helpers.py	2023-02-24 03:26:36.000000000 +0100
+++ pydash-6.0.2_fix2/src/pydash/helpers.py	2024-05-08 22:49:31.426505419 +0200
@@ -5,6 +5,7 @@
 from decimal import Decimal
 from functools import wraps
 import inspect
+import operator
 from inspect import getfullargspec
 import warnings
 
@@ -73,10 +74,16 @@
             argcount = len(sig.parameters)
 
     if argcount is None:
-        argspec = getfullargspec(iteratee)
-        if argspec and not argspec.varargs:  # pragma: no cover
-            # Use inspected arg count.
-            argcount = len(argspec.args)
+        # Signatures were added these operator methods in Python 3.12.3 and 3.11.9 but their
+        # instance objects are incorrectly reported as accepting varargs when they only accept a
+        # single argument.
+        if isinstance(iteratee, (operator.itemgetter, operator.attrgetter, operator.methodcaller)):
+            argcount = 1
+        else:
+            argspec = getfullargspec(iteratee)
+            if argspec and not argspec.varargs:  # pragma: no cover
+                # Use inspected arg count.
+                argcount = len(argspec.args)
 
     if argcount is None:
         # Assume all args are handleable.
openSUSE Build Service is sponsored by