summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-10-06 16:55:18 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-10-06 16:55:18 -0400
commitf33b733e92a2422d64cb7f4ba2a64898e1e4f336 (patch)
treec6d3573dec9e42ee83e2739432419151e52b49fa
parent19545b7d78fb91a82088517681e20cf4ffcd8c63 (diff)
downloadpython-coveragepy-git-f33b733e92a2422d64cb7f4ba2a64898e1e4f336.tar.gz
docs: note #1210 in the changelog
-rw-r--r--CHANGES.rst5
-rw-r--r--CONTRIBUTORS.txt1
-rw-r--r--tests/test_context.py4
3 files changed, 9 insertions, 1 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 937d2d0f..784fa5c2 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -25,7 +25,12 @@ Unreleased
- Changed an internal detail of how tomli is imported, so that tomli can use
coverage.py for their own test suite (`issue 1228`_).
+- Defend against an obscure possibility under code obfuscation, where a
+ function can have an argument called "self", but no local named "self"
+ (`pull request 1210`_). Thanks, Ben Carlsson.
+
.. _issue 1228: https://github.com/nedbat/coveragepy/issues/1228
+.. _pull request 1210: https://github.com/nedbat/coveragepy/pull/1210
.. _changes_60:
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 2642e6b1..1c1fe0e9 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -20,6 +20,7 @@ Arcadiy Ivanov
Aron Griffis
Artem Dayneko
Arthur Deygin
+Ben Carlsson
Ben Finney
Bernát Gábor
Bill Hart
diff --git a/tests/test_context.py b/tests/test_context.py
index de972819..36eff2f0 100644
--- a/tests/test_context.py
+++ b/tests/test_context.py
@@ -278,6 +278,8 @@ class QualnameTest(CoverageTest):
assert get_qualname() is None
def test_bug_1210(self):
+ # Under pyarmor (an obfuscator), a function can have a "self" argument,
+ # but then not have a "self" local.
co = mock.Mock(co_name="a_co_name", co_argcount=1, co_varnames=["self"])
- frame = mock.Mock(f_code = co, f_locals={})
+ frame = mock.Mock(f_code=co, f_locals={})
assert qualname_from_frame(frame) == "unittest.mock.a_co_name"