FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Modules/_testcapi/config.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
/
_testcapi
/
config.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
68 lines (54 loc) · 1.32 KB
Breadcrumbs
cpython
/
Modules
/
_testcapi
/
config.c
Copy path
File metadata and controls
68 lines (54 loc) · 1.32 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
#include
"parts.h"
static
PyObject
*
_testcapi_config_get
(
PyObject
*
module
,
PyObject
*
name_obj
)
{
const
char
*
name
;
if
(
PyArg_Parse
(
name_obj
,
"s"
,
&
name
)
<
0
) {
return
NULL
;
}
return
PyConfig_Get
(
name
);
}
static
PyObject
*
_testcapi_config_getint
(
PyObject
*
module
,
PyObject
*
name_obj
)
{
const
char
*
name
;
if
(
PyArg_Parse
(
name_obj
,
"s"
,
&
name
)
<
0
) {
return
NULL
;
}
int
value
;
if
(
PyConfig_GetInt
(
name
,
&
value
)
<
0
) {
return
NULL
;
}
return
PyLong_FromLong
(
value
);
}
static
PyObject
*
_testcapi_config_names
(
PyObject
*
module
,
PyObject
*
Py_UNUSED
(
args
))
{
return
PyConfig_Names
();
}
static
PyObject
*
_testcapi_config_set
(
PyObject
*
module
,
PyObject
*
args
)
{
const
char
*
name
;
PyObject
*
value
;
if
(
PyArg_ParseTuple
(
args
,
"sO"
,
&
name
,
&
value
)
<
0
) {
return
NULL
;
}
int
res
=
PyConfig_Set
(
name
,
value
);
if
(
res
<
0
) {
return
NULL
;
}
Py_RETURN_NONE
;
}
static
PyMethodDef
test_methods
[]
=
{
{
"config_get"
,
_testcapi_config_get
,
METH_O
},
{
"config_getint"
,
_testcapi_config_getint
,
METH_O
},
{
"config_names"
,
_testcapi_config_names
,
METH_NOARGS
},
{
"config_set"
,
_testcapi_config_set
,
METH_VARARGS
},
{
NULL
}
};
int
_PyTestCapi_Init_Config
(
PyObject
*
mod
)
{
return
PyModule_AddFunctions
(
mod
,
test_methods
);
}
Back
|
FazBrowse Home
|
New Git URL