FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Modules/_sysconfig.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
/
_sysconfig.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
148 lines (123 loc) · 3.43 KB
Breadcrumbs
cpython
/
Modules
/
_sysconfig.c
Copy path
File metadata and controls
148 lines (123 loc) · 3.43 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// _sysconfig provides data for the Python sysconfig module
#ifndef
Py_BUILD_CORE_BUILTIN
# define
Py_BUILD_CORE_MODULE
1
#endif
#include
"Python.h"
#include
"pycore_importdl.h"
// _PyImport_DynLoadFiletab
#include
"pycore_long.h"
// _PyLong_GetZero, _PyLong_GetOne
/*[clinic input]
module _sysconfig
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=0a7c02d3e212ac97]*/
#include
"clinic/_sysconfig.c.h"
#ifdef
MS_WINDOWS
static
int
add_string_value
(
PyObject
*
dict
,
const
char
*
key
,
const
char
*
str_value
)
{
PyObject
*
value
=
PyUnicode_FromString
(
str_value
);
if
(
value
==
NULL
) {
return
-1
;
}
int
err
=
PyDict_SetItemString
(
dict
,
key
,
value
);
Py_DECREF
(
value
);
return
err
;
}
#endif
/*[clinic input]
@permit_long_summary
_sysconfig.config_vars
Returns a dictionary containing build variables intended to be exposed by sysconfig.
[clinic start generated code]*/
static
PyObject
*
_sysconfig_config_vars_impl
(
PyObject
*
module
)
/*[clinic end generated code: output=9c41cdee63ea9487 input=fdda9cab12ca19fe]*/
{
PyObject
*
config
=
PyDict_New
();
if
(
config
==
NULL
) {
return
NULL
;
}
#ifdef
MS_WINDOWS
if
(
add_string_value
(
config
,
"EXT_SUFFIX"
,
PYD_TAGGED_SUFFIX
)
<
0
) {
Py_DECREF
(
config
);
return
NULL
;
}
if
(
add_string_value
(
config
,
"SOABI"
,
PYD_SOABI
)
<
0
) {
Py_DECREF
(
config
);
return
NULL
;
}
#endif
#ifdef
Py_GIL_DISABLED
PyObject
*
py_gil_disabled
=
_PyLong_GetOne
();
#else
PyObject
*
py_gil_disabled
=
_PyLong_GetZero
();
#endif
if
(
PyDict_SetItemString
(
config
,
"Py_GIL_DISABLED"
,
py_gil_disabled
)
<
0
) {
Py_DECREF
(
config
);
return
NULL
;
}
#ifdef
Py_DEBUG
PyObject
*
py_debug
=
_PyLong_GetOne
();
#else
PyObject
*
py_debug
=
_PyLong_GetZero
();
#endif
if
(
PyDict_SetItemString
(
config
,
"Py_DEBUG"
,
py_debug
)
<
0
) {
Py_DECREF
(
config
);
return
NULL
;
}
return
config
;
}
#ifdef
MS_WINDOWS
/*[clinic input]
_sysconfig.get_platform
Return a string that identifies the current platform.
[clinic start generated code]*/
static
PyObject
*
_sysconfig_get_platform_impl
(
PyObject
*
module
)
/*[clinic end generated code: output=4ecbbe2b77633f3e input=c0b43abda44f9a01]*/
{
#ifdef
MS_WIN64
# if
defined(
_M_X64
)
||
defined(
_M_AMD64
)
# define
SYSCONFIG_PLATFORM
"win-amd64"
# elif
defined(
_M_ARM64
)
# define
SYSCONFIG_PLATFORM
"win-arm64"
# endif
#endif
#if
defined(
MS_WIN32
)
&&
!defined(
MS_WIN64
)
# if
defined(
_M_IX86
)
# define
SYSCONFIG_PLATFORM
"win32"
# elif
defined(
_M_ARM
)
# define
SYSCONFIG_PLATFORM
"win-arm32"
# endif
#endif
#ifdef
SYSCONFIG_PLATFORM
return
PyUnicode_FromString
(
SYSCONFIG_PLATFORM
);
#else
Py_RETURN_NONE
;
#endif
}
#endif
// MS_WINDOWS
PyDoc_STRVAR
(
sysconfig__doc__
,
"A helper for the sysconfig module."
);
static
struct
PyMethodDef
sysconfig_methods
[]
=
{
_SYSCONFIG_CONFIG_VARS_METHODDEF
_SYSCONFIG_GET_PLATFORM_METHODDEF
{
NULL
,
NULL
}
};
static
PyModuleDef_Slot
sysconfig_slots
[]
=
{
_Py_ABI_SLOT
,
{
Py_mod_multiple_interpreters
,
Py_MOD_PER_INTERPRETER_GIL_SUPPORTED
},
{
Py_mod_gil
,
Py_MOD_GIL_NOT_USED
},
{
0
,
NULL
}
};
static
PyModuleDef
sysconfig_module
=
{
.
m_base
=
PyModuleDef_HEAD_INIT
,
.
m_name
=
"_sysconfig"
,
.
m_doc
=
sysconfig__doc__
,
.
m_methods
=
sysconfig_methods
,
.
m_slots
=
sysconfig_slots
,
};
PyMODINIT_FUNC
PyInit__sysconfig
(
void
)
{
return
PyModuleDef_Init
(
&
sysconfig_module
);
}
Back
|
FazBrowse Home
|
New Git URL