@@ -13,7 +13,10 @@ from cpython cimport (PyObject, PyBytes_FromString,
13
13
PyUnicode_Check, PyUnicode_AsUTF8String,
14
14
PyErr_Occurred, PyErr_Fetch)
15
15
from cpython.ref cimport PyObject, Py_XDECREF
16
- from io.common import CParserError, DtypeWarning, EmptyDataError
16
+ # XXX: It's annoying that we have to import both CParserError
17
+ # and ParserError. Unfortunately, backwards compatibility is
18
+ # the higher calling right now.
19
+ from io.common import CParserError, ParserError, DtypeWarning, EmptyDataError
17
20
18
21
19
22
cdef extern from " Python.h" :
@@ -720,7 +723,7 @@ cdef class TextReader:
720
723
if isinstance (msg, list ):
721
724
msg = " [%s ], len of %d ," % (
722
725
' ,' .join([ str (m) for m in msg ]), len (msg))
723
- raise CParserError (
726
+ raise ParserError (
724
727
' Passed header=%s but only %d lines in file'
725
728
% (msg, self .parser.lines))
726
729
@@ -813,7 +816,7 @@ cdef class TextReader:
813
816
passed_count = len (header[0 ])
814
817
815
818
# if passed_count > field_count:
816
- # raise CParserError ('Column names have %d fields, '
819
+ # raise ParserError ('Column names have %d fields, '
817
820
# 'data has %d fields'
818
821
# % (passed_count, field_count))
819
822
@@ -1005,7 +1008,7 @@ cdef class TextReader:
1005
1008
(num_cols >= self .parser.line_fields[i]) * num_cols
1006
1009
1007
1010
if self .table_width - self .leading_cols > num_cols:
1008
- raise CParserError (
1011
+ raise ParserError (
1009
1012
" Too many columns specified: expected %s and found %s " %
1010
1013
(self .table_width - self .leading_cols, num_cols))
1011
1014
@@ -1060,7 +1063,7 @@ cdef class TextReader:
1060
1063
self .use_unsigned)
1061
1064
1062
1065
if col_res is None :
1063
- raise CParserError (' Unable to parse column %d ' % i)
1066
+ raise ParserError (' Unable to parse column %d ' % i)
1064
1067
1065
1068
results[i] = col_res
1066
1069
@@ -1311,7 +1314,7 @@ def _is_file_like(obj):
1311
1314
if PY3:
1312
1315
import io
1313
1316
if isinstance (obj, io.TextIOWrapper):
1314
- raise CParserError (' Cannot handle open unicode files (yet)' )
1317
+ raise ParserError (' Cannot handle open unicode files (yet)' )
1315
1318
1316
1319
# BufferedReader is a byte reader for Python 3
1317
1320
file = io.BufferedReader
@@ -2016,7 +2019,7 @@ cdef raise_parser_error(object base, parser_t *parser):
2016
2019
else :
2017
2020
message += ' no error message set'
2018
2021
2019
- raise CParserError (message)
2022
+ raise ParserError (message)
2020
2023
2021
2024
2022
2025
def _concatenate_chunks (list chunks ):
0 commit comments