Skip to content
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

Doctest warning in sqlite3.rst: "unclosed database in sqlite3.Connection" #126259

Closed
sobolevn opened this issue Oct 31, 2024 · 1 comment
Closed
Assignees
Labels
docs Documentation in the Doc dir topic-sqlite3 type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Oct 31, 2024

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

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error docs Documentation in the Doc dir topic-sqlite3 labels Oct 31, 2024
@sobolevn sobolevn self-assigned this Oct 31, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue Oct 31, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 1, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 1, 2024
erlend-aasland pushed a commit that referenced this issue Nov 1, 2024
erlend-aasland pushed a commit that referenced this issue Nov 1, 2024
@erlend-aasland
Copy link
Contributor

Thanks, Nikita.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir topic-sqlite3 type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants