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 trace callback prints duplicate line #70375

Closed
palaviv mannequin opened this issue Jan 23, 2016 · 6 comments
Closed

sqlite3 trace callback prints duplicate line #70375

palaviv mannequin opened this issue Jan 23, 2016 · 6 comments
Labels
3.7 (EOL) end of life extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@palaviv
Copy link
Mannequin

palaviv mannequin commented Jan 23, 2016

BPO 26187
Nosy @berkerpeksag, @zhangyangyu, @AnishShah, @palaviv
PRs
  • bpo-26187: Tests for sqlite3 trace callback #434
  • bpo-26187: Tests sqlite3 trace callback no duplicate on shcema changing #461
  • 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 2017-04-09.09:12:48.676>
    created_at = <Date 2016-01-23.19:34:32.341>
    labels = ['extension-modules', 'type-bug', '3.7']
    title = 'sqlite3 trace callback prints duplicate line'
    updated_at = <Date 2017-04-09.09:12:48.675>
    user = 'https://github.com/palaviv'

    bugs.python.org fields:

    activity = <Date 2017-04-09.09:12:48.675>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-04-09.09:12:48.676>
    closer = 'berker.peksag'
    components = ['Extension Modules']
    creation = <Date 2016-01-23.19:34:32.341>
    creator = 'palaviv'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 26187
    keywords = []
    message_count = 6.0
    messages = ['258874', '264549', '288876', '288913', '291359', '291361']
    nosy_count = 5.0
    nosy_names = ['ghaering', 'berker.peksag', 'xiang.zhang', 'anish.shah', 'palaviv']
    pr_nums = ['434', '461']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue26187'
    versions = ['Python 3.7']

    @palaviv
    Copy link
    Mannequin Author

    palaviv mannequin commented Jan 23, 2016

    I am running the following script:

    ------------------------------------------

    >>> import sqlite3
    >>> import os
    >>> import time
    >>> con1 = sqlite3.connect("/tmp/test.db")
    >>> con2 = sqlite3.connect("/tmp/test.db")
    >>> con1.set_trace_callback(print)
    >>> cur = con1.cursor()
    >>> cur.execute("create table test(a)")
    create table test(a)
    <sqlite3.Cursor object at 0x7fb488ddf260>
    >>> con2.execute("create table test2(a)")
    <sqlite3.Cursor object at 0x7fb488ddf2d0>
    >>> cur.execute("insert into test(a) values(1)")
    BEGIN 
    insert into test(a) values(1)
    insert into test(a) values(1)
    <sqlite3.Cursor object at 0x7fb488ddf260>
    >>> for a in con1.execute("select * from test"):
    ...     print("result:", a)
    ... 
    select * from test
    result: (1,)

    As you can see i get duplicate traceback print of the "insert into test(a) values(1)" line. The duplicate print has no effect on the actual db.

    I have tested this both on python 3.4.3 and 3.6.0a0 on ubuntu14.04

    @palaviv palaviv mannequin added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Jan 23, 2016
    @palaviv
    Copy link
    Mannequin Author

    palaviv mannequin commented Apr 30, 2016

    This issue will be resolved when we change the sqlite3_prepare to sqlite3_prepare_v2. So there should be a dependency on bpo-9303.

    @berkerpeksag
    Copy link
    Member

    It would be nice to add a test case to

    class TraceCallbackTests(unittest.TestCase):
    before closing this.

    @berkerpeksag berkerpeksag added the 3.7 (EOL) end of life label Mar 3, 2017
    @AnishShah
    Copy link
    Mannequin

    AnishShah mannequin commented Mar 3, 2017

    I can work on this.

    @berkerpeksag
    Copy link
    Member

    New changeset 0e6cb2e by Berker Peksag (Aviv Palivoda) in branch 'master':
    bpo-26187: Test that set_trace_callback() is not called multiple times (GH-461)
    0e6cb2e

    @berkerpeksag
    Copy link
    Member

    Thanks, Anish and Aviv!

    @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.7 (EOL) end of life extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant