Skip to content

Fix for Empty except#819

Draft
Andrey1994 wants to merge 1 commit intomasterfrom
finding-autofix-3b94f03a
Draft

Fix for Empty except#819
Andrey1994 wants to merge 1 commit intomasterfrom
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>
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