]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: replace deprecated PyImport_ImportModuleNoBlock with PyImport_ImportModule 68085/head
authorKefu Chai <k.chai@proxmox.com>
Sun, 29 Mar 2026 06:23:31 +0000 (14:23 +0800)
committerKefu Chai <k.chai@proxmox.com>
Sun, 29 Mar 2026 06:27:35 +0000 (14:27 +0800)
PyImport_ImportModuleNoBlock was deprecated in Python 3.13:

  PyModule.cc:374:21: warning: 'PyImport_ImportModuleNoBlock' is deprecated
  [-Wdeprecated-declarations]

The "no block" variant was introduced to avoid deadlocking on Python 2's
single global import lock, but Python 3's per-module locking (since
3.3) made the distinction meaningless. PyImport_ImportModule is the
direct replacement and is compatible with all Python versions.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/mgr/PyModule.cc

index 1c75d70f4663465dee92b3ca6e053b8722da59c9..b974a60b265fe3d8b19341e95b6498db4b3d7ade 100644 (file)
@@ -371,7 +371,7 @@ int PyModule::load(PyThreadState *pMainThreadState)
 
     int r;
 
-    pPickleModule = PyImport_ImportModuleNoBlock("pickle");
+    pPickleModule = PyImport_ImportModule("pickle");
     if (!pPickleModule) {
       derr << "Unable to load pickle" << dendl;
       return -EINVAL;