You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This produces warnings only for the templated class:
$ swig -c++ -python foo.i
foo.i:22: Warning 314: 'lambda' is a python keyword, renaming to '_lambda'
foo.i:20: Warning 314: 'def' is a python keyword, renaming to '_def'
foo.i:21: Warning 314: 'print' is a python keyword, renaming to '_print'
and even weirder, it ignores the %rename directive only for the templated class with the non-instantiated %rename, producing the following wrapper code:
This is related to a fix I happen to put in a recently, see 7268f58. Now FooDouble does have a correctly renamed printme method. The only remaining warning is:
example.i:22: Warning 314: 'lambda' is a python keyword, renaming to '_lambda'
The fix was for %ignore, but does not seem to cover the %namewarn case. If you run with swig -E you can see the macros in pythonkw.swg boil down to using %namewarn:
%namewarn("314"":""'" "lambda" "' is a python keyword, renaming to '_" "lambda" "'",rename="_%s") "lambda";
and in parser.y, Swig_name_namewarn_add is called instead of Swig_name_rename_add, so there is a bit more to do in naming.c.
[This example uses Python but applies to other languages with built-in keywords.]
There are a couple (probably related) issues here.
%ignore
directive%rename
directive%rename
is ignored unless it's applied to a specific template-instantiated class.Consider the following example with a templated and non-templated class, both with the same keywordy function names:
This produces warnings only for the templated class:
and even weirder, it ignores the
%rename
directive only for the templated class with the non-instantiated%rename
, producing the following wrapper code:Expected behavior is to have no warnings, and to have the
_print
inFooDouble
actually renamed toprintme
.The text was updated successfully, but these errors were encountered: