aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/libshiboken/helper.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <[email protected]>2023-02-16 12:34:29 +0100
committerFriedemann Kleint <[email protected]>2023-02-17 11:31:02 +0100
commit46458ff09dc3db347e1b79914e874a3f49e2ec32 (patch)
tree4089cd9bfe8375d199ab4183d2d216b002cbaa59 /sources/shiboken6/libshiboken/helper.cpp
parent42ca6a9b8a04eef15fc03c4aa9c32cfb2ca10ab5 (diff)
Limited API: Remove Py_VerboseFlag define
Py_VerboseFlag is deprecated in 3.12. Replace it by a helper function. [ChangeLog][shiboken6] The Py_VerboseFlag define for Limited API has been removed. Pick-to: 5.15 Task-number: PYSIDE-2230 Change-Id: I1adad1532a4ffcc45b1991cd1b97fd8460f1d4ff Reviewed-by: Adrian Herrmann <[email protected]> Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Christian Tismer <[email protected]>
Diffstat (limited to 'sources/shiboken6/libshiboken/helper.cpp')
-rw-r--r--sources/shiboken6/libshiboken/helper.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/sources/shiboken6/libshiboken/helper.cpp b/sources/shiboken6/libshiboken/helper.cpp
index 27d6b1ee4..394c4fe49 100644
--- a/sources/shiboken6/libshiboken/helper.cpp
+++ b/sources/shiboken6/libshiboken/helper.cpp
@@ -5,6 +5,7 @@
#include "basewrapper_p.h"
#include "sbkstring.h"
#include "sbkstaticstrings.h"
+#include "pep384impl.h"
#include <algorithm>
@@ -466,4 +467,25 @@ const char *typeNameOf(const char *typeIdName)
return result;
}
+#if !defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030A0000
+static int _getPyVerbose()
+{
+ PyConfig config;
+ PyConfig_InitPythonConfig(&config);
+ return config.verbose;
+}
+#endif // !Py_LIMITED_API >= 3.10
+
+int pyVerbose()
+{
+#ifdef Py_LIMITED_API
+ return Pep_GetVerboseFlag();
+#elif PY_VERSION_HEX >= 0x030A0000
+ static const int result = _getPyVerbose();
+ return result;
+#else
+ return Py_VerboseFlag;
+#endif
+}
+
} // namespace Shiboken