Skip to content

Commit f33b733

Browse files
committed
docs: note #1210 in the changelog
1 parent 19545b7 commit f33b733

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGES.rst

+5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ Unreleased
2525
- Changed an internal detail of how tomli is imported, so that tomli can use
2626
coverage.py for their own test suite (`issue 1228`_).
2727

28+
- Defend against an obscure possibility under code obfuscation, where a
29+
function can have an argument called "self", but no local named "self"
30+
(`pull request 1210`_). Thanks, Ben Carlsson.
31+
2832
.. _issue 1228: https://github.com/nedbat/coveragepy/issues/1228
33+
.. _pull request 1210: https://github.com/nedbat/coveragepy/pull/1210
2934

3035

3136
.. _changes_60:

CONTRIBUTORS.txt

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Arcadiy Ivanov
2020
Aron Griffis
2121
Artem Dayneko
2222
Arthur Deygin
23+
Ben Carlsson
2324
Ben Finney
2425
Bernát Gábor
2526
Bill Hart

tests/test_context.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ class test_something: # pylint: disable=unused-variable
278278
assert get_qualname() is None
279279

280280
def test_bug_1210(self):
281+
# Under pyarmor (an obfuscator), a function can have a "self" argument,
282+
# but then not have a "self" local.
281283
co = mock.Mock(co_name="a_co_name", co_argcount=1, co_varnames=["self"])
282-
frame = mock.Mock(f_code = co, f_locals={})
284+
frame = mock.Mock(f_code=co, f_locals={})
283285
assert qualname_from_frame(frame) == "unittest.mock.a_co_name"

0 commit comments

Comments
 (0)