aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken6/libshiboken/sbkmodule.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/sources/shiboken6/libshiboken/sbkmodule.cpp b/sources/shiboken6/libshiboken/sbkmodule.cpp
index c27cde3b8..63c71e618 100644
--- a/sources/shiboken6/libshiboken/sbkmodule.cpp
+++ b/sources/shiboken6/libshiboken/sbkmodule.cpp
@@ -331,11 +331,22 @@ static bool shouldLazyLoad(PyObject *module)
return std::strncmp(modName, "PySide6.", 8) == 0;
}
+static int lazyLoadDefault()
+{
+#ifndef PYPY_VERSION
+ int result = 1;
+#else
+ int result = 0;
+#endif
+ if (auto *flag = getenv("PYSIDE6_OPTION_LAZY"))
+ result = std::atoi(flag);
+ return result;
+}
+
void checkIfShouldLoadImmediately(PyObject *module, const std::string &name,
const NameToTypeFunctionMap &nameToFunc)
{
- static const char *flag = getenv("PYSIDE6_OPTION_LAZY");
- static const int value = flag != nullptr ? std::atoi(flag) : 1;
+ static const int value = lazyLoadDefault();
// PYSIDE-2404: Lazy Loading
//