Add stubs for greenlet (#10463)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
David Salvisberg
2023-07-22 20:23:35 +02:00
committed by GitHub
parent 53a8932797
commit 81373c1c63
5 changed files with 107 additions and 0 deletions
@@ -0,0 +1,7 @@
# Error: is not present in stub
# =============================
# this module only contains C code and exports no Python code, so it's better
# if we pretend it doesn't exist
greenlet.platform
# the tests should not be part of the modules
greenlet.tests
@@ -0,0 +1,15 @@
from __future__ import annotations
from typing import Optional
from typing_extensions import assert_type
import greenlet
g = greenlet.greenlet()
h = greenlet.greenlet()
assert_type(g.parent, Optional[greenlet.greenlet])
g.parent = h
# Although "parent" sometimes can be None at runtime,
# it's always illegal for it to be set to None
g.parent = None # type: ignore