bpo-40956: Convert sqlite3.connect and sqlite3.Connection.__init__ to AC#24421
bpo-40956: Convert sqlite3.connect and sqlite3.Connection.__init__ to AC#24421pablogsal merged 17 commits into
Conversation
bd403c2 to
f70acce
Compare
February 21, 2021 09:08
|
FYI, rebased onto master. |
Sorry, something went wrong.
|
FYI, this is on my TODO list, but I want to take my time to review it since AC PRs tend to introduce regressions because of our lack of test coverage in this area. |
Sorry, something went wrong.
I can take a look at the code coverage later today. If it's possible to increase it by extending the unit test suite, we should do so first. |
Sorry, something went wrong.
|
I don't think we have a lot of tests for optional or keyword arguments of public APIs. #24503 is a recent example of a regression introduced due to lack of tests. |
Sorry, something went wrong.
Exactly. As far as I can see, all arguments are covered except EDIT: |
Sorry, something went wrong.
|
@berkerpeksag This will do the trick for diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index 39c9bf5b61..050094f895 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -533,6 +533,20 @@ def tearDown(self):
self.cur.close()
self.con.close()
+ def test_dont_check_same_thread(self):
+ def run(con, err):
+ try:
+ cur = con.execute("select 1")
+ except sqlite.Error:
+ err.append("multi-threading not allowed")
+
+ con = sqlite.connect(":memory:", check_same_thread=False)
+ err = []
+ t = threading.Thread(target=run, kwargs={"con": con, "err": err})
+ t.start()
+ t.join()
+ self.assertEqual(len(err), 0, "\n".join(err))
+
def test_con_cursor(self):
def run(con, errors):
try:BTW, |
Sorry, something went wrong.
|
@berkerpeksag Can I add tests for the UPDATE: Tests complementing keyword coverage has been added. |
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
f70acce to
a861358
Compare
May 7, 2021 20:17
|
Rebased onto |
Sorry, something went wrong.
|
Not sure what's wrong with the "check generated files" CI; the last commit did not touch the clinic code in any way. I did a |
Sorry, something went wrong.
|
You are changing the AC and either there are some changes you did and you didn't regenerate or as subset of the files in the main branch has moved since then and therefore your files are not up to date. |
Sorry, something went wrong.
Commit af0fc7e passed the CI perfectly. All 98f1a9d did was adding two C comments (out of clinic scope). |
Sorry, something went wrong.
|
Let me know if you want further changes, @pablogsal. |
Sorry, something went wrong.
Many thanks, Pablo! |
Sorry, something went wrong.
…ctory (#95146) This PR partially reverts gh-24421 (PR) and fixes the remaining concerns given in gh-93044 (issue): - keyword arguments are passed as positional arguments to factory() - if an argument is not passed to sqlite3.connect(), its default value is passed to factory() Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…connect to factory (pythonGH-95146) This PR partially reverts pythongh-24421 (PR) and fixes the remaining concerns given in pythongh-93044 (issue): - keyword arguments are passed as positional arguments to factory() - if an argument is not passed to sqlite3.connect(), its default value is passed to factory() Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>. (cherry picked from commit a3d4d15) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
…t to factory (GH-95146) (#95158) This PR partially reverts gh-24421 (PR) and fixes the remaining concerns given in gh-93044 (issue): - keyword arguments are passed as positional arguments to factory() - if an argument is not passed to sqlite3.connect(), its default value is passed to factory() Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>. (cherry picked from commit a3d4d15) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
https://bugs.python.org/issue40956