[pypy-commit] pypy default: fix issue #2682, split firstword on any whitespace
mattip
pypy.commits at gmail.com
Wed Oct 25 08:56:51 EDT 2017
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r92844:7dec6a241b75
Date: 2017-10-25 15:52 +0300
http://bitbucket.org/pypy/pypy/changeset/7dec6a241b75/
Log: fix issue #2682, split firstword on any whitespace
diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -1027,7 +1027,7 @@
if '\0' in sql:
raise ValueError("the query contains a null character")
- first_word = sql.lstrip().split(" ")[0].upper()
+ first_word = sql.lstrip().split()[0].upper()
if first_word == "":
self._type = _STMT_TYPE_INVALID
elif first_word == "SELECT":
diff --git a/pypy/module/test_lib_pypy/test_sqlite3.py b/pypy/module/test_lib_pypy/test_sqlite3.py
--- a/pypy/module/test_lib_pypy/test_sqlite3.py
+++ b/pypy/module/test_lib_pypy/test_sqlite3.py
@@ -228,6 +228,14 @@
cur.execute("create table test(a)")
cur.executemany("insert into test values (?)", [[1], [2], [3]])
assert cur.lastrowid is None
+ # issue 2682
+ cur.execute('''insert
+ into test
+ values (?)
+ ''', (1, ))
+ assert cur.lastrowid is not None
+ cur.execute('''insert\t into test values (?) ''', (1, ))
+ assert cur.lastrowid is not None
def test_authorizer_bad_value(self, con):
def authorizer_cb(action, arg1, arg2, dbname, source):
More information about the pypy-commit
mailing list