New submission from Christian Heimes <li...@cheimes.de>:

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.

----------
assignee: christian.heimes
components: Interpreter Core
messages: 371987
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Incorrect expressions / assert with side effect in hashtable
type: compile error
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41061>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to