8000 Doctest warning in `sqlite3.rst`: "unclosed database in sqlite3.Connection" · Issue #126259 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
Doctest warning in sqlite3.rst: "unclosed database in sqlite3.Connection" #126259
Closed
@sobolevn

Description

@sobolevn

Bug report

Link: https://github.com/python/cpython/actions/runs/11619995124/job/32360863917?pr=126257#step:8:481

 Document: library/sqlite3
-------------------------
3 items passed all tests:
  77 tests in default
   3 tests in sqlite3.cursor
   3 tests in sqlite3.limits
83 tests in 3 items.
83 passed.
Test passed.
3 items passed all tests:
   1 test in default (cleanup code)
   1 test in sqlite3.cursor (cleanup code)
   1 test in sqlite3.limits (cleanup code)
3 tests in 3 items.
3 passed.
Test passed.
Exception ignored in: <sqlite3.Connection object at 0x7fc13a724f30>
Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython/Doc/venv/lib/python3.14/site-packages/docutils/nodes.py", line 359, in __new__
    def __new__(cls, data, rawsource=None):
ResourceWarning: unclosed database in <sqlite3.Connection object at 0x7fc13a724f30>

Refs #111726

This code raises this issue:

.. doctest::
>>> con = sqlite3.connect("file:tutorial.db?mode=ro", uri=True)
>>> con.execute("CREATE TABLE readonly(data)")
Traceback (most recent call last):
OperationalError: attempt to write a readonly database

I have a PR ready.

Linked PRs

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc dirtopic-sqlite3type-bugAn unexpected behavior, bug, or error

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0