Issue 2887: bsddb3 needs to be ported to Python 3.0 (original) (raw)
Created on 2008-05-16 05:27 by alexandre.vassalotti, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (5)
Author: Alexandre Vassalotti (alexandre.vassalotti) *
Date: 2008-05-16 05:27
The recent updates to bsddb (r63207, r63210 and r63218) needs to forward-ported to the py3k branch.
At first glance, here is the things that needs to be done in the test suite:
Change the import:
from test_all import ...
into a relative import:
from .test_all import ...
Replace code incompatible with 3.0, such as changing
dict.has_key(key)
tokey in dict
.Change str literals to bytes literals where appropriate.
Optional: change code like
type([])
ortype(())
to respectivelylist
andtuple
.Change print statements into print() calls.
Change
x != None
tox is not None
.
In the modules:
Change PyInt__* to PyLong_*.
Update the PyTypeObject declaration:
statichere PyTypeObject DB_Type = { PyObject_HEAD_INIT(NULL) 0, /ob_size/ "DB", /tp_name/ sizeof(DBObject), /tp_basicsize/ ... to:
static PyTypeObject DB_Type = { PyVarObject_HEAD_INIT(NULL, 0) "DB", /tp_name/ sizeof(DBObject), /tp_basicsize/ ...
Update module init declaration:
DL_EXPORT(void) init_bsddb(void) { ... to:
PyMODINIT_FUNC init_bsddb(void) { ...
Remove Py_TPFLAGS_HAVE_WEAKREFS.
Change PyString_* calls to PyUnicode_* where appropriate.
There probably other things that I missed, but that should give you a good start.
Author: Gregory P. Smith (gregory.p.smith) *
Date: 2008-05-25 06:11
I believe Jesus wants to do this is such a way that bsddb.h and _bsddb.c are a single code base with #ifdef's that compiles on 2.x and 3.x at once.
Author: Jesús Cea Avión (jcea) *
Date: 2008-05-29 11:47
Yes. My idea is to port the python code as-is, using "2to3", and update the C code with conditional compilation, to keep a single codebase.
I'm having issues with the compatibility. In particular, my code has the following line:
""" staticforward PyTypeObject DB_Type, DBCursor_Type, DBEnv_Type, DBTxn_Type, DBLock_Type; """
Compiling this code fails with the following error (when compiling against Python 3.0):
""" Modules/_bsddb.c:241: error: expected '=', ',', ';', 'asm' or 'attribute' before 'PyTypeObject' """
Compiling the same code against Python 2.x, works.
Ideas welcomed :).
Author: Trent Nelson (trent) *
Date: 2008-07-09 01:47
FWIW, I bumped the version of Berkeley DB being used on Windows from 4.4.20 to 4.7.25 in r64555 (trunk). I blocked this from being merged to py3k. This block should be removed once bsddb has been updated.
Author: Jesús Cea Avión (jcea) *
Date: 2008-09-16 18:19
bsddb is officially dropped in Python 3.0. Too bad :(. I close this issue.
bsddb supports Python 3.0 via a separate project, downloadable from PYPI.
History
Date
User
Action
Args
2022-04-11 14:56:34
admin
set
github: 47136
2008-09-16 18:19:57
jcea
set
status: open -> closed
resolution: rejected
messages: +
2008-07-09 01:47:38
trent
set
nosy: + trent
messages: +
2008-05-29 11:47:32
jcea
set
messages: +
title: bsddb 4.6.4 needs to be ported to Python 3.0 -> bsddb3 needs to be ported to Python 3.0
2008-05-25 06:11:12
gregory.p.smith
set
assignee: jcea
messages: +
2008-05-16 05:27:41
alexandre.vassalotti
create