Skip to content

Commit 818921f

Browse files
committed
fix: reset errno after handling it
1 parent ba8c9b3 commit 818921f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pandas/_libs/src/parser/tokenizer.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,9 +1937,6 @@ int64_t str_to_int64(const char *p_item, int64_t int_min, int64_t int_max,
19371937
}
19381938

19391939
char *endptr;
1940-
// strtoll sets errno if it finds an overflow.
1941-
// It's value is reset to don't pollute the verification below.
1942-
errno = 0;
19431940
int64_t result = strtoll(p_item, &endptr, 10);
19441941

19451942
// Did we use up all the characters?
@@ -1950,6 +1947,7 @@ int64_t str_to_int64(const char *p_item, int64_t int_min, int64_t int_max,
19501947
result = 0;
19511948
} else if (errno == ERANGE || result > int_max || result < int_min) {
19521949
*error = ERROR_OVERFLOW;
1950+
errno = 0;
19531951
result = 0;
19541952
} else {
19551953
*error = 0;
@@ -1995,9 +1993,6 @@ uint64_t str_to_uint64(uint_state *state, const char *p_item, int64_t int_max,
19951993
}
19961994

19971995
char *endptr;
1998-
// strtoull sets errno if it finds an overflow.
1999-
// It's value is reset to don't pollute the verification below.
2000-
errno = 0;
20011996
uint64_t result = strtoull(p_item, &endptr, 10);
20021997

20031998
// Did we use up all the characters?
@@ -2006,6 +2001,7 @@ uint64_t str_to_uint64(uint_state *state, const char *p_item, int64_t int_max,
20062001
result = 0;
20072002
} else if (errno == ERANGE || result > uint_max) {
20082003
*error = ERROR_OVERFLOW;
2004+
errno = 0;
20092005
result = 0;
20102006
} else {
20112007
*error = 0;

0 commit comments

Comments
 (0)