Adding advanced debugging information on dll mismatch - #91
Merged
Conversation
The binding is compiled against one cuvis SDK and can run against another, since the library is installed separately. When the installed one is older it may not export everything the binding imports; the binding survives that and reports it, but there was no clean way to ask about it from here. cuvis.binding adds that: info() returns a BindingInfo with the version built against, the version and path actually loaded and any functions the library does not provide, and prints as a report fit for pasting into a bug report. missing_symbols(), available() and require() cover the common checks, and require() raises UnavailableSDKFunction, an SDKException, so an unavailable function is caught as an ordinary cuvis error rather than a bare RuntimeError. Degrades quietly against a binding too old to report any of this: everything reads empty and available() stays true.
The module now carries full docstrings: what the feature is for, which error each route raises, what every BindingInfo field means, and what each function returns or raises, with short examples in the reST style the repo already uses in doc.py. Writing them turned up two things worth correcting rather than describing. The module claimed that calling an unavailable function raises UnavailableSDKFunction. It does not: the binding layer raises a plain RuntimeError, and only require() raised the typed one, so the same condition surfaced as two unrelated exception types. UnavailableSDKFunction now derives from RuntimeError as well as SDKException, so one except clause covers either route and the documented behaviour is true. The report also printed "status: complete" for a binding too old to report missing functions, asserting something it cannot know. It now says the status is unknown, and is_complete documents that an empty list is all such a binding can offer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a way to ask what the installed cuvis SDK actually provides, instead of finding out when a call fails. Pairs with cuvis.pyil#38, which is what supplies the underlying facts.
cuvis.bindingmodule reporting the compiled binding, the cuvis library loaded beside it, and the functions that library does not provide.binding.info()returns aBindingInfosnapshot whosestr()is a report fit for pasting into a bug report:binding.available(*names)andbinding.require(*names)let a feature check up front rather than failing deeper in.requireraisesUnavailableSDKFunction, which derives from bothSDKExceptionandRuntimeError, so oneexceptcovers it and the plainRuntimeErrorthe binding layer raises when such a function is called directly.cuvis.init(), so it can decide whether an operation is worth attempting at all.cuvis_ilwheel that cannot report any of this:info()saysunknown, this binding does not report itrather than claiming everything is fine,missing_symbols()is empty andrequire()never raises. Absence of evidence, not evidence of absence.CHANGELOG.mdupdated underUnreleased.Verified
cuvis_acq_cont_dead_pixel_correction_*functions,is_completeisFalse, and both error paths name both libraries.cuvis_il3.5.3.2 wheel, not a mock.scripts/check_changelog.pypasses.