Skip to content

Fix for Empty except#819

Merged
Andrey1994 merged 1 commit into
masterfrom
finding-autofix-3b94f03a
Apr 26, 2026
Merged

Fix for Empty except#819
Andrey1994 merged 1 commit into
masterfrom
finding-autofix-3b94f03a

Conversation

@Andrey1994
Copy link
Copy Markdown
Member

Use a targeted exception handler instead of except: and keep the operation explicitly best-effort.

Best fix (without changing functionality):

  • In python_package/brainflow/data_filter.py, inside DataHandlerDLL.__init__, replace:
    • except: + pass
  • With:
    • except (AttributeError, OSError): + explanatory comment + pass

Why this is best:

  • AttributeError covers environments where os.add_dll_directory is unavailable.
  • OSError covers expected runtime failures when adding the directory.
  • Behavior remains the same (non-fatal, continue to PATH fallback), but avoids catching unrelated exceptions and satisfies CodeQL’s requirement for meaningful handling/commenting.

No new imports or dependencies are needed.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Andrey1994 Andrey1994 marked this pull request as ready for review April 26, 2026 22:33
@Andrey1994 Andrey1994 merged commit 43d08e5 into master Apr 26, 2026
38 checks passed
@Andrey1994 Andrey1994 deleted the finding-autofix-3b94f03a branch May 9, 2026 15:27
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