File tree 3 files changed +11
-3
lines changed
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ edition = "2021"
6
6
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7
7
8
8
[features ]
9
+ default = [" compiler" ]
9
10
threading = [" rustpython-common/threading" , " rustpython-vm/threading" ]
10
11
zlib = [" libz-sys" , " flate2/zlib" ]
11
12
bz2 = [" bzip2" ]
12
13
ssl = [" openssl" , " openssl-sys" , " foreign-types-shared" ]
13
14
ssl-vendor = [" ssl" , " openssl/vendored" , " openssl-probe" ]
15
+ compiler = [" rustpython-vm/compiler" ]
14
16
15
17
[dependencies ]
16
18
# rustpython crates
Original file line number Diff line number Diff line change @@ -15,8 +15,15 @@ mod decl {
15
15
PyRef :: try_from_object ( vm, co) ?
16
16
} else if let Ok ( co_str) = PyStrRef :: try_from_object ( vm, obj. clone ( ) ) {
17
17
// String:
18
- vm. compile ( co_str. as_str ( ) , compiler:: Mode :: Exec , "<dis>" . to_owned ( ) )
19
- . map_err ( |err| vm. new_syntax_error ( & err) ) ?
18
+ #[ cfg( feature = "compiler" ) ]
19
+ {
20
+ vm. compile ( co_str. as_str ( ) , compiler:: Mode :: Exec , "<dis>" . to_owned ( ) )
21
+ . map_err ( |err| vm. new_syntax_error ( & err) ) ?
22
+ }
23
+ #[ cfg( not( feature = "compiler" ) ) ]
24
+ {
25
+ Err ( vm. new_not_implemented_error ( "compiler feature is turned off" . to_owned ( ) ) )
26
+ }
20
27
} else {
21
28
PyRef :: try_from_object ( vm, obj) ?
22
29
} ;
Original file line number Diff line number Diff line change @@ -207,7 +207,6 @@ impl VirtualMachine {
207
207
self . new_exception_msg ( overflow_error, msg)
208
208
}
209
209
210
- #[ cfg( any( feature = "rustpython-parser" , feature = "rustpython-codegen" ) ) ]
211
210
pub fn new_syntax_error ( & self , error : & crate :: compiler:: CompileError ) -> PyBaseExceptionRef {
212
211
let syntax_error_type = match & error. error {
213
212
#[ cfg( feature = "rustpython-parser" ) ]
You can’t perform that action at this time.
0 commit comments