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

fix: don't use AbstractContextManager for exceptions_as_dialog #234

Merged
merged 3 commits into from
Mar 6, 2024

Conversation

tlambert03
Copy link
Member

The use of contextlib.AbstractContextManager seems to be more trouble than useful. I occasionally see this error:

/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/superqt/utils/_errormsg_context.py:17: in <module>
    class exceptions_as_dialog(AbstractContextManager):
E   SystemError: <built-in method __prepare__ of type object at 0x7fc513f209a0> returned a result with an exception set
Error: The process '/Users/runner/hostedtoolcache/Python/3.11.8/x64/bin/python' failed with exit code 4

it's not necessary though, it implements the full protocol anyway

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.30%. Comparing base (56f65ff) to head (71588e9).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
+ Coverage   87.29%   87.30%   +0.01%     
==========================================
  Files          46       46              
  Lines        3336     3332       -4     
==========================================
- Hits         2912     2909       -3     
+ Misses        424      423       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tlambert03 tlambert03 merged commit d407af2 into pyapp-kit:main Mar 6, 2024
1 check passed
@tlambert03 tlambert03 deleted the dont-use-abc branch March 6, 2024 20:46
@tlambert03 tlambert03 added the bug Something isn't working label Mar 6, 2024
@tlambert03
Copy link
Member Author

unfortunately, this didn't fix it. here's the whole traceback:

ImportError while loading conftest '/Users/runner/work/pymmcore-plus/pymmcore-plus/pymmcore-plus/napari-micromanager/tests/conftest.py'.
tests/conftest.py:6: in <module>
    from napari_micromanager._util import NMM_METADATA_KEY
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/napari_micromanager/__init__.py:10: in <module>
    from .main_window import MainWindow
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/napari_micromanager/main_window.py:14: in <module>
    from ._core_link import CoreViewerLink
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/napari_micromanager/_core_link.py:10: in <module>
    from superqt.utils import ensure_main_thread
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/superqt/__init__.py:12: in <module>
    from .combobox import QColorComboBox, QEnumComboBox, QSearchableComboBox
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/superqt/combobox/__init__.py:3: in <module>
    from ._color_combobox import QColorComboBox
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/superqt/combobox/_color_combobox.py:20: in <module>
    from superqt.utils import signals_blocked
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/superqt/utils/__init__.py:29: in <module>
    from ._errormsg_context import exceptions_as_dialog
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/superqt/utils/_errormsg_context.py:16: in <module>
    class exceptions_as_dialog:
E   SystemError: <built-in method __prepare__ of type object at 0x10d7b62f0> returned a result with an exception set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

1 participant