stringtype typehandlers are not automatically registered

Bug #238455 reported by John Stowers
2
Affects Status Importance Assigned to Milestone
PyBindGen
Fix Released
Medium
Unassigned

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

Revision history for this message
John Stowers (nzjrs) wrote :

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

Revision history for this message
Gustavo Carneiro (gjc) wrote :

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

Revision history for this message
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
Revision history for this message
Gustavo Carneiro (gjc) wrote :

Ah!
  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?

Revision history for this message
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/modulegen.py:9: 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

Revision history for this message
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)
Changed in pybindgen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.