Skip to content

Use ClassVar for Packet.fields_desc type hint#4998

Open
T3pp31 wants to merge 1 commit into
secdev:masterfrom
T3pp31:fix-4991-classvar-fields-desc
Open

Use ClassVar for Packet.fields_desc type hint#4998
T3pp31 wants to merge 1 commit into
secdev:masterfrom
T3pp31:fix-4991-classvar-fields-desc

Conversation

@T3pp31
Copy link
Copy Markdown
Contributor

@T3pp31 T3pp31 commented May 24, 2026

Summary

  • import ClassVar in scapy.packet
  • annotate Packet.fields_desc as ClassVar[List[AnyField]]
  • keep runtime behavior unchanged

Closes #4991

Checks

  • python3 -m py_compile scapy/packet.py
  • git diff --check

Not run locally:

  • tox -e flake8 (tox resolves to a broken pyenv-win shim; python3 -m tox is not installed)
  • tox -e mypy (same tox issue)
  • python3 -m ruff check --select RUF012 scapy/packet.py (ruff is not installed)

@T3pp31 T3pp31 force-pushed the fix-4991-classvar-fields-desc branch from c732048 to 505acab Compare May 24, 2026 14:08
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.29%. Comparing base (66ef96a) to head (505acab).
⚠️ Report is 30 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4998      +/-   ##
==========================================
- Coverage   80.31%   80.29%   -0.03%     
==========================================
  Files         381      383       +2     
  Lines       93630    95159    +1529     
==========================================
+ Hits        75202    76405    +1203     
- Misses      18428    18754     +326     
Files with missing lines Coverage Δ
scapy/packet.py 84.70% <100.00%> (-0.14%) ⬇️

... and 48 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@T3pp31
Copy link
Copy Markdown
Contributor Author

T3pp31 commented May 24, 2026

CI note: after adding the required AI-Assisted commit trailer, the commit validity check is passing.

The remaining failing check is ubuntu-latest pypy3.11 root -K scanner. Its log shows TypeError: test_am() missing 1 required positional argument: 'mock_sniff' while running on PyPy 7.3.22. This appears unrelated to this PR's scapy/packet.py type-comment-only change and looks like the known PyPy 7.3.22 regression tracked in #4995.

Relevant checks for this change are passing, including Code health check, Type hints check, CodeQL, and Codacy Static Code Analysis.

@T3pp31 T3pp31 marked this pull request as ready for review May 24, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type Hints: Use typing.ClassVar for Packet.fields_desc

1 participant