mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
[3.13] gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set (gh-122952) (#122984)
gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set (gh-122952) As of529a160
(gh-118204), building with HAVE_DYNAMIC_LOADING stopped working. This is a minimal fix just to get builds working again. There are actually a number of long-standing deficiencies with HAVE_DYNAMIC_LOADING builds that need to be resolved separately. (cherry picked from commitee1b8ce26e
) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
This commit is contained in:
parent
ae3f347dc0
commit
dddea7c232
5 changed files with 32 additions and 12 deletions
|
@ -27,6 +27,7 @@ import re
|
|||
import sys
|
||||
import sysconfig
|
||||
import warnings
|
||||
import _imp
|
||||
|
||||
from importlib._bootstrap import _load as bootstrap_load
|
||||
from importlib.machinery import BuiltinImporter, ExtensionFileLoader, ModuleSpec
|
||||
|
@ -154,6 +155,11 @@ class ModuleChecker:
|
|||
self.notavailable = []
|
||||
|
||||
def check(self):
|
||||
if not hasattr(_imp, 'create_dynamic'):
|
||||
logger.warning(
|
||||
('Dynamic extensions not supported '
|
||||
'(HAVE_DYNAMIC_LOADING not defined)'),
|
||||
)
|
||||
for modinfo in self.modules:
|
||||
logger.debug("Checking '%s' (%s)", modinfo.name, self.get_location(modinfo))
|
||||
if modinfo.state == ModuleState.DISABLED:
|
||||
|
@ -415,6 +421,9 @@ class ModuleChecker:
|
|||
logger.error("%s failed to import: %s", modinfo.name, e)
|
||||
raise
|
||||
except Exception as e:
|
||||
if not hasattr(_imp, 'create_dynamic'):
|
||||
logger.warning("Dynamic extension '%s' ignored", modinfo.name)
|
||||
return
|
||||
logger.exception("Importing extension '%s' failed!", modinfo.name)
|
||||
raise
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue