File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed
Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -980,18 +980,14 @@ impl<'py> PyAnyMethods<'py> for Bound<'py, PyAny> {
980980 where
981981 N : IntoPyObject < ' py , Target = PyString > ,
982982 {
983- // PyObject_HasAttr suppresses all exceptions, which was the behaviour of `hasattr` in Python 2.
984- // Use an implementation which suppresses only AttributeError, which is consistent with `hasattr` in Python 3.
983+ let py = self . py ( ) ;
985984 let result = unsafe {
986985 ffi:: compat:: PyObject_HasAttrWithError (
987986 self . as_ptr ( ) ,
988- attr_name
989- . into_pyobject ( self . py ( ) )
990- . map_err ( Into :: into) ?
991- . as_ptr ( ) ,
987+ attr_name. into_pyobject ( py) . map_err ( Into :: into) ?. as_ptr ( ) ,
992988 )
993989 } ;
994- error_on_minusone ( self . py ( ) , result) ?;
990+ error_on_minusone ( py , result) ?;
995991 Ok ( result > 0 )
996992 }
997993
@@ -1027,10 +1023,7 @@ impl<'py> PyAnyMethods<'py> for Bound<'py, PyAny> {
10271023 match unsafe {
10281024 ffi:: compat:: PyObject_GetOptionalAttr (
10291025 self . as_ptr ( ) ,
1030- attr_name
1031- . into_pyobject ( py)
1032- . map_err ( Into :: into) ?
1033- . as_ptr ( ) ,
1026+ attr_name. into_pyobject ( py) . map_err ( Into :: into) ?. as_ptr ( ) ,
10341027 & mut resp_ptr,
10351028 )
10361029 } {
You can’t perform that action at this time.
0 commit comments