Skip to content

fix(const): Command.get calls key.upper() on any key, so bytes mint and ints raise AttributeError #1824

Closed

Description

@JarryShaw

Describe the bug
Command.get (pcapkit/const/ftp/command.py:551, generated from pcapkit/vendor/ftp/command.py) is a staticmethod that calls key.upper() without checking the key's type. Measured on main:

  • Command.get(b'\x01') returns <Command.b'\x01': None>, a bogus unregistered member keyed by bytes.
  • Command.get(-1) raises AttributeError: 'int' object has no attribute 'upper', which is a builtin error rather than an in-library one, and default is ignored.

Method.get had the same shape. #908 fixed it: it became a classmethod that delegates to EnumLookup.get and rejects a non-str key with ValueError (see its versionchanged:: 1.5.0).

Expected behavior
Command.get follows Method.get: a non-str key is rejected with the in-library error, and a str key keeps today's case-insensitive lookup and unregistered-member fallback. A test pins each case.

Additional context
Found by #1816's worker (#1823). Blocked until #1823 merges, because both change pcapkit/vendor/ftp/command.py and the const file it generates.

Activity

  1. JarryShaw commented on Oct 16, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until #1823 merges, since both change pcapkit/vendor/ftp/command.py.

  2. 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 16, 2026
  3. moved this to Blocked in PyPCAPKiton Oct 16, 2026
  4. JarryShaw commented on Oct 16, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1823 has merged. A worker is on it.

  5. 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 16, 2026
  6. moved this from Blocked to WIP in PyPCAPKiton Oct 16, 2026
  7. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 16, 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