[libvirt] [PATCH] apibuild.py: fix TypeError raised in except clause

When an exception happened inside the try clause in serialize_function, a new exception was raised in the except clause subsequently: Traceback (most recent call last): File "./apibuild.py", line 2529, in <module> rebuild("libvirt") File "./apibuild.py", line 2513, in rebuild builder.serialize() File "./apibuild.py", line 2467, in serialize self.serialize_function(output, function) File "./apibuild.py", line 2208, in serialize_function self.warning("Failed to save function %s info: " % name, `id.info`) TypeError: warning() takes exactly 2 arguments (3 given) Use the correct number of arguments for self.warning and print the original exception to stderr. Signed-off-by: Claudio Bley <cbley@av-test.de> --- docs/apibuild.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 91dabf8..2d72936 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -2198,7 +2198,8 @@ class docBuilder: output.write(" <arg name='%s' type='%s' info='%s'/>\n" % (param[1], param[0], escape(param[2]))) self.indexString(name, param[2]) except: - self.warning("Failed to save function %s info: " % name, `id.info`) + print >>sys.stderr, "Exception:", sys.exc_info()[1] + self.warning("Failed to save function %s info: %s" % (name, `id.info`)) output.write(" </%s>\n" % (id.type)) def serialize_exports(self, output, file): -- 1.7.9.5

On 01/30/2013 03:40 AM, Claudio Bley wrote:
When an exception happened inside the try clause in serialize_function, a new exception was raised in the except clause subsequently:
Traceback (most recent call last): File "./apibuild.py", line 2529, in <module> rebuild("libvirt") File "./apibuild.py", line 2513, in rebuild builder.serialize() File "./apibuild.py", line 2467, in serialize self.serialize_function(output, function) File "./apibuild.py", line 2208, in serialize_function self.warning("Failed to save function %s info: " % name, `id.info`) TypeError: warning() takes exactly 2 arguments (3 given)
Use the correct number of arguments for self.warning and print the original exception to stderr.
Signed-off-by: Claudio Bley <cbley@av-test.de> --- docs/apibuild.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ACK. My python is not strong, but as this only touches an error path during documentation building, it can't hurt. Besides, I'm pretty sure that you must have actually triggered this error in your quest to improve documentation, and that the improved output was useful to you :) -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

At Wed, 30 Jan 2013 11:55:17 -0700, Eric Blake wrote:
On 01/30/2013 03:40 AM, Claudio Bley wrote:
When an exception happened inside the try clause in serialize_function, a new exception was raised in the except clause subsequently:
Traceback (most recent call last): File "./apibuild.py", line 2529, in <module> rebuild("libvirt") File "./apibuild.py", line 2513, in rebuild builder.serialize() File "./apibuild.py", line 2467, in serialize self.serialize_function(output, function) File "./apibuild.py", line 2208, in serialize_function self.warning("Failed to save function %s info: " % name, `id.info`) TypeError: warning() takes exactly 2 arguments (3 given)
Use the correct number of arguments for self.warning and print the original exception to stderr.
Signed-off-by: Claudio Bley <cbley@av-test.de> --- docs/apibuild.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ACK. My python is not strong, but as this only touches an error path during documentation building, it can't hurt. Besides, I'm pretty sure that you must have actually triggered this error in your quest to improve documentation, and that the improved output was useful to you :)
It was indeed. :) Thanks, pushed now. Claudio -- AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany Phone: +49 341 265 310 19 Web:<http://www.av-test.org> Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076) Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern
participants (2)
-
Claudio Bley
-
Eric Blake