Fix typo that make the conversion not working

The reason to change was that format is a builtin function in Python.

By redefining it we are simply overriding it and so it is not a problem
although not elegant.

Another issue in this file is `match` that become a contextual keyword
in Python 3.10. Again it is not elegant although it is allowed.
This commit is contained in:
José Matos 2025-01-05 12:16:58 +00:00
parent b319b31e6c
commit 08a747a750

View File

@ -562,15 +562,15 @@ def convert(lines, end_format):
match = re_Format.match(lines[i])
if match:
formatline = i
format_ = int(match.group(4))
if 1 < format_ < end_format:
lines[i] = b"Format %d" % (format_ + 1)
format = int(match.group(4))
if 1 < format < end_format:
lines[i] = b"Format %d" % (format + 1)
only_comment = 0
elif format_ == end_format:
elif format == end_format:
# nothing to do
return format_
return format
else:
error(f'Cannot convert file format {format_} to {end_format}')
error(f'Cannot convert file format {format} to {end_format}')
else:
lines.insert(i, b"Format 2")
only_comment = 0