Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add sys.flags and sys.int_info #4568

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

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 10 additions & 0 deletions vm/src/stdlib/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,10 @@ mod sys {
dev_mode: bool,
/// -X utf8
utf8_mode: u8,
/// -X int_max_str_digits=number
int_max_str_digits: i8,
/// -P, `PYTHONSAFEPATH`
safe_path: bool,
/// -X warn_default_encoding, PYTHONWARNDEFAULTENCODING
warn_default_encoding: u8,
}
Expand All @@ -707,6 +711,8 @@ mod sys {
isolated: settings.isolated as u8,
dev_mode: settings.dev_mode,
utf8_mode: 1,
int_max_str_digits: -1,
safe_path: false,
warn_default_encoding: settings.warn_default_encoding as u8,
}
}
Expand Down Expand Up @@ -808,13 +814,17 @@ mod sys {
pub(super) struct PyIntInfo {
bits_per_digit: usize,
sizeof_digit: usize,
default_max_str_digits: usize,
str_digits_check_threshold: usize,
}

#[pyclass(with(PyStructSequence))]
impl PyIntInfo {
const INFO: Self = PyIntInfo {
bits_per_digit: 30, //?
sizeof_digit: std::mem::size_of::<u32>(),
default_max_str_digits: 4300,
str_digits_check_threshold: 640,
};
}

Expand Down