Title: Pickling is losing some fields on exceptions · Issue #103333 · python/cpython · GitHub
Open Graph Title: Pickling is losing some fields on exceptions · Issue #103333 · python/cpython
X Title: Pickling is losing some fields on exceptions · Issue #103333 · python/cpython
Description: Bug report Say we have an AttributeError with some fields on it (like name). When we pickle and unpickle it, we can see that .name (at least) is lost (and set to None). Optimally those fields should still be in-tact on the unpickled inst...
Open Graph Description: Bug report Say we have an AttributeError with some fields on it (like name). When we pickle and unpickle it, we can see that .name (at least) is lost (and set to None). Optimally those fields shoul...
X Description: Bug report Say we have an AttributeError with some fields on it (like name). When we pickle and unpickle it, we can see that .name (at least) is lost (and set to None). Optimally those fields shoul...
Opengraph URL: https://github.com/python/cpython/issues/103333
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pickling is losing some fields on exceptions","articleBody":"# Bug report\r\n\r\nSay we have an AttributeError with some fields on it (like name). When we pickle and unpickle it, we can see that .name (at least) is lost (and set to None). Optimally those fields should still be in-tact on the unpickled instance.\r\n\r\n```\r\nC:\\Users\\csm10495\\Desktop\u003epython\r\nPython 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n\u003e\u003e\u003e import pickle\r\n\u003e\u003e\u003e a = AttributeError(\"test text\", name=\"test name\", obj=\"test obj\")\r\n\u003e\u003e\u003e a.name\r\n'test name'\r\n\u003e\u003e\u003e pickle.loads(pickle.dumps(a)).name\r\n\u003e\u003e\u003e pickle.loads(pickle.dumps(a))\r\nAttributeError('test text')\r\n```\r\n\r\n# Your environment\r\n\r\n```\r\nC:\\Users\\csm10495\\Desktop\u003epython --version\r\nPython 3.11.0\r\n\r\nC:\\Users\\csm10495\\Desktop\u003ever\r\n\r\nMicrosoft Windows [Version 10.0.19045.2364]\r\n\r\nC:\\Users\\csm10495\\Desktop\u003e\r\n```\r\n\r\nSame thing seems to happen on 3.10.7 and 3.11.3 as well.\r\n\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-103352\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/csm10495","@type":"Person","name":"csm10495"},"datePublished":"2023-04-07T06:24:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/103333/cpython/issues/103333"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:45808afb-a652-7a3c-7b56-7e3f4dcc2490 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 998E:97651:C83F1:10D186:6969C6DE |
| html-safe-nonce | e9c2f33f27fbae424ed59ce63598dd885f2720ef6d788ce41f0b4d285523802f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OThFOjk3NjUxOkM4M0YxOjEwRDE4Njo2OTY5QzZERSIsInZpc2l0b3JfaWQiOiIzMTc1OTk5OTcwNjUyODMzNTAyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | dd77d83f9dd5a61816694b014de57ddb017e0f399c47825fcfaa1165b71d4630 |
| hovercard-subject-tag | issue:1658423441 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/103333/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ead7b9f1c05099bddb6cc3e7fcab8dc24970e69e4be7c16cece8e70e15948453/python/cpython/issues/103333 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ead7b9f1c05099bddb6cc3e7fcab8dc24970e69e4be7c16cece8e70e15948453/python/cpython/issues/103333 |
| og:image:alt | Bug report Say we have an AttributeError with some fields on it (like name). When we pickle and unpickle it, we can see that .name (at least) is lost (and set to None). Optimally those fields shoul... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | csm10495 |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width