Re: wxPython 4/wx.Yield: C++ assert failure

Robin Dunn <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
Joseph Lee wrote:
>
> Hi Robin and others,
>
>  
>
> In one of the projects I’m involved in (NonVisual Desktop Access),
> numerous calls to wx.Yield function are made from various modules.
> After porting NVDA to wxPython 4 alpha, when wx.Yield is called from
> some modules, I get a traceback that ends with the following:
>
> wxAssertionError: C++ assertion "Assert failure" failed at
> ..\..\src\common\evtloopcmn.cpp(110) in wxEventLoopBase::Yield():
> wxYield called recursively
>
>  
>
> Relevant GitHub issue for NVDA can be found at:
>
> https://github.com/nvaccess/nvda/issues/7077
>
>  
>
> The source code for a version of NVDA that uses wxPython 4 can be
> found at:
>
> https://github.com/josephsl/nvda
>
>  
>
> Branch is “wxPy4”. I and other NVDA developers involved in porting
> NVDA to wxPython 4 consider this a showstopper, with a lead developer
> commenting that this might be due to reentrancy issue.
>

Yes. Basically some event(s) happens while within a wx.Yield call which
then results in some other code being called that uses wx.Yield.

The best fix would be to find ways to avoid needing to use yield.
Otherwise you could switch to wx.YieldIfNeeded() (which is just a
convenience wrapper for wx.GetApp().Yield(True)...) That will just
return when the recursion is detected instead of asserting about it. 
The wx.EventLoopBase.Yield documentation is applicable to this as all
the incarnations of Yield eventually get to that method.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.