[issue2887] bsddb 4.6.4 needs to be ported to Python 3.0

Alexandre Vassalotti report at bugs.python.org
Fri May 16 07:27:43 CEST 2008


New submission from Alexandre Vassalotti <alexandre at peadrop.com>:

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)`` to ``key in dict``.

  - Change str literals to bytes literals where appropriate.

  - Optional: change code like ``type([])`` or ``type(())`` to 
    respectively ``list`` and ``tuple``.

  - Change print statements into print() calls.

  - Change ``x != None`` to ``x 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.

----------
components: Extension Modules, Library (Lib), Tests
messages: 66918
nosy: alexandre.vassalotti, gregory.p.smith, jcea
priority: normal
severity: normal
status: open
title: bsddb 4.6.4 needs to be ported to Python 3.0
type: feature request
versions: Python 3.0

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2887>
__________________________________


More information about the Python-bugs-list mailing list