File tree 3 files changed +14
-3
lines changed 3 files changed +14
-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,18 @@ 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
+ let _ = co_str;
26
+ return Err (
27
+ vm. new_not_implemented_error ( "compiler feature is turned off" . to_owned ( ) )
28
+ ) ;
29
+ }
20
30
} else {
21
31
PyRef :: try_from_object ( vm, obj) ?
22
32
} ;
Original file line number Diff line number Diff line change @@ -228,7 +228,6 @@ impl VirtualMachine {
228
228
self . new_exception_msg ( overflow_error, msg)
229
229
}
230
230
231
- #[ cfg( any( feature = "rustpython-parser" , feature = "rustpython-codegen" ) ) ]
232
231
pub fn new_syntax_error ( & self , error : & crate :: compiler:: CompileError ) -> PyBaseExceptionRef {
233
232
let syntax_error_type = match & error. error {
234
233
#[ cfg( feature = "rustpython-parser" ) ]
You can’t perform that action at this time.
0 commit comments