[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed
Roundup Robot added the comment: New changeset 020dbfdf9517 by Victor Stinner in branch 'default': Issue #18488: Fix _pysqlite_final_callback() http://hg.python.org/cpython/rev/020dbfdf9517 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed
STINNER Victor added the comment: +1 for PyException_SetContext or similar. The C code should behave like a finally: x.finalize(). If the Python callback failed in _pysqlite_step_callback() or _pysqlite_final_callback(): the exception is printed if sqlite3.enable_callback_tracebacks() has been called, or cleared otherwise. Only one kind of exception is expected to be passed to be caller (according to sqlite unit tests): AttributeError. The changeset 020dbfdf9517 restores the behaviour of Python 3.3 for best backward compatibility. If you want better reporting, please open a new issue. My only concern was just to not call a Python function while an exception is set: I fixed this issue using PyErr_Fetch/PyErr_Restore. So I'm closing the issue. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed
Amaury Forgeot d'Arc added the comment: +1 for PyException_SetContext or similar. The C code should behave like a finally: x.finalize(). -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed
Serhiy Storchaka added the comment: I think both (PyException_SetContext), as in Python code. See textiowrapper_close() in Modules/_io/textio.c for example. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed
STINNER Victor added the comment: See also isue #18501, similar issue in ElementTree. I created the issue while working on the issue #18408. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed
New submission from STINNER Victor: In Modules/_sqlite/connection.c, _pysqlite_final_callback() calls the finalize() method of the user function. Calling this method may clear the current exception, whereas test_sqlite excepts that exceptions of step() are reported. -- messages: 193257 nosy: haypo priority: normal severity: normal status: open title: sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +christian.heimes, ghaering, pitrou, serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed
Roundup Robot added the comment: New changeset a2214ab0812e by Victor Stinner in branch 'default': Issue #18488: _pysqlite_final_callback() should not clear the exception set by http://hg.python.org/cpython/rev/a2214ab0812e -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed
STINNER Victor added the comment: What is the expected behaviour? Should sqlite call finalize() if step() failed? If finalize() must be called: which exception should be kept? step() or failure() exception? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18488 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com