Open
Description
cpython/Python/instrumentation.c
Line 2566 in c740fe3
Since PyLong_FromLong can return NULL, it is necessary to use Py_XDECREF, as stated in refcount.h.
Line 207 in c740fe3
cpython/Python/instrumentation.c
Line 2566 in c740fe3
Since PyLong_FromLong can return NULL, it is necessary to use Py_XDECREF, as stated in refcount.h.
Line 207 in c740fe3
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant
Activity
PyLong_FromLong(x) != NULL
whenx
is known to be small #134415sergey-miryanov commentedon May 21, 2025
It falls to small_int case and can't return NULL. I suggest adding an assert and leave the decref code as is.
smurav commentedon May 21, 2025
Yes, I think it's the right thing to do.
Since PyLong_From Long(PY_MONITORING_DEBUGGER_ID) falls to small_int …
Merge branch 'main' into fix-pythongh-134411
Merge branch 'fix-pythongh-134411' of github.com:smurav/cpython into …
[-]Dangerous reference count decrement.[/-][+]`Python/instrumentation.c`: ensure non-NULL `PyLong_FromLong` results when possible[/+]skv0zsneg commentedon May 27, 2025
Hi! I want to work on this issue but I didn't work with CPython at all. If it not a problem can you please provide some links for start?
grantlouisherman commentedon May 30, 2025
I think this can be closed because of #134415 right?
picnixz commentedon May 30, 2025
It'll be closed once we merged the PR.