Add stubs for greenlet (#10463)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
David SalvisbergandAlex Waygood authored and GitHub committed 2023-07-22 19:23:35 +01:00
1 parent 53a8932797
commit 81373c1c63
5 files changed
+107

No files matched your search

@@ -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