Skip to content

Commit 520f807

Browse files
authored
builtins: default values for int.(to|from)_bytes in py311 (#7647)
See python/cpython#89318
1 parent c93f92d commit 520f807

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

stdlib/builtins.pyi

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,29 @@ class int:
218218
if sys.version_info >= (3, 10):
219219
def bit_count(self) -> int: ...
220220

221-
def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ...
222-
@classmethod
223-
def from_bytes(
224-
cls: type[Self],
225-
bytes: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer,
226-
byteorder: Literal["little", "big"],
227-
*,
228-
signed: bool = ...,
229-
) -> Self: ...
221+
if sys.version_info >= (3, 11):
222+
def to_bytes(
223+
self, length: SupportsIndex = ..., byteorder: Literal["little", "big"] = ..., *, signed: bool = ...
224+
) -> bytes: ...
225+
@classmethod
226+
def from_bytes(
227+
cls: type[Self],
228+
bytes: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer,
229+
byteorder: Literal["little", "big"] = ...,
230+
*,
231+
signed: bool = ...,
232+
) -> Self: ...
233+
else:
234+
def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ...
235+
@classmethod
236+
def from_bytes(
237+
cls: type[Self],
238+
bytes: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer,
239+
byteorder: Literal["little", "big"],
240+
*,
241+
signed: bool = ...,
242+
) -> Self: ...
243+
230244
def __add__(self, __x: int) -> int: ...
231245
def __sub__(self, __x: int) -> int: ...
232246
def __mul__(self, __x: int) -> int: ...

0 commit comments

Comments
 (0)