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.

classification
Title: sqlite's create_function() raises exception on unhashable callback, but creates function
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: ghaering, serhiy.storchaka, sir-sigurd
Priority: normal Keywords: patch

Created on 2018-07-05 10:34 by sir-sigurd, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8113 merged sir-sigurd, 2018-07-05 10:39
PR 10946 merged serhiy.storchaka, 2018-12-05 20:27
PR 10952 merged miss-islington, 2018-12-05 21:10
PR 10955 merged serhiy.storchaka, 2018-12-05 21:33
Messages (5)
msg321094 - (view) Author: Sergey Fedoseev (sir-sigurd) * Date: 2018-07-05 10:34
In [1]: import sqlite3

In [2]: con = sqlite3.connect(':memory:')

In [3]: con.execute('SELECT f()')
---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
<ipython-input-3-e3bab2096896> in <module>()
----> 1 con.execute('SELECT f()')

OperationalError: no such function: f

In [4]: con.create_function('f', 0, [])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-452e7d2028ac> in <module>()
----> 1 con.create_function('f', 0, [])

TypeError: unhashable type: 'list'

In [5]: con.execute('SELECT f()')
---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
<ipython-input-5-e3bab2096896> in <module>()
----> 1 con.execute('SELECT f()')

OperationalError: user-defined function raised exception


It seems that something like this cause segmentation fault, but I can't reproduce it.
Some other similar sqlite functions also affected. They can be easily modified to accept unhashable objects, but probably it should be done in another issue.
msg331138 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-05 17:50
New changeset 5b25f1d03100e2283c1b129d461ba68ac0169a14 by Serhiy Storchaka (Sergey Fedoseev) in branch 'master':
bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113)
https://github.com/python/cpython/commit/5b25f1d03100e2283c1b129d461ba68ac0169a14
msg331166 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-05 21:09
New changeset 1de91a0032fed500ddd3d8c4fb7a38c0b8719f67 by Serhiy Storchaka in branch '3.7':
bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113). (GH-10946)
https://github.com/python/cpython/commit/1de91a0032fed500ddd3d8c4fb7a38c0b8719f67
msg331180 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-05 22:03
New changeset fdf505000f135df3bdae08697b2a324d8f046768 by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6':
bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113). (GH-10946) (GH-10952)
https://github.com/python/cpython/commit/fdf505000f135df3bdae08697b2a324d8f046768
msg331184 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-05 22:21
New changeset fff8fab1ce4af208cd9c6cd84a8be626a1b744d8 by Serhiy Storchaka in branch '2.7':
[2.7] bpo-34052: Prevent SQLite functions from setting callbacks on exceptions. (GH-8113). (GH-10946) (GH-10955)
https://github.com/python/cpython/commit/fff8fab1ce4af208cd9c6cd84a8be626a1b744d8
History
Date User Action Args
2022-04-11 14:59:02adminsetgithub: 78233
2018-12-05 22:22:06serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-12-05 22:21:43serhiy.storchakasetmessages: + msg331184
2018-12-05 22:03:17serhiy.storchakasetmessages: + msg331180
2018-12-05 21:33:27serhiy.storchakasetpull_requests: + pull_request10204
2018-12-05 21:10:09miss-islingtonsetpull_requests: + pull_request10202
2018-12-05 21:09:59serhiy.storchakasetmessages: + msg331166
2018-12-05 20:27:29serhiy.storchakasetpull_requests: + pull_request10196
2018-12-05 17:50:29serhiy.storchakasetmessages: + msg331138
2018-07-05 10:53:58serhiy.storchakasetassignee: serhiy.storchaka

nosy: + ghaering, serhiy.storchaka
versions: + Python 3.6, Python 3.7
2018-07-05 10:39:17sir-sigurdsetkeywords: + patch
stage: patch review
pull_requests: + pull_request7702
2018-07-05 10:34:47sir-sigurdcreate