Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
# :raises ValueError: If module/version is already loaded, already
# required, or unavailable.
gi.require_version("Gtk", "3.0")
# Also require GioUnix to avoid PyGIWarning when Gio is imported
# GioUnix is platform-specific and may not be available on all systems
try:
gi.require_version("GioUnix", "2.0")
except ValueError:
# GioUnix is not available on this platform, which is fine
pass
except ValueError as e:
# in this case we want to re-raise as ImportError so the
# auto-backend selection logic correctly skips.
Expand Down
7 changes: 7 additions & 0 deletions lib/matplotlib/backends/backend_gtk4.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
# :raises ValueError: If module/version is already loaded, already
# required, or unavailable.
gi.require_version("Gtk", "4.0")
# Also require GioUnix to avoid PyGIWarning when Gio is imported
# GioUnix is platform-specific and may not be available on all systems
try:
gi.require_version("GioUnix", "2.0")
except ValueError:
# GioUnix is not available on this platform, which is fine
pass
except ValueError as e:
# in this case we want to re-raise as ImportError so the
# auto-backend selection logic correctly skips.
Expand Down
Loading