FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-111726: Remove some unneeded doctests from sqlite3 docs by erlend-aasland · Pull Request #117623 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
43 changes: 7 additions & 36 deletions Doc/library/sqlite3.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -394,29 +394,11 @@ Module functions
will get tracebacks from callbacks on :data:`sys.stderr`. Use ``False``
to disable the feature again.

Register an :func:`unraisable hook handler <sys.unraisablehook>` for an
improved debug experience:

.. testsetup:: sqlite3.trace

import sqlite3
.. note::

.. doctest:: sqlite3.trace

>>> sqlite3.enable_callback_tracebacks(True)
>>> con = sqlite3.connect(":memory:")
>>> def evil_trace(stmt):
... 5/0
...
>>> con.set_trace_callback(evil_trace)
>>> def debug(unraisable):
... print(f"{unraisable.exc_value!r} in callback {unraisable.object.__name__}")
... print(f"Error message: {unraisable.err_msg}")
>>> import sys
>>> sys.unraisablehook = debug
>>> cur = con.execute("SELECT 1")
ZeroDivisionError('division by zero') in callback evil_trace
Error message: None
Errors in user-defined function callbacks are logged as unraisable exceptions.
Use an :func:`unraisable hook handler <sys.unraisablehook>` for
introspection of the failed callback.

.. function:: register_adapter(type, adapter, /)

Expand Down Expand Up @@ -1068,13 +1050,10 @@ Connection objects
.. versionchanged:: 3.10
Added the ``sqlite3.enable_load_extension`` auditing event.

.. testsetup:: sqlite3.loadext

import sqlite3
con = sqlite3.connect(":memory:")
.. We cannot doctest the load extension API, since there is no convenient
way to skip it.

.. testcode:: sqlite3.loadext
:skipif: True # not testable at the moment
.. code-block::

con.enable_load_extension(True)

Expand All @@ -1098,14 +1077,6 @@ Connection objects
for row in con.execute("SELECT rowid, name, ingredients FROM recipe WHERE name MATCH 'pie'"):
print(row)

con.close()

.. testoutput:: sqlite3.loadext
:hide:

(2, 'broccoli pie', 'broccoli cheese onions flour')
(3, 'pumpkin pie', 'pumpkin sugar flour butter')

.. method:: load_extension(path, /, *, entrypoint=None)

Load an SQLite extension from a shared library.
Expand Down

Back | FazBrowse Home | New Git URL