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: Empty bytestrings are not longer returned on SQLite.
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, erlendaasland, felixxm, ghaering, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2021-03-02 11:52 by felixxm, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24706 merged felixxm, 2021-03-02 12:18
Messages (4)
msg387918 - (view) Author: Mariusz Felisiak (felixxm) * Date: 2021-03-02 11:52
We noticed a regression in Python3.10.0a6 (it works properly in Python3.10.0a5) when running Django's test suite. Empty bytestrings are not longer returned properly on SQLite:

def test_return_empty_bytes(self):
    cur = self.con.cursor()
    cur.execute("select X''")
    val = cur.fetchone()[0]
    self.assertEqual(val, b'')

Regression in https://github.com/python/cpython/commit/47feb1feb28631b6647699b7633109aa85340966
See https://bugs.python.org/issue43249

I will submit PR in few minutes.
msg387921 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-03-02 12:10
sqlite3_column_blob() should be handled like sqlite3_value_blob() in GH-24674:

In case of NULL, check sqlite3_errcode() and raise MemoryError if needed. Else it's a zero-sized blob.
msg387924 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-03-02 12:38
I created bpo-43369 for out-of-memory error handling, since it also applies to sqlite3_column_text().
msg388021 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2021-03-03 14:16
New changeset 3b4b2cf418707c79f96689e401e3c703c0fdd4d2 by Mariusz Felisiak in branch 'master':
bpo-43368: Fix fetching empty bytes in sqlite3 (GH-24706)
https://github.com/python/cpython/commit/3b4b2cf418707c79f96689e401e3c703c0fdd4d2
History
Date User Action Args
2022-04-11 14:59:42adminsetgithub: 87534
2021-03-03 14:16:41berker.peksagsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-03-03 14:16:31berker.peksagsetmessages: + msg388021
2021-03-02 12:38:20erlendaaslandsetmessages: + msg387924
2021-03-02 12:18:11felixxmsetkeywords: + patch
stage: patch review
pull_requests: + pull_request23480
2021-03-02 12:10:29erlendaaslandsetmessages: + msg387921
2021-03-02 12:08:07serhiy.storchakasetnosy: + serhiy.storchaka, erlendaasland
2021-03-02 12:01:43felixxmsetnosy: + berker.peksag
2021-03-02 11:52:08felixxmcreate