From e30bfd42085ca53253b9a2e09aebfa273c005810 Mon Sep 17 00:00:00 2001 From: Jonas Bardino Date: Wed, 29 May 2024 19:27:23 +0200 Subject: [PATCH] Drop explicit byte and str conversion on data in fileio write helpers now that mode is intelligently selected to match input data type. --- mig/shared/fileio.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mig/shared/fileio.py b/mig/shared/fileio.py index 387912125..490982699 100644 --- a/mig/shared/fileio.py +++ b/mig/shared/fileio.py @@ -131,11 +131,8 @@ def _write_chunk(path, chunk, offset, logger=None, mode='r+b', filehandle.write('\0') # logger.debug('write %s chunk of size %d at position %d' % # (path, len(chunk), filehandle.tell())) - # NOTE: we may need to force str or bytes here depending on mode - if 'b' in mode: - filehandle.write(force_utf8(chunk)) - else: - filehandle.write(force_native_str(chunk)) + # NOTE: mode should already be adjusted to chunk string type here + filehandle.write(chunk) # logger.debug("file %r chunk written at %d" % (path, offset)) return True except Exception as err: