From 494e5b36b6006f052853b658ead8b86431247850 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Sat, 29 Oct 2022 01:16:39 -0700 Subject: [PATCH 1/6] gh-83004: Clean up refleak in _pickle initialisation --- Modules/_pickle.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 52704b0c59ade1..1fc8486ba2f3ec 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -7987,15 +7987,20 @@ PyInit__pickle(void) return NULL; Py_INCREF(st->PickleError); - if (PyModule_AddObject(m, "PickleError", st->PickleError) < 0) + if (PyModule_AddObject(m, "PickleError", st->PickleError) < 0) { + Py_DECREF(st->PickleError); return NULL; + } Py_INCREF(st->PicklingError); - if (PyModule_AddObject(m, "PicklingError", st->PicklingError) < 0) + if (PyModule_AddObject(m, "PicklingError", st->PicklingError) < 0) { + Py_DECREF(st->PicklingError); return NULL; + } Py_INCREF(st->UnpicklingError); - if (PyModule_AddObject(m, "UnpicklingError", st->UnpicklingError) < 0) + if (PyModule_AddObject(m, "UnpicklingError", st->UnpicklingError) < 0) { + Py_DECREF(st->UnpicklingError); return NULL; - + } if (_Pickle_InitState(st) < 0) return NULL; From 9ae0e272b5032eb3605d7064b5e1c7343d594705 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Sat, 29 Oct 2022 01:45:30 -0700 Subject: [PATCH 2/6] actually use PyModule_AddObjectRef --- Modules/_pickle.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 1fc8486ba2f3ec..80bb2126de7eef 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -7986,19 +7986,13 @@ PyInit__pickle(void) if (st->UnpicklingError == NULL) return NULL; - Py_INCREF(st->PickleError); - if (PyModule_AddObject(m, "PickleError", st->PickleError) < 0) { - Py_DECREF(st->PickleError); + if (PyModule_AddObjectRef(m, "PickleError", st->PickleError) < 0) { return NULL; } - Py_INCREF(st->PicklingError); - if (PyModule_AddObject(m, "PicklingError", st->PicklingError) < 0) { - Py_DECREF(st->PicklingError); + if (PyModule_AddObjectRef(m, "PicklingError", st->PicklingError) < 0) { return NULL; } - Py_INCREF(st->UnpicklingError); - if (PyModule_AddObject(m, "UnpicklingError", st->UnpicklingError) < 0) { - Py_DECREF(st->UnpicklingError); + if (PyModule_AddObjectRef(m, "UnpicklingError", st->UnpicklingError) < 0) { return NULL; } if (_Pickle_InitState(st) < 0) From 6c21bbf34200db52870e3f2e5d6979d6dfc5de82 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 2 Nov 2022 05:53:28 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst diff --git a/Misc/NEWS.d/next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst b/Misc/NEWS.d/next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst new file mode 100644 index 00000000000000..d203543e301726 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst @@ -0,0 +1 @@ +Clean up refleak in :mod:`_pickle` initialisation From 5d7cb8731b8538be2b43a4a9d55d9bb56a93cdfb Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 2 Nov 2022 05:53:36 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2022-11-02-05-53-34.gh-issue-83004.qc_KHr.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2022-11-02-05-53-34.gh-issue-83004.qc_KHr.rst diff --git a/Misc/NEWS.d/next/Library/2022-11-02-05-53-34.gh-issue-83004.qc_KHr.rst b/Misc/NEWS.d/next/Library/2022-11-02-05-53-34.gh-issue-83004.qc_KHr.rst new file mode 100644 index 00000000000000..d203543e301726 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-11-02-05-53-34.gh-issue-83004.qc_KHr.rst @@ -0,0 +1 @@ +Clean up refleak in :mod:`_pickle` initialisation From ccd82c559eda2c397ef5deb77ab55d89c52e327a Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Tue, 1 Nov 2022 22:56:43 -0700 Subject: [PATCH 5/6] delete duplicate news entry --- .../next/Library/2022-11-02-05-53-34.gh-issue-83004.qc_KHr.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Library/2022-11-02-05-53-34.gh-issue-83004.qc_KHr.rst diff --git a/Misc/NEWS.d/next/Library/2022-11-02-05-53-34.gh-issue-83004.qc_KHr.rst b/Misc/NEWS.d/next/Library/2022-11-02-05-53-34.gh-issue-83004.qc_KHr.rst deleted file mode 100644 index d203543e301726..00000000000000 --- a/Misc/NEWS.d/next/Library/2022-11-02-05-53-34.gh-issue-83004.qc_KHr.rst +++ /dev/null @@ -1 +0,0 @@ -Clean up refleak in :mod:`_pickle` initialisation From ae2aa96c6db02252c639a2d9d7bf5e31cfc5228c Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 2 Nov 2022 19:19:07 -0700 Subject: [PATCH 6/6] Update Misc/NEWS.d/next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst --- .../next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst b/Misc/NEWS.d/next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst index d203543e301726..de00063420638a 100644 --- a/Misc/NEWS.d/next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst +++ b/Misc/NEWS.d/next/Library/2022-11-02-05-53-25.gh-issue-83004.qc_KHr.rst @@ -1 +1 @@ -Clean up refleak in :mod:`_pickle` initialisation +Clean up refleaks on failed module initialisation in in :mod:`_pickle` pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy