@@ -13,7 +13,6 @@ use arr_macro::arr;
1313use crossbeam_utils:: atomic:: AtomicCell ;
1414use num_traits:: { Signed , ToPrimitive } ;
1515
16- use crate :: builtins;
1716use crate :: builtins:: code:: { self , PyCode , PyCodeRef } ;
1817use crate :: builtins:: dict:: PyDictRef ;
1918use crate :: builtins:: int:: { PyInt , PyIntRef } ;
@@ -27,18 +26,14 @@ use crate::builtins::tuple::PyTuple;
2726use crate :: common:: { hash:: HashSecret , lock:: PyMutex , rc:: PyRc } ;
2827use crate :: exceptions:: { self , PyBaseException , PyBaseExceptionRef } ;
2928use crate :: frame:: { ExecutionResult , Frame , FrameRef } ;
30- use crate :: frozen;
3129use crate :: function:: { FuncArgs , IntoFuncArgs } ;
32- use crate :: import;
33- use crate :: iterator;
3430use crate :: pyobject:: {
3531 BorrowValue , Either , IdProtocol , IntoPyObject , ItemProtocol , PyArithmaticValue , PyContext ,
3632 PyObject , PyObjectRef , PyRef , PyResult , PyValue , TryFromObject , TryIntoRef , TypeProtocol ,
3733} ;
3834use crate :: scope:: Scope ;
3935use crate :: slots:: PyComparisonOp ;
40- use crate :: stdlib;
41- use crate :: sysmodule;
36+ use crate :: { builtins, bytecode, frozen, import, iterator, stdlib, sysmodule} ;
4237#[ cfg( feature = "rustpython-compiler" ) ]
4338use rustpython_compiler:: {
4439 compile:: { self , CompileOpts } ,
@@ -126,6 +121,15 @@ pub struct PyGlobalState {
126121 pub atexit_funcs : PyMutex < Vec < ( PyObjectRef , FuncArgs ) > > ,
127122}
128123
124+ impl PyGlobalState {
125+ pub fn add_frozen < I > ( & mut self , ctx : & PyContext , frozen : I )
126+ where
127+ I : IntoIterator < Item = ( String , bytecode:: FrozenModule ) > ,
128+ {
129+ self . frozen . extend ( frozen:: map_frozen ( ctx, frozen) )
130+ }
131+ }
132+
129133pub const NSIG : usize = 64 ;
130134
131135#[ derive( Copy , Clone , PartialEq , Eq ) ]
0 commit comments