From: George Waters Date: Mon, 14 Jul 2025 15:20:32 +0000 (-0400) Subject: Make micropython.const accept any constant type X-Git-Tag: 8.63.0~2^2~1 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/d92dc8084a38204adb5cf0453ba789f4226039ae?ds=inline Make micropython.const accept any constant type micropython.const now supports any constant type, not just int. This updates the type checking to reflect this. This also updates the name of the file so that type checkers can find it. --- diff --git a/src/micropython-stubs/micropython.pyi b/src/micropython-stubs/__init__.pyi similarity index 95% rename from src/micropython-stubs/micropython.pyi rename to src/micropython-stubs/__init__.pyi index 33dd6a9..5026b97 100644 --- a/src/micropython-stubs/micropython.pyi +++ b/src/micropython-stubs/__init__.pyi @@ -12,7 +12,7 @@ from typing import Callable, TypeVar, Any, NoReturn Fun = TypeVar("Fun", bound=Callable[..., Any]) -def const(x: int) -> int: +def const[T](x: T) -> T: "Emulate making a constant" def native(f: Fun) -> Fun: