diff options
author | Uli Schlachter <psychon@znc.in> | 2020-07-17 15:31:58 +0200 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2021-09-30 17:15:34 +0000 |
commit | 65169c1af7893882c21d1e2a544903212b8d6fb0 (patch) | |
tree | e22a9b489b80d2c711a5a288f5edbe23adda478c /xcbgen | |
parent | 6d72110e1eddf4e802aff3442b7b58f471175ceb (diff) | |
download | xcb-proto-65169c1af7893882c21d1e2a544903212b8d6fb0.tar.gz |
Use xml.etree.cElementTree where appropriate
This makes the code added in the previous commit consistent with the
rest of the code base. From Björn's suggestion:
This should import xml.etree.{,c}ElementTree conditionally on the
version of the Python interpreter used to import this module.
xml.etree.ElementTree is preferred for Python >= 3.3, as it uses the
fastest possible implementation automatically. Earlier versions of
Python need xml.etree.cElementTree as they may not have an
implementation that can be used in a platform generic way.
Suggested-by: Björn Esser <besser82@fedoraproject.org>
Diffstat (limited to 'xcbgen')
-rw-r--r-- | xcbgen/xtypes.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py index 0d92f2e..c8c4e01 100644 --- a/xcbgen/xtypes.py +++ b/xcbgen/xtypes.py @@ -3,7 +3,12 @@ This module contains the classes which represent XCB data types. ''' from xcbgen.expr import Field, Expression from xcbgen.align import Alignment, AlignmentLog -from xml.etree.ElementTree import SubElement + +if version_info[:2] >= (3, 3): + from xml.etree.ElementTree import SubElement +else: + from xml.etree.cElementTree import SubElement + import __main__ verbose_align_log = False |