mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
update int hash
This commit is contained in:
parent
620db020ed
commit
0a75eb857c
@ -244,9 +244,7 @@ static py_i64 c11_8bytes__hash(union c11_8bytes u) {
|
|||||||
|
|
||||||
static bool int__hash__(int argc, py_Ref argv) {
|
static bool int__hash__(int argc, py_Ref argv) {
|
||||||
PY_CHECK_ARGC(1);
|
PY_CHECK_ARGC(1);
|
||||||
py_i64 val = py_toint(&argv[0]);
|
py_assign(py_retval(), argv);
|
||||||
union c11_8bytes u = {._i64 = val};
|
|
||||||
py_newint(py_retval(), c11_8bytes__hash(u));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,3 +138,13 @@ for i in range(n):
|
|||||||
# if i % 3 == 0:
|
# if i % 3 == 0:
|
||||||
# y = b.pop()
|
# y = b.pop()
|
||||||
# delattr(a, y)
|
# delattr(a, y)
|
||||||
|
|
||||||
|
d = {}
|
||||||
|
for i in range(-1000, 1000):
|
||||||
|
d[i] = i
|
||||||
|
assert d[i] == i
|
||||||
|
|
||||||
|
e = {}
|
||||||
|
for i in range(-10000, 10000, 3):
|
||||||
|
e[i] = i
|
||||||
|
assert e[i] == i
|
Loading…
x
Reference in New Issue
Block a user