[pypy-commit] pypy stdlib-2.7.13: simplify code a bit
arigo
pypy.commits at gmail.com
Sun Dec 18 18:31:37 EST 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: stdlib-2.7.13
Changeset: r89171:55980e9a374e
Date: 2016-12-19 00:30 +0100
http://bitbucket.org/pypy/pypy/changeset/55980e9a374e/
Log: simplify code a bit
diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -364,12 +364,7 @@
cursor._reset = True
def _reset_all_statements(self):
- total = 0
- for weakref in self.__statements:
- statement = weakref()
- if statement is not None:
- total += statement._reset()
- return total
+ self.__do_all_statements(Statement._reset, False)
@_check_thread_wrap
@_check_closed_wrap
@@ -839,12 +834,10 @@
# this is the only place shown by pysqlite tests, and I
# can only hope there is no other.
- while True:
+ ret = _lib.sqlite3_step(self.__statement._statement)
+ if ret == _lib.SQLITE_LOCKED:
+ self.__connection._reset_all_statements()
ret = _lib.sqlite3_step(self.__statement._statement)
- if (ret == _lib.SQLITE_LOCKED and
- self.__connection._reset_all_statements()):
- continue
- break
if ret == _lib.SQLITE_ROW:
if multiple:
@@ -1074,8 +1067,6 @@
if self._in_use and self._statement:
_lib.sqlite3_reset(self._statement)
self._in_use = False
- return 1
- return 0
if sys.version_info[0] < 3:
def __check_decodable(self, param):
More information about the pypy-commit
mailing list