Skip to content

TCP(**kwargs) raises AttributeError instead of constructing a packet #423

Description

@JarryShaw

Constructing TCP from keyword arguments fails:

>>> from pcapkit.protocols.transport.tcp import TCP
>>> TCP(srcport=80, dstport=443)
AttributeError: 'int' object has no attribute 'port'

Raised at pcapkit/protocols/transport/tcp.py:479, which reads .port off a
value it was handed as a plain int.

Reproduced on main. This is the documented construction path for every other
protocol, so either the argument handling needs to accept the integer form it
advertises, or the expectation needs stating — but an AttributeError naming
int tells the caller nothing about what it should have passed.

Found while profiling for #420 (not a performance issue — noticed in passing).

Activity

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

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions