(Mostly for Roy): I saw this on the SWIG list, and wonder if it might be related to the problems we have been seeing where multi-arg typemaps end up invoking the wrong wrapper methods. (Not the newly-discovered directorout stuff). Perhaps if we switched to "compactdefaultargs" things would start to work more sanely. Looking at this section of the SWIG docs, it looks like it should be safe, and might at least make it easier to diagnose any problems, if it doesn''t fix them outright: http://www.swig.org/Doc1.3/SWIGPlus.html#SWIGPlus_default_args Just a thought. Kevin -------- Original Message -------- Subject: Re: [Swig] typemap + default argument bug? Date: Tue, 27 Sep 2005 15:57:52 -0400 (EDT) From: Josh Cherry <jcherry@ncbi.nlm.nih.gov> To: Charles@Schwieters.org CC: swig@cs.uchicago.edu On Tue, 27 Sep 2005 Charles@Schwieters.org wrote:> _wrap_new_ClassB calls SWIG_ConvertPtr to convert the instanceName > argument to a p_String, thereby ignoring the typemap. > > Previous versions of swig do not seem to exhibit this behavior (I > checked 1.3.22 and 1.3.24). They seem to treat the instanceName > argument as a PyObject* before calling stringTypemap. > > Do I misunderstand something, or is this a bug in 1.3.25? Is there a > workaround?Here''s my guess. What you are seeing results from the fact that the handling of default arguments changed to be like the handling of overloaded functions. For overloaded functions to work right you need to do the %typecheck thing, which you haven''t done for String. Doing that should fix this. Putting %feature("compactdefaultargs"); in your interface file should also fix it by restoring the old handling of default arguments. Note that the SWIG_ConvertPtr you see in _wrap_new_ClassB is just for checking the type; you should see your "in" typemap used in _wrap_new_ClassB_1 (or something like that). Josh -- Joshua L. Cherry, Ph.D. NCBI/NLM/NIH (Contractor) jcherry@ncbi.nlm.nih.gov _______________________________________________ Swig maillist - Swig@cs.uchicago.edu http://mailman.cs.uchicago.edu/mailman/listinfo/swig
Roy Sutton
2005-Oct-09 23:45 UTC
[Wxruby-users] [Fwd: Re: [Swig] typemap + default argument bug?]
Great work, Kevin. I''ll try making a few of the suggested changes and see how things work out. I''ve been really overloaded lately and haven''t had much time for this. Hopefully I can make some time this week. Roy Kevin Smith wrote:> (Mostly for Roy): > > I saw this on the SWIG list, and wonder if it might be related to the > problems we have been seeing where multi-arg typemaps end up invoking > the wrong wrapper methods. (Not the newly-discovered directorout stuff). > > Perhaps if we switched to "compactdefaultargs" things would start to > work more sanely. Looking at this section of the SWIG docs, it looks > like it should be safe, and might at least make it easier to diagnose > any problems, if it doesn''t fix them outright: > http://www.swig.org/Doc1.3/SWIGPlus.html#SWIGPlus_default_args > > Just a thought. > > Kevin > > > -------- Original Message -------- > Subject: Re: [Swig] typemap + default argument bug? > Date: Tue, 27 Sep 2005 15:57:52 -0400 (EDT) > From: Josh Cherry <jcherry at ncbi.nlm.nih.gov> > To: Charles at Schwieters.org > CC: swig at cs.uchicago.edu > > > On Tue, 27 Sep 2005 Charles at Schwieters.org wrote: > > >> _wrap_new_ClassB calls SWIG_ConvertPtr to convert the instanceName >> argument to a p_String, thereby ignoring the typemap. >> >> Previous versions of swig do not seem to exhibit this behavior (I >> checked 1.3.22 and 1.3.24). They seem to treat the instanceName >> argument as a PyObject* before calling stringTypemap. >> >> Do I misunderstand something, or is this a bug in 1.3.25? Is there a >> workaround? >> > > Here''s my guess. What you are seeing results from the fact that the > handling of default arguments changed to be like the handling of > overloaded functions. For overloaded functions to work right you need to > do the %typecheck thing, which you haven''t done for String. Doing that > should fix this. Putting > > %feature("compactdefaultargs"); > > in your interface file should also fix it by restoring the old handling of > default arguments. Note that the SWIG_ConvertPtr you see in > _wrap_new_ClassB is just for checking the type; you should see your "in" > typemap used in _wrap_new_ClassB_1 (or something like that). > > Josh > > -- > Joshua L. Cherry, Ph.D. > NCBI/NLM/NIH (Contractor) > jcherry at ncbi.nlm.nih.gov > > > > > _______________________________________________ > Swig maillist - Swig at cs.uchicago.edu > http://mailman.cs.uchicago.edu/mailman/listinfo/swig > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > > >