[BRLTTY] [PATCH] [Python] returnerror cdef to def ?

Mario Lang mlang at delysid.org
Fri May 25 18:49:30 EDT 2007


Hi.

Currently, GCC emits a warning regarding a statment without effect
in the python bindings that comes from the definition of returnerror.

returnerror is currently defined as a cdef.  cdef does not really support
docstrings in pyrex (why should it).  On second glance however, returnerror is
only called in python context.  I propose to change the definition
to a normal def, and make it simpler.  The warning is gone afterwards,
only one remining from the __init__ docstring in the cdef class Connection
(why would a cdef have a python docstring?).

Can the API maintainers review please?

Index: Bindings/Python/brlapi.pyx
===================================================================
--- Bindings/Python/brlapi.pyx	(revision 3058)
+++ Bindings/Python/brlapi.pyx	(working copy)
@@ -52,11 +52,9 @@
 cimport c_brlapi
 include "constants.auto.pyx"
 
-cdef returnerrno():
+def returnerrno():
 	"""This function returns str message error from errno"""
-	cdef c_brlapi.brlapi_error_t *error
-	error = c_brlapi.brlapi_error_location()
-	return c_brlapi.brlapi_strerror(error)
+	return c_brlapi.brlapi_strerror(c_brlapi.brlapi_error_location())
 
 class ConnectionError:
 	"""Error while connecting to BrlTTY"""

-- 
CYa,
  Mario | Debian Developer <URL:http://debian.org/>
  .''`. | Get my public key via finger mlang at db.debian.org
 : :' : | 1024D/7FC1A0854909BCCDBE6C102DDFFC022A6B113E44
 `. `'
   `-      <URL:http://delysid.org/>  <URL:http://www.staff.tugraz.at/mlang/>


More information about the BRLTTY mailing list