Title: 3.13.2: cast in Py_XDECREF causes runtime failures with immortal objects · Issue #135746 · python/cpython · GitHub
Open Graph Title: 3.13.2: cast in Py_XDECREF causes runtime failures with immortal objects · Issue #135746 · python/cpython
X Title: 3.13.2: cast in Py_XDECREF causes runtime failures with immortal objects · Issue #135746 · python/cpython
Description: Bug report Bug description: In Python 3.13.2 I use Py_XDECREF(PyObject *op) It is called at the end of a function-call to load an image (cv2.imread) which fails, resulting in a None value (not NULL!). For Python 3.9 Py_XDECREF works just...
Open Graph Description: Bug report Bug description: In Python 3.13.2 I use Py_XDECREF(PyObject *op) It is called at the end of a function-call to load an image (cv2.imread) which fails, resulting in a None value (not NULL...
X Description: Bug report Bug description: In Python 3.13.2 I use Py_XDECREF(PyObject *op) It is called at the end of a function-call to load an image (cv2.imread) which fails, resulting in a None value (not NULL...
Opengraph URL: https://github.com/python/cpython/issues/135746
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"3.13.2: cast in Py_XDECREF causes runtime failures with immortal objects","articleBody":"# Bug report\n\n### Bug description:\n\nIn Python 3.13.2 I use\n```python\nPy_XDECREF(PyObject *op) \n```\nIt is called at the end of a function-call to load an image (cv2.imread) which fails, resulting in a None value (not NULL!). For Python 3.9 Py_XDECREF works just fine, without crash. For Python 3.13.2 the program, compiled with VS2022 (64 Bit), raises a \"Run-Time Check Failure #1 - A cast to a smaller data type has caused a loss of data.\" and my application crashes (\"/RTC1 = Basic Runtime Checks enabled\").\n\nI followed up the calls:\n```python\n Py_DECREF\n _Py_IsImmortal\n #elif SIZEOF_VOID_P \u003e 4\n _Py_CAST(PY_INT32_T, op-\u003eob_refcnt) \u003c-- crash\n```\n\nThe value is\n```python\nop-\u003eob_refcnt == 0x0000000100000000\n```\n\nTo fix this problem, I propose, that the type cast to 32 bit should be changed to \n```python\n_Py_CAST(PY_INT32_T, op-\u003eob_refcnt \u0026 0xFFFFFFFF)\n```\n\n### CPython versions tested on:\n\n3.13\n\n### Operating systems tested on:\n\nWindows","author":{"url":"https://github.com/Jejos","@type":"Person","name":"Jejos"},"datePublished":"2025-06-20T09:39:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":17},"url":"https://github.com/135746/cpython/issues/135746"}
| 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:f002d019-3553-3963-d9cc-f7b002ef619b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA1C:159D04:8196B0:A9FFAA:696B4E3D |
| html-safe-nonce | f6b88ea1d7bc3583c23f11fbcf93c2a64879872055513736b2aef15c7b3c699d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTFDOjE1OUQwNDo4MTk2QjA6QTlGRkFBOjY5NkI0RTNEIiwidmlzaXRvcl9pZCI6IjMzNTkwNDM5NjkyMDU2MjAyODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | aea4e1726129c50c5d5c67e23b91660ebb971ba9039c223a5cf06079cd1dbabd |
| hovercard-subject-tag | issue:3162599543 |
| 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/135746/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0998310a0ae56d0b972938e5fa860cd56583d2d38fd538486fa30b61461a4c6c/python/cpython/issues/135746 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0998310a0ae56d0b972938e5fa860cd56583d2d38fd538486fa30b61461a4c6c/python/cpython/issues/135746 |
| og:image:alt | Bug report Bug description: In Python 3.13.2 I use Py_XDECREF(PyObject *op) It is called at the end of a function-call to load an image (cv2.imread) which fails, resulting in a None value (not NULL... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Jejos |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| 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 | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width