Skip to content

Conversation

@Thyre
Copy link

@Thyre Thyre commented Sep 8, 2025

Using a value of None for the FunctionFormat NONE causes Python 3.13 to abort Extra-P with the following error message:

[...]
    from extrap.util.string_formats import FunctionFormats
  File "extrap/util/string_formats.py", line 11, in <module>
    class FunctionFormats(enum.Enum):
    ...<2 lines>...
        LATEX = enum.auto()
  File "extrap/util/string_formats.py", line 13, in FunctionFormats
    PYTHON = enum.auto()
    ^^^^^^
  File "python3.13/enum.py", line 441, in __setitem__
    v.value = self._generate_next_value(
              ~~~~~~~~~~~~~~~~~~~~~~~~~^
            key, 1, len(self._member_names), self._last_values[:],
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            )
            ^
  File "python3.13/enum.py", line 1267, in _generate_next_value_
    raise TypeError('unable to increment %r' % (last_value, )) from None
TypeError: unable to increment (None,)

To fix this, also treat None as enum.auto(), so that values can be properly initialized.

Using a value of None for the FunctionFormat NONE causes Python 3.13 to abort
Extra-P with the following error message:

```
[...]
    from extrap.util.string_formats import FunctionFormats
  File "extrap/util/string_formats.py", line 11, in <module>
    class FunctionFormats(enum.Enum):
    ...<2 lines>...
        LATEX = enum.auto()
  File "extrap/util/string_formats.py", line 13, in FunctionFormats
    PYTHON = enum.auto()
    ^^^^^^
  File "python3.13/enum.py", line 441, in __setitem__
    v.value = self._generate_next_value(
              ~~~~~~~~~~~~~~~~~~~~~~~~~^
            key, 1, len(self._member_names), self._last_values[:],
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            )
            ^
  File "python3.13/enum.py", line 1267, in _generate_next_value_
    raise TypeError('unable to increment %r' % (last_value, )) from None
TypeError: unable to increment (None,)
```

To fix this, also treat None as `enum.auto()`, so that values can be
properly initialized.

Signed-off-by: Jan André Reuter <j.reuter@fz-juelich.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant