You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sqlite3 trace callback prints duplicate line #70375
>>> 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
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
Activity
palaviv commentedon Jan 23, 2016
I am running the following script:
------------------------------------------
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 commentedon 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 commentedon Mar 3, 2017
It would be nice to add a test case to
cpython/Lib/sqlite3/test/hooks.py
Line 204 in 86a6705
AnishShah commentedon Mar 3, 2017
I can work on this.
berkerpeksag commentedon Apr 9, 2017
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 commentedon Apr 9, 2017
Thanks, Anish and Aviv!