> from xml.etree.ElementTree import _namespace_map
>
> And the import in cElementTree won't be necessary.
> After all, _namespace_map is definitely not a public API!
Because of the interaction of the support.import_fresh_module with the CleanContext context manager, it's not so easy to remove black magic.
I don't find better than:
if hasattr(ET, '_namespace_map'):
_namespace_map = ET._namespace_map
else:
from xml.etree.ElementTree import _namespace_map
This is why I kept the import in the deprecated "cElementTree" at first.
It does not hurt (it's private API), and it makes the test easier.
( If you have doubts, try ./python -m test test_xml_etree{,_c} or variants. )
I will probably commit code and documentation at once. It makes things easier regarding traceability. |