Title: [3.8] bpo-39485: fix corner-case in method-detection of mock (GH-18252) by miss-islington · Pull Request #18255 · python/cpython · GitHub
Open Graph Title: [3.8] bpo-39485: fix corner-case in method-detection of mock (GH-18252) by miss-islington · Pull Request #18255 · python/cpython
X Title: [3.8] bpo-39485: fix corner-case in method-detection of mock (GH-18252) by miss-islington · Pull Request #18255 · 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/18255
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ffb75fcc-a2bc-77e9-55c8-321abf4e8b3f |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D7F6:3695F9:4430D94:6051F74:6A56E2A5 |
| html-safe-nonce | 41ea96d54b7a254ac413cef9147b31b150d7b4c505e43660c4bf1b5a472a1ba0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0Y2OjM2OTVGOTo0NDMwRDk0OjYwNTFGNzQ6NkE1NkUyQTUiLCJ2aXNpdG9yX2lkIjoiNjQyMzAyMzQxNzEzNDg2NzEwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 84c3207a0843f26b68ee5e1298d1e95bb01670325984133f9a576ae50798b7db |
| hovercard-subject-tag | pull_request:368627731 |
| 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/18255/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 | 5220a278731283038daf0ed00b41f06ef7ff9539020ecc806c5c5a0fb6bda25a |
| 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 | 8684ae1a81cd3e4ef219b241179982bbda1a5b1f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width