I can confirm this still happens with python-yaml 3.10 and 3.11.2, as well as with the package python-ruamel.yaml 0.11.14-1 (a fork and superset of python-yaml).
This has been fixed in version 0.12.3 of ruamel.yaml. A fix for this in python-yaml is trivial, but upstream has been non-responsive for the last two years (hence the fork). Anthon

