Stefan Behnel <stefan...@behnel.de> added the comment:
PR welcome. This is how lxml implements it: https://lxml.de/api.html#cdata Tests are here: https://github.com/lxml/lxml/blob/1a2db33aa8b9619c1caf407167567d5cca0b9019/src/lxml/tests/test_etree.py#L1692-L1749 I guess it won't look perfectly the same in ElementTree in the end, but it might be enough to implement a string wrapper class (or even str subclass?), and then maybe special-case it in the serialiser (probably needed for the escaping). However, anything that relieves the serialiser from doing special work for this exceptional case might be a good idea. ---------- stage: -> needs patch versions: +Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36874> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com