New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xml.sax.xmlreader.XMLReader.getProperty (xml.sax.handler.property_xml_string) returns bytes #50935
Comments
The documentation for the xml.sax.handler.property_xml_string SAX This makes handling the returned value very difficult because there is This is currently blocking the port of SimpleTAL to Python 3 achieving |
Would you like to contribute a patch? |
I'm not familiar with the inner workings of the expat integration with The first patch (expatreader.py.patch) is the minimum to resolve this |
Adding second patch. |
A unit test (or even a sample script) showing the desired feature is needed. |
See additional research and discussion in the comments of PR python/issues-test-cpython#9715. Simply changing this to return a string rather than bytes would break backwards compatibility. I certainly agree that this should have returned a string in the first place, especially since the Unicode decoding is otherwise completely abstracted away and the encoding used is not made available. Our options:
Since this appears to be rarely used and option 3 requires significantly more effort than the others, I am against it. Option 2 seems the safest, but I'd like to hear more from those more experienced with XML. |
The other thing to consider which also supports option 2 is that xml.parsers.expat provides an interface to the Expat parser which is easier to use and more complete than the Sax parser implementation and is the implementation likely to be used by anyone needing a streaming parser. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: