diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 588272448bbfda6..e46c62cce8c6e29 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -31,11 +31,10 @@ from test.support import ( SHORT_TIMEOUT, check_disallow_instantiation, requires_subprocess, - is_apple, is_emscripten, is_wasi + is_apple, is_emscripten, is_wasi, import_helper ) from test.support import gc_collect from test.support import threading_helper -from _testcapi import INT_MAX, ULLONG_MAX from os import SEEK_SET, SEEK_CUR, SEEK_END from test.support.os_helper import TESTFN, TESTFN_UNDECODABLE, unlink, temp_dir, FakePath @@ -1200,6 +1199,7 @@ def test_blob_seek_and_tell(self): self.assertEqual(self.blob.tell(), 40) def test_blob_seek_error(self): + testcapi = import_helper.import_module("_testcapi") msg_oor = "offset out of blob range" msg_orig = "'origin' should be os.SEEK_SET, os.SEEK_CUR, or os.SEEK_END" msg_of = "seek offset results in overflow" @@ -1217,9 +1217,9 @@ def test_blob_seek_error(self): # Force overflow errors self.blob.seek(1, SEEK_SET) with self.assertRaisesRegex(OverflowError, msg_of): - self.blob.seek(INT_MAX, SEEK_CUR) + self.blob.seek(testcapi.INT_MAX, SEEK_CUR) with self.assertRaisesRegex(OverflowError, msg_of): - self.blob.seek(INT_MAX, SEEK_END) + self.blob.seek(testcapi.INT_MAX, SEEK_END) def test_blob_read(self): buf = self.blob.read() @@ -1374,13 +1374,14 @@ def test_blob_mapping_invalid_index_type(self): self.blob["a"] = b"b" def test_blob_get_item_error(self): + testcapi = import_helper.import_module("_testcapi") dataset = [len(self.blob), 105, -105] for idx in dataset: with self.subTest(idx=idx): with self.assertRaisesRegex(IndexError, "index out of range"): self.blob[idx] with self.assertRaisesRegex(IndexError, "cannot fit 'int'"): - self.blob[ULLONG_MAX] + self.blob[testcapi.ULLONG_MAX] # Provoke read error self.cx.execute("update test set b='aaaa' where rowid=1")