Fix cspell warnings

This commit is contained in:
Jeong YunWon committed 2025-06-27 12:32:59 +09:00
1 parent 993ea8923c
commit 3673372d3d
30 files changed
+79 -50

No files matched your search

+2
View File
@@ -45,7 +45,9 @@ SA_ONSTACK
stackdepth
stringlib
structseq
subparams
tok_oldval
tvars
unaryop
unparse
unparser
+6
View File
@@ -84,6 +84,7 @@ getrandom
getrecursionlimit
getrefcount
getsizeof
getswitchinterval
getweakrefcount
getweakrefs
getwindowsversion
@@ -167,13 +168,17 @@ pycs
pyexpat
PYTHONBREAKPOINT
PYTHONDEBUG
PYTHONDONTWRITEBYTECODE
PYTHONHASHSEED
PYTHONHOME
PYTHONINSPECT
PYTHONINTMAXSTRDIGITS
PYTHONNOUSERSITE
PYTHONOPTIMIZE
PYTHONPATH
PYTHONPATH
PYTHONSAFEPATH
PYTHONUNBUFFERED
PYTHONVERBOSE
PYTHONWARNDEFAULTENCODING
PYTHONWARNINGS
@@ -206,6 +211,7 @@ seennl
setattro
setcomp
setrecursionlimit
setswitchinterval
showwarnmsg
signum
slotnames
+4
View File
@@ -3,8 +3,10 @@ arrayvec
bidi
biguint
bindgen
bitand
bitflags
bitor
bitxor
bstr
byteorder
byteset
@@ -15,6 +17,7 @@ cranelift
cstring
datelike
deserializer
deserializers
fdiv
flamescope
flate2
@@ -31,6 +34,7 @@ keccak
lalrpop
lexopt
libc
libcall
libloading
libz
longlong
+3
View File
@@ -67,6 +67,8 @@
"GetSet",
"groupref",
"internable",
"jitted",
"jitting",
"lossily",
"makeunicodedata",
"miri",
@@ -85,6 +87,7 @@
"pygetset",
"pyimpl",
"pylib",
"pymath",
"pymember",
"PyMethod",
"PyModule",
+2 -1
View File
@@ -1,3 +1,4 @@
// cspell:ignore uncomputed
use crate::atomic::{PyAtomic, Radium};
use crate::format::CharLen;
use crate::wtf8::{CodePoint, Wtf8, Wtf8Buf};
@@ -424,7 +425,7 @@ pub fn zfill(bytes: &[u8], width: usize) -> Vec<u8> {
}
}
/// Convert a string to ascii compatible, escaping unicodes into escape
/// Convert a string to ascii compatible, escaping unicode-s into escape
/// sequences.
pub fn to_ascii(value: &str) -> AsciiString {
let mut ascii = Vec::new();
+13 -13
View File
@@ -2361,7 +2361,7 @@ impl Compiler<'_> {
// self.jump_to_fail_pop(pc, JumpOp::PopJumpIfFalse)?;
// }
// // Check that the number of subpatterns is not absurd.
// // Check that the number of sub-patterns is not absurd.
// if size.saturating_sub(1) > (i32::MAX as usize) {
// panic!("too many sub-patterns in mapping pattern");
// // return self.compiler_error("too many sub-patterns in mapping pattern");
@@ -2469,27 +2469,27 @@ impl Compiler<'_> {
emit!(self, Instruction::CopyItem { index: 1_u32 });
self.compile_pattern(alt, pc)?;
let nstores = pc.stores.len();
let n_stores = pc.stores.len();
if i == 0 {
// Save the captured names from the first alternative.
control = Some(pc.stores.clone());
} else {
let control_vec = control.as_ref().unwrap();
if nstores != control_vec.len() {
if n_stores != control_vec.len() {
return Err(self.error(CodegenErrorType::ConflictingNameBindPattern));
} else if nstores > 0 {
} else if n_stores > 0 {
// Check that the names occur in the same order.
for icontrol in (0..nstores).rev() {
let name = &control_vec[icontrol];
for i_control in (0..n_stores).rev() {
let name = &control_vec[i_control];
// Find the index of `name` in the current stores.
let istores =
let i_stores =
pc.stores.iter().position(|n| n == name).ok_or_else(|| {
self.error(CodegenErrorType::ConflictingNameBindPattern)
})?;
if icontrol != istores {
if i_control != i_stores {
// The orders differ; we must reorder.
assert!(istores < icontrol, "expected istores < icontrol");
let rotations = istores + 1;
assert!(i_stores < i_control, "expected i_stores < i_control");
let rotations = i_stores + 1;
// Rotate pc.stores: take a slice of the first `rotations` items...
let rotated = pc.stores[0..rotations].to_vec();
// Remove those elements.
@@ -2497,13 +2497,13 @@ impl Compiler<'_> {
pc.stores.remove(0);
}
// Insert the rotated slice at the appropriate index.
let insert_pos = icontrol - istores;
let insert_pos = i_control - i_stores;
for (j, elem) in rotated.into_iter().enumerate() {
pc.stores.insert(insert_pos + j, elem);
}
// Also perform the same rotation on the evaluation stack.
for _ in 0..(istores + 1) {
self.pattern_helper_rotate(icontrol + 1)?;
for _ in 0..(i_stores + 1) {
self.pattern_helper_rotate(i_control + 1)?;
}
}
}
+1 -1
View File
@@ -93,7 +93,7 @@ pub fn compile(
source_path: &str,
opts: CompileOpts,
) -> Result<CodeObject, CompileError> {
// TODO: do this less hackily; ruff's parser should translate a CRLF line
// TODO: do this less hacky; ruff's parser should translate a CRLF line
// break in a multiline string into just an LF in the parsed value
#[cfg(windows)]
let source = &source.replace("\r\n", "\n");
@@ -1,3 +1,4 @@
// cspell:ignore aheui
/// Setting up a project with a frozen stdlib can be done *either* by using `rustpython::InterpreterConfig` or `rustpython_vm::Interpreter::with_init`.
/// See each function for example.
///
+1 -1
View File
@@ -56,7 +56,7 @@ fn parse_folder(path: &Path) -> std::io::Result<Vec<ParsedFile>> {
let parsed_file = parse_python_file(&path);
match &parsed_file.result {
Ok(_) => {}
Err(y) => error!("Erreur in file {path:?} {y:?}"),
Err(y) => error!("Error in file {path:?} {y:?}"),
}
res.push(parsed_file);
+2 -2
View File
@@ -77,9 +77,9 @@ impl StackMachine {
}
pub fn run(&mut self, code: CodeObject) {
let mut oparg_state = OpArgState::default();
let mut op_arg_state = OpArgState::default();
let _ = code.instructions.iter().try_for_each(|&word| {
let (instruction, arg) = oparg_state.get(word);
let (instruction, arg) = op_arg_state.get(word);
self.process_instruction(instruction, arg, &code.constants, &code.names)
});
}
+2 -2
View File
@@ -168,7 +168,7 @@ fn test_power() {
assert_approx_eq!(pow(-4.5, 4.0), Ok(410.0625));
assert_approx_eq!(pow(-2.5, 3.0), Ok(-15.625));
assert_approx_eq!(pow(-2.5, 4.0), Ok(39.0625));
// Test positive float base, positive float exponent with nonintegral exponents
// Test positive float base, positive float exponent with non-integral exponents
assert_approx_eq!(pow(2.0, 2.5), Ok(5.656854249492381));
assert_approx_eq!(pow(3.0, 3.5), Ok(46.76537180435969));
assert_approx_eq!(pow(4.0, 4.5), Ok(512.0));
@@ -187,7 +187,7 @@ fn test_power() {
assert_approx_eq!(pow(-2.0, -3.0), Ok(-0.125));
assert_approx_eq!(pow(-2.0, -4.0), Ok(0.0625));
// Currently negative float base with nonintegral exponent is not supported:
// Currently negative float base with non-integral exponent is not supported:
// assert_approx_eq!(pow(-2.0, 2.5), Ok(5.656854249492381));
// assert_approx_eq!(pow(-3.0, 3.5), Ok(-46.76537180435969));
// assert_approx_eq!(pow(-4.0, 4.5), Ok(512.0));
+1
View File
@@ -242,6 +242,7 @@ fn write_profile(settings: &Settings) -> Result<(), Box<dyn std::error::Error>>
Some("html") => ProfileFormat::Html,
Some("text") => ProfileFormat::Text,
None if profile_output == Some("-".as_ref()) => ProfileFormat::Text,
// cspell:ignore speedscope
Some("speedscope") | None => ProfileFormat::SpeedScope,
Some(other) => {
error!("Unknown profile format {}", other);
+2
View File
@@ -1,3 +1,5 @@
// cspell:ignore ossl osslconf
fn main() {
println!(r#"cargo::rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_COMP"))"#);
println!(r#"cargo::rustc-check-cfg=cfg(openssl_vendored)"#);
+1 -1
View File
@@ -40,7 +40,7 @@ mod gc {
}
#[pyfunction]
fn get_refererts(_args: FuncArgs, vm: &VirtualMachine) -> PyResult {
fn get_referents(_args: FuncArgs, vm: &VirtualMachine) -> PyResult {
Err(vm.new_not_implemented_error(""))
}
+6 -6
View File
@@ -140,7 +140,7 @@ mod _lzma {
#[pyarg(any, default = FORMAT_AUTO)]
format: i32,
#[pyarg(any, optional)]
memlimit: Option<u64>,
mem_limit: Option<u64>,
#[pyarg(any, optional)]
filters: Option<u32>,
}
@@ -149,15 +149,15 @@ mod _lzma {
type Args = LZMADecompressorConstructorArgs;
fn py_new(cls: PyTypeRef, args: Self::Args, vm: &VirtualMachine) -> PyResult {
if args.format == FORMAT_RAW && args.memlimit.is_some() {
if args.format == FORMAT_RAW && args.mem_limit.is_some() {
return Err(vm.new_value_error("Cannot specify memory limit with FORMAT_RAW"));
}
let memlimit = args.memlimit.unwrap_or(u64::MAX);
let mem_limit = args.mem_limit.unwrap_or(u64::MAX);
let filters = args.filters.unwrap_or(0);
let stream_result = match args.format {
FORMAT_AUTO => Stream::new_auto_decoder(memlimit, filters),
FORMAT_XZ => Stream::new_stream_decoder(memlimit, filters),
FORMAT_ALONE => Stream::new_lzma_decoder(memlimit),
FORMAT_AUTO => Stream::new_auto_decoder(mem_limit, filters),
FORMAT_XZ => Stream::new_stream_decoder(mem_limit, filters),
FORMAT_ALONE => Stream::new_lzma_decoder(mem_limit),
// TODO: FORMAT_RAW
_ => return Err(new_lzma_error("Invalid format", vm)),
};
+1 -1
View File
@@ -26,7 +26,7 @@ pub struct PyDescriptorOwned {
pub struct PyMethodDescriptor {
pub common: PyDescriptor,
pub method: &'static PyMethodDef,
// vectorcall: vectorcallfunc,
// vectorcall: vector_call_func,
pub objclass: &'static Py<PyType>, // TODO: move to tp_members
}
+5 -5
View File
@@ -1,5 +1,5 @@
#[cfg(feature = "jit")]
mod jitfunc;
mod jit;
use super::{
PyAsyncGen, PyCode, PyCoroutine, PyDictRef, PyGenerator, PyStr, PyStrRef, PyTupleRef, PyType,
@@ -324,7 +324,7 @@ impl PyFunction {
) -> PyResult {
#[cfg(feature = "jit")]
if let Some(jitted_code) = self.jitted_code.get() {
match jitfunc::get_jit_args(self, &func_args, jitted_code, vm) {
match jit::get_jit_args(self, &func_args, jitted_code, vm) {
Ok(args) => {
return Ok(args.invoke().to_pyobject(vm));
}
@@ -530,10 +530,10 @@ impl PyFunction {
fn __jit__(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<()> {
zelf.jitted_code
.get_or_try_init(|| {
let arg_types = jitfunc::get_jit_arg_types(&zelf, vm)?;
let ret_type = jitfunc::jit_ret_type(&zelf, vm)?;
let arg_types = jit::get_jit_arg_types(&zelf, vm)?;
let ret_type = jit::jit_ret_type(&zelf, vm)?;
rustpython_jit::compile(&zelf.code.code, &arg_types, ret_type)
.map_err(|err| jitfunc::new_jit_error(err.to_string(), vm))
.map_err(|err| jit::new_jit_error(err.to_string(), vm))
})
.map(drop)
}
File renamed without changes.
+1
View File
@@ -1,3 +1,4 @@
// cspell:ignore iparam
use std::sync::LazyLock;
use super::type_;
+2 -2
View File
@@ -17,9 +17,9 @@ pub struct PyModuleDef {
// pub size: isize,
pub methods: &'static [PyMethodDef],
pub slots: PyModuleSlots,
// traverse: traverseproc
// traverse: traverse_proc
// clear: inquiry
// free: freefunc
// free: free_func
}
pub type ModuleCreate =
+2 -2
View File
@@ -126,12 +126,12 @@ fn object_getstate_default(obj: &PyObject, required: bool, vm: &VirtualMachine)
if required {
let mut basicsize = obj.class().slots.basicsize;
// if obj.class().slots.dictoffset > 0
// if obj.class().slots.dict_offset > 0
// && !obj.class().slots.flags.has_feature(PyTypeFlags::MANAGED_DICT)
// {
// basicsize += std::mem::size_of::<PyObjectRef>();
// }
// if obj.class().slots.weaklistoffset > 0 {
// if obj.class().slots.weaklist_offset > 0 {
// basicsize += std::mem::size_of::<PyObjectRef>();
// }
if let Some(ref slot_names) = slot_names {
+5
View File
@@ -575,6 +575,7 @@ impl PyStr {
fn _compute_hash(&self, vm: &VirtualMachine) -> hash::PyHash {
let hash_val = vm.state.hash_secret.hash_bytes(self.as_bytes());
debug_assert_ne!(hash_val, hash::SENTINEL);
// cspell:ignore cmpxchg
// like with char_len, we don't need a cmpxchg loop, since it'll always be the same value
self.hash.store(hash_val, atomic::Ordering::Relaxed);
hash_val
@@ -2259,7 +2260,9 @@ mod tests {
("Format This As Title String", "fOrMaT thIs aS titLe String"),
("Format,This-As*Title;String", "fOrMaT,thIs-aS*titLe;String"),
("Getint", "getInt"),
// cspell:disable-next-line
("Greek Ωppercases ...", "greek ωppercases ..."),
// cspell:disable-next-line
("Greek ῼitlecases ...", "greek ῳitlecases ..."),
];
for (title, input) in tests {
@@ -2274,7 +2277,9 @@ mod tests {
"A Titlecased Line",
"A\nTitlecased Line",
"A Titlecased, Line",
// cspell:disable-next-line
"Greek Ωppercases ...",
// cspell:disable-next-line
"Greek ῼitlecases ...",
];
+4 -4
View File
@@ -118,15 +118,15 @@ impl FuncArgs {
{
// last `kwarg_names.len()` elements of args in order of appearance in the call signature
let total_argc = args.len();
let kwargc = kwarg_names.len();
let posargc = total_argc - kwargc;
let kwarg_count = kwarg_names.len();
let pos_arg_count = total_argc - kwarg_count;
let posargs = args.by_ref().take(posargc).collect();
let pos_args = args.by_ref().take(pos_arg_count).collect();
let kwargs = kwarg_names.zip_eq(args).collect::<IndexMap<_, _>>();
FuncArgs {
args: posargs,
args: pos_args,
kwargs,
}
}
+1 -1
View File
@@ -66,7 +66,7 @@ const fn zst_ref_out_of_thin_air<T: 'static>(x: T) -> &'static T {
}
/// Get the STATIC_FUNC of the passed function. The same
/// requirements of zero-sizedness apply, see that documentation for details.
/// requirements of zero-sized-ness apply, see that documentation for details.
///
/// Equivalent to [`IntoPyNativeFn::into_func()`], but usable in a const context. This is only
/// valid if the function is zero-sized, i.e. that `std::mem::size_of::<F>() == 0`. If you call
+2 -2
View File
@@ -44,7 +44,7 @@ unsafe impl Traverse for PyInner<Erased> {
// 2. call vtable's trace function to trace payload
// self.typ.trace(tracer_fn);
self.dict.traverse(tracer_fn);
// weak_list keeps a *pointer* to a struct for maintaince weak ref, so no ownership, no trace
// weak_list keeps a *pointer* to a struct for maintenance of weak ref, so no ownership, no trace
self.slots.traverse(tracer_fn);
if let Some(f) = self.vtable.trace {
@@ -64,7 +64,7 @@ unsafe impl<T: PyObjectPayload> Traverse for PyInner<T> {
// (No need to call vtable's trace function because we already know the type)
// self.typ.trace(tracer_fn);
self.dict.traverse(tracer_fn);
// weak_list keeps a *pointer* to a struct for maintaince weak ref, so no ownership, no trace
// weak_list keeps a *pointer* to a struct for maintenance of weak ref, so no ownership, no trace
self.slots.traverse(tracer_fn);
T::try_traverse(&self.payload, tracer_fn);
}
+1 -1
View File
@@ -443,7 +443,7 @@ mod builtins {
.is_ok_and(|fd| fd == expected)
};
// everything is normalish, we can just rely on rustyline to use stdin/stdout
// everything is normal, we can just rely on rustyline to use stdin/stdout
if fd_matches(&stdin, 0) && fd_matches(&stdout, 1) && std::io::stdin().is_terminal() {
let prompt = prompt.as_ref().map_or("", |s| s.as_str());
let mut readline = Readline::new(());
+4 -4
View File
@@ -69,17 +69,17 @@ impl ExternalLibs {
library_path: &str,
_vm: &VirtualMachine,
) -> Result<(usize, &SharedLibrary), libloading::Error> {
let nlib = SharedLibrary::new(library_path)?;
let key = nlib.get_pointer();
let new_lib = SharedLibrary::new(library_path)?;
let key = new_lib.get_pointer();
match self.libraries.get(&key) {
Some(l) => {
if l.is_closed() {
self.libraries.insert(key, nlib);
self.libraries.insert(key, new_lib);
}
}
_ => {
self.libraries.insert(key, nlib);
self.libraries.insert(key, new_lib);
}
};
+1
View File
@@ -1,3 +1,4 @@
// cspell:ignore typevarobject funcobj
use crate::{PyRef, VirtualMachine, stdlib::PyModule};
pub(crate) use decl::*;
+2
View File
@@ -36,9 +36,11 @@ pub struct Settings {
/// sys.argv
pub argv: Vec<String>,
// cspell:ignore Xfoo
/// -Xfoo[=bar]
pub xoptions: Vec<(String, Option<String>)>,
// cspell:ignore Wfoo
/// -Wfoo
pub warnoptions: Vec<String>,
+1 -1
View File
@@ -45,7 +45,7 @@ fn basic(c: &mut Criterion) {
// START GENERATED by generate_tests.py
#[rustfmt::skip] let p5 = Pattern { pattern: "(Python)\\1", code: &[14, 18, 1, 12, 12, 6, 0, 80, 121, 116, 104, 111, 110, 0, 0, 0, 0, 0, 0, 17, 0, 16, 80, 16, 121, 16, 116, 16, 104, 16, 111, 16, 110, 17, 1, 11, 0, 1] };
// END GENERATED
// pattern p6 = re.compile('([0a-z][a-z0-9]*,)+') #, 'a5,b7,c9,'), # Disable the fastmap optimization
// pattern p6 = re.compile('([0a-z][a-z0-9]*,)+') #, 'a5,b7,c9,'), # Disable the fast map optimization
// START GENERATED by generate_tests.py
#[rustfmt::skip] let p6 = Pattern { pattern: "([0a-z][a-z0-9]*,)+", code: &[14, 4, 0, 2, 4294967295, 23, 31, 1, 4294967295, 17, 0, 13, 7, 16, 48, 22, 97, 122, 0, 24, 13, 0, 4294967295, 13, 8, 22, 97, 122, 22, 48, 57, 0, 1, 16, 44, 17, 1, 18, 1] };
// END GENERATED