This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incorrect expressions / assert with side effect in hashtable
Type: compile error Stage: resolved
Components: Interpreter Core Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: christian.heimes, miss-islington
Priority: normal Keywords: patch

Created on 2020-06-21 08:52 by christian.heimes, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21028 merged christian.heimes, 2020-06-21 08:59
PR 21042 merged miss-islington, 2020-06-22 07:42
Messages (3)
msg371987 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2020-06-21 08:52
Coverity has found four issues in hashtable implementation and tests

Py_hashtable_get_entry_generic(_Py_hashtable_t *ht, const void *key)

CID 1464680 (#1 of 1): Evaluation order violation (EVALUATION_ORDER)write_write_typo: In entry = entry = (_Py_hashtable_entry_t *)((_Py_slist_t *)&ht->buckets[index])->head, entry is written twice with the same value.


_Py_hashtable_get_entry_ptr(_Py_hashtable_t *ht, const void *key)

CID 1464602 (#1 of 1): Evaluation order violation (EVALUATION_ORDER)write_write_typo: In entry = entry = (_Py_hashtable_entry_t *)((_Py_slist_t *)&ht->buckets[index])->head, entry is written twice with the same value.


test_hashtable(PyObject *self, PyObject *Py_UNUSED(args))

CID 1464668 (#1 of 1): Side effect in assertion (ASSERT_SIDE_EFFECT)assignment_where_comparison_intended: Assignment entry->key = (void *)(uintptr_t)key has a side effect. This code will work differently in a non-debug build.
CID 1464664 (#1 of 1): Side effect in assertion (ASSERT_SIDE_EFFECT)assignment_where_comparison_intended: Assignment entry->value = (void *)(uintptr_t)(1 + ((int)key - 97)) has a side effect. This code will work differently in a non-debug build.
msg372038 - (view) Author: miss-islington (miss-islington) Date: 2020-06-22 07:41
New changeset 4901ea952691ad70aae21cfe04b6bd363b5a6aff by Christian Heimes in branch 'master':
bpo-41061: Fix incorrect expressions in hashtable (GH-21028)
https://github.com/python/cpython/commit/4901ea952691ad70aae21cfe04b6bd363b5a6aff
msg372043 - (view) Author: miss-islington (miss-islington) Date: 2020-06-22 08:01
New changeset f19ed6b0c77ba3bdaa1d8c304a61f2fa90b5d6ac by Miss Islington (bot) in branch '3.9':
bpo-41061: Fix incorrect expressions in hashtable (GH-21028)
https://github.com/python/cpython/commit/f19ed6b0c77ba3bdaa1d8c304a61f2fa90b5d6ac
History
Date User Action Args
2022-04-11 14:59:32adminsetgithub: 85233
2020-10-21 16:49:05christian.heimessetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-06-22 08:01:52miss-islingtonsetmessages: + msg372043
2020-06-22 07:42:03miss-islingtonsetpull_requests: + pull_request20213
2020-06-22 07:41:52miss-islingtonsetnosy: + miss-islington
messages: + msg372038
2020-06-21 08:59:17christian.heimessetkeywords: + patch
stage: patch review
pull_requests: + pull_request20200
2020-06-21 08:52:57christian.heimescreate