[Bug]: incompatible (wrt CPython 3.12) signatures for some integer math functions and int's methods
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
Hướng nghiên cứu
Bắt đầu bằng cách xác định các triển khai hoặc điểm vào của GraalPy cho math.comb, factorial, gcd, isqrt, lcm, perm và int.from_bytes/to_bytes. Chạy các phép so sánh inspect.signature được cung cấp với CPython; được xem là hoàn tất khi các chữ ký, tên tham số, giá trị mặc định và các dấu đánh dấu chỉ-vị-trí khớp với hành vi được báo cáo của CPython 3.12.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 1.7k
- Fork
- 155
- Merge trung bình
- 5 giờ 7 phút
- Pull request đã merge (30 ngày)
- 45
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của oracle/graalpython
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
oracle/graalpython#1105 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
oracle/graalpython#1102 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
oracle/graalpython#1186 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
oracle/graalpython#1185 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 74/100
oracle/graalpython#1133 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của oracle/graalpython
Issue tương tự
-
json_params_matcher fails on falsy top-level JSON primitives (0, False, "")Có thể đã có người làm @mayureshsonawane17 đã nhận hôm nay. Đang mởWaiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
第二章思考题 8:Skill 追加到末尾不必每轮重新计算 KVĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
bojieli/ai-agent-book#1169 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority:low ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
OpenHands/extensions#738 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
micronaut-projects/micronaut-core#13677 ·
Maintainer thường phản hồi trong vòng 1 ngày