diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-01-29 16:10:24 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-29 16:10:24 (GMT) |
| commit | cf0645a17acbc0c4dbbf82434e37637965748bbb (patch) | |
| tree | 76768f4c502ac5b5bf7ecaaf49e1ec8d39bee28c /Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp | |
| parent | a6559b436dc5663828eca055be62683e0b0cf5bb (diff) | |
| download | cpython-cf0645a17acbc0c4dbbf82434e37637965748bbb.zip cpython-cf0645a17acbc0c4dbbf82434e37637965748bbb.tar.gz cpython-cf0645a17acbc0c4dbbf82434e37637965748bbb.tar.bz2 | |
bpo-39485: fix corner-case in method-detection of mock (GH-18256)
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>
Diffstat (limited to 'Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp')
0 files changed, 0 insertions, 0 deletions
