Staging
v0.5.1
https://github.com/python/cpython
Revision cf0645a17acbc0c4dbbf82434e37637965748bbb authored by Miss Islington (bot) on 29 January 2020, 16:10:24 UTC, committed by GitHub on 29 January 2020, 16:10:24 UTC
Replace check for whether something is a method in the mock module. The
previous version fails on PyPy, because there no method wrappers exist
(everything looks like a regular Python-defined function). Thus the
isinstance(getattr(result, '__get__', None), MethodWrapperTypes) check
returns True for any descriptor, not just methods.

This condition could also return erroneously True in CPython for
C-defined descriptors.

Instead to decide whether something is a method, just check directly
whether it's a function defined on the class. This passes all tests on
CPython and fixes the bug on PyPy.
(cherry picked from commit a327677905956ae0b239ff430a1346dfe265709e)

Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>

Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
1 parent a6559b4
History
Tip revision: cf0645a17acbc0c4dbbf82434e37637965748bbb authored by Miss Islington (bot) on 29 January 2020, 16:10:24 UTC
bpo-39485: fix corner-case in method-detection of mock (GH-18256)
Tip revision: cf0645a
File Mode Size
ax_check_openssl.m4 -rw-r--r-- 4.1 KB

back to top