diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-05-15 18:55:35 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-05-15 18:55:35 -0400 |
commit | 30c0e3f25656d65ffb82d8313e99f601efb4a74d (patch) | |
tree | a5933307f2726fc57ae55140604cfe09962f5247 /coverage/tomlconfig.py | |
parent | 0d67ae1b7938ada3fe5df680b643d69290f0c099 (diff) | |
download | python-coveragepy-git-30c0e3f25656d65ffb82d8313e99f601efb4a74d.tar.gz |
refactor: clean up tomllib addition
Diffstat (limited to 'coverage/tomlconfig.py')
-rw-r--r-- | coverage/tomlconfig.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/coverage/tomlconfig.py b/coverage/tomlconfig.py index 82f84ce9..b04d66e2 100644 --- a/coverage/tomlconfig.py +++ b/coverage/tomlconfig.py @@ -6,20 +6,21 @@ import configparser import os import re -import sys +from coverage import env from coverage.exceptions import ConfigError from coverage.misc import import_third_party, substitute_variables -if sys.version_info >= (3, 11): - import tomllib + +if env.PYVERSION >= (3, 11): + import tomllib # pylint: disable=import-error else: # TOML support on Python 3.10 and below is an install-time extra option. # (Import typing is here because import_third_party will unload any module # that wasn't already imported. tomli imports typing, and if we unload it, # later it's imported again, and on Python 3.6, this causes infinite # recursion.) - import typing # pylint: disable=unused-import, wrong-import-order + import typing # pylint: disable=unused-import tomllib = import_third_party("tomli") |