@@ -394,29 +394,11 @@ Module functions
394
394
will get tracebacks from callbacks on :data: `sys.stderr `. Use ``False ``
395
395
to disable the feature again.
396
396
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 ::
403
398
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.
420
402
421
403
.. function :: register_adapter(type, adapter, /)
422
404
@@ -1068,13 +1050,10 @@ Connection objects
1068
1050
.. versionchanged :: 3.10
1069
1051
Added the ``sqlite3.enable_load_extension `` auditing event.
1070
1052
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.
1075
1055
1076
- .. testcode :: sqlite3.loadext
1077
- :skipif: True # not testable at the moment
1056
+ .. code-block ::
1078
1057
1079
1058
con.enable_load_extension(True)
1080
1059
@@ -1098,14 +1077,6 @@ Connection objects
1098
1077
for row in con.execute("SELECT rowid, name, ingredients FROM recipe WHERE name MATCH 'pie'"):
1099
1078
print(row)
1100
1079
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
-
1109
1080
.. method :: load_extension(path, /, *, entrypoint=None)
1110
1081
1111
1082
Load an SQLite extension from a shared library.
0 commit comments