mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
It's system-dependent. stubdefaulter told me `multiprocessing.heap.Heap: parameter size: stub default 4096 != runtime default 16384`, which presumably means it's 4096 on @AlexWaygood's system and 16384 on mine. I looked in the code and the default is set to `mmap.PAGESIZE`, which in turn is set from some system call at import time.
37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
import sys
|
|
from _typeshed import Incomplete
|
|
from collections.abc import Callable
|
|
from mmap import mmap
|
|
from typing import Protocol
|
|
from typing_extensions import TypeAlias
|
|
|
|
__all__ = ["BufferWrapper"]
|
|
|
|
class Arena:
|
|
size: int
|
|
buffer: mmap
|
|
if sys.platform == "win32":
|
|
name: str
|
|
def __init__(self, size: int) -> None: ...
|
|
else:
|
|
fd: int
|
|
def __init__(self, size: int, fd: int = -1) -> None: ...
|
|
|
|
_Block: TypeAlias = tuple[Arena, int, int]
|
|
|
|
if sys.platform != "win32":
|
|
class _SupportsDetach(Protocol):
|
|
def detach(self) -> int: ...
|
|
|
|
def reduce_arena(a: Arena) -> tuple[Callable[[int, _SupportsDetach], Arena], tuple[int, Incomplete]]: ...
|
|
def rebuild_arena(size: int, dupfd: _SupportsDetach) -> Arena: ...
|
|
|
|
class Heap:
|
|
def __init__(self, size: int = ...) -> None: ...
|
|
def free(self, block: _Block) -> None: ...
|
|
def malloc(self, size: int) -> _Block: ...
|
|
|
|
class BufferWrapper:
|
|
def __init__(self, size: int) -> None: ...
|
|
def create_memoryview(self) -> memoryview: ...
|