stringtype typehandlers are not automatically registered

Bug #238455 reported by John Stowers on 2008-06-09
Affects Status Importance Assigned to Milestone

Bug Description

CStringParam, and friends from pybindgen.typehandlers.stringtype do not call super() and therefor do not seem to be automatically registered as parameter and return type handlers (via metaclass). This means I have to write

param_type_matcher.register("char *", CStringParam)
return_type_matcher.register("char *", CStringReturn)

AFAICT all other type handers register themselves

John Stowers (nzjrs) wrote :

Actually looking over the code again, I am not sure why some typehandlers are automatically registered, while others are not.

Gustavo Carneiro (gjc) wrote :

Type handlers are registered by a metaclass, which looks at a CTYPES class variable.

Gustavo Carneiro (gjc) wrote :

I committed unit tests to check that char* type handlers are being registered. So I really do not understand what is wrong. Need more information on how to reproduce the problem.

Changed in pybindgen:
importance: Undecided → Medium
status: New → Incomplete
Gustavo Carneiro (gjc) wrote :

  param_type_matcher.register("char *", CStringParam)
  return_type_matcher.register("char *", CStringReturn)

The problem is the extra space between char and *. The types are currently being registered without the space. Is the gccxml scanner reporting types with the space?

John Stowers (nzjrs) wrote :

Yes it does. Gccxml reports

/opt/cvs/include/libsyncml-1.0/libsyncml/sml_devinf.h:177: WrapperWarning: Return value 'char *' error (used in extern char * smlDevInfContentTypeGetCTType(SmlDevInfContentType const * ct) [free function]): TypeLookupError('char *',)
  char *smlDevInfContentTypeGetCTType(const SmlDevInfContentType *ct);

The pybindgen error handler reports

/home/john/SOC/wrap-syncml/pysyncml-0.1/ UserWarning: exception TypeLookupError('char *',) in wrapper <pybindgen.function.Function object at 0x826496c>

Both seem to have spaces.

If I try it with
param_type_matcher.register("char*", CStringParam)
return_type_matcher.register("char*", CStringReturn)

Then I get ValueError: return type char* already registered

So it must be something to do with spaces

Gustavo Carneiro (gjc) wrote :

Should be fixed by revision 444, which filters all type strings through a "type normalization function".

Changed in pybindgen:
status: Incomplete → Fix Committed
Gustavo Carneiro (gjc) on 2008-07-27
Changed in pybindgen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers