Skip to content

Commit 7a65e6b

Browse files
linesightclaude
andcommitted
fix(cefpython.pyx): guard X11 error-handler install at compile time
Wrapping the InstallX11ErrorHandlers() call with a runtime sys.platform check is not enough — Cython still semantically analyses the right-hand side, and _g_linux_wayland_mode is only defined when window_utils_linux.pyx is included in the build (Linux only). macOS / Windows builds therefore fail with "undeclared name not builtin: _g_linux_wayland_mode" during Cython compilation. Use the existing IF UNAME_SYSNAME == "Linux" compile-time directive (same pattern used for the other Linux-only blocks in this file at lines 580, 845, 990, 1021) so the body is excluded on non-Linux hosts. The redundant runtime sys.platform check inside it is dropped. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bd924c4 commit 7a65e6b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/cefpython.pyx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,13 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
699699
Debug("CefInitialize() WARNING: OnContextInitialized not received"
700700
" within 30 seconds")
701701

702-
if sys.platform.startswith("linux") and not _g_linux_wayland_mode:
703-
WindowUtils.InstallX11ErrorHandlers()
702+
# Compile-time Linux guard: _g_linux_wayland_mode is defined in
703+
# window_utils_linux.pyx, which is only included in the Linux build,
704+
# so this whole block must be excluded on Windows/macOS or Cython
705+
# fails with "undeclared name not builtin: _g_linux_wayland_mode".
706+
IF UNAME_SYSNAME == "Linux":
707+
if not _g_linux_wayland_mode:
708+
WindowUtils.InstallX11ErrorHandlers()
704709

705710

706711
return ret

0 commit comments

Comments
 (0)