Skip to content

Commit 49336ab

Browse files
Eclips4picnixz
andauthored
Apply suggestions from code review
Co-authored-by: Bénédikt Tran <[email protected]>
1 parent 5423c71 commit 49336ab

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add a :func:`!sys._jit_enabled` helper to determine in runtime if JIT is enabled or not.
1+
Allow to determine whether the JIT is enabled at runtime via :func:`!sys._jit_enabled`.

Python/pylifecycle.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,14 +1303,13 @@ init_interp_main(PyThreadState *tstate)
13031303
// perf profiler works fine with tier 2 interpreter, so
13041304
// only checking for a "real JIT".
13051305
#if _Py_TIER % 2 != 0
1306-
int enabled = _PySys_JITEnabled();
1307-
printf("enabled = %d\n", enabled);
1308-
if (enabled && config->perf_profiling > 0) {
1306+
if (_PySys_JITEnabled() && config->perf_profiling > 0) {
13091307
(void)PyErr_WarnEx(
1310-
PyExc_RuntimeWarning,
1311-
"JIT deactivated as perf profiling support is active",
1312-
0);
1313-
} else
1308+
PyExc_RuntimeWarning,
1309+
"JIT deactivated as perf profiling support is active",
1310+
0);
1311+
}
1312+
else
13141313
#endif
13151314
{
13161315
PyObject *opt = _PyOptimizer_NewUOpOptimizer();

Python/sysmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2541,7 +2541,7 @@ PyAPI_FUNC(int) PyUnstable_CopyPerfMapFile(const char* parent_filename) {
25412541
int
25422542
_PySys_JITEnabled(void)
25432543
{
2544-
char *env = Py_GETENV("PYTHON_JIT");
2544+
const char *env = Py_GETENV("PYTHON_JIT");
25452545
if (_Py_TIER2 == 1) {
25462546
// Interpreter was built with enabled jit, but it can be disabled via PYTHON_JIT=0
25472547
if (env && *env != '\0') {

0 commit comments

Comments
 (0)