From 871d9e6e555e74c5bd993c33e31768392cda1afe Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Wed, 10 Jul 2024 03:09:31 +0800 Subject: [PATCH 1/5] gh121528: Fix the process crash when load extension when it's compiled with low version of the python --- Include/internal/pycore_object.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h index fa789611133a6f..841c213067c5eb 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -266,8 +266,9 @@ _PyObject_Init(PyObject *op, PyTypeObject *typeobj) { assert(op != NULL); Py_SET_TYPE(op, typeobj); - assert(_PyType_HasFeature(typeobj, Py_TPFLAGS_HEAPTYPE) || _Py_IsImmortal(typeobj)); - Py_INCREF(typeobj); + if (_PyType_HasFeature(typeobj, Py_TPFLAGS_HEAPTYPE) || _Py_IsImmortal(typeobj)){ + Py_INCREF(typeobj); + } _Py_NewReference(op); } From faff2d46be2b11b700f4b7f953d61dc6c2812b6f Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Wed, 10 Jul 2024 03:13:57 +0800 Subject: [PATCH 2/5] add news --- .../2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst new file mode 100644 index 00000000000000..19cabeebe2d211 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst @@ -0,0 +1,2 @@ +Fix the process crash when load extension when it's compiled with low +version of the python. From 6c8c8238ceadc78076f0798283e7de5d913ab893 Mon Sep 17 00:00:00 2001 From: Manjusaka Date: Wed, 10 Jul 2024 16:23:35 +0800 Subject: [PATCH 3/5] format code --- Include/internal/pycore_object.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h index 841c213067c5eb..4caa323a15a420 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -266,7 +266,7 @@ _PyObject_Init(PyObject *op, PyTypeObject *typeobj) { assert(op != NULL); Py_SET_TYPE(op, typeobj); - if (_PyType_HasFeature(typeobj, Py_TPFLAGS_HEAPTYPE) || _Py_IsImmortal(typeobj)){ + if (_PyType_HasFeature(typeobj, Py_TPFLAGS_HEAPTYPE) || _Py_IsImmortal(typeobj)) { Py_INCREF(typeobj); } _Py_NewReference(op); From 194a0e0042b56673af5d0fed172a40373b463cea Mon Sep 17 00:00:00 2001 From: Nadeshiko Manju Date: Wed, 10 Jul 2024 20:10:52 +0800 Subject: [PATCH 4/5] Update Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst Co-authored-by: Peter Bierma --- .../2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst index 19cabeebe2d211..8f69c68f6335aa 100644 --- a/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst +++ b/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst @@ -1,2 +1,2 @@ -Fix the process crash when load extension when it's compiled with low +Fix crash when loading extension modules that are compiled with an older version of the python. From 74478b9d6ad6cbe8c07536eee8f80bdca5d7a579 Mon Sep 17 00:00:00 2001 From: Nadeshiko Manju Date: Wed, 10 Jul 2024 20:11:00 +0800 Subject: [PATCH 5/5] Update Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst Co-authored-by: Peter Bierma --- .../2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst index 8f69c68f6335aa..f571f5961b2805 100644 --- a/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst +++ b/Misc/NEWS.d/next/Core_and_Builtins/2024-07-10-03-13-19.gh-issue-121528._Bo7rw.rst @@ -1,2 +1,2 @@ Fix crash when loading extension modules that are compiled with an older -version of the python. +version of Python.