8000 bpo-42213: Remove redundant cyclic GC hack in sqlite3 by erlend-aasland · Pull Request #26462 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-42213: Remove redundant cyclic GC hack in sqlite3 #26462

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

Closed
Prev Previous commit
Next Next commit
Revert gc workarounds
Reverts commits:
- 866e226.
- 5ff1a80.
- 1e3f589.
- 6cb435b.
  • Loading branch information
Erlend E. Aasland committed Jun 2, 2021
commit 063878cb35406d733bdf87a293eb64f221db767c
11 changes: 2 additions & 9 deletions Lib/sqlite3/test/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import sqlite3 as sqlite
import sys

from test.support import gc_collect
from test.support.os_helper import TESTFN, unlink


Expand Down Expand Up @@ -171,16 +170,10 @@ def test_in_transaction_ro(self):
with self.assertRaises(AttributeError):
self.cx.in_transaction = True


class OpenTests(unittest.TestCase):
def tearDown(self):
# bpo-42213: ensure that TESTFN is closed before unlinking
gc_collect()
unlink(TESTFN)

def test_open_with_path_like_object(self):
""" Checks that we can successfully connect to a database using an object that
is PathLike, i.e. has __fspath__(). """
self.addCleanup(unlink, TESTFN)
class Path:
def __fspath__(self):
return TESTFN
Expand All @@ -189,6 +182,7 @@ def __fspath__(self):
cx.execute('create table test(id integer)')

def test_open_uri(self):
self.addCleanup(unlink, TESTFN)
with sqlite.connect(TESTFN) as cx:
cx.execute('create table test(id integer)')
with sqlite.connect('file:' + TESTFN, uri=True) as cx:
Expand Down Expand Up @@ -948,7 +942,6 @@ def suite():
CursorTests,
ExtensionTests,
ModuleTests,
OpenTests,
SqliteOnConflictTests,
ThreadTests,
]
Expand Down
6 changes: 0 additions & 6 deletions Lib/sqlite3/test/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import unittest
import sqlite3 as sqlite

from test.support import gc_collect
from test.support.os_helper import TESTFN, unlink


Expand Down Expand Up @@ -262,11 +261,6 @@ def trace(statement):
cur.execute(queries[1])
self.assertEqual(traced_statements, queries)

# bpo-42213: ensure that TESTFN is closed before the cleanup runs
con1.close()
con2.close()
gc_collect()


def suite():
tests = [
Expand Down
0