Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Safe hasattr for PyQt5 #1161

Merged
merged 3 commits into from
Oct 12, 2022
Merged

BUG: Safe hasattr for PyQt5 #1161

merged 3 commits into from
Oct 12, 2022

Conversation

larsoner
Copy link
Contributor

Over in enthought/mayavi#1180 I am working on VTK 9.2.2 fixes, and I am getting a segfault in CIs during GC:

https://github.com/enthought/mayavi/actions/runs/3222141217/jobs/5270891488

Locally I don't get a segfault but rather a slightly nicer error message:

Exceptions caught in Qt event loop:
________________________________________________________________________________
Traceback (most recent call last):
  File "/home/larsoner/python/pyface/pyface/ui/qt4/action/action_item.py", line 379, in _qt4_on_destroyed
    if hasattr(self.control, "_tool_instance"):
RuntimeError: wrapped C/C++ object of type QAction has been deleted

This PR fixes this by catching this RuntimeError during hasattr. Locally at least the Mayavi tests pass with PyQt5 with this change.

@corranwebster
Copy link
Contributor

Thanks - this looks like a reasonable fix.

@larsoner
Copy link
Contributor Author

larsoner commented Oct 11, 2022

There was a timeout on one run after 360 minutes (!) that's hopefully unrelated, so rather than pushing an empty commit (to get CIs to run again) I added a timeout-minutes: 20 to the CI run. Looks like all others were < 5 minutes so this seemed like a reasonable buffer against slow downloads and such.

@corranwebster
Copy link
Contributor

Yes, it is almost certainly orthogonal - I haven't seen that sort of error in the CI runs, but I will keep an eye out for it in the future.

I think this should be good to merge.

@corranwebster corranwebster merged commit 608e153 into enthought:main Oct 12, 2022
@corranwebster corranwebster added the needs backport to maint/* This issue needs to be backported to a maintenance branch label Oct 12, 2022
@larsoner larsoner deleted the safe branch October 12, 2022 12:45
corranwebster added a commit that referenced this pull request Nov 11, 2022
* BUG: Safe hasattr for PyQt5

* Update pyface/ui/qt4/action/action_item.py

* MAINT: Timeout

Co-authored-by: Corran Webster <cwebster@enthought.com>
corranwebster added a commit that referenced this pull request Nov 14, 2022
* BUG: Safe hasattr for PyQt5

* Update pyface/ui/qt4/action/action_item.py

* MAINT: Timeout

Co-authored-by: Corran Webster <cwebster@enthought.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs backport to maint/* This issue needs to be backported to a maintenance branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants