[Bug]: incompatible (wrt CPython 3.12) signatures for some integer math functions and int's methods
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
まず、math.comb、factorial、gcd、isqrt、lcm、perm、int.from_bytes/to_bytes に対応する GraalPy の実装またはエントリポイントを特定します。提供されている inspect.signature の比較を CPython に対して実行します。シグネチャ、パラメータ名、デフォルト値、位置専用マーカーが、報告されている CPython 3.12 の動作と一致すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Python 3.12.13 (tags/v3.12.13:3bb231a6a5d, May 14 2026, 11:06:30) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import math, inspect
>>> for fn in ["comb", "factorial", "gcd", "isqrt", "lcm", "perm"]:
... f = getattr(math, fn)
... print(f, inspect.signature(f))
...
<built-in function comb> (n, k, /)
<built-in function factorial> (n, /)
<built-in function gcd> (*integers)
<built-in function isqrt> (n, /)
<built-in function lcm> (*integers)
<built-in function perm> (n, k=None, /)
>>> for meth in dir(int):
... m = getattr(int, meth)
... if meth.startswith("_") or not callable(m):
... continue
... try:
... print(meth, inspect.signature(m))
... except ValueError:
... pass
...
as_integer_ratio (self, /)
bit_count (self, /)
bit_length (self, /)
from_bytes (bytes, byteorder='big', *, signed=False)
is_integer (self, /)
to_bytes (self, /, length=1, byteorder='big', *, signed=False)
In the GraalPy instead:
Python 3.12.8 (Tue Jun 23 15:17:16 UTC 2026)
[Graal, GraalVM CE, Java 25.0.3 (amd64)] on 'linux'
Type "help", "copyright", "credits" or "license" for more information.
>>> import math, inspect
>>> for fn in ["comb", "factorial", "gcd", "isqrt", "lcm", "perm"]:
... f = getattr(math, fn)
... print(f, inspect.signature(f))
...
<built-in function comb> (a, b, /)
<built-in function factorial> (a, /)
<built-in function gcd> (*args, **kwargs)
<built-in function isqrt> (a, /)
<built-in function lcm> (*args, **kwargs)
<built-in function perm> (n, k, /)
>>> for meth in dir(int):
... m = getattr(int, meth)
... if meth.startswith("_") or not callable(m):
... continue
... try:
... print(meth, inspect.signature(m))
... except ValueError:
... pass
...
as_integer_ratio (self, /)
bit_count (self, /)
bit_length (self, /)
conjugate (self, /)
from_bytes (bytes, byteorder, /, *, signed)
is_integer (self, /)
to_bytes (self, length, byteorder, /, *, signed)
As you can see, all present function signatures from the math module are different. Of course, most functions have positional-only arguments and naming differences aren't significant. But differences for gcd, lcm and perm - are. Same true for to_bytes/from_bytes methods: they lack default values and incorrectly specify positional-only arguments.
Though, I would appreciate if signatures will be fully compatible, including naming of positional-only parameters. The reason is that such naming is used in the Python prose docs, e.g. https://docs.python.org/3.12/library/math.html#math.comb. The GraalPy has no documentation like this for the stdlib.
Operating system
Linux
CPU architecture
x86_64
GraalPy version
25.1.3
JDK version
No response
Context configuration
No response
Steps to reproduce
See bug description.
Expected behavior
Match CPython.
Stack trace
Additional context
No response
- 主要言語
- Python
- スター
- 1.6k
- フォーク
- 155
- 平均マージ
- 7時間 35分
- マージ済み PR(30日)
- 48
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
oracle/graalpython のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
oracle/graalpython#1105 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
oracle/graalpython#1102 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
oracle/graalpython#1169 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
oracle/graalpython#1133 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
oracle/graalpython#1112 ·
メンテナーはふだん 1 日以内に返信
oracle/graalpython の issue をすべて見る
似ている issue
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
kristofdegrave/homeassistant-smart-charging#1413 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
nasa/earthdata-varinfo#113 ·
-
curriculum documentation quality
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
githubnext/gh-aw-workshop#3849 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信