[Bug]: invalid signature of int.__new__ and missing signatures for __new__ dunders in extensions
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
Rechercherichtung
Start by reproducing the reported inspect.signature results for int.__new__ and gmp.mpz.__new__, then compare them with the expected CPython signatures. The issue does not name implementation files or tests, so locate the code and tests that determine signatures for built-in and extension __new__ methods. Done means both report the generic (*args, **kwargs) signature.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
In some sense it's a continuation of #998, but I think it deserves a separate issue.
GraalPy reports int.__new__() signature being <Signature (cls, x, /, base)>. That's just invalid, assuming e.g. that non keyword base argument is supported:
Python 3.13.14 (Thu Sep 17 18:51:21 UTC 2026)
[Graal, Oracle GraalVM, Java 25.0.4.1.1 (amd64)] on 'linux'
Type "help", "copyright", "credits" or "license" for more information.
>>> int('123', 16)
291
Also, in fact - default values for x and base are supported. Unfortunately, such methods can't be expressed by some targeted signature.
In CPython it is generic, <Signature (*args, **kwargs)>, and same for __new__() dunders in extensions (Here signatures in the GraalPy are missing.). Perhaps, GraalPy should do same. (Though note that PyPy3 has behavior similar to the GraalPy, but invalid signature here is <Signature (x=0, base=None, /)>.)
Operating system
Linux
CPU architecture
x86_64
GraalPy version
25.0.4.1.1
JDK version
No response
Context configuration
No response
Steps to reproduce
pip install python-gmp
Python 3.13.14 (Thu Sep 17 18:51:21 UTC 2026)
[Graal, Oracle GraalVM, Java 25.0.4.1.1 (amd64)] on 'linux'
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmp, inspect
>>> inspect.signature(int.__new__)
<Signature (cls, x, /, base)>
>>> inspect.signature(gmp.mpz.__new__)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
inspect.signature(gmp.mpz.__new__)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/home/sk/graalpy3.13-25.4.4.1.1-linux-amd64/lib/python3.13/inspect.py", line 3399, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
globals=globals, locals=locals, eval_str=eval_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sk/graalpy3.13-25.4.4.1.1-linux-amd64/lib/python3.13/inspect.py", line 3122, in from_callable
return _signature_from_callable(obj, sigcls=cls,
follow_wrapper_chains=follow_wrapped,
globals=globals, locals=locals, eval_str=eval_str)
File "/home/sk/graalpy3.13-25.4.4.1.1-linux-amd64/lib/python3.13/inspect.py", line 2615, in _signature_from_callable
return _signature_from_builtin(sigcls, obj,
skip_bound_arg=skip_bound_arg)
File "/home/sk/graalpy3.13-25.4.4.1.1-linux-amd64/lib/python3.13/inspect.py", line 2401, in _signature_from_builtin
raise ValueError("no signature found for builtin {!r}".format(func))
ValueError: no signature found for builtin <built-in method __new__ of type object at 0x42603ed>
Expected behavior
Python 3.16.0a0 (heads/main:ee68f5f46a1, Aug 12 2026, 11:19:39) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmp, inspect
>>> inspect.signature(int.__new__)
<Signature (*args, **kwargs)>
>>> inspect.signature(gmp.mpz.__new__)
<Signature (*args, **kwargs)>
Stack trace
Additional context
No response
- Vorherrschende Sprache
- Python
- Sterne
- 1.7k
- Forks
- 155
- Ø Merge
- 6 Std. 26 Min.
- Gemergte PRs (30 T.)
- 53
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus oracle/graalpython
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
oracle/graalpython#1105 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
oracle/graalpython#1102 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 74/100
oracle/graalpython#1133 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
oracle/graalpython#1112 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
oracle/graalpython#1111 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in oracle/graalpython
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 3 Tagen
-
Negation with "not" and "no" is ignored during sentiment analysisEvtl. vergeben @vivek-3728 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
techcsispit/mess-mood#11 · 1 Kommentar ·
-
changelog investigate
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
ramnes/notion-sdk-py#408 ·
-
good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
btclib-org/btclib-wallet#267 ·
Maintainer antworten meist innerhalb von 1 Tag
-
good first issue tech-debt
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
knnmelprop/YAADO#111 ·