Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaee68d2

Browse files
authored
Fixfreeze-stdlib +Interpreter::without_stdlib (RustPython#5051)
* Fix pylib invalidation config* Fix Interpreter::without_stdlib with frozen-stdlib feature
1 parentd4be55c commitaee68d2

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

‎pylib/build.rs‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
fnmain(){
2-
process_python_libs("../Lib/python_builtins/*");
2+
process_python_libs("../vm/Lib/python_builtins/*");
33

44
#[cfg(not(feature ="stdlib"))]
5-
process_python_libs("../Lib/core_modules/*");
6-
7-
#[cfg(feature ="stdlib")]
8-
process_python_libs("../../Lib/**/*");
5+
process_python_libs("../vm/Lib/core_modules/*");
6+
#[cfg(feature ="freeze-stdlib")]
7+
ifcfg!(windows){
8+
process_python_libs("../Lib/**/*");
9+
}else{
10+
process_python_libs("./Lib/**/*");
11+
}
912

1013
ifcfg!(windows){
1114
ifletOk(real_path) = std::fs::read_to_string("Lib"){

‎vm/src/vm/mod.rs‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,13 @@ impl VirtualMachine {
244244

245245
fnimport_utf8_encodings(&mutself) ->PyResult<()>{
246246
import::import_frozen(self,"codecs")?;
247-
let encoding_module_name =ifcfg!(feature ="freeze-stdlib"){
248-
"encodings.utf_8"
249-
}else{
250-
"encodings_utf_8"
251-
};
247+
// FIXME: See corresponding part of `core_frozen_inits`
248+
// let encoding_module_name = if cfg!(feature = "freeze-stdlib") {
249+
// "encodings.utf_8"
250+
// } else {
251+
// "encodings_utf_8"
252+
// };
253+
let encoding_module_name ="encodings_utf_8";
252254
let encoding_module = import::import_frozen(self, encoding_module_name)?;
253255
let getregentry = encoding_module.get_attr("getregentry",self)?;
254256
let codec_info = getregentry.call((),self)?;
@@ -875,7 +877,9 @@ fn core_frozen_inits() -> impl Iterator<Item = (&'static str, FrozenModule)> {
875877

876878
// core stdlib Python modules that the vm calls into, but are still used in Python
877879
// application code, e.g. copyreg
878-
#[cfg(not(feature ="freeze-stdlib"))]
880+
// FIXME: Initializing core_modules here results duplicated frozen module generation for core_modules.
881+
// We need a way to initialize this modules for both `Interpreter::without_stdlib()` and `InterpreterConfig::new().init_stdlib().interpreter()`
882+
// #[cfg(not(feature = "freeze-stdlib"))]
879883
ext_modules!(
880884
iter,
881885
dir ="./Lib/core_modules",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp