summaryrefslogtreecommitdiffstats
path: root/Lib/types.py
diff options
context:
space:
mode:
authorAntoine Pitrou <antoine@python.org>2023-09-25 17:50:39 (GMT)
committerGitHub <noreply@github.com>2023-09-25 17:50:39 (GMT)
commit88a6137cdb81c80440d9d1ee7dee17ea0b820f11 (patch)
tree270d9673418978c1344c8061d65e0f9ceb9df619 /Lib/types.py
parentbc06743533b5fea2d5ecdad6dd3caa372c67439f (diff)
downloadcpython-88a6137cdb81c80440d9d1ee7dee17ea0b820f11.zip
cpython-88a6137cdb81c80440d9d1ee7dee17ea0b820f11.tar.gz
cpython-88a6137cdb81c80440d9d1ee7dee17ea0b820f11.tar.bz2
gh-109599: Add types.CapsuleType (#109600)
--------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Lib/types.py')
-rw-r--r--Lib/types.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/types.py b/Lib/types.py
index b4aa19c..1484c22 100644
--- a/Lib/types.py
+++ b/Lib/types.py
@@ -1,6 +1,7 @@
"""
Define names for built-in types that aren't directly accessible as a builtin.
"""
+
import sys
# Iterators in Python aren't a matter of type but of protocol. A large
@@ -330,4 +331,11 @@ EllipsisType = type(Ellipsis)
NoneType = type(None)
NotImplementedType = type(NotImplemented)
+def __getattr__(name):
+ if name == 'CapsuleType':
+ import _socket
+ return type(_socket.CAPI)
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
+
__all__ = [n for n in globals() if n[:1] != '_']
+__all__ += ['CapsuleType']