diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 2981478d3..ccac7eab0 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1097,7 +1097,7 @@ class ExtensionFileLoader(FileLoader, _LoaderBasics): return hash(self.name) ^ hash(self.path) def create_module(self, spec): - """Create an unitialized extension module""" + """Create an uninitialized extension module""" module = _bootstrap._call_with_frames_removed( _imp.create_dynamic, spec) _bootstrap._verbose_message('extension module {!r} loaded from {!r}', diff --git a/vm/src/builtins/dict.rs b/vm/src/builtins/dict.rs index a911711c8..42e383f84 100644 --- a/vm/src/builtins/dict.rs +++ b/vm/src/builtins/dict.rs @@ -462,7 +462,7 @@ impl PyDictRef { key: K, vm: &VirtualMachine, ) -> PyResult> { - // Test if this object is a true dict, or mabye a subclass? + // Test if this object is a true dict, or maybe a subclass? // If it is a dict, we can directly invoke inner_get_item_option, // and prevent the creation of the KeyError exception. // Also note, that we prevent the creation of a full PyStr object diff --git a/vm/src/builtins/float.rs b/vm/src/builtins/float.rs index 32b3f5359..880e3714a 100644 --- a/vm/src/builtins/float.rs +++ b/vm/src/builtins/float.rs @@ -409,8 +409,9 @@ impl PyFloat { None if ndigits.is_positive() => i32::MAX, None => i32::MIN, }; - let float = float_ops::round_float_digits(self.value, ndigits) - .ok_or_else(|| vm.new_overflow_error("overflow ocurred during round".to_owned()))?; + let float = float_ops::round_float_digits(self.value, ndigits).ok_or_else(|| { + vm.new_overflow_error("overflow occurred during round".to_owned()) + })?; vm.ctx.new_float(float) } else { let fract = self.value.fract(); diff --git a/vm/src/builtins/set.rs b/vm/src/builtins/set.rs index e05b5ce24..b1c9109c2 100644 --- a/vm/src/builtins/set.rs +++ b/vm/src/builtins/set.rs @@ -633,7 +633,7 @@ impl PyFrozenSet { vec![] }; - // Return empty fs if iterable passed is emtpy and only for exact fs types. + // Return empty fs if iterable passed is empty and only for exact fs types. if elements.is_empty() && cls.is(&vm.ctx.types.frozenset_type) { Ok(vm.ctx.empty_frozenset.clone()) } else { diff --git a/vm/src/frame.rs b/vm/src/frame.rs index 3fac501d6..727874ba1 100644 --- a/vm/src/frame.rs +++ b/vm/src/frame.rs @@ -424,7 +424,7 @@ impl ExecutingFrame<'_> { } } - /// Ok(Err(e)) means that an error ocurred while calling throw() and the generator should try + /// Ok(Err(e)) means that an error occurred while calling throw() and the generator should try /// sending it fn gen_throw( &mut self, diff --git a/vm/src/function.rs b/vm/src/function.rs index aac8e2430..e72e23f2b 100644 --- a/vm/src/function.rs +++ b/vm/src/function.rs @@ -311,7 +311,7 @@ impl FromArgOptional for T { /// A map of keyword arguments to their values. /// -/// A built-in function with a `KwArgs` parameter is analagous to a Python +/// A built-in function with a `KwArgs` parameter is analogous to a Python /// function with `**kwargs`. All remaining keyword arguments are extracted /// (and hence the function will permit an arbitrary number of them). /// diff --git a/vm/src/import.rs b/vm/src/import.rs index 4784fc8ee..465ef299e 100644 --- a/vm/src/import.rs +++ b/vm/src/import.rs @@ -95,7 +95,7 @@ pub fn import_builtin(vm: &VirtualMachine, module_name: &str) -> PyResult { .get(module_name) .ok_or_else(|| { vm.new_import_error( - format!("Cannot import bultin module {}", module_name), + format!("Cannot import builtin module {}", module_name), module_name, ) }) diff --git a/vm/src/pyobject.rs b/vm/src/pyobject.rs index 016ce9881..f2e2ed608 100644 --- a/vm/src/pyobject.rs +++ b/vm/src/pyobject.rs @@ -848,7 +848,7 @@ pub trait TryFromObject: Sized { fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult; } -/// Rust-side only version of TryFromObject to reduce unnessessary Rc::clone +/// Rust-side only version of TryFromObject to reduce unnecessary Rc::clone impl TryFromObject for T { fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult { TryFromBorrowedObject::try_from_borrowed_object(vm, &obj) diff --git a/vm/src/stdlib/collections.rs b/vm/src/stdlib/collections.rs index 5773a68a5..c41cfd142 100644 --- a/vm/src/stdlib/collections.rs +++ b/vm/src/stdlib/collections.rs @@ -131,7 +131,7 @@ mod _collections { deque.clear(); unsafe { // `maxlen` is better to be defined as UnsafeCell in common practice, - // but then more type works without any safety benifits + // but then more type works without any safety benefits let unsafe_maxlen = &zelf.maxlen as *const _ as *const std::cell::UnsafeCell>; *(*unsafe_maxlen).get() = maxlen; diff --git a/vm/src/stdlib/imp.rs b/vm/src/stdlib/imp.rs index 93bb7f940..fdfaf062e 100644 --- a/vm/src/stdlib/imp.rs +++ b/vm/src/stdlib/imp.rs @@ -71,7 +71,7 @@ fn _imp_create_builtin(spec: PyObjectRef, vm: &VirtualMachine) -> PyResult { } fn _imp_exec_builtin(_mod: PyModuleRef) -> i32 { - // TOOD: Should we do something here? + // TODO: Should we do something here? 0 } diff --git a/vm/src/stdlib/io.rs b/vm/src/stdlib/io.rs index cfa606e2b..062efdfb9 100644 --- a/vm/src/stdlib/io.rs +++ b/vm/src/stdlib/io.rs @@ -549,7 +549,7 @@ mod _io { #[pymethod] fn read(instance: PyObjectRef, size: OptionalSize, vm: &VirtualMachine) -> PyResult { if let Some(size) = size.to_usize() { - // FIXME: unnessessary zero-init + // FIXME: unnecessary zero-init let b = PyByteArray::from(vec![0; size]).into_ref(vm); let n = >::try_from_object( vm, diff --git a/vm/src/stdlib/itertools.rs b/vm/src/stdlib/itertools.rs index 5576ac191..19679747c 100644 --- a/vm/src/stdlib/itertools.rs +++ b/vm/src/stdlib/itertools.rs @@ -586,7 +586,7 @@ mod decl { state.grouper = None; if !state.next_group { - // FIXME: unnecessary clone. current_key always exist until assinging new + // FIXME: unnecessary clone. current_key always exist until assigning new let current_key = state.current_key.clone(); drop(state); diff --git a/vm/src/stdlib/operator.rs b/vm/src/stdlib/operator.rs index 6b92a2143..922a79aea 100644 --- a/vm/src/stdlib/operator.rs +++ b/vm/src/stdlib/operator.rs @@ -224,7 +224,7 @@ mod _operator { vm._membership(a, b) } - /// Return the number of occurences of b in a. + /// Return the number of occurrences of b in a. #[pyfunction(name = "countOf")] fn count_of(a: PyObjectRef, b: PyObjectRef, vm: &VirtualMachine) -> PyResult { let mut count: usize = 0; @@ -249,7 +249,7 @@ mod _operator { a.get_item(b, vm) } - /// Return the number of occurences of b in a. + /// Return the number of occurrences of b in a. #[pyfunction(name = "indexOf")] fn index_of(a: PyObjectRef, b: PyObjectRef, vm: &VirtualMachine) -> PyResult { let mut index: usize = 0; diff --git a/vm/src/stdlib/pystruct.rs b/vm/src/stdlib/pystruct.rs index 0a35deb90..e33bdca20 100644 --- a/vm/src/stdlib/pystruct.rs +++ b/vm/src/stdlib/pystruct.rs @@ -237,7 +237,7 @@ pub(crate) mod _struct { // First determine "@", "<", ">","!" or "=" let endianness = parse_endianness(&mut chars); - // Now, analyze struct string furter: + // Now, analyze struct string further: let (codes, size, arg_count) = parse_format_codes(&mut chars, endianness) .map_err(|err| new_struct_error(vm, err))?; diff --git a/vm/src/stdlib/signal.rs b/vm/src/stdlib/signal.rs index 609baf886..398a3d07f 100644 --- a/vm/src/stdlib/signal.rs +++ b/vm/src/stdlib/signal.rs @@ -154,8 +154,8 @@ fn trigger_signals( vm: &VirtualMachine, ) -> PyResult<()> { for (signum, trigger) in TRIGGERS.iter().enumerate().skip(1) { - let triggerd = trigger.swap(false, Ordering::Relaxed); - if triggerd { + let triggered = trigger.swap(false, Ordering::Relaxed); + if triggered { if let Some(handler) = &signal_handlers[signum] { if vm.is_callable(handler) { vm.invoke(handler, (signum, vm.ctx.none()))?; diff --git a/vm/src/stdlib/sre.rs b/vm/src/stdlib/sre.rs index a62042409..514cb879f 100644 --- a/vm/src/stdlib/sre.rs +++ b/vm/src/stdlib/sre.rs @@ -76,7 +76,7 @@ mod _sre { ) -> PyResult { // FIXME: // pattern could only be None if called by re.Scanner - // re.Scanner has no offical API and in CPython's implement + // re.Scanner has no official API and in CPython's implement // isbytes will be hanging (-1) // here is just a hack to let re.Scanner works only with str not bytes let isbytes = !vm.is_none(&pattern) && !pattern.payload_is::(); diff --git a/vm/src/stdlib/time.rs b/vm/src/stdlib/time.rs index 7eb58cced..12342964b 100644 --- a/vm/src/stdlib/time.rs +++ b/vm/src/stdlib/time.rs @@ -61,7 +61,7 @@ pub fn get_time() -> f64 { fn time_time_ns(_vm: &VirtualMachine) -> u64 { match SystemTime::now().duration_since(UNIX_EPOCH) { Ok(v) => v.as_nanos() as u64, - Err(_) => unsafe { std::hint::unreachable_unchecked() }, // guaranted to be not to be happen with now() + UNIX_EPOCH, + Err(_) => unsafe { std::hint::unreachable_unchecked() }, // guaranteed to be not to be happen with now() + UNIX_EPOCH, } } diff --git a/vm/src/stdlib/winapi.rs b/vm/src/stdlib/winapi.rs index 13ee546ac..b8bf3f9e1 100644 --- a/vm/src/stdlib/winapi.rs +++ b/vm/src/stdlib/winapi.rs @@ -25,22 +25,22 @@ fn husize(h: HANDLE) -> usize { h as usize } -trait Convertable { +trait Convertible { fn is_err(&self) -> bool; } -impl Convertable for HANDLE { +impl Convertible for HANDLE { fn is_err(&self) -> bool { *self == handleapi::INVALID_HANDLE_VALUE } } -impl Convertable for i32 { +impl Convertible for i32 { fn is_err(&self) -> bool { *self == 0 } } -fn cvt(vm: &VirtualMachine, res: T) -> PyResult { +fn cvt(vm: &VirtualMachine, res: T) -> PyResult { if res.is_err() { Err(errno_err(vm)) } else { diff --git a/vm/src/sysmodule.rs b/vm/src/sysmodule.rs index 2c3d7addd..7075c03a6 100644 --- a/vm/src/sysmodule.rs +++ b/vm/src/sysmodule.rs @@ -604,7 +604,7 @@ prefix -- prefix used to find the Python library thread_info -- a struct sequence with information about the thread implementation. version -- the version of this interpreter as a string version_info -- version information as a named tuple -_base_executable -- __PYVENV_LAUNCHER__ enviroment variable if defined, else sys.executable. +_base_executable -- __PYVENV_LAUNCHER__ environment variable if defined, else sys.executable. __stdin__ -- the original stdin; don't touch! __stdout__ -- the original stdout; don't touch! diff --git a/vm/src/vm.rs b/vm/src/vm.rs index 0c74e3186..2da43ad01 100644 --- a/vm/src/vm.rs +++ b/vm/src/vm.rs @@ -377,7 +377,7 @@ impl VirtualMachine { let res = inner_init(); - self.expect_pyresult(res, "initializiation failed"); + self.expect_pyresult(res, "initialization failed"); self.initialized = true; } @@ -1658,7 +1658,7 @@ impl VirtualMachine { .unwrap(); Ok(match cmp(obj, other, op, self)? { Either::A(obj) => PyArithmaticValue::from_object(self, obj).map(Either::A), - Either::B(arithmatic) => arithmatic.map(Either::B), + Either::B(arithmetic) => arithmetic.map(Either::B), }) };