You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assertion failed: tmp==APSWBuffer_hash(res), file apsw\src\apswbuffer.c, line 200
Using APSW 3.26.0-r1 on Python 2.7.15 on Windows.
When using PYTHONHASHSEED=random, APSWBuffer_hash() no longer corresponds to Python hash algorithm, which invalidates the optimization of stealing the existing hash code.
In debug mode this triggers an assertion, not sure what kind of misbehavior could be triggered in normal builds.
Hash Randomization is enabled by default in Python 3, so that's probably also affected.
The text was updated successfully, but these errors were encountered:
Even without hash randomization, there's a subtle bug when the hash computation results in -1:
When copying such a hash code from Python, it's adjusted to -2 (and stays that way; as the +1 is avoided in this special case).
However in APSWBuffer_hash, the +1 is always added and the -1->-2 special case is handled only later. So if the python hash computation results in -1, the effective hash code as determined by APSWBuffer_FromObject() is -2; but the effective hash code as determined by APSWBuffer_hash is 0.
Assertion failed: tmp==APSWBuffer_hash(res), file apsw\src\apswbuffer.c, line 200
Using APSW 3.26.0-r1 on Python 2.7.15 on Windows.
When using
PYTHONHASHSEED=random
,APSWBuffer_hash()
no longer corresponds to Python hash algorithm, which invalidates the optimization of stealing the existing hash code.In debug mode this triggers an assertion, not sure what kind of misbehavior could be triggered in normal builds.
Hash Randomization is enabled by default in Python 3, so that's probably also affected.
The text was updated successfully, but these errors were encountered: