Skip to content

fix(foundation): third-party engines replace a user's verbose callback with their own printer #1874

Closed

Description

@JarryShaw

Extractor.__init__ sets _flag_v = True and stores the callable when verbose is one (pcapkit/foundation/extraction.py:1293-1295). But each third-party engine then does if ext._flag_v: ext._vfunc = lambda e, f: print(...). That happens in foundation/engines/scapy.py:387-391, dpkt.py:~461, pyshark.py:~262, pypcap.py:~319, pcap_ct.py:~406 and pypcapfile.py:~227. So on those engines a user's own verbose= callback is silently replaced by the engine's print. Only the built-in PCAP and PCAP-NG engines keep it.

Found while typing _vfunc for #1839 (#1867).

Fix: install an engine's default printer only when verbose=True was passed as a bool, and keep a user callable as given. The test should run a non-default engine with a recording callback and assert the callback is called for every frame.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 17, 2026
  2. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixPull requests that fix a defect (fix: subject prefix)

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions