[3.11] gh-86493: Fix possible leaks in some modules initialization (GH-106768) (GH-106855) (GH-106863)

[3.11] [3.12] gh-86493: Fix possible leaks in some modules initialization (GH-106768) (GH-106855)

Fix _ssl, _stat, _testinternalcapi, _threadmodule, cmath, math, posix, time.
(cherry picked from commit 3e65baee72).
(cherry picked from commit a423ddbdea)
This commit is contained in:
Serhiy Storchaka 2023-07-19 09:40:38 +03:00 committed by GitHub
parent 0c47ed7bbf
commit fced79f91e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 62 deletions

View file

@ -1648,8 +1648,8 @@ thread_module_exec(PyObject *module)
// Round towards minus infinity
timeout_max = floor(timeout_max);
if (PyModule_AddObject(module, "TIMEOUT_MAX",
PyFloat_FromDouble(timeout_max)) < 0) {
if (_PyModule_Add(module, "TIMEOUT_MAX",
PyFloat_FromDouble(timeout_max)) < 0) {
return -1;
}