https://github.com/python/cpython/commit/5e1a9c8392f5da173a44cf3b7007836789ac6885 commit: 5e1a9c8392f5da173a44cf3b7007836789ac6885 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: sobolevn <[email protected]> date: 2025-12-17T17:04:39Z summary:
[3.13] gh-142873: Do not check for `PyContextVar_CheckExact` twice in `PyContextVar_Set` (GH-142874) (#142894) gh-142873: Do not check for `PyContextVar_CheckExact` twice in `PyContextVar_Set` (GH-142874) (cherry picked from commit e61a447d0e0753621e8fc347e99dfc87884d68ab) Co-authored-by: sobolevn <[email protected]> files: M Python/context.c diff --git a/Python/context.c b/Python/context.c index c9675f44772cb4..1b2797b8af5bd6 100644 --- a/Python/context.c +++ b/Python/context.c @@ -264,12 +264,6 @@ 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; - } - PyContext *ctx = context_get(); if (ctx == NULL) { return NULL; @@ -979,12 +973,6 @@ static PyObject * _contextvars_ContextVar_get_impl(PyContextVar *self, PyObject *default_value) /*[clinic end generated code: output=0746bd0aa2ced7bf input=30aa2ab9e433e401]*/ { - if (!PyContextVar_CheckExact(self)) { - PyErr_SetString( - PyExc_TypeError, "an instance of ContextVar was expected"); - return NULL; - } - PyObject *val; if (PyContextVar_Get((PyObject *)self, default_value, &val) < 0) { return NULL; _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
