From 8d700746df9074b8b66903e3948138788c798338 Mon Sep 17 00:00:00 2001 From: Osamaali313 Date: Mon, 20 Jul 2026 00:03:37 +0300 Subject: [PATCH] Mark math.log parameters as positional-only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `math.log` is a C function that accepts no keyword arguments; at runtime `math.log(x=8)` and `math.log(8, base=2)` both raise `TypeError: math.log() takes no keyword arguments`. The stub omits the trailing `/`, so type checkers wrongly accept those keyword forms. Every sibling in the same module is already positional-only — isqrt, ldexp, lgamma, log10, log1p, log2, modf all end with `, /` — and `cmath.log` is also `(z, base=..., /)`. `math.log` is the lone exception. Add `, /` (a positional-only parameter may still carry a default). --- stdlib/math/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/math/__init__.pyi b/stdlib/math/__init__.pyi index 4839bf7e90df..b11324c4ae9a 100644 --- a/stdlib/math/__init__.pyi +++ b/stdlib/math/__init__.pyi @@ -90,7 +90,7 @@ def isqrt(n: SupportsIndex, /) -> int: ... def lcm(*integers: SupportsIndex) -> int: ... def ldexp(x: _SupportsFloatOrIndex, i: int, /) -> float: ... def lgamma(x: _SupportsFloatOrIndex, /) -> float: ... -def log(x: _SupportsFloatOrIndex, base: _SupportsFloatOrIndex = ...) -> float: ... +def log(x: _SupportsFloatOrIndex, base: _SupportsFloatOrIndex = ..., /) -> float: ... def log10(x: _SupportsFloatOrIndex, /) -> float: ... def log1p(x: _SupportsFloatOrIndex, /) -> float: ... def log2(x: _SupportsFloatOrIndex, /) -> float: ...