[Python-checkins] bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures (GH-26062) (GH-26093)

serhiy-storchaka webhook-mailer at python.org
Sun May 16 10:34:48 EDT 2021


https://github.com/python/cpython/commit/925cb85e9e28d69be53db669527c0a1292f0fbfb
commit: 925cb85e9e28d69be53db669527c0a1292f0fbfb
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2021-05-16T17:34:43+03:00
summary:

bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures (GH-26062) (GH-26093)

These are passed and called as PyCFunction, however they are defined here without the (ignored) args parameter.

This works fine in some C compilers, but fails in webassembly or anything else that has strict function pointer call type checking.
(cherry picked from commit ab383eb6f03896b0ef6634ee3d776344fcb9e5b8)

Co-authored-by: Joe Marshall <joe.marshall at nottingham.ac.uk>

Co-authored-by: Joe Marshall <joe.marshall at nottingham.ac.uk>

files:
A Misc/NEWS.d/next/Core and Builtins/2021-05-12-14-26-16.bpo-44114.p-WfAE.rst
M Objects/dictobject.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-05-12-14-26-16.bpo-44114.p-WfAE.rst b/Misc/NEWS.d/next/Core and Builtins/2021-05-12-14-26-16.bpo-44114.p-WfAE.rst
new file mode 100644
index 00000000000000..c50b1594cae356
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2021-05-12-14-26-16.bpo-44114.p-WfAE.rst	
@@ -0,0 +1 @@
+Fix incorrect dictkeys_reversed and dictitems_reversed function signatures in C code, which broke webassembly builds.
\ No newline at end of file
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 06412a9d87aaf8..2ae122d3239c14 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -4615,7 +4615,7 @@ static PySequenceMethods dictitems_as_sequence = {
     (objobjproc)dictitems_contains,     /* sq_contains */
 };
 
-static PyObject* dictitems_reversed(_PyDictViewObject *dv);
+static PyObject* dictitems_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored));
 
 PyDoc_STRVAR(reversed_items_doc,
 "Return a reverse iterator over the dict items.");
@@ -4668,7 +4668,7 @@ dictitems_new(PyObject *dict, PyObject *Py_UNUSED(ignored))
 }
 
 static PyObject *
-dictitems_reversed(_PyDictViewObject *dv)
+dictitems_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored))
 {
     if (dv->dv_dict == NULL) {
         Py_RETURN_NONE;
@@ -4698,7 +4698,7 @@ static PySequenceMethods dictvalues_as_sequence = {
     (objobjproc)0,                      /* sq_contains */
 };
 
-static PyObject* dictvalues_reversed(_PyDictViewObject *dv);
+static PyObject* dictvalues_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored));
 
 PyDoc_STRVAR(reversed_values_doc,
 "Return a reverse iterator over the dict values.");
@@ -4749,7 +4749,7 @@ dictvalues_new(PyObject *dict, PyObject *Py_UNUSED(ignored))
 }
 
 static PyObject *
-dictvalues_reversed(_PyDictViewObject *dv)
+dictvalues_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored))
 {
     if (dv->dv_dict == NULL) {
         Py_RETURN_NONE;



More information about the Python-checkins mailing list