-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
This code does checking for PyContextVar_CheckExact twice:
Lines 340 to 350 in 1fc3039
| 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:
Lines 28 to 33 in 1fc3039
| #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:
Lines 346 to 350 in 1fc3039
| 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
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error