autorun: clear builtins._ so a False result does not fail later tests - #5221
Open
DresslerFrank wants to merge 1 commit into
Open
DresslerFrank wants to merge 1 commit into
DresslerFrank wants to merge 1 commit into
Conversation
Tests that followed one ending in False were reported as failed. UTScapy
uses the last expression value as the result, and a successful assert
does not replace it. autorun_commands did not delete builtins._ at the
start of a test, so the previous False stayed in place.
The following uts file demonstrates the problem:
% False result carries over
+ Carry over
= one
False
= two
assert True
`two` raises nothing and does not set a new value, but it was reported
as failed.
The purpose of the scapy_session code was unclear. The history showed
that it belonged to session save/load, removed in 13621d1 ("Sessions
removed"), and that this code had been left behind. Searching the rest
of the tree for those leftovers by hand looked like more work than it
was worth, and a good fit for AI, so I asked it to find and remove
them as well.
Fixes secdev#5220
AI-Assisted: yes (Grok 4.7)
Co-authored-by: Cursor <cursoragent@cursor.com>
DresslerFrank
commented
Oct 5, 2026
| interp = ScapyAutorunInterpreter(locals=my_globals) | ||
| try: | ||
| del builtins.__dict__["scapy_session"]["_"] | ||
| del builtins.__dict__["_"] |
Contributor
Author
There was a problem hiding this comment.
This is the important change that fixes UTScapy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests that followed one ending in False were reported as failed. UTScapy uses the last expression value as the result, and a successful assert does not replace it. autorun_commands did not delete
builtins._at the start of a test, so the previous False stayed in place.The following uts file demonstrates the problem:
tworaises nothing and does not set a new value, but it was reported as failed.The purpose of the scapy_session code was unclear. The history showed that it belonged to session save/load, removed in 13621d1 ("Sessions removed"), and that this code had been left behind. Searching the rest of the tree for those leftovers by hand looked like more work than it was worth, and a good fit for AI, so I asked it to find and remove them as well.
Fixes #5220
AI-Assisted: yes (Grok 4.7)