Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pickle test for PacketList [ready] #3113

Merged
merged 3 commits into from
Mar 27, 2021
Merged

Conversation

polybassa
Copy link
Contributor

@polybassa polybassa commented Feb 24, 2021

edited by gpotter2

This PR:

  • fix NamedTuple (and PacketList) pickling on Python < 3.7

@polybassa
Copy link
Contributor Author

@gpotter2 This is related to NamedTuple. Do you have an idea if this is fixable?

@gpotter2
Copy link
Member

gpotter2 commented Mar 2, 2021

This looks like an annoying bug. It also only appears to be present on older python 3 versions :/ I'll have a look if I get the time

@polybassa
Copy link
Contributor Author

Thanks. I looked a little bit into it, but it would require a redefinition of NamedTuple in compat in case of Python version < 3.6.
As far as I understood this bug, the NamedTuple lambda is not sufficient for pickle. I checked a little bit for simple solutions, but unfortunately I couldn't find any. So I assume, a class NamedTuple implementation with some black magic in __init__ or __new__ is necessary to solve this.

@polybassa
Copy link
Contributor Author

Closing this PR, since I can not finish it.

@polybassa polybassa closed this Mar 8, 2021
@gpotter2
Copy link
Member

gpotter2 commented Mar 8, 2021

I will

@gpotter2
Copy link
Member

I think it's easier to just implement custom pickling. Let's see how this works

@codecov
Copy link

codecov bot commented Mar 11, 2021

Codecov Report

Merging #3113 (eeac021) into master (a4dcd78) will increase coverage by 0.20%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3113      +/-   ##
==========================================
+ Coverage   85.05%   85.26%   +0.20%     
==========================================
  Files         256      261       +5     
  Lines       54303    54425     +122     
==========================================
+ Hits        46189    46407     +218     
+ Misses       8114     8018      -96     
Impacted Files Coverage Δ
scapy/compat.py 95.42% <100.00%> (+43.67%) ⬆️
scapy/packet.py 83.17% <100.00%> (+0.96%) ⬆️
scapy/contrib/automotive/enumerator.py 43.87% <0.00%> (-7.85%) ⬇️
scapy/arch/windows/__init__.py 67.73% <0.00%> (-0.38%) ⬇️
scapy/layers/sixlowpan.py 86.31% <0.00%> (-0.26%) ⬇️
scapy/layers/tls/automaton_cli.py 70.82% <0.00%> (-0.10%) ⬇️
scapy/utils.py 78.30% <0.00%> (-0.07%) ⬇️
scapy/plist.py 86.31% <0.00%> (ø)
scapy/contrib/automotive/uds_logging.py 71.56% <0.00%> (ø)
scapy/contrib/automotive/graph.py 66.66% <0.00%> (ø)
... and 30 more

@polybassa
Copy link
Contributor Author

polybassa commented Mar 11, 2021 via email

@polybassa polybassa changed the title Add pickle test for PacketList Add pickle test for PacketList [ready] Mar 22, 2021
@gpotter2 gpotter2 merged commit 94ba1d3 into secdev:master Mar 27, 2021
bzalkilani pushed a commit to bzalkilani/scapy that referenced this pull request Jun 12, 2022
* Add pickle test for PacketList

* test different NamedTuple for pickle

* Improve pickling

Co-authored-by: gpotter2 <gabriel@potter.fr>
bzalkilani pushed a commit to bzalkilani/scapy that referenced this pull request Jun 14, 2022
* Add pickle test for PacketList

* test different NamedTuple for pickle

* Improve pickling

Co-authored-by: gpotter2 <gabriel@potter.fr>
@polybassa polybassa deleted the pickle_test branch July 27, 2022 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants