@@ -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" :
@@ -719,7 +722,7 @@ cdef class TextReader:
719
722
if isinstance (msg, list ):
720
723
msg = " [%s ], len of %d ," % (
721
724
' ,' .join([ str (m) for m in msg ]), len (msg))
722
- raise CParserError (
725
+ raise ParserError (
723
726
' Passed header=%s but only %d lines in file'
724
727
% (msg, self .parser.lines))
725
728
@@ -812,7 +815,7 @@ cdef class TextReader:
812
815
passed_count = len (header[0 ])
813
816
814
817
# if passed_count > field_count:
815
- # raise CParserError ('Column names have %d fields, '
818
+ # raise ParserError ('Column names have %d fields, '
816
819
# 'data has %d fields'
817
820
# % (passed_count, field_count))
818
821
@@ -1004,7 +1007,7 @@ cdef class TextReader:
1004
1007
(num_cols >= self .parser.line_fields[i]) * num_cols
1005
1008
1006
1009
if self .table_width - self .leading_cols > num_cols:
1007
- raise CParserError (
1010
+ raise ParserError (
1008
1011
" Too many columns specified: expected %s and found %s " %
1009
1012
(self .table_width - self .leading_cols, num_cols))
1010
1013
@@ -1059,7 +1062,7 @@ cdef class TextReader:
1059
1062
self .use_unsigned)
1060
1063
1061
1064
if col_res is None :
1062
- raise CParserError (' Unable to parse column %d ' % i)
1065
+ raise ParserError (' Unable to parse column %d ' % i)
1063
1066
1064
1067
results[i] = col_res
1065
1068
@@ -1310,7 +1313,7 @@ def _is_file_like(obj):
1310
1313
if PY3:
1311
1314
import io
1312
1315
if isinstance (obj, io.TextIOWrapper):
1313
- raise CParserError (' Cannot handle open unicode files (yet)' )
1316
+ raise ParserError (' Cannot handle open unicode files (yet)' )
1314
1317
1315
1318
# BufferedReader is a byte reader for Python 3
1316
1319
file = io.BufferedReader
@@ -2015,7 +2018,7 @@ cdef raise_parser_error(object base, parser_t *parser):
2015
2018
else :
2016
2019
message += ' no error message set'
2017
2020
2018
- raise CParserError (message)
2021
+ raise ParserError (message)
2019
2022
2020
2023
2021
2024
def _concatenate_chunks (list chunks ):
0 commit comments