Skip to content

Commit abed6c1

Browse files
committed
fix: error to -1
1 parent 6265172 commit abed6c1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pandas/_libs/include/pandas/parser/tokenizer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ See LICENSE for the license
1717
#define ERROR_NO_DIGITS 1
1818
#define ERROR_OVERFLOW 2
1919
#define ERROR_INVALID_CHARS 3
20-
#define ERROR_WORD2BIG 4
2120

2221
#include <stdint.h>
2322

pandas/_libs/src/parser/tokenizer.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ static int copy_string_without_char(char output[PROCESSED_WORD_CAPACITY],
18911891

18921892
// check if we have enough space, including the null terminator.
18931893
if (nbytes + bytes_read >= PROCESSED_WORD_CAPACITY) {
1894-
return ERROR_WORD2BIG;
1894+
return -1;
18951895
}
18961896
// copy block
18971897
memcpy(&output[bytes_read], left, nbytes);
@@ -1908,7 +1908,7 @@ static int copy_string_without_char(char output[PROCESSED_WORD_CAPACITY],
19081908
if (end_ptr > left) {
19091909
size_t nbytes = nbytes = end_ptr - left;
19101910
if (nbytes + bytes_read >= PROCESSED_WORD_CAPACITY) {
1911-
return ERROR_WORD2BIG;
1911+
return -1;
19121912
}
19131913
memcpy(&output[bytes_read], left, nbytes);
19141914
bytes_read += nbytes;
@@ -1941,7 +1941,8 @@ int64_t str_to_int64(const char *p_item, int64_t int_min, int64_t int_max,
19411941
int status = copy_string_without_char(buffer, p_item, strlen(p_item), tsep);
19421942

19431943
if (status != 0) {
1944-
*error = status;
1944+
// Word is too big, probably will cause an overflow
1945+
*error = ERROR_OVERFLOW;
19451946
return 0;
19461947
}
19471948

0 commit comments

Comments
 (0)