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

Convert Python exceptions to appropriate SQLite error codes #89002

Closed
serhiy-storchaka opened this issue Aug 5, 2021 · 3 comments
Closed

Convert Python exceptions to appropriate SQLite error codes #89002

serhiy-storchaka opened this issue Aug 5, 2021 · 3 comments
Labels
3.11 only security fixes extension-modules C modules in the Modules dir topic-sqlite3 type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

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']

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @serhiy-storchaka serhiy-storchaka added 3.11 only security fixes extension-modules C modules in the Modules dir type-feature A feature request or enhancement labels Aug 5, 2021
    @serhiy-storchaka
    Copy link
    Member Author

    It was grown from bigmem tests for bpo-44822.

    @serhiy-storchaka
    Copy link
    Member Author

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

    @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.11 only security fixes extension-modules C modules in the Modules dir topic-sqlite3 type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants