Skip to content

Commit

Permalink
docs: note #1210 in the changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Oct 6, 2021
1 parent 19545b7 commit f33b733
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.rst
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -20,6 +20,7 @@ Arcadiy Ivanov
Aron Griffis
Artem Dayneko
Arthur Deygin
Ben Carlsson
Ben Finney
Bernát Gábor
Bill Hart
Expand Down
4 changes: 3 additions & 1 deletion tests/test_context.py
Expand Up @@ -278,6 +278,8 @@ class test_something: # pylint: disable=unused-variable
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"

0 comments on commit f33b733

Please sign in to comment.