Commit b33cf6cf authored by Jostein Leira's avatar Jostein Leira 😃 Committed by Asitha Senanayake
Browse files

Fix crash using Python 3.12 trying to change character set

parent 74a7ecc7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
Changelog
=========

0.6.1 (Pending)
--------------
- Fix crash in Python 3.12.4 trying to change which character set to use
  reading a file/stream that does not support the reconfigure() method.
  Typical error message `'_io.StringIO' object has no attribute 'reconfigure'`



0.6.0 (2024-05-05)
--------------
- Remove support for Python 3.8
+2 −2
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ def AGS4_to_dict(filepath_or_buffer, encoding='utf-8', get_line_numbers=False, r
    if _is_file_like(filepath_or_buffer):
        f = filepath_or_buffer
        f.seek(0)
        if hasattr(f, 'encoding') and getattr(f, 'encoding', None) != encoding:
        if hasattr(f, 'encoding') and getattr(f, 'encoding', None) != encoding and hasattr(f, 'reconfigure'):
            f.reconfigure(encoding=encoding)
        close_file = False
    else:
@@ -726,7 +726,7 @@ def check_file(filepath_or_buffer, standard_AGS4_dictionary=None, rename_duplica
    if _is_file_like(filepath_or_buffer):
        f = filepath_or_buffer
        f.seek(0)
        if hasattr(f, 'encoding') and getattr(f, 'encoding', None) != encoding:
        if hasattr(f, 'encoding') and getattr(f, 'encoding', None) != encoding and hasattr(f, 'reconfigure'):
            f.reconfigure(encoding=encoding)
        close_file = False
    else: