Jesús Cea Avión <j...@jcea.es> added the comment:

Better bsddb error control. Please, review.

"""
[j...@babylon5 release27-maint]$ ./python
Python 2.7.0+ (release27-maint:86176:86178M, Nov  5 2010, 00:30:) 
[GCC 4.5.1] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import bsddb
>>> exit()
"""

"""
[j...@babylon5 release27-maint]$ ./python -3
Python 2.7.0+ (release27-maint:86176:86178M, Nov  5 2010, 00:30:) 
[GCC 4.5.1] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import bsddb
__main__:1: DeprecationWarning: in 3.x, the bsddb module has been removed; 
please use the pybsddb project instead
/home/python/svn-hg/release27-maint/Lib/bsddb/__init__.py:67: 
DeprecationWarning: CObject type is not supported in 3.x. Please use capsule 
objects instead.
  import _bsddb
"""

"""
[j...@babylon5 release27-maint]$ ./python -3 -Werror
Python 2.7.0+ (release27-maint:86176:86178M, Nov  5 2010, 00:30:)
[GCC 4.5.1] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> warnings.filterwarnings('ignore',
... "in 3.x, the bsddb module has been removed; please use the pybsddb project 
instead",
... category=DeprecationWarning)
>>> import bsddb
Exception DeprecationWarning: DeprecationWarning('CObject type is not supported 
in 3.x. Please use capsule objects instead.',) in <module '_bsddb' (built-in)> 
ignored
>>> exit()
"""

Why is my "PyErr_Warn()" not being printed?

The code: (py_api is the CObject, will be NULL if an exception happened)

"""
    if (py_api) {
        PyDict_SetItemString(d, "api", py_api);
        Py_DECREF(py_api);
    } else { /* Something bad happened */
        PyErr_WriteUnraisable(m);
        PyErr_Warn(PyExc_RuntimeWarning,
                "_bsddb/_pybsddb C API will be not available");
        PyErr_Clear();
    }
"""

Commit r86180.

Now I have to up-port this patch to the upcoming pybssddb 5.1.1.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9675>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to