From bc99d88db7c098a0901dc9ba76344472599f4c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 12 Jul 2023 06:58:31 +0200 Subject: [PATCH] Update to 3.12.0b4 Patch 402 is part of this release. --- 00402-add-pytype_getdict.patch | 126 --------------------------------- python3.12.spec | 14 ++-- sources | 4 +- 3 files changed, 7 insertions(+), 137 deletions(-) delete mode 100644 00402-add-pytype_getdict.patch diff --git a/00402-add-pytype_getdict.patch b/00402-add-pytype_getdict.patch deleted file mode 100644 index 661c4fb..0000000 --- a/00402-add-pytype_getdict.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Eric Snow -Date: Wed, 21 Jun 2023 09:51:01 +0200 -Subject: [PATCH] 00402: Add PyType_GetDict() - -This patch should make pyqt6 build with Python 3.12. -For more info see: https://github.com/python/cpython/pull/105747 ---- - Doc/c-api/type.rst | 16 ++++++++++++++++ - Doc/c-api/typeobj.rst | 17 +++++++++++++++-- - Include/cpython/object.h | 1 + - ...23-06-13-14-24-55.gh-issue-105227.HDL9aF.rst | 5 +++++ - Objects/typeobject.c | 7 +++++++ - 5 files changed, 44 insertions(+), 2 deletions(-) - create mode 100644 Misc/NEWS.d/next/C API/2023-06-13-14-24-55.gh-issue-105227.HDL9aF.rst - -diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst -index c99c7ef93a..8f883f5299 100644 ---- a/Doc/c-api/type.rst -+++ b/Doc/c-api/type.rst -@@ -50,6 +50,22 @@ Type Objects - The return type is now ``unsigned long`` rather than ``long``. - - -+.. c:function:: PyObject* PyType_GetDict(PyTypeObject* type) -+ -+ Return the type object's internal namespace, which is otherwise only -+ exposed via a read-only proxy (``cls.__dict__``). This is a -+ replacement for accessing :c:member:`~PyTypeObject.tp_dict` directly. -+ The returned dictionary must be treated as read-only. -+ -+ This function isn't intended for general use. It's meant for -+ specific embedding and language-binding cases, where direct access -+ to the dict is necessary and indirect access (e.g. via the proxy) -+ isn't adequate. Extension modules may continue to use ``tp_dict``, -+ directly or indirectly, when setting up their own types. -+ -+ .. versionadded:: 3.12 -+ -+ - .. c:function:: void PyType_Modified(PyTypeObject *type) - - Invalidate the internal lookup cache for the type and all of its -diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst -index c6e783acdf..46015bc108 100644 ---- a/Doc/c-api/typeobj.rst -+++ b/Doc/c-api/typeobj.rst -@@ -110,7 +110,7 @@ Quick Reference - +------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+ - | :c:member:`~PyTypeObject.tp_base` | :c:type:`PyTypeObject` * | __base__ | | | X | | - +------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+ -- | :c:member:`~PyTypeObject.tp_dict` | :c:type:`PyObject` * | __dict__ | | | ? | | -+ | <<:c:member:`~PyTypeObject.tp_dict`>> | :c:type:`PyObject` * | __dict__ | | | ? | | - +------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+ - | :c:member:`~PyTypeObject.tp_descr_get` | :c:type:`descrgetfunc` | __get__ | | | | X | - +------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+ -@@ -157,6 +157,9 @@ Quick Reference - **<>**: Names in angle brackets should be initially set to ``NULL`` and - treated as read-only. - -+ **<<>>**: Names in double angle brackets should be initially set to -+ ``NULL`` and treated as read-only after initialization. -+ - **[]**: Names in square brackets are for internal use only. - - **** (as a prefix) means the field is required (must be non-``NULL``). -@@ -1717,7 +1720,17 @@ and :c:type:`PyType_Type` effectively act as defaults.) - called; it may also be initialized to a dictionary containing initial attributes - for the type. Once :c:func:`PyType_Ready` has initialized the type, extra - attributes for the type may be added to this dictionary only if they don't -- correspond to overloaded operations (like :meth:`__add__`). -+ correspond to overloaded operations (like :meth:`__add__`). Once -+ initialization for the type has finished, this field should be -+ treated as read-only. -+ -+ .. versionchanged:: 3.12 -+ -+ Internals detail: For the static builtin types this is always ``NULL``. -+ Instead, the dict for each is stored on ``PyInterpreterState``. -+ If needed, use :c:func:`PyType_GetDict` to get the corresponding -+ dict for those types. This is not normally necessary, -+ and certainly not for user-defined type objects. - - **Inheritance:** - -diff --git a/Include/cpython/object.h b/Include/cpython/object.h -index d8eff69103..c5d0851a4b 100644 ---- a/Include/cpython/object.h -+++ b/Include/cpython/object.h -@@ -283,6 +283,7 @@ PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject * - PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *, const char *); - PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *, const char *); - PyAPI_FUNC(PyObject *) PyType_GetModuleByDef(PyTypeObject *, PyModuleDef *); -+PyAPI_FUNC(PyObject *) PyType_GetDict(PyTypeObject *); - - PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); - PyAPI_FUNC(void) _Py_BreakPoint(void); -diff --git a/Misc/NEWS.d/next/C API/2023-06-13-14-24-55.gh-issue-105227.HDL9aF.rst b/Misc/NEWS.d/next/C API/2023-06-13-14-24-55.gh-issue-105227.HDL9aF.rst -new file mode 100644 -index 0000000000..6e0e5396f6 ---- /dev/null -+++ b/Misc/NEWS.d/next/C API/2023-06-13-14-24-55.gh-issue-105227.HDL9aF.rst -@@ -0,0 +1,5 @@ -+The new :c:func:`PyType_GetDict` provides the dictionary for the given type -+object that is normally exposed by ``cls.__dict__``. Normally it's -+sufficient to use :c:member:`~PyTypeObject.tp_dict`, but for the static -+builtin types ``tp_dict`` is now always ``NULL``. ``PyType_GetDict()`` -+provides the correct dict object instead. -diff --git a/Objects/typeobject.c b/Objects/typeobject.c -index bf33bde257..0deec50d63 100644 ---- a/Objects/typeobject.c -+++ b/Objects/typeobject.c -@@ -238,6 +238,13 @@ _PyType_GetDict(PyTypeObject *self) - return lookup_tp_dict(self); - } - -+PyObject * -+PyType_GetDict(PyTypeObject *self) -+{ -+ PyObject *dict = lookup_tp_dict(self); -+ return _Py_XNewRef(dict); -+} -+ - static inline void - set_tp_dict(PyTypeObject *self, PyObject *dict) - { diff --git a/python3.12.spec b/python3.12.spec index e0a0083..7998f07 100644 --- a/python3.12.spec +++ b/python3.12.spec @@ -14,10 +14,10 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well %global general_version %{pybasever}.0 -%global prerel b3 +%global prerel b4 %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} -Release: 2%{?dist} +Release: 1%{?dist} License: Python-2.0.1 @@ -362,13 +362,6 @@ Patch251: 00251-change-user-install-location.patch # https://github.com/GrahamDumpleton/mod_wsgi/issues/730 Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch -# 00402 # ecae89d5edb8d253925dce12c3c56d1a6da198f3 -# Add PyType_GetDict() -# -# This patch should make pyqt6 build with Python 3.12. -# For more info see: https://github.com/python/cpython/pull/105747 -Patch402: 00402-add-pytype_getdict.patch - # (New patches go here ^^^) # # When adding new patches to "python" and "python3" in Fedora, EL, etc., @@ -1658,6 +1651,9 @@ CheckPython optimized # ====================================================== %changelog +* Wed Jul 12 2023 Miro Hrončok - 3.12.0~b4-1 +- Update to 3.12.0b4 + * Wed Jun 21 2023 Tomáš Hrnčiar - 3.12.0~b3-2 - Backport upstream patch to add PyType_GetDict() function diff --git a/sources b/sources index ec8436c..fd50c0a 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (Python-3.12.0b3.tar.xz) = 2d83285ea09445da25204285937366b20793b12223f5a0979276633213773d14de6dbb6a311629b755962804d8521b30cf9fe032f447608b6df7af721a18ba0c -SHA512 (Python-3.12.0b3.tar.xz.asc) = ab0d91f3c2fc001fe924f71182526d543a3c9e65238954bb954c58d03171a6cb3640a15570d2d7b889c6251fd876790121cd36bcc29a901f53d17f5f4f8f6f4e +SHA512 (Python-3.12.0b4.tar.xz) = 942a47d12c51e13939c815de908e766b818e4862c536153ae94b8032b5263b0cc23bda9a75fe60f48ee400a4ce405e2583da684847623cf552c20efcbc663469 +SHA512 (Python-3.12.0b4.tar.xz.asc) = ab2684cc4044bf39c8064ec7d41dc2d04f01c9bccf5404ec1fffbce89a3a831b4d7dac3613ef892988a16839aeb13cbc03a085fae5c086ee19d3bfb925dff6c0