mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[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 commit3e65baee72). (cherry picked from commita423ddbdea)
This commit is contained in:
parent
0c47ed7bbf
commit
fced79f91e
10 changed files with 45 additions and 62 deletions
|
|
@ -3825,21 +3825,21 @@ math_ulp_impl(PyObject *module, double x)
|
|||
static int
|
||||
math_exec(PyObject *module)
|
||||
{
|
||||
if (PyModule_AddObject(module, "pi", PyFloat_FromDouble(Py_MATH_PI)) < 0) {
|
||||
if (_PyModule_Add(module, "pi", PyFloat_FromDouble(Py_MATH_PI)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (PyModule_AddObject(module, "e", PyFloat_FromDouble(Py_MATH_E)) < 0) {
|
||||
if (_PyModule_Add(module, "e", PyFloat_FromDouble(Py_MATH_E)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
// 2pi
|
||||
if (PyModule_AddObject(module, "tau", PyFloat_FromDouble(Py_MATH_TAU)) < 0) {
|
||||
if (_PyModule_Add(module, "tau", PyFloat_FromDouble(Py_MATH_TAU)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (PyModule_AddObject(module, "inf", PyFloat_FromDouble(m_inf())) < 0) {
|
||||
if (_PyModule_Add(module, "inf", PyFloat_FromDouble(m_inf())) < 0) {
|
||||
return -1;
|
||||
}
|
||||
#if _PY_SHORT_FLOAT_REPR == 1
|
||||
if (PyModule_AddObject(module, "nan", PyFloat_FromDouble(m_nan())) < 0) {
|
||||
if (_PyModule_Add(module, "nan", PyFloat_FromDouble(m_nan())) < 0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue