Title: [3.7] bpo-39485: fix corner-case in method-detection of mock (GH-18252) by miss-islington · Pull Request #18256 · python/cpython · GitHub
Open Graph Title: [3.7] bpo-39485: fix corner-case in method-detection of mock (GH-18252) by miss-islington · Pull Request #18256 · python/cpython
X Title: [3.7] bpo-39485: fix corner-case in method-detection of mock (GH-18252) by miss-islington · Pull Request #18256 · python/cpython
Description: 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 a327677) Co-authored-by: Carl Friedrich Bolz-Tereick cfbolz@gmx.de https://bugs.python.org/issue39485
Open Graph Description: 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 functi...
X Description: 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 functi...
Opengraph URL: https://github.com/python/cpython/pull/18256
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:97551279-dbbd-255f-b079-c6059e14a2ab |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DBB6:2F450E:10CFFE4:184A5BB:6A57A412 |
| html-safe-nonce | 000881c1c197a9bb77b76451ec1c1110b32ba4369090fa71e897bdeacd490e39 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkI2OjJGNDUwRToxMENGRkU0OjE4NEE1QkI6NkE1N0E0MTIiLCJ2aXNpdG9yX2lkIjoiNTQyODExODE0NTA0NDU4NDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c27da615f9fcc9b24ea5df6850f0312db451929b36c0371f5c2e5545e83264f0 |
| hovercard-subject-tag | pull_request:368627904 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/18256/files |
| twitter:image | https://avatars.githubusercontent.com/u/31488909?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/31488909?s=400&v=4 |
| og:image:alt | 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 functi... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 017a07c29bdd8a37b5907fc9a689338deb7103b5af7f56714193b2700229b3df |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0dd6847d644323df8f8c1368c065f9f630095e3b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width