classification
Title: Incorrect function signatures in dictobject.c
Type: crash Stage: resolved
Components: Interpreter Core Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: joemarshall, methane, miss-islington, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2021-05-12 12:46 by joemarshall, last changed 2021-05-16 14:34 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 26062 merged joemarshall, 2021-05-12 12:47
PR 26092 merged miss-islington, 2021-05-13 07:54
PR 26093 merged miss-islington, 2021-05-13 07:54
PR 26094 closed miss-islington, 2021-05-13 07:55
PR 26098 merged methane, 2021-05-13 11:43
PR 26107 merged miss-islington, 2021-05-13 20:43
PR 26108 merged miss-islington, 2021-05-13 20:43
PR 26109 closed miss-islington, 2021-05-13 20:43
Messages (6)
msg393506 - (view) Author: Joe Marshall (joemarshall) * Date: 2021-05-12 12:46
There's a couple of wrong function signatures in dictobject.c,

dictkeys_reversed and dictitems_reversed are defined as single arg functions like so: PyObject *(PyObject *), and are then passed around and called as PyCFunctions, which should be PyObject *(PyObject *self,PyObject *args). dictvalues_reversed is correct.

This works fine on most C compilers as the extra arg is just ignored, but on things that use strict function pointer type checking (e.g. webassembly), it crashes (and hence any of the tests that happen to use these functions fails, which is a surprising number)

I've got a fix in my pyodide repo, which I'll chuck in as a pull request on github.
msg393563 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-05-13 08:03
Good catch! The signature of dictkeys_reversed was already fixed (for purity reason), but the same bug in dictvalues_reversed and dictitems_reversed was missed. It is nice that such bugs can now be caught by tools.
msg393564 - (view) Author: miss-islington (miss-islington) Date: 2021-05-13 08:17
New changeset 7cbe6ca63495d478a3164d6d26ef36cb611abbbb by Miss Islington (bot) in branch '3.10':
bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures (GH-26062)
https://github.com/python/cpython/commit/7cbe6ca63495d478a3164d6d26ef36cb611abbbb
msg393604 - (view) Author: miss-islington (miss-islington) Date: 2021-05-13 21:07
New changeset 04c46101944777dd131bbfe8dbfef5f4d328860d by Miss Islington (bot) in branch '3.9':
bpo-44114: Remove redundant cast. (GH-26098)
https://github.com/python/cpython/commit/04c46101944777dd131bbfe8dbfef5f4d328860d
msg393605 - (view) Author: miss-islington (miss-islington) Date: 2021-05-13 21:07
New changeset c4c3beb5ad6b55c20b6dc7c6a92860f467afa75b by Miss Islington (bot) in branch '3.10':
bpo-44114: Remove redundant cast. (GH-26098)
https://github.com/python/cpython/commit/c4c3beb5ad6b55c20b6dc7c6a92860f467afa75b
msg393744 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-05-16 14:34
New changeset 925cb85e9e28d69be53db669527c0a1292f0fbfb by Miss Islington (bot) in branch '3.9':
bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures (GH-26062) (GH-26093)
https://github.com/python/cpython/commit/925cb85e9e28d69be53db669527c0a1292f0fbfb
History
Date User Action Args
2021-05-16 14:34:47serhiy.storchakasetmessages: + msg393744
2021-05-13 21:21:36pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-05-13 21:07:35miss-islingtonsetmessages: + msg393605
2021-05-13 21:07:25miss-islingtonsetmessages: + msg393604
2021-05-13 20:47:45pitrousetversions: - Python 3.8
2021-05-13 20:43:15miss-islingtonsetpull_requests: + pull_request24753
2021-05-13 20:43:09miss-islingtonsetpull_requests: + pull_request24752
2021-05-13 20:43:04miss-islingtonsetpull_requests: + pull_request24751
2021-05-13 11:43:50methanesetpull_requests: + pull_request24739
2021-05-13 08:17:14miss-islingtonsetmessages: + msg393564
2021-05-13 08:03:52serhiy.storchakasettype: behavior -> crash
versions: + Python 3.8, Python 3.9, Python 3.10, Python 3.11
2021-05-13 08:03:19serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg393563
2021-05-13 07:55:21miss-islingtonsetpull_requests: + pull_request24734
2021-05-13 07:54:33miss-islingtonsetpull_requests: + pull_request24733
2021-05-13 07:54:27miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request24732
2021-05-13 05:22:36malinsetnosy: + methane
2021-05-12 12:47:31joemarshallsetkeywords: + patch
stage: patch review
pull_requests: + pull_request24703
2021-05-12 12:46:01joemarshallcreate