Skip to content

Replace assert with ValueError in PortField validation #34

@dannywillems

Description

@dannywillems

Problem

field.py line 60 uses assert 0 <= port < 65536 for port validation. Assertions can be stripped with python -O, silently disabling the validation at runtime.

Solution

  • Replace assert with if not (0 <= port < 65536): raise ValueError(...)
  • Update tests to check for ValueError instead of AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions