Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2019-09-17.09:37:40.032>created_at=<Date2019-09-16.10:00:11.887>labels= ['3.7', '3.8', 'type-bug', 'library', '3.9']
title='Weird way of case-insensitive indexing of sqlite3.Row'updated_at=<Date2019-09-17.09:37:40.032>user='https://github.com/serhiy-storchaka'
sqlite3.Row can be indexed by integers and by strings. In the latter case string matching is case insensitive. But the code that implements this is too simple-minded. It compares UTF-8 representation of two strings ignoring some bit. It works for ASCII letters, but has weird behavior for digits, '_' and non-ASCII characters.
For example:
>>> import sqlite3
>>> con = sqlite3.connect(":memory:")
>>> con.row_factory = sqlite3.Row
>>> row = con.execute("select 1 as a_1").fetchone()
>>> row['a_1']
1
>>> row['A_1']
1
>>> row['A_\x11']
1
>>> row['A\x7f1']
1
>>> row = con.execute("select 1 as ÿ").fetchone()
>>> row["ÿ"]
1
>>> row["Ÿ"]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: No item with that key
>>> row["ß"]
1
New changeset f669581 by Serhiy Storchaka in branch 'master': bpo-38185: Fixed case-insensitive string comparison in sqlite3.Row indexing. (GH-16190) f669581
New changeset d8d653c by Miss Islington (bot) in branch '3.8': bpo-38185: Fixed case-insensitive string comparison in sqlite3.Row indexing. (GH-16190) d8d653c
New changeset 80cb055 by Miss Islington (bot) in branch '3.7': bpo-38185: Fixed case-insensitive string comparison in sqlite3.Row indexing. (GH-16190) 80cb055
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: