|
Overriding PyArg_ParseTuple arguments: msg#00151programming.swig
I'm SWIGging a C library into Python that does a lot of string handling. One of the functions takes a char * argument, which can be NULL (to get the default behavior). If I don't do anything special in my SWIG wrapper, when I try to call this function with a None argument, I get a TypeError saying the argument must be a string, not None. I know that Python's PyArg_ParseTuple function supports the "z" format character, which converts a Python string into a char *, and converts Python None into NULL. This functionality has been part of Python since 1.5.2. Yet I don't see any way to achieve this behavior in SWIG except by using a typemap to explicitly check for PyNone. Is there any way to override the automatically generated PyArg_ParseTuple arguments in order to get this behavior? Thanks, --Tessa _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | SWIG-1.3.20 - Report Bugs: 00151, David Beazley |
|---|---|
| Next by Date: | Re: Overriding PyArg_ParseTuple arguments: 00151, David Beazley |
| Previous by Thread: | SWIG-1.3.20 - Report Bugsi: 00151, David Beazley |
| Next by Thread: | Re: Overriding PyArg_ParseTuple arguments: 00151, David Beazley |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |