Bug report
This code does checking for PyContextVar_CheckExact twice:
|
PyObject * |
|
PyContextVar_Set(PyObject *ovar, PyObject *val) |
|
{ |
|
ENSURE_ContextVar(ovar, NULL) |
|
PyContextVar *var = (PyContextVar *)ovar; |
|
|
|
if (!PyContextVar_CheckExact(var)) { |
|
PyErr_SetString( |
|
PyExc_TypeError, "an instance of ContextVar was expected"); |
|
return NULL; |
|
} |
First in:
|
#define ENSURE_ContextVar(o, err_ret) \ |
|
if (!PyContextVar_CheckExact(o)) { \ |
|
PyErr_SetString(PyExc_TypeError, \ |
|
"an instance of ContextVar was expected"); \ |
|
return err_ret; \ |
|
} |
Then in:
|
if (!PyContextVar_CheckExact(var)) { |
|
PyErr_SetString( |
|
PyExc_TypeError, "an instance of ContextVar was expected"); |
|
return NULL; |
|
} |
There's no reason to do this.
Linked PRs
Bug report
This code does checking for
PyContextVar_CheckExacttwice:cpython/Python/context.c
Lines 340 to 350 in 1fc3039
First in:
cpython/Python/context.c
Lines 28 to 33 in 1fc3039
Then in:
cpython/Python/context.c
Lines 346 to 350 in 1fc3039
There's no reason to do this.
Linked PRs
PyContextVar_CheckExacttwice inPyContextVar_Set#142874PyContextVar_CheckExacttwice inPyContextVar_Set(GH-142874) #142893PyContextVar_CheckExacttwice inPyContextVar_Set(GH-142874) #142894