projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e559ff1
)
[py] only set RuntimeError string when needed in gen_code.py (closes gh-303)
fix/pyexceptions
master
author
Paul Brossier
<piem@piem.org>
Fri, 10 Apr 2026 15:11:58 +0000
(12:11 -0300)
committer
Paul Brossier
<piem@piem.org>
Fri, 10 Apr 2026 15:11:58 +0000
(12:11 -0300)
python/lib/gen_code.py
patch
|
blob
|
history
diff --git
a/python/lib/gen_code.py
b/python/lib/gen_code.py
index
95b9fa5
..
fbb06a0
100644
(file)
--- a/
python/lib/gen_code.py
+++ b/
python/lib/gen_code.py
@@
-345,7
+345,8
@@
Py_{shortname}_init (Py_{shortname} * self, PyObject * args, PyObject * kwds)
out += """
// return -1 and set error string on failure
if (self->o == NULL) {{
- PyErr_Format (PyExc_RuntimeError, "failed creating {shortname}");
+ if (PyErr_Occurred() == NULL)
+ PyErr_Format (PyExc_RuntimeError, "failed creating {shortname}");
return -1;
}}
""".format(paramchars = paramchars, paramvals = paramvals, **self.__dict__)