Skip to content

fixes for Python 3.15#1074

Merged
tomjelinek merged 4 commits intoClusterLabs:mainfrom
tomjelinek:python-3.15
Mar 2, 2026
Merged

fixes for Python 3.15#1074
tomjelinek merged 4 commits intoClusterLabs:mainfrom
tomjelinek:python-3.15

Conversation

@tomjelinek
Copy link
Member

No description provided.

This commit fixes several related issues.

Primary issue: Function pcs.common.interface.dto.to_dict wasn't working
properly.
It failed to convert Enum values to their primitive type counterparts
(value = enum_value.value). Up until Python 3.15, this error was masked
by json.dumps doing the conversion. However, this stopped working with
Python 3.15, exposing the error.
There were several causes of this error:
1) The function failed to run recursively on lists of Enum.
2) The function failed to run recursively on dataclass fields typed as
   Unions.
3) The function failed to run recursively on dataclass fields with
   forward references in type hints, which are used to implement
   recursive data structures.
In the process of fixing these, _convert_dict function got cleaned up.
Some cleaning happened on the module level, as well.

Other fixes:
* Unions are no longer allowed in dataclasses, so StringSequence and
  StringCollections (which are Unions) got replaced there.
* pcs.cli.cluster_property.output.PropertyConfigurationFacade got fixed.
* pcs_test/tier0/lib/permissions/config/test_parser.py got fixed
  * it used a wrong function to convert a DTO to a dict
  * in an attempt to simulate invalid input, it was creating invalid DTOs
This is a follow up to the previous commit.
pcs.common.interface.dto.from_dict functionality has been updated to
implement fixes developed for to_dict. Although there was no error
observer with the previous implementation, the functions are rather
similar and they both use the same functions. Since these used functions
have been modified for to_dict, from_dict must have been updated to
match.
@tomjelinek tomjelinek requested a review from Pederrr March 2, 2026 11:52
@tomjelinek tomjelinek merged commit f1d177a into ClusterLabs:main Mar 2, 2026
1 check failed
@tomjelinek tomjelinek deleted the python-3.15 branch March 2, 2026 13:35
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.

2 participants