This commit is contained in:
lief-agent
2026-04-25 09:39:23 +02:00
parent ac033c4bd0
commit 255cd71927
8 changed files with 12 additions and 8 deletions
+3 -2
View File
@@ -128,7 +128,7 @@ if(NOT LIEF_OPT_MBEDTLS_EXTERNAL)
)
if (LIEF_PYTHON_FREE_THREADED)
target_compile_definitions(LIB_LIEF PRIVATE
# These '#define' have an impact at compile time.
# these must be set at LIB_LIEF compile time to be forwarded to MbedTLS
-DMBEDTLS_THREADING_C
-DMBEDTLS_THREADING_ALT
)
@@ -142,7 +142,8 @@ else()
target_link_libraries(LIB_LIEF PRIVATE
MbedTLS::tfpsacrypto MbedTLS::mbedx509)
if (LIEF_PYTHON_FREE_THREADED)
message(WARNING "Python free-threaded needs MbedTLS with threading support")
message(WARNING "Python free-threading requires the external MbedTLS to have \
been built with threading support. LIEF cannot enforce this.")
endif()
endif()
+1 -1
View File
@@ -266,7 +266,7 @@ void init(nb::module_& m) {
m.attr("__is_tagged__") = bool(LIEF_TAGGED);
m.doc() = "LIEF Python API";
// This attribute defines whether LIEF was compiled without GIL
// This attribute reflects whether LIEF was compiled with free-threading support
#if defined (NB_FREE_THREADED)
m.attr("__free_threaded__") = true;
#else
+1 -1
View File
@@ -109,7 +109,7 @@
* Python 3.8 is no longer supported
* Add support for the free-threaded Python builds.
The C++ core is thread safe on the few static variables,
The C++ core is now thread-safe with respect to its few static variables,
and can be used when the GIL is disabled (:issue:`1255`):
.. code-block:: python
+2 -2
View File
@@ -414,8 +414,8 @@ void ResourcesManager::change_icon(const ResourceIcon& original,
}
ResourcesManager::it_const_dialogs ResourcesManager::dialogs() const {
static std::mutex DIAG_MU;
std::scoped_lock lock(DIAG_MU);
static std::mutex DIALOG_CACHE_MU;
std::scoped_lock lock(DIALOG_CACHE_MU);
dialogs_.clear();
const ResourceNode* dialog_node = get_node_type(TYPE::DIALOG);
if (dialog_node == nullptr) {
+2
View File
@@ -29,6 +29,7 @@
#endif
#endif
namespace LIEF {
void mbedtls_init() {
static std::once_flag ONCE;
std::call_once(ONCE, [] {
@@ -39,3 +40,4 @@ void mbedtls_init() {
std::atexit(mbedtls_psa_crypto_free);
});
}
}
+2
View File
@@ -14,4 +14,6 @@
*/
#pragma once
namespace LIEF {
void mbedtls_init();
}
-1
View File
@@ -17,7 +17,6 @@
#include <mutex>
#include <condition_variable>
#include <cassert>
#include <mbedtls/threading.h>
inline auto* get_mu(mbedtls_platform_mutex_t* mu) {
+1 -1
View File
@@ -470,5 +470,5 @@ def convert_size(size_bytes: int) -> str:
def is_free_threaded() -> bool:
"Check if the current interpreter supports free-threading"
"""Check if the current interpreter supports free-threading"""
return sysconfig.get_config_var("Py_GIL_DISABLED") == "1" and lief.__free_threaded__