pub fn new(config: PythonConfig) -> Result<MainPythonInterpreter<'a>, &'static str> {
        match config.terminfo_resolution {
            TerminfoResolution::Dynamic => {
                if let Some(v) = resolve_terminfo_dirs() {
                    env::set_var("TERMINFO_DIRS", &v);
                }
            }
            TerminfoResolution::Static(ref v) => {
                env::set_var("TERMINFO_DIRS", v);
            }
            TerminfoResolution::None => {}
        }

        let (raw_allocator, raw_rust_allocator) = match config.raw_allocator {
            PythonRawAllocator::Jemalloc => (Some(raw_jemallocator()), None),
            PythonRawAllocator::Rust => (None, Some(make_raw_rust_memory_allocator())),
            PythonRawAllocator::System => (None, None),
        };

        let frozen_modules = make_custom_frozen_modules(&config);

        let mut res = MainPythonInterpreter {
            config,
            frozen_modules,
            init_run: false,
            raw_allocator,
            raw_rust_allocator,
            gil: None,
            py: None,
            program_name: None,
        };

        res.init()?;

        Ok(res)
    }
/// Construct a Python interpreter from a configuration.
///
/// The Python interpreter is initialized as a side-effect. The GIL is held.
Construct a Python interpreter from a configuration.
The Python interpreter is initialized as a side-effect. The GIL is held.
Construct a Python interpreter from a configuration . The Python interpreter is initialized as a side - effect . The GIL is held .
pub fn new(config: PythonConfig) -> Result<MainPythonInterpreter<'a>, &'static str> {
        match config.terminfo_resolution {
            TerminfoResolution::Dynamic => {
                if let Some(v) = resolve_terminfo_dirs() {
                    env::set_var("TERMINFO_DIRS", &v);
                }
            }
            TerminfoResolution::Static(ref v) => {
                env::set_var("TERMINFO_DIRS", v);
            }
            TerminfoResolution::None => {}
        }
        let (raw_allocator, raw_rust_allocator) = match config.raw_allocator {
            PythonRawAllocator::Jemalloc => (Some(raw_jemallocator()), None),
            PythonRawAllocator::Rust => (None, Some(make_raw_rust_memory_allocator())),
            PythonRawAllocator::System => (None, None),
        };
        let frozen_modules = make_custom_frozen_modules(&config);
        let mut res = MainPythonInterpreter {
            config,
            frozen_modules,
            init_run: false,
            raw_allocator,
            raw_rust_allocator,
            gil: None,
            py: None,
            program_name: None,
        };
        res.init()?;
        Ok(res)
    }
pub fn new ( config : PythonConfig ) -> Result < MainPythonInterpreter < ' a > , & ' static str > { match config . terminfo_resolution { TerminfoResolution :: Dynamic => { if let Some ( v ) = resolve_terminfo_dirs ( ) { env :: set_var ( " " , & v ) ; } } TerminfoResolution :: Static ( ref v ) => { env :: set_var ( " " , v ) ; } TerminfoResolution :: None => { } } let ( raw_allocator , raw_rust_allocator ) = match config . raw_allocator { PythonRawAllocator :: Jemalloc => ( Some ( raw_jemallocator ( ) ) , None ) , PythonRawAllocator :: Rust => ( None , Some ( make_raw_rust_memory_allocator ( ) ) ) , PythonRawAllocator :: System => ( None , None ) , } ; let frozen_modules = make_custom_frozen_modules ( & config ) ; let mut res = MainPythonInterpreter { config , frozen_modules , init_run : false , raw_allocator , raw_rust_allocator , gil : None , py : None , program_name : None , } ; res . init ( ) ? ; Ok ( res ) }
Construct a Python interpreter from a configuration.
Construct a Python interpreter from a configuration .
config
PythonConfig