Title: gh-97591: In `Exception.__setstate__()`, acquire strong reference before calling `tp_hash` slot. by ofey404 · Pull Request #97700 · python/cpython · GitHub
Open Graph Title: gh-97591: In `Exception.__setstate__()`, acquire strong reference before calling `tp_hash` slot. by ofey404 · Pull Request #97700 · python/cpython
X Title: gh-97591: In `Exception.__setstate__()`, acquire strong reference before calling `tp_hash` slot. by ofey404 · Pull Request #97700 · python/cpython
Description: Added an Py_INCREF / Py_DECREF pair around the call of tp_hash slot in Exception.__setstate__(). If the last reference of dict value is cleared (by dict.clear()), during the __setstate__ method call, it would cause gc crash. A script to reproduce this is in #97591 : import gc class Key(str): def __hash__(self): d.clear() return 0 class Value(str): pass d = {} d[Key()] = Value() e = Exception() e.__setstate__(d) gc.collect() # Segfault happens here Similiar issue: #92930 Issue: gh-97591
Open Graph Description: Added an Py_INCREF / Py_DECREF pair around the call of tp_hash slot in Exception.__setstate__(). If the last reference of dict value is cleared (by dict.clear()), during the __setstate__ method cal...
X Description: Added an Py_INCREF / Py_DECREF pair around the call of tp_hash slot in Exception.__setstate__(). If the last reference of dict value is cleared (by dict.clear()), during the __setstate__ method cal...
Opengraph URL: https://github.com/python/cpython/pull/97700
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:32b86e37-a3a2-b21c-3da2-ed6ee00a67a0 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | 8742:27A700:26A23D1:35BCB30:69694DB8 |
| html-safe-nonce | 5347a706c40938b576f362ebc4e7fd877ccbb348b50eac031f180bb80554625b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzQyOjI3QTcwMDoyNkEyM0QxOjM1QkNCMzA6Njk2OTREQjgiLCJ2aXNpdG9yX2lkIjoiODc0ODQ5NzU2MjIwMTgzNjk4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2cb737424d6c78cb5019e5a1276613390f556d9fc1924fc339ee9fb94f2e1fc6 |
| hovercard-subject-tag | pull_request:1073477646 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/97700/checks |
| twitter:image | https://avatars.githubusercontent.com/u/35857538?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/35857538?s=400&v=4 |
| og:image:alt | Added an Py_INCREF / Py_DECREF pair around the call of tp_hash slot in Exception.__setstate__(). If the last reference of dict value is cleared (by dict.clear()), during the __setstate__ method cal... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| turbo-cache-control | no-preview |
| 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 full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width