@@ -352,6 +352,7 @@ def get_handle(
352352 compression : Optional [Union [str , Mapping [str , Any ]]] = None ,
353353 memory_map : bool = False ,
354354 is_text : bool = True ,
355+ errors = None ,
355356):
356357 """
357358 Get file handle for given path/buffer and mode.
@@ -390,6 +391,12 @@ def get_handle(
390391 is_text : boolean, default True
391392 whether file/buffer is in text format (csv, json, etc.), or in binary
392393 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
393400
394401 Returns
395402 -------
@@ -475,7 +482,7 @@ def get_handle(
475482 elif is_path :
476483 if encoding :
477484 # Encoding
478- f = open (path_or_buf , mode , encoding = encoding , newline = "" )
485+ f = open (path_or_buf , mode , encoding = encoding , errors = errors , newline = "" )
479486 elif is_text :
480487 # No explicit encoding
481488 f = open (path_or_buf , mode , errors = "replace" , newline = "" )
@@ -488,7 +495,7 @@ def get_handle(
488495 if is_text and (compression or isinstance (f , need_text_wrapping )):
489496 from io import TextIOWrapper
490497
491- g = TextIOWrapper (f , encoding = encoding , newline = "" )
498+ g = TextIOWrapper (f , encoding = encoding , errors = errors , newline = "" )
492499 if not isinstance (f , (BufferedIOBase , RawIOBase )):
493500 handles .append (g )
494501 f = g
0 commit comments