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

Kevin Ollivier <[email protected]>
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <[email protected]>
Hi Joseph,

 

The NVDA developer is likely correct, but your example shows expected behavior, not a bug. You're adding an infinite number of timer events, then calling wx.Yield in them. This will cause infinite recursion, as wx.Yield will process the next timer event, which will call wx.Yield, which will process the next timer event, which will call wx.Yield, and so on. I don't think a change in wx.Yield is at fault here, it's just alerting you to the recursion instead of causing it. To get to the bottom of this, you'll need to find out what is triggering the recursion in NVDA.

 

Taking a quick look at the NVDA code's use of wx.Yield, I think the first step would probably be to find out if api.py's processPendingEvents is somehow calling itself multiple times. If you can identify the specific set of steps that trigger recursion, the NVDA developers will probably be able to come up with some ideas for workarounds or fixes.

 

Regards,

 

Kevin

 

From: <[email protected]> on behalf of Joseph Lee <[email protected]>
Reply-To: <[email protected]>
Date: Thursday, April 27, 2017 at 9:36 AM
To: <[email protected]>
Subject: RE: [wxPython-dev] wxPython 4/wx.Yield: C++ assert failure

 

Hi Robin,

At least wx.YieldIfNeeded suppresses the assertions. However, according to a lead NVDA developer, this does not really resolve this problem, as NVDA needs to handle other events external to wxWidgets such as accessibility events. The lead developer (not me) believes that the root problem might have to do with timers and certain things that are internally different between wxPython classic and phoenix.

Can you try out this example and see if we can trace this:

https://www.dropbox.com/s/p8uuf52hzlmyd3x/wxReentrance.py?dl=1

 

Note that the example requires Python 2.7 with wxPython 4.0.0A1. Thanks.

Cheers,

Joseph

 

From: [email protected] [mailto:[email protected]] On Behalf Of Robin Dunn
Sent: Thursday, April 27, 2017 12:17 AM
To: [email protected]
Subject: Re: [wxPython-dev] wxPython 4/wx.Yield: C++ assert failure

 

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.

-- 
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.


-- 
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.