Skip to content

[BUG] Enum custom signature in 3.14 #37

@ego-thales

Description

@ego-thales

Describe the bug:

Failed test in 3.14:

____________________ test_enum_with_explicit_support_signature ____________________

enum = <enum 'EnumFactory'>

    def test_enum_with_explicit_support_signature(enum):
        """Test our enums signature."""
>       assert repr(signature(enum)) == "<Signature (value)>"
E       AssertionError: assert '<Signature (*values)>' == '<Signature (value)>'
E         
E         - <Signature (value)>
E         + <Signature (*values)>
E         ?             +     +

test/scio/utils/enums/test_enums.py:11: AssertionError

Likely culprit (python/cpython/pull/116234):
https://github.com/python/cpython/blob/5ae4612e72c315ac18edaeee9e4851654844a454/Lib/enum.py#L1087-L1099

How to reproduce:

from enum import Enum
from inspect import Signature, signature

class Foo(int, Enum):
    BAR = 1
    __signature__ = Signature()
>>> # Python 3.14.0
>>> signature(Foo)
<Signature (*values)>
>>> # Python 3.12 and 3.13
>>> signature(Foo)
<Signature ()>

Environment information:

scio version: 1.0.1.dev0
Python version: 3.14.0
Platform: Linux (#85~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 19 16:18:59 UTC 2)
Machine type: x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions