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