FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Modules/_typingmodule.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
/
_typingmodule.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
100 lines (82 loc) · 2.47 KB
Breadcrumbs
cpython
/
Modules
/
_typingmodule.c
Copy path
File metadata and controls
100 lines (82 loc) · 2.47 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* typing accelerator C extension: _typing module. */
#ifndef
Py_BUILD_CORE
#define
Py_BUILD_CORE
#endif
#include
"Python.h"
#include
"internal/pycore_interp.h"
#include
"internal/pycore_typevarobject.h"
#include
"internal/pycore_unionobject.h"
// _PyUnion_Type
#include
"pycore_pystate.h"
// _PyInterpreterState_GET()
#include
"clinic/_typingmodule.c.h"
/*[clinic input]
module _typing
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=1db35baf1c72942b]*/
/* helper function to make typing.NewType.__call__ method faster */
/*[clinic input]
_typing._idfunc -> object
x: object
/
[clinic start generated code]*/
static
PyObject
*
_typing__idfunc
(
PyObject
*
module
,
PyObject
*
x
)
/*[clinic end generated code: output=63c38be4a6ec5f2c input=49f17284b43de451]*/
{
return
Py_NewRef
(
x
);
}
static
PyMethodDef
typing_methods
[]
=
{
_TYPING__IDFUNC_METHODDEF
{
NULL
,
NULL
,
0
,
NULL
}
};
PyDoc_STRVAR
(
typing_doc
,
"Primitives and accelerators for the typing module.\n"
);
static
int
_typing_exec
(
PyObject
*
m
)
{
PyInterpreterState
*
interp
=
_PyInterpreterState_GET
();
#define
EXPORT_TYPE
(
name
,
typename
) \
if (PyModule_AddObjectRef(m, name, \
(PyObject *)interp->cached_objects.typename) < 0) { \
return -1; \
}
EXPORT_TYPE
(
"TypeVar"
,
typevar_type
);
EXPORT_TYPE
(
"TypeVarTuple"
,
typevartuple_type
);
EXPORT_TYPE
(
"ParamSpec"
,
paramspec_type
);
EXPORT_TYPE
(
"ParamSpecArgs"
,
paramspecargs_type
);
EXPORT_TYPE
(
"ParamSpecKwargs"
,
paramspeckwargs_type
);
EXPORT_TYPE
(
"Generic"
,
generic_type
);
#undef
EXPORT_TYPE
if
(
PyModule_AddObjectRef
(
m
,
"TypeAliasType"
, (
PyObject
*
)
&
_PyTypeAlias_Type
)
<
0
) {
return
-1
;
}
if
(
PyModule_AddObjectRef
(
m
,
"Union"
, (
PyObject
*
)
&
_PyUnion_Type
)
<
0
) {
return
-1
;
}
if
(
PyModule_AddObjectRef
(
m
,
"NoDefault"
, (
PyObject
*
)
&
_Py_NoDefaultStruct
)
<
0
) {
return
-1
;
}
return
0
;
}
static
struct
PyModuleDef_Slot
_typingmodule_slots
[]
=
{
_Py_ABI_SLOT
,
{
Py_mod_exec
,
_typing_exec
},
{
Py_mod_multiple_interpreters
,
Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
},
{
Py_mod_gil
,
Py_MOD_GIL_NOT_USED
},
{
0
,
NULL
}
};
static
struct
PyModuleDef
typingmodule
=
{
PyModuleDef_HEAD_INIT
,
"_typing"
,
typing_doc
,
0
,
typing_methods
,
_typingmodule_slots
,
NULL
,
NULL
,
NULL
};
PyMODINIT_FUNC
PyInit__typing
(
void
)
{
return
PyModuleDef_Init
(
&
typingmodule
);
}
Back
|
FazBrowse Home
|
New Git URL