mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-25 01:38:40 +08:00
Add stubs for greenlet (#10463)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user