diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2022-07-12 08:05:49 -0400 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-07-12 08:39:01 -0400 |
| commit | 0d6449874cd4d3003ce908d66fa654b64bfea0c0 (patch) | |
| tree | e6f2449abf080fa99562b7efe4952675d6fdd5ec /coverage | |
| parent | 297b70e43e083297093781be6e5e1681e5dd70cb (diff) | |
| download | python-coveragepy-git-0d6449874cd4d3003ce908d66fa654b64bfea0c0.tar.gz | |
fix: 3.11.0b4 has 0-numbered lines. Fixes #1419
CPython added these lines in
https://github.com/python/cpython/commit/1bfe83a114da3939c00746fc44dc5da7f56f525f
Diffstat (limited to 'coverage')
| -rw-r--r-- | coverage/env.py | 3 | ||||
| -rw-r--r-- | coverage/parser.py | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/coverage/env.py b/coverage/env.py index 444cb892..2e21b9a7 100644 --- a/coverage/env.py +++ b/coverage/env.py @@ -110,6 +110,9 @@ class PYBEHAVIOR: # Some words are keywords in some places, identifiers in other places. soft_keywords = (PYVERSION >= (3, 10)) + # Modules start with a line numbered zero. This means empty modules have + # only a 0-number line, which is ignored, giving a truly empty module. + empty_is_empty = (PYVERSION >= (3, 11, 0, 'beta', 4)) # Coverage.py specifics. diff --git a/coverage/parser.py b/coverage/parser.py index dce4f937..7ef67d2c 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -377,7 +377,7 @@ class ByteParser: """ if hasattr(self.code, "co_lines"): for _, _, line in self.code.co_lines(): - if line is not None: + if line: yield line else: # Adapted from dis.py in the standard library. |
