Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty bytestrings are not longer returned on SQLite. #87534

Closed
felixxm mannequin opened this issue Mar 2, 2021 · 4 comments
Closed

Empty bytestrings are not longer returned on SQLite. #87534

felixxm mannequin opened this issue Mar 2, 2021 · 4 comments
Labels
3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@felixxm
Copy link
Mannequin

felixxm mannequin commented Mar 2, 2021

BPO 43368
Nosy @berkerpeksag, @serhiy-storchaka, @erlend-aasland, @felixxm
PRs
  • bpo-43368: Fix fetching empty bytes on SQLite. #24706
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-03-03.14:16:41.453>
    created_at = <Date 2021-03-02.11:52:08.762>
    labels = ['type-bug', 'library', '3.10']
    title = 'Empty bytestrings are not longer returned on SQLite.'
    updated_at = <Date 2021-03-03.14:16:41.452>
    user = 'https://github.com/felixxm'

    bugs.python.org fields:

    activity = <Date 2021-03-03.14:16:41.452>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-03-03.14:16:41.453>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2021-03-02.11:52:08.762>
    creator = 'felixxm'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43368
    keywords = ['patch']
    message_count = 4.0
    messages = ['387918', '387921', '387924', '388021']
    nosy_count = 5.0
    nosy_names = ['ghaering', 'berker.peksag', 'serhiy.storchaka', 'erlendaasland', 'felixxm']
    pr_nums = ['24706']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue43368'
    versions = ['Python 3.10']

    @felixxm
    Copy link
    Mannequin Author

    felixxm mannequin commented Mar 2, 2021

    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 47feb1f
    See https://bugs.python.org/issue43249

    I will submit PR in few minutes.

    @felixxm felixxm mannequin added 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 2, 2021
    @erlend-aasland
    Copy link
    Contributor

    sqlite3_column_blob() should be handled like sqlite3_value_blob() in #68862:

    In case of NULL, check sqlite3_errcode() and raise MemoryError if needed. Else it's a zero-sized blob.

    @erlend-aasland
    Copy link
    Contributor

    I created bpo-43369 for out-of-memory error handling, since it also applies to sqlite3_column_text().

    @berkerpeksag
    Copy link
    Member

    New changeset 3b4b2cf by Mariusz Felisiak in branch 'master':
    bpo-43368: Fix fetching empty bytes in sqlite3 (GH-24706)
    3b4b2cf

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants