From b505adf5698f6947771100512fe527b72030071f Mon Sep 17 00:00:00 2001 From: Wynn Wilkes Date: Thu, 14 Mar 2024 08:47:03 -0600 Subject: [PATCH 1/2] Allow the valgrind generator script to run with a different python version - You can now pass a different path for a different python installation. --- valgrind/valgrind-generate-sups.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/valgrind/valgrind-generate-sups.sh b/valgrind/valgrind-generate-sups.sh index 37bfe3f883..3e28cb37bb 100755 --- a/valgrind/valgrind-generate-sups.sh +++ b/valgrind/valgrind-generate-sups.sh @@ -1,5 +1,7 @@ #!/bin/bash +pydir=${1:-/usr} + gensup() { for SUP in Cond Free Leak Overlap Addr1 Addr2 Addr4 Addr8 Addr16 Value1 Value2 Value4 Value8 Value16 ; do @@ -16,10 +18,10 @@ gensup() { while read SO ; do gensup libpython "$SO" -done < <(find /usr/lib*/ -type f -name libpython*) +done < <(find ${pydir}/lib*/ -type f -name libpython*) while read SO ; do gensup python "$SO" -done < <(find /usr/lib*/python*/ -type f -name \*.so) +done < <(find ${pydir}/lib*/python*/ -type f -name \*.so) From f321efc8b64fbd90c575bbfa5367f5ab599e08a3 Mon Sep 17 00:00:00 2001 From: Wynn Wilkes Date: Thu, 14 Mar 2024 08:48:19 -0600 Subject: [PATCH 2/2] Fix a potential error with not releasing the gil in uwsgi_python_rpc - If this call fails, we need to release the gil before returning as we've obtained it. --- plugins/python/python_plugin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index de92f34c2f..6c5be6c7ff 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -1778,8 +1778,10 @@ uint64_t uwsgi_python_rpc(void *func, uint8_t argc, char **argv, uint16_t argvs[ PyObject *pyargs = PyTuple_New(argc); PyObject *ret; - if (!pyargs) + if (!pyargs) { + UWSGI_RELEASE_GIL; return 0; + } for (i = 0; i < argc; i++) { PyTuple_SetItem(pyargs, i, PyString_FromStringAndSize(argv[i], argvs[i]));