Skip to content

Optionally disable console by feature #5691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ license.workspace = true
default = ["threading", "stdlib", "importlib"]
importlib = ["rustpython-vm/importlib"]
encodings = ["rustpython-vm/encodings"]
quiet-stdio = ["rustpython-vm/quiet-stdio"]
stdlib = ["rustpython-stdlib", "rustpython-pylib", "encodings"]
flame-it = ["rustpython-vm/flame-it", "flame", "flamescope"]
freeze-stdlib = ["stdlib", "rustpython-vm/freeze-stdlib", "rustpython-pylib?/freeze-stdlib"]
1 change: 1 addition & 0 deletions vm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ codegen = ["rustpython-codegen", "ast"]
parser = ["rustpython-parser", "ast"]
serde = ["dep:serde"]
wasmbind = ["chrono/wasmbind", "getrandom/wasm_js", "wasm-bindgen"]
quiet-stdio = []

[dependencies]
rustpython-compiler = { workspace = true, optional = true }
5 changes: 4 additions & 1 deletion vm/src/vm/mod.rs
Original file line number Diff line number Diff line change
@@ -296,7 +296,10 @@ impl VirtualMachine {
let importlib = import::init_importlib_base(self)?;
self.import_utf8_encodings()?;

#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
#[cfg(all(
any(not(target_arch = "wasm32"), target_os = "wasi"),
not(feature = "quiet-stdio")
))]
{
let io = import::import_builtin(self, "_io")?;
let set_stdio = |name, fd, write| {

Unchanged files with check annotations Beta

.multiple(true)
.value_name("get-pip args")
.min_values(0)
.help(

Check warning on line 67 in src/settings.rs

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (PYTHONDONTWRITEBYTECODE)
"install the pip package manager for rustpython; \
requires rustpython be build with the ssl feature enabled.",
),
.multiple(true)
.help("Give the verbosity (can be applied multiple times)"),
)
.arg(

Check warning on line 84 in src/settings.rs

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (PYTHONNOUSERSITE)
Arg::with_name("debug")
.short("d")
.multiple(true)

Check warning on line 87 in src/settings.rs

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (PYTHONUNBUFFERED)
.help("Debug the parser."),
)
.arg(
let entry = entry?;
let metadata = entry.metadata()?;
let path = entry.path();

Check warning on line 59 in examples/parse_folder.rs

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (Erreur)
if metadata.is_dir() {
res.extend(parse_folder(&path)?);
}
match kind {
AugAssignKind::Name { id } => {
// stack: RESULT

Check warning on line 2188 in compiler/codegen/src/compile.rs

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (nkwd)
self.compile_name(id, NameUsage::Store)?;
}
AugAssignKind::Subscript => {

Check warning on line 2191 in compiler/codegen/src/compile.rs

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (nkwd)
// stack: CONTAINER SLICE RESULT
emit!(self, Instruction::Rotate3);
emit!(self, Instruction::StoreSubscript);

Check warning on line 2194 in compiler/codegen/src/compile.rs

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (nkwd)
}
AugAssignKind::Attr { idx } => {
// stack: CONTAINER RESULT
self.compile_expression(step)?;
}
let step = step.is_some();
emit!(self, Instruction::BuildSlice { step });

Check warning on line 2484 in compiler/codegen/src/compile.rs

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (nrots)
}
Expr::Yield(ExprYield { value, .. }) => {
if !self.ctx.in_func() {

Check warning on line 2487 in compiler/codegen/src/compile.rs

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (nrots)
return Err(self.error(CodegenErrorType::InvalidYield));
}
self.mark_generator();