mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 12:40:15 +01:00
py/objslice: Ensure slice is not hashable.
As per https://bugs.python.org/issue408326, the slice object should not be hashable. Since MicroPython has an implicit fallback when the unary_op slot is empty, we need to fill this slot. Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
committed by
Damien George
parent
eaccaa3677
commit
8491eb190f
15
tests/basics/slice_op.py
Normal file
15
tests/basics/slice_op.py
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
try:
|
||||
t = [][:]
|
||||
except:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
|
||||
# REVISIT: slice comparison operators are not implemented in MicroPython
|
||||
|
||||
# test that slice is not hashable, i.e. it can't be used to copy a dict
|
||||
try:
|
||||
{}[:] = {}
|
||||
except TypeError:
|
||||
print('TypeError')
|
||||
Reference in New Issue
Block a user