@@ -352,6 +352,7 @@ def get_handle(
352
352
compression : Optional [Union [str , Mapping [str , Any ]]] = None ,
353
353
memory_map : bool = False ,
354
354
is_text : bool = True ,
355
+ errors = None ,
355
356
):
356
357
"""
357
358
Get file handle for given path/buffer and mode.
@@ -390,6 +391,12 @@ def get_handle(
390
391
is_text : boolean, default True
391
392
whether file/buffer is in text format (csv, json, etc.), or in binary
392
393
mode (pickle, etc.).
394
+ errors : str, default 'strict'
395
+ Specifies how encoding and decoding errors are to be handled.
396
+ See the errors argument for :func:`open` for a full list
397
+ of options.
398
+
399
+ .. versionadded:: 1.1.0
393
400
394
401
Returns
395
402
-------
@@ -475,7 +482,7 @@ def get_handle(
475
482
elif is_path :
476
483
if encoding :
477
484
# Encoding
478
- f = open (path_or_buf , mode , encoding = encoding , newline = "" )
485
+ f = open (path_or_buf , mode , encoding = encoding , errors = errors , newline = "" )
479
486
elif is_text :
480
487
# No explicit encoding
481
488
f = open (path_or_buf , mode , errors = "replace" , newline = "" )
@@ -488,7 +495,7 @@ def get_handle(
488
495
if is_text and (compression or isinstance (f , need_text_wrapping )):
489
496
from io import TextIOWrapper
490
497
491
- g = TextIOWrapper (f , encoding = encoding , newline = "" )
498
+ g = TextIOWrapper (f , encoding = encoding , errors = errors , newline = "" )
492
499
if not isinstance (f , (BufferedIOBase , RawIOBase )):
493
500
handles .append (g )
494
501
f = g
0 commit comments