FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Modules/_typesmodule.c at main · python/cpython · GitHub
python
/
cpython
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
37.4k
Star
77.5k
Code
Issues
5k+
Pull requests
2.7k
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Modules
/
_typesmodule.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
76 lines (70 loc) · 3.19 KB
Breadcrumbs
cpython
/
Modules
/
_typesmodule.c
Copy path
File metadata and controls
76 lines (70 loc) · 3.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* _types module */
#include
"Python.h"
#include
"pycore_descrobject.h"
// _PyMethodWrapper_Type
#include
"pycore_lazyimportobject.h"
// PyLazyImport_Type
#include
"pycore_namespace.h"
// _PyNamespace_Type
#include
"pycore_object.h"
// _PyNone_Type, _PyNotImplemented_Type
#include
"pycore_unionobject.h"
// _PyUnion_Type
static
int
_types_exec
(
PyObject
*
m
)
{
#define
EXPORT_STATIC_TYPE
(
NAME
,
TYPE
) \
do { \
assert(PyUnstable_IsImmortal((PyObject *)&(TYPE))); \
if (PyModule_AddObjectRef(m, (NAME), (PyObject *)&(TYPE)) < 0) { \
return -1; \
} \
} while (0)
EXPORT_STATIC_TYPE
(
"AsyncGeneratorType"
,
PyAsyncGen_Type
);
EXPORT_STATIC_TYPE
(
"BuiltinFunctionType"
,
PyCFunction_Type
);
// BuiltinMethodType is the same as BuiltinFunctionType
EXPORT_STATIC_TYPE
(
"BuiltinMethodType"
,
PyCFunction_Type
);
EXPORT_STATIC_TYPE
(
"CapsuleType"
,
PyCapsule_Type
);
EXPORT_STATIC_TYPE
(
"CellType"
,
PyCell_Type
);
EXPORT_STATIC_TYPE
(
"ClassMethodDescriptorType"
,
PyClassMethodDescr_Type
);
EXPORT_STATIC_TYPE
(
"CodeType"
,
PyCode_Type
);
EXPORT_STATIC_TYPE
(
"CoroutineType"
,
PyCoro_Type
);
EXPORT_STATIC_TYPE
(
"EllipsisType"
,
PyEllipsis_Type
);
EXPORT_STATIC_TYPE
(
"FrameType"
,
PyFrame_Type
);
EXPORT_STATIC_TYPE
(
"FrameLocalsProxyType"
,
PyFrameLocalsProxy_Type
);
EXPORT_STATIC_TYPE
(
"FunctionType"
,
PyFunction_Type
);
EXPORT_STATIC_TYPE
(
"GeneratorType"
,
PyGen_Type
);
EXPORT_STATIC_TYPE
(
"GenericAlias"
,
Py_GenericAliasType
);
EXPORT_STATIC_TYPE
(
"GetSetDescriptorType"
,
PyGetSetDescr_Type
);
// LambdaType is the same as FunctionType
EXPORT_STATIC_TYPE
(
"LambdaType"
,
PyFunction_Type
);
EXPORT_STATIC_TYPE
(
"LazyImportType"
,
PyLazyImport_Type
);
EXPORT_STATIC_TYPE
(
"MappingProxyType"
,
PyDictProxy_Type
);
EXPORT_STATIC_TYPE
(
"MemberDescriptorType"
,
PyMemberDescr_Type
);
EXPORT_STATIC_TYPE
(
"MethodDescriptorType"
,
PyMethodDescr_Type
);
EXPORT_STATIC_TYPE
(
"MethodType"
,
PyMethod_Type
);
EXPORT_STATIC_TYPE
(
"MethodWrapperType"
,
_PyMethodWrapper_Type
);
EXPORT_STATIC_TYPE
(
"ModuleType"
,
PyModule_Type
);
EXPORT_STATIC_TYPE
(
"NoneType"
,
_PyNone_Type
);
EXPORT_STATIC_TYPE
(
"NotImplementedType"
,
_PyNotImplemented_Type
);
EXPORT_STATIC_TYPE
(
"SimpleNamespace"
,
_PyNamespace_Type
);
EXPORT_STATIC_TYPE
(
"TracebackType"
,
PyTraceBack_Type
);
EXPORT_STATIC_TYPE
(
"UnionType"
,
_PyUnion_Type
);
EXPORT_STATIC_TYPE
(
"WrapperDescriptorType"
,
PyWrapperDescr_Type
);
#undef
EXPORT_STATIC_TYPE
return
0
;
}
static
struct
PyModuleDef_Slot
_typesmodule_slots
[]
=
{
_Py_ABI_SLOT
,
{
Py_mod_exec
,
_types_exec
},
{
Py_mod_multiple_interpreters
,
Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
},
{
Py_mod_gil
,
Py_MOD_GIL_NOT_USED
},
{
0
,
NULL
}
};
static
struct
PyModuleDef
typesmodule
=
{
.
m_base
=
PyModuleDef_HEAD_INIT
,
.
m_name
=
"_types"
,
.
m_doc
=
"Define names for built-in types."
,
.
m_size
=
0
,
.
m_slots
=
_typesmodule_slots
,
};
PyMODINIT_FUNC
PyInit__types
(
void
)
{
return
PyModuleDef_Init
(
&
typesmodule
);
}
Back
|
FazBrowse Home
|
New Git URL