From 9ad4d50b5d859443e3ba004bd36c560af3673a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 5 Dec 2023 16:49:32 +0100 Subject: [PATCH] Use built-in `importlib.resources` on Python 3.9+ (#7042) Use built-in `importlib.resources` module rather than the external `importlib_resources` package on Python 3.9 and newer. The latter is only intended as a backport for old Python versions, and since modern Linux distributions may no longer support such old Python versions, they also no longer provide importlib_resources (this is the case on Gentoo). --- scripts/update_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/update_api.py b/scripts/update_api.py index d426da34a..7d3d8899f 100755 --- a/scripts/update_api.py +++ b/scripts/update_api.py @@ -1831,7 +1831,10 @@ import atexit import sys, os import contextlib import ctypes -import importlib_resources +if sys.version_info >= (3, 9): + import importlib.resources as importlib_resources +else: + import importlib_resources from .z3types import * from .z3consts import *