mirror of https://github.com/python/cpython
bpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005)
This commit is contained in:
parent
57364ce34e
commit
919d42d477
|
@ -368,7 +368,11 @@ PyTypeObject PyAnextAwaitable_Type = {
|
||||||
PyObject *
|
PyObject *
|
||||||
PyAnextAwaitable_New(PyObject *awaitable, PyObject *default_value)
|
PyAnextAwaitable_New(PyObject *awaitable, PyObject *default_value)
|
||||||
{
|
{
|
||||||
anextawaitableobject *anext = PyObject_GC_New(anextawaitableobject, &PyAnextAwaitable_Type);
|
anextawaitableobject *anext = PyObject_GC_New(
|
||||||
|
anextawaitableobject, &PyAnextAwaitable_Type);
|
||||||
|
if (anext == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
Py_INCREF(awaitable);
|
Py_INCREF(awaitable);
|
||||||
anext->wrapped = awaitable;
|
anext->wrapped = awaitable;
|
||||||
Py_INCREF(default_value);
|
Py_INCREF(default_value);
|
||||||
|
|
Loading…
Reference in New Issue