[issue7033] C/API - Document exceptions
Georg Brandl ge...@python.org added the comment: lekma, this patch is now listed in the 2.7 what's new document as contributed by the lekma user, please tell us if you want your name there. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
lekma lekma...@gmail.com added the comment: lekma, this patch is now listed in the 2.7 what's new document as contributed by the lekma user, please tell us if you want your name there. Nope, that's ok (it's perfect). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
Georg Brandl ge...@python.org added the comment: Thanks for the patch! I rewrote the C function a bit to also take a dict argument, and added a test for that. Committed in r77088. Will merge to py3k. -- resolution: - accepted status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
lekma lekma...@gmail.com added the comment: Thanks for the patch! I rewrote the C function a bit to also take a dict argument, and added a test for that. Committed in r77088. Will merge to py3k. Great! Thanks to all for the help! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
lekma lekma...@gmail.com added the comment: patch against trunk: - fix tabs issue (I hope) - add test -- Added file: http://bugs.python.org/file15645/issue7033_trunk_3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
lekma lekma...@gmail.com added the comment: The same with a simpler test. I leave it up to you guys to choose which one is the best. -- Added file: http://bugs.python.org/file15646/issue7033_trunk_3_alt_test.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
lekma lekma...@gmail.com added the comment: Is there any chance that this will make it in? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
R. David Murray rdmur...@bitdance.com added the comment: Since it's a new CAPI I think it should probably be discussed briefly on python-dev. -- nosy: +r.david.murray priority: - normal stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
Antoine Pitrou pit...@free.fr added the comment: Since it's a new CAPI I think it should probably be discussed briefly on python-dev. So do I. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
R. David Murray rdmur...@bitdance.com added the comment: Also, what about tests? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
Georg Brandl ge...@python.org added the comment: Funnily, I already did ask on python-dev, and only got one (+1) answer from Brett. I was going to add it some time when I have more cycles for Python. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
R. David Murray rdmur...@bitdance.com added the comment: Yes, I'd say that counts as a brief discussion :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
Antoine Pitrou pit...@free.fr added the comment: One nitpick: Python/errors.c uses tabs for indentation, your patch should as well. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
lekma lekma...@gmail.com added the comment: Even though I don't fully agree with your comments here is a second attempt addressing them, against trunk. For the record, I think that the signature difference is enough to warrant a name that is a clear cut from PyErr_NewException. And in the spirit of the Py_InitModule and PyModule_Create families of function I thought the most common/simple form should stand out from the more complete one. But, hey, I'm happy if this gets in (in any form :). -- Added file: http://bugs.python.org/file15035/issue7033_trunk_2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
lekma lekma...@gmail.com added the comment: Same as previous against py3k -- Added file: http://bugs.python.org/file15036/issue7033_py3k_2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
Georg Brandl ge...@python.org added the comment: Sounds like a useful new API. Two comments: * The version without *base* is not needed. Passing an explicit NULL for *base* is easy enough. * The name PyErr_Create is needlessly different from PyErr_NewException. Something like PyErr_NewExceptionWithDoc is better. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
New submission from lekma lekma...@gmail.com: It would be nice to have an obvious/simple way to document C exceptions (especially when using the autoexception feature from Sphinx). Something along: PyObject *PyErr_Create(char *name, const char *doc) Creates and returns a new exception object. This behaves like PyErr_Create2() with base set to NULL. PyObject *PyErr_Create2(char *name, const char *doc, PyObject *base) Creates and returns a new exception object. The name argument must be the name of the new exception, a C string of the form module.class. If doc is non-NULL, it will be used to define the docstring for the exception. if base is NULL, it creates a class object derived from Exception (accessible in C as PyExc_Exception). for py3k the signatures would be: PyObject *PyErr_Create(const char *name, const char *doc) PyObject *PyErr_Create2(const char *name, const char *doc, PyObject *base) Internally, these functions would pass a dict to PyErr_NewException with the key '__doc__' set to doc. If there is support for this, I can provide patches for trunk and py3k. -- components: Interpreter Core messages: 93439 nosy: lekma severity: normal status: open title: C/API - Document exceptions type: feature request versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
lekma lekma...@gmail.com added the comment: First attempt at implementing this. Diff is against trunk. -- keywords: +patch Added file: http://bugs.python.org/file15021/issue7033_trunk.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7033] C/API - Document exceptions
lekma lekma...@gmail.com added the comment: The same against py3k -- Added file: http://bugs.python.org/file15022/issue7033_py3k.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7033 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com