File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -1678,25 +1678,25 @@ _Unpickler_SetInputStream(UnpicklerObject *self, PyObject *file)
1678
1678
{
1679
1679
/* Optional file methods */
1680
1680
if (_PyObject_LookupAttr (file , & _Py_ID (peek ), & self -> peek ) < 0 ) {
1681
- return -1 ;
1681
+ goto error ;
1682
1682
}
1683
1683
if (_PyObject_LookupAttr (file , & _Py_ID (readinto ), & self -> readinto ) < 0 ) {
1684
- return -1 ;
1684
+ goto error ;
1685
1685
}
1686
- (void )_PyObject_LookupAttr (file , & _Py_ID (read ), & self -> read );
1687
- (void )_PyObject_LookupAttr (file , & _Py_ID (readline ), & self -> readline );
1688
- if (!self -> readline || !self -> read ) {
1689
- if (!PyErr_Occurred ()) {
1690
- PyErr_SetString (PyExc_TypeError ,
1691
- "file must have 'read' and 'readline' attributes" );
1692
- }
1693
- Py_CLEAR (self -> read );
1694
- Py_CLEAR (self -> readinto );
1695
- Py_CLEAR (self -> readline );
1696
- Py_CLEAR (self -> peek );
1697
- return -1 ;
1686
+ if (_PyObject_LookupAttr (file , & _Py_ID (read ), & self -> read ) < 0 ) {
1687
+ goto error ;
1688
+ }
1689
+ if (_PyObject_LookupAttr (file , & _Py_ID (readline ), & self -> readline ) < 0 ) {
1690
+ goto error ;
1698
1691
}
1699
1692
return 0 ;
1693
+
1694
+ error :
1695
+ Py_CLEAR (self -> read );
1696
+ Py_CLEAR (self -> readinto );
1697
+ Py_CLEAR (self -> readline );
1698
+ Py_CLEAR (self -> peek );
1699
+ return -1 ;
1700
1700
}
1701
1701
1702
1702
/* Returns -1 (with an exception set) on failure, 0 on success. This may
You can’t perform that action at this time.
0 commit comments