File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change 4
4
"""Contains classes and functions that a SAML2.0 Identity provider (IdP)
5
5
or attribute authority (AA) may use to conclude its tasks.
6
6
"""
7
+ import sys
7
8
import dbm
8
9
import importlib
9
10
import logging
55
56
}
56
57
57
58
58
- def _avoid_dbm_sqlite ():
59
- """
60
- Force dbm.gnu to be used instead of dbm.sqlite because of threading issues when
61
- running idp_server.py. The dbm.sqlite is the default dbm module used by Python >= 3.13
62
- """
63
- import dbm .gnu
64
- import dbm
65
- dbm ._defaultmod = dbm .gnu
66
-
67
-
68
59
def _shelve_compat (name , * args , ** kwargs ):
69
- _avoid_dbm_sqlite ()
70
60
try :
71
- return shelve .open (name , * args , ** kwargs )
61
+ if sys .version_info < (3 , 13 ):
62
+ return shelve .open (name , * args , ** kwargs )
63
+ else :
64
+ # Python 3.13 and later uses dbm.sqlite3 as default which is not compatible
65
+ # with cheroot using threading. So, we need to use dbm.dumb instead.
66
+ return shelve .Shelf (dbm .dumb .open (name ), * args , ** kwargs )
72
67
except dbm .error [0 ]:
73
68
# Python 3 whichdb needs to try .db to determine type
74
69
if name .endswith (".db" ):
You can’t perform that action at this time.
0 commit comments