GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — Don't use assert to enforce interface constraints · Issue #1552 · gitpython-developers/GitPython Closed Labels Description# sscce.py import git git.Repo(".").tags[None] $ git init Initialized empty Git repository in /tmp/tmp.Xoz9gZndOi/.git/ $ venv/bin/python sscce.py Traceback (most recent call last): File "sscce.py", line 5, in <module> git.Repo(".").tags[None] File "/tmp/tmp.Xoz9gZndOi/venv/lib/python3.8/site-packages/git/util.py", line 1087, in __getitem__ assert isinstance(index, (int, str, slice)), "Index of IterableList should be an int or str" AssertionError: Index of IterableList should be an int or str Line 1087 in c84dde2
assert should not be used in product code because it can be ignored with -O:
$ venv/bin/python -O sscce.py Traceback (most recent call last): File "sscce.py", line 5, in <module> git.Repo(".").tags[None] File "/tmp/tmp.Xoz9gZndOi/venv/lib/python3.8/site-packages/git/util.py", line 1095, in __getitem__ return getattr(self, index) TypeError: getattr(): attribute name must be string (In fact, that behavior is probably better since a
$ venv/bin/bandit venv/lib/python3.8/site-packages/git/util.py ... >> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Severity: Low Confidence: High CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html) Location: venv/lib/python3.8/site-packages/git/util.py:1087:8 More Info: https://bandit.readthedocs.io/en/1.7.4/plugins/b101_assert_used.html 1086 1087 assert isinstance(index, (int, str, slice)), "Index of IterableList should be an int or str" 1088 1089 if isinstance(index, int): ... Activity
MetadataMetadataAssigneesLabelsTypeProjectsMilestoneRelationshipsDevelopmentIssue actions | ||
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |