Re: [pygccxml-development] mdecl and methods that return values
Brought to you by:
mbaas,
roman_yakovenko
From: Allen B. <al...@vr...> - 2006-05-30 18:58:34
|
Roman Yakovenko wrote: >> On 5/30/06, Allen Bierbaum <al...@vr...> wrote: >> > Roman Yakovenko wrote: >> > >> my_class = my_namespace["MyClass"] >> > >> my_class["mymethod"].exclude() >> > > >> > > >> > > exclude does not have return value >> > >> > The part that causes the problem is the return from ["mymethod"]. It >> > doesn't return anything, so the code above ends up calling >> exclude() on >> > NoneType. >> >> I will check this and will try to fix. > > > Allan, I am sure I am doing something wrong. > I created new test case to check the code: http://tinyurl.com/nlama . > ( Please take a look on test__getitem__ method. ) > I can not reproduce the bug you are talking about :-) > > May be you have scopedef_t.ALLOW_EMPTY_MDECL_WRAPPER set to True? > In this case, if query returns empty exception is not raised. > > Can you try and reproduce the bug, thanks ? > I think you are talking about this part of the test: mb.global_ns[ *'public_base_t'* ].exclude() Change it to something like this: mb.global_ns[ *'public_base_t'* ]['myFunction'].exclude() OR mb.global_ns[ *'public_base_t'* ].member_functions('myFunction').exclude() There should be a failure when calling exclude on the value returned from the member function lookup because there is nothing returned. When a mdecl_wrapper has a method called upon it, it never returns a value. Your test works because the only place a mdecl_wrapper comes in is the value returned from the ['public_base_t'] call. This will function fine with something like exclude that doesn't return values. But it will not work when you need values returned. -Allen |