Skip to content

Commit d9485a2

Browse files
committed
Parse int for lltrace
1 parent bb9d955 commit d9485a2

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Python/ceval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ maybe_lltrace_resume_frame(_PyInterpreterFrame *frame, _PyInterpreterFrame *skip
245245
if (!lltrace) {
246246
// Can also be controlled by environment variable
247247
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
248-
if (python_lltrace != NULL && *python_lltrace >= '0') {
249-
lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that
248+
if (python_lltrace != NULL) {
249+
lltrace = atoi(python_lltrace);
250250
}
251251
}
252252
if (lltrace >= 5) {

Python/optimizer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,8 @@ translate_bytecode_to_trace(
567567
#ifdef Py_DEBUG
568568
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
569569
int lltrace = 0;
570-
if (python_lltrace != NULL && *python_lltrace >= '0') {
571-
lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that
570+
if (python_lltrace != NULL) {
571+
lltrace = atoi(python_lltrace);
572572
}
573573
#endif
574574

@@ -1193,8 +1193,8 @@ make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFil
11931193
#ifdef Py_DEBUG
11941194
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
11951195
int lltrace = 0;
1196-
if (python_lltrace != NULL && *python_lltrace >= '0') {
1197-
lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that
1196+
if (python_lltrace != NULL) {
1197+
lltrace = atoi(python_lltrace);
11981198
}
11991199
if (lltrace >= 2) {
12001200
printf("Optimized trace (length %d):\n", length);

Python/optimizer_analysis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
static inline int get_lltrace(void) {
4242
char *uop_debug = Py_GETENV(DEBUG_ENV);
4343
int lltrace = 0;
44-
if (uop_debug != NULL && *uop_debug >= '0') {
45-
lltrace = *uop_debug - '0'; // TODO: Parse an int and all that
44+
if (uop_debug != NULL) {
45+
lltrace = atoi(uop_debug);
4646
}
4747
return lltrace;
4848
}

Python/optimizer_symbols.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
static inline int get_lltrace(void) {
3838
char *uop_debug = Py_GETENV("PYTHON_OPT_DEBUG");
3939
int lltrace = 0;
40-
if (uop_debug != NULL && *uop_debug >= '0') {
41-
lltrace = *uop_debug - '0'; // TODO: Parse an int and all that
40+
if (uop_debug != NULL) {
41+
lltrace = atoi(uop_debug);
4242
}
4343
return lltrace;
4444
}

0 commit comments

Comments
 (0)