blueloveTH 2 ماه پیش
والد
کامیت
64ec1ed313
3فایلهای تغییر یافته به همراه19 افزوده شده و 18 حذف شده
  1. 17 18
      include/typings/stdc.pyi
  2. 2 0
      python/typing.py
  3. 0 0
      src/common/_generated.c

+ 17 - 18
include/typings/stdc.pyi

@@ -1,4 +1,4 @@
-from typing import overload, Self
+from typing import Self, ClassVar
 
 intptr = int
 
@@ -9,15 +9,13 @@ def memcpy(dst: intptr, src: intptr, n: int) -> None: ...
 def memset(s: intptr, c: int, n: int) -> None: ...
 def memcmp(s1: intptr, s2: intptr, n: int) -> int: ...
 
-def addressof(obj: Memory) -> intptr: ...
-def sizeof(obj: type[Memory]) -> int: ...
-
 def read_cstr(p: intptr) -> str: ...
 def read_bytes(p: intptr, n: int) -> bytes: ...
 def write_cstr(p: intptr, data: str) -> None: ...
 def write_bytes(p: intptr, data: bytes) -> None: ...
 
-class Memory: ...
+class Memory:
+    size: ClassVar[int]
 
 class _BuiltinMemory[T](Memory):
     value: T
@@ -27,11 +25,8 @@ class _BuiltinMemory[T](Memory):
     def read(p: intptr, offset: int) -> T: ...
     @staticmethod
     def write(p: intptr, offset: int, value: T) -> None: ...
-    @staticmethod
-    def array(length: int) -> Self: ...
-
-    @property
-    def size(self) -> int: ...
+    @classmethod
+    def array(cls, length: int) -> Self: ...
 
     def __getitem__(self, index: int) -> T: ...
     def __setitem__(self, index: int, value: T) -> None: ...
@@ -51,11 +46,15 @@ class Double(_BuiltinMemory[float]): ...
 class Pointer(_BuiltinMemory[intptr]): ...
 class Bool(_BuiltinMemory[bool]): ...
 
-INT8: _BuiltinMemory[int]
-UINT8: _BuiltinMemory[int]
-INT16: _BuiltinMemory[int]
-UINT16: _BuiltinMemory[int]
-INT32: _BuiltinMemory[int]
-UINT32: _BuiltinMemory[int]
-INT64: _BuiltinMemory[int]
-UINT64: _BuiltinMemory[int]
+INT8: _BuiltinMemory[int] = ...
+UINT8: _BuiltinMemory[int] = ...
+INT16: _BuiltinMemory[int] = ...
+UINT16: _BuiltinMemory[int] = ...
+INT32: _BuiltinMemory[int] = ...
+UINT32: _BuiltinMemory[int] = ...
+INT64: _BuiltinMemory[int] = ...
+UINT64: _BuiltinMemory[int] = ...
+
+def addressof(obj: Memory) -> intptr: ...
+def sizeof(obj: type[Memory]) -> int: ...
+

+ 2 - 0
python/typing.py

@@ -28,6 +28,8 @@ Type = _PLACEHOLDER
 TypeAlias = _PLACEHOLDER
 NewType = _PLACEHOLDER
 
+ClassVar = _PLACEHOLDER
+
 Literal = _PLACEHOLDER
 LiteralString = _PLACEHOLDER
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
src/common/_generated.c


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است