Skip to content

Commit 338bdb2

Browse files
[3.14] gh-142873: Do not check for PyContextVar_CheckExact twice in PyContextVar_Set (GH-142874) (#142893)
gh-142873: Do not check for `PyContextVar_CheckExact` twice in `PyContextVar_Set` (GH-142874) (cherry picked from commit e61a447) Co-authored-by: sobolevn <[email protected]>
1 parent 547e38c commit 338bdb2

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

Python/context.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,6 @@ PyContextVar_Set(PyObject *ovar, PyObject *val)
343343
ENSURE_ContextVar(ovar, NULL)
344344
PyContextVar *var = (PyContextVar *)ovar;
345345

346-
if (!PyContextVar_CheckExact(var)) {
347-
PyErr_SetString(
348-
PyExc_TypeError, "an instance of ContextVar was expected");
349-
return NULL;
350-
}
351-
352346
PyContext *ctx = context_get();
353347
if (ctx == NULL) {
354348
return NULL;
@@ -1024,12 +1018,6 @@ static PyObject *
10241018
_contextvars_ContextVar_get_impl(PyContextVar *self, PyObject *default_value)
10251019
/*[clinic end generated code: output=0746bd0aa2ced7bf input=30aa2ab9e433e401]*/
10261020
{
1027-
if (!PyContextVar_CheckExact(self)) {
1028-
PyErr_SetString(
1029-
PyExc_TypeError, "an instance of ContextVar was expected");
1030-
return NULL;
1031-
}
1032-
10331021
PyObject *val;
10341022
if (PyContextVar_Get((PyObject *)self, default_value, &val) < 0) {
10351023
return NULL;

0 commit comments

Comments
 (0)