Skip to content

Commit

Permalink
Use built-in importlib.resources on Python 3.9+ (#7042)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
mgorny committed Dec 5, 2023
1 parent 764f0d5 commit 9ad4d50
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/update_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1831,7 +1831,10 @@ def write_core_py_preamble(core_py):
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 *
Expand Down

0 comments on commit 9ad4d50

Please sign in to comment.