@@ -3,7 +3,7 @@ use std::ffi::CString;
33
44use datafusion_common:: { DataFusionError , error:: Result as DataFusionResult } ;
55use pyo3:: {
6- Bound , FromPyObject , PyAny , PyErr , PyResult , Python ,
6+ Borrowed , Bound , FromPyObject , PyAny , PyErr , PyResult , Python ,
77 exceptions:: PyTypeError ,
88 intern,
99 types:: { PyAnyMethods , PyDictMethods , PyModuleMethods , PyStringMethods , PyTypeMethods } ,
@@ -14,8 +14,10 @@ use crate::{
1414 signature:: { PythonFn , PythonFnSignature , PythonNullableType , PythonType } ,
1515} ;
1616
17- impl < ' py > FromPyObject < ' py > for PythonType {
18- fn extract_bound ( ob : & Bound < ' py , PyAny > ) -> PyResult < Self > {
17+ impl < ' a , ' py > FromPyObject < ' a , ' py > for PythonType {
18+ type Error = PyErr ;
19+
20+ fn extract ( ob : Borrowed < ' a , ' py , PyAny > ) -> PyResult < Self > {
1921 let py = ob. py ( ) ;
2022
2123 // https://docs.python.org/3/library/builtins.html
@@ -42,14 +44,16 @@ impl<'py> FromPyObject<'py> for PythonType {
4244 } else {
4345 Err ( PyErr :: new :: < PyTypeError , _ > ( format ! (
4446 "unknown annotation type: {}" ,
45- py_representation( ob)
47+ py_representation( ob. as_any ( ) )
4648 ) ) )
4749 }
4850 }
4951}
5052
51- impl < ' py > FromPyObject < ' py > for PythonNullableType {
52- fn extract_bound ( ob : & Bound < ' py , PyAny > ) -> PyResult < Self > {
53+ impl < ' a , ' py > FromPyObject < ' a , ' py > for PythonNullableType {
54+ type Error = PyErr ;
55+
56+ fn extract ( ob : Borrowed < ' a , ' py , PyAny > ) -> PyResult < Self > {
5357 let py = ob. py ( ) ;
5458
5559 // https://docs.python.org/3/library/inspect.html
@@ -105,11 +109,13 @@ impl<'py> FromPyObject<'py> for PythonNullableType {
105109 }
106110}
107111
108- impl < ' py > FromPyObject < ' py > for PythonFnSignature {
112+ impl < ' a , ' py > FromPyObject < ' a , ' py > for PythonFnSignature {
113+ type Error = PyErr ;
114+
109115 /// Convert [`inspect.Signature`] to [`PythonFnSignature`].
110116 ///
111117 /// [`inspect.Signature`]: https://docs.python.org/3/library/inspect.html#inspect.Signature
112- fn extract_bound ( ob : & Bound < ' py , PyAny > ) -> PyResult < Self > {
118+ fn extract ( ob : Borrowed < ' a , ' py , PyAny > ) -> PyResult < Self > {
113119 let py = ob. py ( ) ;
114120
115121 // https://docs.python.org/3/library/inspect.html
0 commit comments