@@ -394,29 +394,11 @@ Module functions
394394 will get tracebacks from callbacks on :data: `sys.stderr `. Use ``False ``
395395 to disable the feature again.
396396
397- Register an :func: `unraisable hook handler <sys.unraisablehook> ` for an
398- improved debug experience:
399-
400- .. testsetup :: sqlite3.trace
401-
402- import sqlite3
397+ .. note ::
403398
404- .. doctest :: sqlite3.trace
405-
406- >>> sqlite3.enable_callback_tracebacks(True )
407- >>> con = sqlite3.connect(" :memory:" )
408- >>> def evil_trace (stmt ):
409- ... 5 / 0
410- ...
411- >>> con.set_trace_callback(evil_trace)
412- >>> def debug (unraisable ):
413- ... print (f " { unraisable.exc_value!r } in callback { unraisable.object.__name__ } " )
414- ... print (f " Error message: { unraisable.err_msg} " )
415- >>> import sys
416- >>> sys.unraisablehook = debug
417- >>> cur = con.execute(" SELECT 1" )
418- ZeroDivisionError('division by zero') in callback evil_trace
419- Error message: None
399+ Errors in user-defined function callbacks are logged as unraisable exceptions.
400+ Use an :func: `unraisable hook handler <sys.unraisablehook> ` for
401+ introspection of the failed callback.
420402
421403.. function :: register_adapter(type, adapter, /)
422404
@@ -1068,13 +1050,10 @@ Connection objects
10681050 .. versionchanged :: 3.10
10691051 Added the ``sqlite3.enable_load_extension `` auditing event.
10701052
1071- .. testsetup :: sqlite3.loadext
1072-
1073- import sqlite3
1074- con = sqlite3.connect(":memory: ")
1053+ .. We cannot doctest the load extension API, since there is no convenient
1054+ way to skip it.
10751055
1076- .. testcode :: sqlite3.loadext
1077- :skipif: True # not testable at the moment
1056+ .. code-block ::
10781057
10791058 con.enable_load_extension(True)
10801059
@@ -1098,14 +1077,6 @@ Connection objects
10981077 for row in con.execute("SELECT rowid, name, ingredients FROM recipe WHERE name MATCH 'pie'"):
10991078 print(row)
11001079
1101- con.close()
1102-
1103- .. testoutput :: sqlite3.loadext
1104- :hide:
1105-
1106- (2, 'broccoli pie', 'broccoli cheese onions flour')
1107- (3, 'pumpkin pie', 'pumpkin sugar flour butter')
1108-
11091080 .. method :: load_extension(path, /, *, entrypoint=None)
11101081
11111082 Load an SQLite extension from a shared library.
0 commit comments