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

[sqlite3] simplify executescript() #89204

Closed
erlend-aasland opened this issue Aug 28, 2021 · 5 comments
Closed

[sqlite3] simplify executescript() #89204

erlend-aasland opened this issue Aug 28, 2021 · 5 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

@erlend-aasland
Copy link
Contributor

BPO 45041
Nosy @pablogsal, @erlend-aasland
PRs
  • bpo-45041: Simplify sqlite3.Cursor.executescript() #28020
  • bpo-45041: Increase coverage for sqlite3.Cursor.executescript() #28074
  • bpo-45041: Restore sqlite3 executescript behaviour for SELECT queries #28509
  • 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-09-19.23:19:22.309>
    created_at = <Date 2021-08-28.21:42:20.742>
    labels = ['extension-modules', 'type-feature', '3.11']
    title = '[sqlite3] simplify executescript()'
    updated_at = <Date 2021-10-07.09:17:03.465>
    user = 'https://github.com/erlend-aasland'

    bugs.python.org fields:

    activity = <Date 2021-10-07.09:17:03.465>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-09-19.23:19:22.309>
    closer = 'erlendaasland'
    components = ['Extension Modules']
    creation = <Date 2021-08-28.21:42:20.742>
    creator = 'erlendaasland'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45041
    keywords = ['patch']
    message_count = 5.0
    messages = ['400505', '400669', '402180', '402185', '403366']
    nosy_count = 2.0
    nosy_names = ['pablogsal', 'erlendaasland']
    pr_nums = ['28020', '28074', '28509']
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue45041'
    versions = ['Python 3.11']

    @erlend-aasland
    Copy link
    Contributor Author

    See also bpo-45040

    Since sqlite3_finalize() will pass on any error message set by sqlite3_step(), we can greatly simplify SQLite C API usage and error handling in sqlite3.Cursor.executescript(), thus reducing the number of times we save/restore thread state, and also simplifying error handling greatly.

    We can also "inline" the commit before the main loop using the SQLite API directly, instead of calling self.commit()

    Diffstat for the proposed patch:
    1 file changed, 25 insertions(+), 42 deletions(-)

    @erlend-aasland erlend-aasland added 3.11 only security fixes extension-modules C modules in the Modules dir type-feature A feature request or enhancement labels Aug 28, 2021
    @pablogsal
    Copy link
    Member

    New changeset e34bb40 by Erlend Egeberg Aasland in branch 'main':
    bpo-45041: Increase coverage for sqlite3.Cursor.executescript() (GH-28074)
    e34bb40

    @pablogsal
    Copy link
    Member

    New changeset a677971 by Erlend Egeberg Aasland in branch 'main':
    bpo-45041: Simplify sqlite3.Cursor.executescript() (GH-28020)
    a677971

    @erlend-aasland
    Copy link
    Contributor Author

    Thanks for reviewing, Pablo!

    @pablogsal
    Copy link
    Member

    New changeset 3f2c433 by Erlend Egeberg Aasland in branch 'main':
    bpo-45041: Restore sqlite3 executescript behaviour for SELECT queries (GH-28509)
    3f2c433

    @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