mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-03-03 15:45:46 +03:00
Deal with slices passed to __*item__ in Python 3.
This commit is contained in:
parent
ade1b2cc7b
commit
e18f1c63ea
|
@ -141,12 +141,12 @@ class DictRow(list):
|
||||||
self[:] = [None] * len(cursor.description)
|
self[:] = [None] * len(cursor.description)
|
||||||
|
|
||||||
def __getitem__(self, x):
|
def __getitem__(self, x):
|
||||||
if not isinstance(x, int):
|
if not isinstance(x, (int, slice)):
|
||||||
x = self._index[x]
|
x = self._index[x]
|
||||||
return list.__getitem__(self, x)
|
return list.__getitem__(self, x)
|
||||||
|
|
||||||
def __setitem__(self, x, v):
|
def __setitem__(self, x, v):
|
||||||
if not isinstance(x, int):
|
if not isinstance(x, (int, slice)):
|
||||||
x = self._index[x]
|
x = self._index[x]
|
||||||
list.__setitem__(self, x, v)
|
list.__setitem__(self, x, v)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user