This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Sqlite3 & turkish locale
Type: Stage: resolved
Components: Extension Modules Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, pitrou, python-dev, takluyver
Priority: normal Keywords:

Created on 2011-10-04 10:46 by takluyver, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg144873 - (view) Author: Thomas Kluyver (takluyver) * Date: 2011-10-04 10:46
When using sqlite3 with the Turkish locale, cursor.lastrowid is not accessible after an insert statement if "INSERT" is upper case.

I believe that the cause is that the detect_statement_kind function [1] calls the locale-dependent C function tolower(). The Turkish locale specifies a different case mapping for I (to a dotless lowercase i: ı), so it's not recognised as an insert statement, which looks like it will cause the transaction to be committed immediately.

See also the discussion on issue 1813 [2], and a Redhat bug with a test case for this [3].


[1] http://hg.python.org/cpython/file/c4b6d9312da1/Modules/_sqlite/cursor.c#l41
[2] http://bugs.python.org/issue1813
[3] https://bugzilla.redhat.com/show_bug.cgi?id=720209
msg144877 - (view) Author: Thomas Kluyver (takluyver) * Date: 2011-10-04 11:32
What form does the test need to be in? There's a script at the redhat bug I linked that demonstrates the issue. Do I need to turn it into a function? A patch for the existing test suite?
msg144880 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-10-04 11:40
A patch against Lib/sqlite3/test/regression.py would be nice.
msg144881 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-10-04 11:41
New changeset 469555867244 by Antoine Pitrou in branch '3.2':
Issue #13099: Fix sqlite3.Cursor.lastrowid under a Turkish locale.
http://hg.python.org/cpython/rev/469555867244

New changeset 652e2dacbf4b by Antoine Pitrou in branch 'default':
Issue #13099: Fix sqlite3.Cursor.lastrowid under a Turkish locale.
http://hg.python.org/cpython/rev/652e2dacbf4b

New changeset 89713606b654 by Antoine Pitrou in branch '2.7':
Issue #13099: Fix sqlite3.Cursor.lastrowid under a Turkish locale.
http://hg.python.org/cpython/rev/89713606b654
msg144882 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-04 11:42
Fixed, thank you.
msg144883 - (view) Author: Thomas Kluyver (takluyver) * Date: 2011-10-04 11:45
Thanks, Antoine. Should I still try to write a regression test for it?
msg144884 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-04 11:56
> Thanks, Antoine. Should I still try to write a regression test for it?

I've had issues writing regression tests for other Turkish
locale-related failures (namely, there are other bugs in some glibcs
that could cause the test to fail anyway). I'm not sure it's worth it
here.
History
Date User Action Args
2022-04-11 14:57:22adminsetgithub: 57308
2011-10-04 11:56:04pitrousetmessages: + msg144884
2011-10-04 11:45:19takluyversetmessages: + msg144883
2011-10-04 11:42:17pitrousetstatus: open -> closed

versions: + Python 3.3
nosy: + pitrou

messages: + msg144882
resolution: fixed
stage: test needed -> resolved
2011-10-04 11:41:45python-devsetnosy: + python-dev
messages: + msg144881
2011-10-04 11:40:53ezio.melottisetmessages: + msg144880
2011-10-04 11:32:50takluyversettype: behavior ->
messages: + msg144877
2011-10-04 11:19:33ezio.melottisetnosy: + ezio.melotti

type: behavior
stage: test needed
2011-10-04 10:46:39takluyvercreate