Skip to content

sqlite3 trace callback prints duplicate line #70375

Closed

Description

@palaviv
mannequin
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']

    Activity

    1. palaviv commented on Jan 23, 2016

      palavivmannequin
      MannequinAuthor

      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

    2. palaviv commented on Apr 30, 2016

      palavivmannequin
      MannequinAuthor

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

    3. berkerpeksag commented on Mar 3, 2017

      @berkerpeksag
      Member

      It would be nice to add a test case to

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

    4. AnishShah commented on Mar 3, 2017

      AnishShahmannequin
      Mannequin

      I can work on this.

    5. berkerpeksag commented on Apr 9, 2017

      @berkerpeksag
      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

    6. berkerpeksag commented on Apr 9, 2017

      @berkerpeksag
      Member

      Thanks, Anish and Aviv!

    7. 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

      3.7 (EOL)end of lifeextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions