mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #35395 -- slice filter crashes on an empty dict with Python 3.12.
Keep consistent behaviour of slice() filter between python 3.12 and prior versions in the case of a dict passed to the filter (catch the new to python 3.12 KeyError exception).
This commit is contained in:
committed by
Sarah Boyce
parent
16d0542bb6
commit
e64d42e753
@@ -644,7 +644,7 @@ def slice_filter(value, arg):
|
||||
bits.append(int(x))
|
||||
return value[slice(*bits)]
|
||||
|
||||
except (ValueError, TypeError):
|
||||
except (ValueError, TypeError, KeyError):
|
||||
return value # Fail silently.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user