Skip to content

Replace accidental str sentinel for RemotePlotterProxy on macOS - #27

Open
BrennanTM wants to merge 1 commit into
PrecisionNeuroLab:mainfrom
BrennanTM:fix/remote-plotter-sentinel
Open

Replace accidental str sentinel for RemotePlotterProxy on macOS#27
BrennanTM wants to merge 1 commit into
PrecisionNeuroLab:mainfrom
BrennanTM:fix/remote-plotter-sentinel

Conversation

@BrennanTM

Copy link
Copy Markdown

What broke — macOS branch of util/pyvista/__init__.py: RemotePlotterProxy = type('__None'). One-arg type() returns the argument's type, i.e. str, so any string satisfied isinstance(x, RemotePlotterProxy).

Fix — a dedicated never-instantiated sentinel class. Checked all ~30 isinstance sites and the three is RemotePlotterProxy identity checks: identical behavior minus the str hazard.

Teststests/test_util/test_pyvistaDefaults.py (skipped off-macOS).

Adjacent, not fixed hereRemotePlotterProxyBase is undefined at runtime on macOS in VisualizedROI.py / SampleMetadataOrientationsLayer.py (guarded import, unguarded use); see #20.

type('__None') with a single argument returns the type of the argument,
i.e. str, so any string would satisfy isinstance checks against
RemotePlotterProxy on macOS. Use a dedicated never-instantiated class
instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant