[Python-Dev] Catching exceptions and convert them to warnings in C level code (was: Re: Pronouncement needed in issue9675) (original) (raw)
Jesus Cea jcea at jcea.es
Sat Oct 2 22:14:28 CEST 2010
- Previous message: [Python-Dev] Rietveld integration into Roundup
- Next message: [Python-Dev] Catching exceptions and convert them to warnings in C level code (was: Re: Pronouncement needed in issue9675)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 28/09/10 18:00, Antoine Pitrou wrote:
By "fails" you mean "crashes the interpreter". While the deprecation warning can be discussed, bsddb shouldn't crash when PyCObjectFromVoidPtr() returns NULL, but instead bail out cleanly (or perhaps even ignore the error and simply display a warning that the C API won't be available).
I plan to deploy two patches for this issue. One, bsddb surviving the warning->error flag. The other, changing the deprecation warning in "CObject" to a py3k warning.
While doing this, I think would be useful if bsddb could intercept the exception and provide sensible feedback without raising an exception at import time. I have checked <http://docs.python.org/c-api/exceptions.html>. "PyErr_Fetch" is a bit overkill, it seems.
My idea is to convert the CObject exception in bsddb to print a warning like "CObject creation failed. The bsddb.cAPI will be not available. Reason is: XXXX".
Is there a "canonical way" of doing this?. Sorry if the answer is trivial...
Jesus Cea Avion // /// /// jcea at jcea.es - http://www.jcea.es/ // // // // // jabber / xmpp:jcea at jabber.org // // ///// . // // // // // "Things are not so easy" // // // // // // "My name is Dump, Core Dump" /// //_/ // // "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQCVAwUBTKeSpJlgi5GaxT1NAQIMkgP9FCFewuhLHzExwi+aMSuevb56aoFOrBSE q/XKN+9JxE59n2BwxgaJtUBrBdUraLe17SswgVgjxzReHKI+eNgC1fTwvDV+KqGa 9AMvlNGBfNCLP/TcSRzIGc9w0MsZaS8MvBKJWw+4hINclcp4a/AgxkCxc9sbm/dM ATijPsG0RPY= =qAIG -----END PGP SIGNATURE-----
- Previous message: [Python-Dev] Rietveld integration into Roundup
- Next message: [Python-Dev] Catching exceptions and convert them to warnings in C level code (was: Re: Pronouncement needed in issue9675)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]