Skip to content

Commit d0c7ac3

Browse files
authored
Parse PYTHON_LLTRACE/PYTHON_OPT_DEBUG as integers
1 parent 54607ee commit d0c7ac3

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

Python/optimizer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ _PyJit_translate_single_bytecode_to_trace(
625625
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
626626
int lltrace = 0;
627627
if (python_lltrace != NULL && *python_lltrace >= '0') {
628-
lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that
628+
lltrace = atoi(python_lltrace);
629629
}
630630
#endif
631631
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
@@ -1033,7 +1033,7 @@ _PyJit_TryInitializeTracing(
10331033
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
10341034
int lltrace = 0;
10351035
if (python_lltrace != NULL && *python_lltrace >= '0') {
1036-
lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that
1036+
lltrace = atoi(python_lltrace);
10371037
}
10381038
DPRINTF(2,
10391039
"Tracing %s (%s:%d) at byte offset %d at chain depth %d\n",
@@ -1433,7 +1433,7 @@ make_executor_from_uops(_PyThreadStateImpl *tstate, _PyUOpInstruction *buffer, i
14331433
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
14341434
int lltrace = 0;
14351435
if (python_lltrace != NULL && *python_lltrace >= '0') {
1436-
lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that
1436+
lltrace = atoi(python_lltrace);
14371437
}
14381438
if (lltrace >= 2) {
14391439
printf("Optimized trace (length %d):\n", length);

Python/optimizer_analysis.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
char *uop_debug = Py_GETENV(DEBUG_ENV);
4848
int lltrace = 0;
4949
if (uop_debug != NULL && *uop_debug >= '0') {
50-
lltrace = *uop_debug - '0'; // TODO: Parse an int and all that
50+
lltrace = atoi(uop_debug);
5151
}
5252
return lltrace;
5353
}

Python/optimizer_symbols.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static inline int get_lltrace(void) {
6565
char *uop_debug = Py_GETENV("PYTHON_OPT_DEBUG");
6666
int lltrace = 0;
6767
if (uop_debug != NULL && *uop_debug >= '0') {
68-
lltrace = *uop_debug - '0'; // TODO: Parse an int and all that
68+
lltrace = atoi(uop_debug);
6969
}
7070
return lltrace;
7171
}

0 commit comments

Comments
 (0)