Skip to content

Conversation

dvdkon
Copy link

@dvdkon dvdkon commented Sep 13, 2025

Apparently a leftover from Python 2 to 3 migration, tostring() joined the result of tostringlist() with an empty str instead of an empty bytes. This PR fixes the issue in a way that mirrors the standard library's xml.etree.

@ThomasWaldmann
Copy link
Member

@dvdkon thanks for the PR. guess that bug was due to the confusing docstrings/comments. They are from the python2 ages and talk about strings, but mean bytes, not str (python 3 types).

The xml.etree api seems to support encoding="unicode" to support str, but other encodings generate bytes.

AFAICS, emeraldtree does not have that support and only supports encoding to bytes.

@ThomasWaldmann
Copy link
Member

@dvdkon just curious, how did you find that?

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