-
Notifications
You must be signed in to change notification settings - Fork 443
Python 3.13 Compatibility (cgi, dbm.sqlite) #978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,18 @@ | |
} | ||
|
||
|
||
def _avoid_dbm_sqlite(): | ||
""" | ||
Force dbm.gnu to be used instead of dbm.sqlite because of threading issues when | ||
running idp_server.py. The dbm.sqlite is the default dbm module used by Python >= 3.13 | ||
""" | ||
import dbm.gnu | ||
import dbm | ||
dbm._defaultmod = dbm.gnu | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This should be removed. Other we get errors like following:
If we remove that, I can use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you all think about these approaches?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I've updated the PR to use
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should push everyone to use the new format. We have two cases
If the file is not available, then we are on case (2) and we can just use Shelf with the new backend. If the file is there, we should try to open it with Shelf assuming it is an sqlite3 db. If that fails, we emit a warning and then convert it to be an sqlite3 db. Doing the conversion at runtime could be expensive, but it will only be done once. To avoid paying this at runtime, we can provide update instructions with a script that will read the configuration, locate the database and convert it. At a later update we can remove the conversion code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new format would be And the goal of having a conversion script would be that you could re-use your existing db when upgrading lets say from Python 3.12 to 3.13? I don't know if that's possible. It seems that it's not possible to read the Berkeley DB 1.85 files that are written by 3.12 and below by default when calling |
||
|
||
|
||
def _shelve_compat(name, *args, **kwargs): | ||
_avoid_dbm_sqlite() | ||
try: | ||
return shelve.open(name, *args, **kwargs) | ||
except dbm.error[0]: | ||
|
Uh oh!
There was an error while loading. Please reload this page.