This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author erlendaasland
Recipients berker.peksag, erlendaasland, serhiy.storchaka
Date 2021-05-09.08:28:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1620548889.46.0.572288085506.issue44087@roundup.psfhosted.org>
In-reply-to
Content
Currently, the sqlite3.Statement type is not exposed in the module dict:

>>> import sqlite3
>>> sqlite3.Statement
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/sqlite3/__init__.py", line 37, in __getattr__
    raise AttributeError(f"module 'sqlite3' has no attribute '{name}'")
AttributeError: module 'sqlite3' has no attribute 'Statement'


It is possible to extract it using this trick:
>>> cx = sqlite3.connect(":memory:")
>>> stmt = cx("select 1")
>>> type(stmt)
<class 'sqlite3.Statement'>
>>> type(stmt)()
<sqlite3.Statement object at 0x109006b30>

There is no use case for this; statement objects belong to the internal workings of the sqlite3 module. I suggest adding Py_TPFLAGS_DISALLOW_INSTANTIATION to make this fact more explicit.
History
Date User Action Args
2021-05-09 08:28:09erlendaaslandsetrecipients: + erlendaasland, berker.peksag, serhiy.storchaka
2021-05-09 08:28:09erlendaaslandsetmessageid: <1620548889.46.0.572288085506.issue44087@roundup.psfhosted.org>
2021-05-09 08:28:09erlendaaslandlinkissue44087 messages
2021-05-09 08:28:09erlendaaslandcreate