This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use qualname list to avoid false positive on load()
The code checking for yaml.load() issues had false positives on json.load() and foo.load(). This patch checks the qualnames of the load function to avoid false positives. Change-Id: I22ffb9e852e31d04dc49c4ad949d1417e70f8828 Closes-bug: 1622615
- Loading branch information
1 parent
8e76fcb
commit e98515f
Showing
2 changed files
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import json | ||
import yaml | ||
|
||
def test_yaml_load(): | ||
ystr = yaml.dump({'a' : 1, 'b' : 2, 'c' : 3}) | ||
y = yaml.load(ystr) | ||
yaml.dump(y) | ||
y = yaml.load(ystr, Loader=yaml.SafeLoader) | ||
|
||
def test_json_load(): | ||
# no issue should be found | ||
j = json.load("{}") |