Repository navigation
fix(foundation): let the pypcap engine fall back when the pcap module cannot load (#2132) - #2133
Merged
Merged
Conversation
… cannot load (#2132) - Add _pcap_backend.engine_reason(): the wrong-backend verdict plus the installed-but-unusable one PCAP_CT already gave. - PyPCAP._reason_for and PCAP_CT._reason_for both return it, so extract(engine='pypcap') now warns and falls back to the default engine instead of raising the loader's OSError, and the two cannot drift again. - Document the new verdict in PyPCAP's docstrings and the engines docs. Tests: tests/foundation/engines/test_pypcap_unusable_module_2132_unit.py, with a fake pcap package raising OSError in a child interpreter; fails on origin/main, passes here, foundation leg green.
Owner
Author
|
GOOD TO GO at
|
JarryShaw
force-pushed
the
fix/2132-pypcap-unusable-module
branch
from
October 24, 2026 02:22
cdff40b to
fe72cfa
Compare
Contributor
|
Coverage: 91.55% (unit tier, Python 3.15,
Per-file detail: the |
Owner
Author
|
Ready to merge at
This closes #2132. |
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.
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #2132.
pcapmodule is installed but cannot load (OSErrorfrom its loader),extract(engine='pypcap')raised the error.engine='pcap_ct'warned and fell back.PyPCAP._reason_foronly checkedwrong_backend_reason._reason_fornow call a new_pcap_backend.engine_reason(wanted, found), so they cannot drift apart. It returns the wrong-backend reason, orPCAP_CT's existing "installed but unusable -- " wording, orNonewhen the module is absent, which the import test already reports.PyPCAP.__init__backstop raisesUnsupportedCallrather than letting theOSErrorout ofimport pcap.engine_reasonentry in3rdparty.rst, and the "declines to run" bullet inengines/index.rst.tests/foundation/engines/test_pypcap_unusable_module_2132_unit.py.pcapthat raisesOSError('Cannot find libpcap.so library'). In the child, both engines must warn and fall back.main: 8 failed, 2 passed. The passingpcap_ctcase is the control.