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/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:822d0d9e-0ac4-f961-c8c0-787f3e856c27 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A62E:337CEB:8CFFFB:BD43B6:69697B59 |
| html-safe-nonce | 7c1187bde822e9cdda3b4021559aee68a10cce8a1a20b9717762a2e6b9f3f49b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjJFOjMzN0NFQjo4Q0ZGRkI6QkQ0M0I2OjY5Njk3QjU5IiwidmlzaXRvcl9pZCI6IjM3NjM3ODc0Mjc4ODkxMTgwNDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f5c2dfddcb5deb3b0f04468731e5942f11898b1aac61bbe0785ca897a458d42f |
| hovercard-subject-tag | pull_request:1073477646 |
| 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/97700/files |
| 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 | f33e4b94c8824ab2b434d82a94139432fb5ebee9df4b75304140ad22508c4a77 |
| 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 | 48f380098b30acbb700b04f1724481ca10d574fc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width