<!-- If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not the right place to seek help. Consider the following options instead: - reading the Python tutorial: https://docs.python.org/3/tutorial/ - posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7 - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list - searching our issue tracker (https://github.com/python/cpython/issues) to see if your problem has already been reported --> # Bug report Noticed this while testing `3.12.0b4`. While in my particular case I can work around it, it never the less is a change in behavior to `3.11`. ```py class FixedIntType(int): _signed: bool def __new__(cls, *args, **kwargs): print(f"{cls}, {args=}") return super().__new__(cls, *args, **kwargs) def __init_subclass__(cls, signed: int | None = None) -> None: super().__init_subclass__() if signed is not None: cls._signed = signed if "__new__" not in cls.__dict__: cls.__new__ = cls.__new__ # <-- This line triggers the error class uint_t(FixedIntType, signed=False): pass class CustomInt(uint_t): def __new__(cls, value: int = 0): return super().__new__(cls, value) def with_id(self, value: int): return type(self)(value) CustomInt().with_id(1024) ``` ``` <class '__main__.CustomInt'>, args=(0,) <class '__main__.CustomInt'>, args=(<class '__main__.CustomInt'>, 1024) Traceback (most recent call last): File "/.../cpython/test.py", line 26, in <module> CustomInt().with_id(1024) File "/.../cpython/test.py", line 24, in with_id return type(self)(value) ^^^^^^^^^^^^^^^^^ File "/.../cpython/test.py", line 21, in __new__ return super().__new__(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/.../cpython/test.py", line 6, in __new__ return super().__new__(cls, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: int() base must be >= 2 and <= 36, or 0 ``` Without `cls.__new__ = cls.__new__` ``` <class '__main__.CustomInt'>, args=(0,) <class '__main__.CustomInt'>, args=(1024,) ``` I bisected the issue to #103497. /CC: @carljm # Your environment - CPython versions tested on: `3.120b4` - Operating system and architecture: macOS ARM64 <!-- gh-linked-prs --> ### Linked PRs * gh-106977 * gh-107204 <!-- /gh-linked-prs -->