@@ -559,6 +559,7 @@ where
559559/// 
560560/// ``` 
561561/// use std::time::Duration; 
562+ /// use std::ffi::CString; 
562563/// 
563564/// use pyo3::prelude::*; 
564565/// 
@@ -572,11 +573,11 @@ where
572573/// async fn py_sleep(seconds: f32) -> PyResult<()> { 
573574///     let test_mod = Python::with_gil(|py| -> PyResult<PyObject> { 
574575///         Ok( 
575- ///             PyModule::from_code_bound ( 
576+ ///             PyModule::from_code ( 
576577///                 py, 
577- ///                 PYTHON_CODE, 
578- ///                 "test_into_future/test_mod.py", 
579- ///                 "test_mod" 
578+ ///                 &CString::new( PYTHON_CODE).unwrap() , 
579+ ///                 &CString::new( "test_into_future/test_mod.py").unwrap() , 
580+ ///                 &CString::new( "test_mod").unwrap(),  
580581///             )? 
581582///             .into() 
582583///         ) 
@@ -613,6 +614,7 @@ pub fn into_future(
613614/// ``` 
614615/// use pyo3::prelude::*; 
615616/// use futures::{StreamExt, TryStreamExt}; 
617+ /// use std::ffi::CString; 
616618/// 
617619/// const TEST_MOD: &str = r#" 
618620/// import asyncio 
@@ -627,11 +629,11 @@ pub fn into_future(
627629/// # #[pyo3_async_runtimes::tokio::main] 
628630/// # async fn main() -> PyResult<()> { 
629631/// let stream = Python::with_gil(|py| { 
630- ///     let test_mod = PyModule::from_code_bound ( 
632+ ///     let test_mod = PyModule::from_code ( 
631633///         py, 
632- ///         TEST_MOD, 
633- ///         "test_rust_coroutine/test_mod.py", 
634- ///         "test_mod", 
634+ ///         &CString::new( TEST_MOD).unwrap() , 
635+ ///         &CString::new( "test_rust_coroutine/test_mod.py").unwrap() , 
636+ ///         &CString::new( "test_mod").unwrap() , 
635637///     )?; 
636638/// 
637639///     pyo3_async_runtimes::tokio::into_stream_with_locals_v1( 
@@ -673,6 +675,7 @@ pub fn into_stream_with_locals_v1(
673675/// ``` 
674676/// use pyo3::prelude::*; 
675677/// use futures::{StreamExt, TryStreamExt}; 
678+ /// use std::ffi::CString; 
676679/// 
677680/// const TEST_MOD: &str = r#" 
678681/// import asyncio 
@@ -687,11 +690,11 @@ pub fn into_stream_with_locals_v1(
687690/// # #[pyo3_async_runtimes::tokio::main] 
688691/// # async fn main() -> PyResult<()> { 
689692/// let stream = Python::with_gil(|py| { 
690- ///     let test_mod = PyModule::from_code_bound ( 
693+ ///     let test_mod = PyModule::from_code ( 
691694///         py, 
692- ///         TEST_MOD, 
693- ///         "test_rust_coroutine/test_mod.py", 
694- ///         "test_mod", 
695+ ///         &CString::new( TEST_MOD).unwrap() , 
696+ ///         &CString::new( "test_rust_coroutine/test_mod.py").unwrap() , 
697+ ///         &CString::new( "test_mod").unwrap() , 
695698///     )?; 
696699/// 
697700///     pyo3_async_runtimes::tokio::into_stream_v1(test_mod.call_method0("gen")?) 
@@ -730,6 +733,7 @@ pub fn into_stream_v1(
730733/// ``` 
731734/// use pyo3::prelude::*; 
732735/// use futures::{StreamExt, TryStreamExt}; 
736+ /// use std::ffi::CString; 
733737/// 
734738/// const TEST_MOD: &str = r#" 
735739/// import asyncio 
@@ -744,11 +748,11 @@ pub fn into_stream_v1(
744748/// # #[pyo3_async_runtimes::tokio::main] 
745749/// # async fn main() -> PyResult<()> { 
746750/// let stream = Python::with_gil(|py| { 
747- ///     let test_mod = PyModule::from_code_bound ( 
751+ ///     let test_mod = PyModule::from_code ( 
748752///         py, 
749- ///         TEST_MOD, 
750- ///         "test_rust_coroutine/test_mod.py", 
751- ///         "test_mod", 
753+ ///         &CString::new( TEST_MOD).unwrap() , 
754+ ///         &CString::new( "test_rust_coroutine/test_mod.py").unwrap() , 
755+ ///         &CString::new( "test_mod").unwrap() , 
752756///     )?; 
753757/// 
754758///     pyo3_async_runtimes::tokio::into_stream_with_locals_v2( 
@@ -790,6 +794,7 @@ pub fn into_stream_with_locals_v2(
790794/// ``` 
791795/// use pyo3::prelude::*; 
792796/// use futures::{StreamExt, TryStreamExt}; 
797+ /// use std::ffi::CString; 
793798/// 
794799/// const TEST_MOD: &str = r#" 
795800/// import asyncio 
@@ -804,11 +809,11 @@ pub fn into_stream_with_locals_v2(
804809/// # #[pyo3_async_runtimes::tokio::main] 
805810/// # async fn main() -> PyResult<()> { 
806811/// let stream = Python::with_gil(|py| { 
807- ///     let test_mod = PyModule::from_code_bound ( 
812+ ///     let test_mod = PyModule::from_code ( 
808813///         py, 
809- ///         TEST_MOD, 
810- ///         "test_rust_coroutine/test_mod.py", 
811- ///         "test_mod", 
814+ ///         &CString::new( TEST_MOD).unwrap() , 
815+ ///         &CString::new( "test_rust_coroutine/test_mod.py").unwrap() , 
816+ ///         &CString::new( "test_mod").unwrap() , 
812817///     )?; 
813818/// 
814819///     pyo3_async_runtimes::tokio::into_stream_v2(test_mod.call_method0("gen")?) 
0 commit comments