FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Modules/_testcapi/modsupport.c at 3.15 · python/cpython · GitHub
python
cpython
Repository navigation
Code
Issues
5k+
(5k+)
Pull requests
2.5k
(2.5k)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Modules
/
_testcapi
/
modsupport.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
83 lines (75 loc) · 2.19 KB
Breadcrumbs
cpython
/
Modules
/
_testcapi
/
modsupport.c
Copy path
File metadata and controls
83 lines (75 loc) · 2.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
77
78
79
80
81
82
83
#include
"parts.h"
static
PyObject
*
pyabiinfo_check
(
PyObject
*
Py_UNUSED
(
module
),
PyObject
*
args
)
{
const
char
*
modname
;
unsigned long
maj
,
min
,
flags
,
buildver
,
abiver
;
if
(!
PyArg_ParseTuple
(
args
,
"zkkkkk"
,
&
modname
,
&
maj
,
&
min
,
&
flags
,
&
buildver
,
&
abiver
))
{
return
NULL
;
}
PyABIInfo
info
=
{
.
abiinfo_major_version
=
(
uint8_t
)
maj
,
.
abiinfo_minor_version
=
(
uint8_t
)
min
,
.
flags
=
(
uint16_t
)
flags
,
.
build_version
=
(
uint32_t
)
buildver
,
.
abi_version
=
(
uint32_t
)
abiver
};
if
(
PyABIInfo_Check
(
&
info
,
modname
)
<
0
) {
return
NULL
;
}
Py_RETURN_NONE
;
}
static
PyObject
*
pyarg_parsearray
(
PyObject
*
self
,
PyObject
*
const
*
args
,
Py_ssize_t
nargs
)
{
int
a
,
b
,
c
=
0
;
if
(!
PyArg_ParseArray
(
args
,
nargs
,
"ii|i"
,
&
a
,
&
b
,
&
c
)) {
return
NULL
;
}
return
Py_BuildValue
(
"iii"
,
a
,
b
,
c
);
}
static
PyObject
*
pyarg_parsearrayandkeywords
(
PyObject
*
self
,
PyObject
*
const
*
args
,
Py_ssize_t
nargs
,
PyObject
*
kwnames
)
{
int
a
,
b
,
c
=
0
;
const
char
*
kwlist
[]
=
{
"a"
,
"b"
,
"c"
,
NULL
};
if
(!
PyArg_ParseArrayAndKeywords
(
args
,
nargs
,
kwnames
,
"ii|i"
,
kwlist
,
&
a
,
&
b
,
&
c
)) {
return
NULL
;
}
return
Py_BuildValue
(
"iii"
,
a
,
b
,
c
);
}
static
PyMethodDef
TestMethods
[]
=
{
{
"pyabiinfo_check"
,
pyabiinfo_check
,
METH_VARARGS
},
{
"pyarg_parsearray"
,
_PyCFunction_CAST
(
pyarg_parsearray
),
METH_FASTCALL
},
{
"pyarg_parsearrayandkeywords"
,
_PyCFunction_CAST
(
pyarg_parsearrayandkeywords
),
METH_FASTCALL
|
METH_KEYWORDS
},
{
NULL
},
};
int
_PyTestCapi_Init_Modsupport
(
PyObject
*
m
)
{
if
(
PyModule_AddIntMacro
(
m
,
PyABIInfo_STABLE
)
<
0
) {
return
-1
;
}
if
(
PyModule_AddIntMacro
(
m
,
PyABIInfo_INTERNAL
)
<
0
) {
return
-1
;
}
if
(
PyModule_AddIntMacro
(
m
,
PyABIInfo_GIL
)
<
0
) {
return
-1
;
}
if
(
PyModule_AddIntMacro
(
m
,
PyABIInfo_FREETHREADED
)
<
0
) {
return
-1
;
}
if
(
PyModule_AddIntMacro
(
m
,
PyABIInfo_FREETHREADING_AGNOSTIC
)
<
0
) {
return
-1
;
}
if
(
PyModule_AddFunctions
(
m
,
TestMethods
)
<
0
) {
return
-1
;
}
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL