Title: Suspected `PyErr_Fetch()` behavior change · Issue #102594 · python/cpython · GitHub
Open Graph Title: Suspected `PyErr_Fetch()` behavior change · Issue #102594 · python/cpython
X Title: Suspected `PyErr_Fetch()` behavior change · Issue #102594 · python/cpython
Description: Bug report While testing pybind11 with Python 3.12alpha6 I ran into what looks like a PyErr_Fetch() behavior change. I also tried with the main branch @ c6858d1. I think the issue reduces to: PyErr_SetObject() as e.g. here: https://githu...
Open Graph Description: Bug report While testing pybind11 with Python 3.12alpha6 I ran into what looks like a PyErr_Fetch() behavior change. I also tried with the main branch @ c6858d1. I think the issue reduces to: PyErr...
X Description: Bug report While testing pybind11 with Python 3.12alpha6 I ran into what looks like a PyErr_Fetch() behavior change. I also tried with the main branch @ c6858d1. I think the issue reduces to: PyErr...
Opengraph URL: https://github.com/python/cpython/issues/102594
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Suspected `PyErr_Fetch()` behavior change","articleBody":"\u003c!--\r\n If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not\r\n the right place to seek help. Consider the following options instead:\r\n\r\n - reading the Python tutorial: https://docs.python.org/3/tutorial/\r\n - posting in the \"Users\" category on discuss.python.org: https://discuss.python.org/c/users/7\r\n - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list\r\n - searching our issue tracker (https://github.com/python/cpython/issues) to see if\r\n your problem has already been reported\r\n--\u003e\r\n\r\n# Bug report\r\n\r\nWhile testing pybind11 with Python 3.12alpha6 I ran into what looks like a `PyErr_Fetch()` behavior change. I also tried with the main branch @ c6858d1e7f4cd3184d5ddea4025ad5dfc7596546.\r\n\r\nI think the issue reduces to:\r\n\r\n* `PyErr_SetObject()` as e.g. here: https://github.com/pybind/pybind11/blob/442261da585536521ff459b1457b2904895f23b4/tests/test_exceptions.cpp#L309\r\n\r\n* Followed more-or-less immediately by a `PyErr_Fetch()` as e.g. here: https://github.com/pybind/pybind11/blob/442261da585536521ff459b1457b2904895f23b4/include/pybind11/pytypes.h#L482\r\n\r\nThe special twist is that the exception type involved raises a `ValueError` in its `__init__`:\r\n\r\n* https://github.com/pybind/pybind11/blob/442261da585536521ff459b1457b2904895f23b4/tests/test_exceptions.py#L295\r\n\r\nFor easy reference the same code copy-pasted here:\r\n\r\n```\r\nclass FlakyException(Exception):\r\n def __init__(self, failure_point):\r\n if failure_point == \"failure_point_init\":\r\n raise ValueError(\"triggered_failure_point_init\")\r\n self.failure_point = failure_point\r\n```\r\n\r\n* Up to and including 3.12alpha3: `PyErr_Fetch()` produces the `FlakyException` type ([this here](https://github.com/pybind/pybind11/blob/442261da585536521ff459b1457b2904895f23b4/include/pybind11/pytypes.h#L488)).\r\n\r\n* **With 3.12alpha6: `PyErr_Fetch()` produces the `ValueError` type** instead.\r\n\r\nAdditional detail:\r\n\r\nUp to and including 3.12alpha3: only `PyErr_NormalizeException()` hits the `ValueError` in `FlakyException._init__`, but not `PyErr_Fetch()`.\r\n\r\n# Your environment\r\n\r\n\u003c!-- Include as many relevant details as possible about the environment you experienced the bug in --\u003e\r\n\r\n- CPython versions tested on: 3.12alpha6, main branch @ c6858d1e7f4cd3184d5ddea4025ad5dfc7596546\r\n- Operating system and architecture: Debian 5.19.11 clang14, ubuntu22 gcc11\r\n\r\n\u003c!--\r\nYou can freely edit this text. Remove any lines you believe are unnecessary.\r\n--\u003e\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-102606\n* gh-102607\n* gh-102675\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/rwgk","@type":"Person","name":"rwgk"},"datePublished":"2023-03-11T06:09:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":22},"url":"https://github.com/102594/cpython/issues/102594"}
| 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:c6d1b6b9-3cce-b26f-a516-3cac4fedb4a9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CADC:10F1EB:6129C:8995C:696A0C25 |
| html-safe-nonce | 23810f33e15da6646305b9b658cf17fece40b77b0776a12945ff7f73ee567e39 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQURDOjEwRjFFQjo2MTI5Qzo4OTk1Qzo2OTZBMEMyNSIsInZpc2l0b3JfaWQiOiI3MTQzNjQ3NzIzMTI1MzQ1MzE3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 48a7d2a855fed6f821305da1a84a49a519e901d790dbd41aa44410886137a14e |
| hovercard-subject-tag | issue:1619899630 |
| 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/102594/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dbb45d36e70baaebbfd9a2a5f20188342bd456d6703c07c5b99e24bd6efcd630/python/cpython/issues/102594 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dbb45d36e70baaebbfd9a2a5f20188342bd456d6703c07c5b99e24bd6efcd630/python/cpython/issues/102594 |
| og:image:alt | Bug report While testing pybind11 with Python 3.12alpha6 I ran into what looks like a PyErr_Fetch() behavior change. I also tried with the main branch @ c6858d1. I think the issue reduces to: PyErr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rwgk |
| hostname | github.com |
| expected-hostname | github.com |
| None | 699227a00bbb7fe1eec276d2ae1c3a93068bc5ba483bd9dc4b2a27a8f4f2f595 |
| 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 | 7266b2d935baa1c6474b16dd9feaa5ca30607261 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width