refactor(lib): remove duplicated library-search blocks#113
Merged
cboulay merged 1 commit intoJun 16, 2026
Conversation
The 'active Python env lib dir' and 'macOS Frameworks' search blocks in find_liblsl_libraries were each present twice, verbatim. The generator is consumed with next(), so the second copy could only ever yield a path already yielded by the first - it was dead code. Removing it drops up to 8 redundant os.path.isfile() calls on the library-not-found fallback path and leaves the set and order of yielded paths unchanged.
sappelhoff
commented
Jun 15, 2026
| if os.path.isfile(path): | ||
| yield path | ||
|
|
||
| # The active Python env's lib directory (e.g. `conda install -c conda-forge |
Contributor
Author
There was a problem hiding this comment.
when reviewing this chunk and wondering why it is entirely removed ... expand the lines upward and you see the exact same block repeated.
cboulay
approved these changes
Jun 16, 2026
cboulay
left a comment
Contributor
There was a problem hiding this comment.
Super weird how that happened in the first place. Thanks for taking care of it.
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.
(PR and content generated with the help of Claude)
What
Remove duplicated code in
find_liblsl_libraries(src/pylsl/lib/__init__.py).Why
The "active Python env lib dir" block and the "macOS Frameworks" block were each present twice, verbatim. Because the generator is consumed with
next()(the loader takes the first yielded path), the second copy could only ever re-yield a path already produced by the first — it was effectively dead code.Impact
os.path.isfile()calls in the fallback path (when the library hasn't been found by an earlier search location). This only runs at import time, so the runtime impact is negligible — this is primarily a correctness/clarity cleanup.Behavior
Unchanged: the set and order of yielded candidate paths is identical (the duplicate added no new paths).
import pylslandfind_liblsl_libraries()verified working after the change; existing test suite passes.