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.
Created on 2013年07月17日 23:39 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (8) | |||
|---|---|---|---|
| msg193257 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年07月17日 23:39 | |
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. |
|||
| msg193259 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年07月17日 23:46 | |
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 |
|||
| msg193260 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年07月17日 23:56 | |
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? |
|||
| msg193269 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年07月18日 06:58 | |
I think both (PyException_SetContext), as in Python code. See textiowrapper_close() in Modules/_io/textio.c for example. |
|||
| msg193338 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年07月18日 23:44 | |
See also isue #18501, similar issue in ElementTree. I created the issue while working on the issue #18408. |
|||
| msg193349 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2013年07月19日 08:05 | |
+1 for PyException_SetContext or similar. The C code should behave like a "finally: x.finalize()". |
|||
| msg193504 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年07月22日 06:35 | |
New changeset 020dbfdf9517 by Victor Stinner in branch 'default': Issue #18488: Fix _pysqlite_final_callback() http://hg.python.org/cpython/rev/020dbfdf9517 |
|||
| msg193505 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年07月22日 06:39 | |
"+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. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:48 | admin | set | github: 62688 |
| 2013年07月22日 06:39:08 | vstinner | set | status: open -> closed resolution: fixed messages: + msg193505 |
| 2013年07月22日 06:35:19 | python-dev | set | messages: + msg193504 |
| 2013年07月19日 08:05:48 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages: + msg193349 |
| 2013年07月18日 23:44:37 | vstinner | set | messages: + msg193338 |
| 2013年07月18日 06:58:02 | serhiy.storchaka | set | messages: + msg193269 |
| 2013年07月17日 23:56:18 | vstinner | set | messages: + msg193260 |
| 2013年07月17日 23:46:17 | python-dev | set | nosy:
+ python-dev messages: + msg193259 |
| 2013年07月17日 23:43:38 | vstinner | set | nosy:
+ ghaering, pitrou, christian.heimes, serhiy.storchaka |
| 2013年07月17日 23:39:52 | vstinner | create | |