Issue #13099: Fix sqlite3.Cursor.lastrowid under a Turkish locale.
Reported and diagnosed by Thomas Kluyver.
diff --git a/Misc/ACKS b/Misc/ACKS
index 4f2ea13..3dc3de1 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -488,6 +488,7 @@
 Bob Kline
 Matthias Klose
 Jeremy Kloth
+Thomas Kluyver
 Kim Knapp
 Lenny Kneler
 Pat Knight
diff --git a/Misc/NEWS b/Misc/NEWS
index dd98665..6b558b4 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -36,6 +36,9 @@
 Library
 -------
 
+- Issue #13099: Fix sqlite3.Cursor.lastrowid under a Turkish locale.
+  Reported and diagnosed by Thomas Kluyver.
+
 - Issue #13087: BufferedReader.seek() now always raises UnsupportedOperation
   if the underlying raw stream is unseekable, even if the seek could be
   satisfied using the internal buffer.  Patch by John O'Connor.
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 97908a3..b9a4358 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -55,8 +55,8 @@
 
     dst = buf;
     *dst = 0;
-    while (isalpha(*src) && dst - buf < sizeof(buf) - 2) {
-        *dst++ = tolower(*src++);
+    while (Py_ISALPHA(*src) && dst - buf < sizeof(buf) - 2) {
+        *dst++ = Py_TOLOWER(*src++);
     }
 
     *dst = 0;