Visitar URL original
Convert Python exceptions to appropriate SQLite error codes · Issue #89002 · python/cpython · GitHub
Skip to content

Convert Python exceptions to appropriate SQLite error codes #89002

Description

@serhiy-storchaka
BPO 44839
Nosy @berkerpeksag, @serhiy-storchaka, @erlend-aasland
PRs
  • bpo-44839: Raise more specific errors in sqlite3 #27613
  • 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-08-06.18:29:14.143>
    created_at = <Date 2021-08-05.11:54:52.391>
    labels = ['extension-modules', 'type-feature', '3.11']
    title = 'Convert Python exceptions to appropriate SQLite error codes'
    updated_at = <Date 2021-08-06.18:29:14.143>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2021-08-06.18:29:14.143>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-08-06.18:29:14.143>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2021-08-05.11:54:52.391>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44839
    keywords = ['patch']
    message_count = 3.0
    messages = ['398997', '398999', '399121']
    nosy_count = 3.0
    nosy_names = ['berker.peksag', 'serhiy.storchaka', 'erlendaasland']
    pr_nums = ['27613']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44839'
    versions = ['Python 3.11']

    Activity

    1. serhiy-storchaka commented on Aug 5, 2021

      @serhiy-storchaka
      MemberAuthor

      Currently, any exception raised in user-defined function set the general SQLITE_ERROR error which then produce sqlite3.OperationalError.

      For example, if the user function returns a string or bytes object larger than INT_MAX you get OperationalError, but if it is less than INT_MAX and larger than the SQLite limit (configurable, 1000000000 by default) you get DataError. If a memory error occurred in Python code you get OperationalError, but if it is occurred in the SQLite code you get MemoryError.

      The proposed PR sets corresponding SQLite error codes for MemoryError and OverflowError in user-defined functions. They will produce MemoryError and DataError in Python.

    2. serhiy-storchaka commented on Aug 5, 2021

      @serhiy-storchaka
      MemberAuthor

      It was grown from bigmem tests for bpo-44822.

    3. serhiy-storchaka commented on Aug 6, 2021

      @serhiy-storchaka
      MemberAuthor

      New changeset 7d747f2 by Serhiy Storchaka in branch 'main':
      bpo-44839: Raise more specific errors in sqlite3 (GH-27613)
      7d747f2

    4. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions