pytoolz / toolz

A functional standard library for Python.
http://toolz.readthedocs.org/
Other
4.57k stars 258 forks source link

test_inspect_wrapped_property fails #577

Open doronbehar opened 2 months ago

doronbehar commented 2 months ago

In a batch of python updates to NixOS, we experienced this error:

=================================== FAILURES ===================================
________________________ test_inspect_wrapped_property _________________________

    def test_inspect_wrapped_property():
        class Wrapped(object):
            def __init__(self, func):
                self.func = func

            def __call__(self, *args, **kwargs):
                return self.func(*args, **kwargs)

            @property
            def __wrapped__(self):
                return self.func

        func = lambda x: x
        wrapped = Wrapped(func)
        assert inspect.signature(func) == inspect.signature(wrapped)

>       assert num_required_args(Wrapped) is None
E       AssertionError: assert 1 is None
E        +  where 1 = num_required_args(<class 'test_inspect_args.test_inspect_wrapped_property.<locals>.Wrapped'>)

toolz/tests/test_inspect_args.py:485: AssertionError
shadchin commented 2 months ago

Fail on Python 3.11.9 or Python 3.12.3

cjwatson commented 2 months ago

This was probably due to https://github.com/python/cpython/commit/59167c962efcae72e8d88aa4b33062ed3de4f120, which was cherry-picked into both 3.11.9 and 3.12.3.