File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8202,31 +8202,23 @@ static PyObject *
82028202object___reduce_ex___impl (PyObject * self , int protocol )
82038203/*[clinic end generated code: output=2e157766f6b50094 input=f326b43fb8a4c5ff]*/
82048204{
8205- PyObject * reduce ;
8206- if (PyObject_GetOptionalAttr (self , & _Py_ID (__reduce__ ), & reduce ) < 0 ) {
8207- return NULL ;
8208- }
8209- if (reduce != NULL ) {
8210- PyObject * cls , * clsreduce ;
8211- int override ;
8212-
8213- cls = (PyObject * ) Py_TYPE (self );
8214- clsreduce = PyObject_GetAttr (cls , & _Py_ID (__reduce__ ));
8215- if (clsreduce == NULL ) {
8216- Py_DECREF (reduce );
8217- return NULL ;
8218- }
8219-
8205+ PyObject * clsreduce = _PyType_LookupRef (Py_TYPE (self ), & _Py_ID (__reduce__ ));
8206+ if (clsreduce != NULL ) {
82208207 PyInterpreterState * interp = _PyInterpreterState_GET ();
8221- override = (clsreduce != _Py_INTERP_CACHED_OBJECT (interp , objreduce ));
8208+ int override = (clsreduce != _Py_INTERP_CACHED_OBJECT (interp , objreduce ));
82228209 Py_DECREF (clsreduce );
8210+
82238211 if (override ) {
8224- PyObject * res = _PyObject_CallNoArgs (reduce );
8225- Py_DECREF (reduce );
8226- return res ;
8212+ PyObject * reduce ;
8213+ if (PyObject_GetOptionalAttr (self , & _Py_ID (__reduce__ ), & reduce ) < 0 ) {
8214+ return NULL ;
8215+ }
8216+ if (reduce != NULL ) {
8217+ PyObject * res = _PyObject_CallNoArgs (reduce );
8218+ Py_DECREF (reduce );
8219+ return res ;
8220+ }
82278221 }
8228- else
8229- Py_DECREF (reduce );
82308222 }
82318223
82328224 return _common_reduce (self , protocol );
You can’t perform that action at this time.
0 commit comments