Skip to content

fix(corekit): copying or pickling PeekableStream recurses until RecursionError #1524

Closed

Description

@JarryShaw

On main 5f4da2301, both copy.copy(_PeekableStream(io.BytesIO(b'abc'))) and a pickle round trip raise RecursionError: maximum recursion depth exceeded. I measured both.

Cause: __getattr__ forwards to self._stream. copy and pickle create the instance without calling __init__, so _stream is unset, and reading it re-enters __getattr__.

Fix: __getattr__ should raise AttributeError for _stream itself (or for any dunder) instead of forwarding. Add copy and pickle tests.

The #1521 review found this. #1521 makes the class public as pcapkit.corekit.io.PeekableStream, so the fix belongs there. Blocked until #1521 merges.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 9, 2026
  2. JarryShaw commented on Oct 10, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1521 has merged, so the class now lives at pcapkit.corekit.io.PeekableStream. A worker is on the fix.

  3. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 10, 2026
  4. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 10, 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