mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-11-20 07:00:25 +00:00
Close leaked sqlite3 connections (ResourceWarning on Python 3.13+) (#6181)
Python 3.13+ reports sqlite3 connections that are garbage collected without being closed. The unit tests print a run of "ResourceWarning: unclosed database" lines on Linux/CPython 3.14: - SQLAlchemy.close() only returned its connection to the engine's pool, so the underlying DBAPI connection (e.g. sqlite3 for '-d sqlite://...') stayed open. Dispose the engine on close. - vulnTest() used "with sqlite3.connect(...)", which commits but does not close the connection. Use contextlib.closing(). - test_multibit and test_sqlalchemy never closed what they opened. Co-authored-by: PiyushSatyarthi <244159432+PiyushSatyarthi@users.noreply.github.com>
This commit is contained in:
parent
eca9ff2e13
commit
cb5216564a
4 changed files with 31 additions and 6 deletions
|
|
@ -58,6 +58,7 @@ class TestSQLAlchemySqlitePath(unittest.TestCase):
|
|||
|
||||
sa = SQLAlchemy(dialect="sqlite")
|
||||
sa.connect()
|
||||
self.addCleanup(sa.close)
|
||||
|
||||
# the reformatted URL must resolve to the exact absolute file (not '//...path')
|
||||
self.assertEqual(_sa.engine.url.make_url(sa.address).database, os.path.abspath(dbfile))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue