@@ -458,8 +458,8 @@ tuple_from_py_func_args!(A, B, C, D, E, F);
458
458
pub type FunctionBox < T > = SmallBox < T , S1 > ;
459
459
460
460
/// A built-in Python function.
461
- pub type PyNativeFunc = FunctionBox < dyn Fn ( & VirtualMachine , PyFuncArgs ) -> PyResult + ' static > ;
462
- // TODO: + Send + Sync
461
+ pub type PyNativeFunc =
462
+ FunctionBox < dyn Fn ( & VirtualMachine , PyFuncArgs ) -> PyResult + ' static + Send + Sync > ;
463
463
464
464
/// Implemented by types that are or can generate built-in functions.
465
465
///
@@ -481,7 +481,7 @@ pub trait IntoPyNativeFunc<T, R, VM> {
481
481
482
482
impl < F > IntoPyNativeFunc < PyFuncArgs , PyResult , VirtualMachine > for F
483
483
where
484
- F : Fn ( & VirtualMachine , PyFuncArgs ) -> PyResult + ' static ,
484
+ F : Fn ( & VirtualMachine , PyFuncArgs ) -> PyResult + ' static + Send + Sync ,
485
485
{
486
486
fn into_func ( self ) -> PyNativeFunc {
487
487
smallbox ! ( self )
@@ -499,7 +499,7 @@ macro_rules! into_py_native_func_tuple {
499
499
( $( ( $n: tt, $T: ident) ) ,* ) => {
500
500
impl <F , $( $T, ) * R > IntoPyNativeFunc <( $( OwnedParam <$T>, ) * ) , R , VirtualMachine > for F
501
501
where
502
- F : Fn ( $( $T, ) * & VirtualMachine ) -> R + ' static ,
502
+ F : Fn ( $( $T, ) * & VirtualMachine ) -> R + ' static + Send + Sync ,
503
503
$( $T: FromArgs , ) *
504
504
R : IntoPyObject ,
505
505
{
@@ -514,7 +514,7 @@ macro_rules! into_py_native_func_tuple {
514
514
515
515
impl <F , S , $( $T, ) * R > IntoPyNativeFunc <( RefParam <S >, $( OwnedParam <$T>, ) * ) , R , VirtualMachine > for F
516
516
where
517
- F : Fn ( & S , $( $T, ) * & VirtualMachine ) -> R + ' static ,
517
+ F : Fn ( & S , $( $T, ) * & VirtualMachine ) -> R + ' static + Send + Sync ,
518
518
S : PyValue ,
519
519
$( $T: FromArgs , ) *
520
520
R : IntoPyObject ,
@@ -530,7 +530,7 @@ macro_rules! into_py_native_func_tuple {
530
530
531
531
impl <F , $( $T, ) * R > IntoPyNativeFunc <( $( OwnedParam <$T>, ) * ) , R , ( ) > for F
532
532
where
533
- F : Fn ( $( $T, ) * ) -> R + ' static ,
533
+ F : Fn ( $( $T, ) * ) -> R + ' static + Send + Sync ,
534
534
$( $T: FromArgs , ) *
535
535
R : IntoPyObject ,
536
536
{
@@ -541,7 +541,7 @@ macro_rules! into_py_native_func_tuple {
541
541
542
542
impl <F , S , $( $T, ) * R > IntoPyNativeFunc <( RefParam <S >, $( OwnedParam <$T>, ) * ) , R , ( ) > for F
543
543
where
544
- F : Fn ( & S , $( $T, ) * ) -> R + ' static ,
544
+ F : Fn ( & S , $( $T, ) * ) -> R + ' static + Send + Sync ,
545
545
S : PyValue ,
546
546
$( $T: FromArgs , ) *
547
547
R : IntoPyObject ,
0 commit comments