Skip to content

Commit 5f0cdde

Browse files
committed
Fixes typos in vm/
1 parent 7868070 commit 5f0cdde

20 files changed

+28
-27
lines changed

Lib/importlib/_bootstrap_external.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ def __hash__(self):
10971097
return hash(self.name) ^ hash(self.path)
10981098

10991099
def create_module(self, spec):
1100-
"""Create an unitialized extension module"""
1100+
"""Create an uninitialized extension module"""
11011101
module = _bootstrap._call_with_frames_removed(
11021102
_imp.create_dynamic, spec)
11031103
_bootstrap._verbose_message('extension module {!r} loaded from {!r}',

vm/src/builtins/dict.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ impl PyDictRef {
462462
key: K,
463463
vm: &VirtualMachine,
464464
) -> PyResult<Option<PyObjectRef>> {
465-
// Test if this object is a true dict, or mabye a subclass?
465+
// Test if this object is a true dict, or maybe a subclass?
466466
// If it is a dict, we can directly invoke inner_get_item_option,
467467
// and prevent the creation of the KeyError exception.
468468
// Also note, that we prevent the creation of a full PyStr object

vm/src/builtins/float.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,9 @@ impl PyFloat {
409409
None if ndigits.is_positive() => i32::MAX,
410410
None => i32::MIN,
411411
};
412-
let float = float_ops::round_float_digits(self.value, ndigits)
413-
.ok_or_else(|| vm.new_overflow_error("overflow ocurred during round".to_owned()))?;
412+
let float = float_ops::round_float_digits(self.value, ndigits).ok_or_else(|| {
413+
vm.new_overflow_error("overflow occurred during round".to_owned())
414+
})?;
414415
vm.ctx.new_float(float)
415416
} else {
416417
let fract = self.value.fract();

vm/src/builtins/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ impl PyFrozenSet {
633633
vec![]
634634
};
635635

636-
// Return empty fs if iterable passed is emtpy and only for exact fs types.
636+
// Return empty fs if iterable passed is empty and only for exact fs types.
637637
if elements.is_empty() && cls.is(&vm.ctx.types.frozenset_type) {
638638
Ok(vm.ctx.empty_frozenset.clone())
639639
} else {

vm/src/frame.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ impl ExecutingFrame<'_> {
424424
}
425425
}
426426

427-
/// Ok(Err(e)) means that an error ocurred while calling throw() and the generator should try
427+
/// Ok(Err(e)) means that an error occurred while calling throw() and the generator should try
428428
/// sending it
429429
fn gen_throw(
430430
&mut self,

vm/src/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ impl<T: TryFromObject> FromArgOptional for T {
311311

312312
/// A map of keyword arguments to their values.
313313
///
314-
/// A built-in function with a `KwArgs` parameter is analagous to a Python
314+
/// A built-in function with a `KwArgs` parameter is analogous to a Python
315315
/// function with `**kwargs`. All remaining keyword arguments are extracted
316316
/// (and hence the function will permit an arbitrary number of them).
317317
///

vm/src/import.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub fn import_builtin(vm: &VirtualMachine, module_name: &str) -> PyResult {
9595
.get(module_name)
9696
.ok_or_else(|| {
9797
vm.new_import_error(
98-
format!("Cannot import bultin module {}", module_name),
98+
format!("Cannot import builtin module {}", module_name),
9999
module_name,
100100
)
101101
})

vm/src/pyobject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ pub trait TryFromObject: Sized {
848848
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self>;
849849
}
850850

851-
/// Rust-side only version of TryFromObject to reduce unnessessary Rc::clone
851+
/// Rust-side only version of TryFromObject to reduce unnecessary Rc::clone
852852
impl<T: TryFromBorrowedObject> TryFromObject for T {
853853
fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> {
854854
TryFromBorrowedObject::try_from_borrowed_object(vm, &obj)

vm/src/stdlib/collections.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ mod _collections {
131131
deque.clear();
132132
unsafe {
133133
// `maxlen` is better to be defined as UnsafeCell in common practice,
134-
// but then more type works without any safety benifits
134+
// but then more type works without any safety benefits
135135
let unsafe_maxlen =
136136
&zelf.maxlen as *const _ as *const std::cell::UnsafeCell<Option<usize>>;
137137
*(*unsafe_maxlen).get() = maxlen;

vm/src/stdlib/imp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn _imp_create_builtin(spec: PyObjectRef, vm: &VirtualMachine) -> PyResult {
7171
}
7272

7373
fn _imp_exec_builtin(_mod: PyModuleRef) -> i32 {
74-
// TOOD: Should we do something here?
74+
// TODO: Should we do something here?
7575
0
7676
}
7777

vm/src/stdlib/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ mod _io {
549549
#[pymethod]
550550
fn read(instance: PyObjectRef, size: OptionalSize, vm: &VirtualMachine) -> PyResult {
551551
if let Some(size) = size.to_usize() {
552-
// FIXME: unnessessary zero-init
552+
// FIXME: unnecessary zero-init
553553
let b = PyByteArray::from(vec![0; size]).into_ref(vm);
554554
let n = <Option<usize>>::try_from_object(
555555
vm,

vm/src/stdlib/itertools.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ mod decl {
586586
state.grouper = None;
587587

588588
if !state.next_group {
589-
// FIXME: unnecessary clone. current_key always exist until assinging new
589+
// FIXME: unnecessary clone. current_key always exist until assigning new
590590
let current_key = state.current_key.clone();
591591
drop(state);
592592

vm/src/stdlib/operator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ mod _operator {
224224
vm._membership(a, b)
225225
}
226226

227-
/// Return the number of occurences of b in a.
227+
/// Return the number of occurrences of b in a.
228228
#[pyfunction(name = "countOf")]
229229
fn count_of(a: PyObjectRef, b: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> {
230230
let mut count: usize = 0;
@@ -249,7 +249,7 @@ mod _operator {
249249
a.get_item(b, vm)
250250
}
251251

252-
/// Return the number of occurences of b in a.
252+
/// Return the number of occurrences of b in a.
253253
#[pyfunction(name = "indexOf")]
254254
fn index_of(a: PyObjectRef, b: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> {
255255
let mut index: usize = 0;

vm/src/stdlib/pystruct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub(crate) mod _struct {
237237
// First determine "@", "<", ">","!" or "="
238238
let endianness = parse_endianness(&mut chars);
239239

240-
// Now, analyze struct string furter:
240+
// Now, analyze struct string further:
241241
let (codes, size, arg_count) = parse_format_codes(&mut chars, endianness)
242242
.map_err(|err| new_struct_error(vm, err))?;
243243

vm/src/stdlib/signal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ fn trigger_signals(
154154
vm: &VirtualMachine,
155155
) -> PyResult<()> {
156156
for (signum, trigger) in TRIGGERS.iter().enumerate().skip(1) {
157-
let triggerd = trigger.swap(false, Ordering::Relaxed);
158-
if triggerd {
157+
let triggered = trigger.swap(false, Ordering::Relaxed);
158+
if triggered {
159159
if let Some(handler) = &signal_handlers[signum] {
160160
if vm.is_callable(handler) {
161161
vm.invoke(handler, (signum, vm.ctx.none()))?;

vm/src/stdlib/sre.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ mod _sre {
7676
) -> PyResult<Pattern> {
7777
// FIXME:
7878
// pattern could only be None if called by re.Scanner
79-
// re.Scanner has no offical API and in CPython's implement
79+
// re.Scanner has no official API and in CPython's implement
8080
// isbytes will be hanging (-1)
8181
// here is just a hack to let re.Scanner works only with str not bytes
8282
let isbytes = !vm.is_none(&pattern) && !pattern.payload_is::<PyStr>();

vm/src/stdlib/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn get_time() -> f64 {
6161
fn time_time_ns(_vm: &VirtualMachine) -> u64 {
6262
match SystemTime::now().duration_since(UNIX_EPOCH) {
6363
Ok(v) => v.as_nanos() as u64,
64-
Err(_) => unsafe { std::hint::unreachable_unchecked() }, // guaranted to be not to be happen with now() + UNIX_EPOCH,
64+
Err(_) => unsafe { std::hint::unreachable_unchecked() }, // guaranteed to be not to be happen with now() + UNIX_EPOCH,
6565
}
6666
}
6767

vm/src/stdlib/winapi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ fn husize(h: HANDLE) -> usize {
2525
h as usize
2626
}
2727

28-
trait Convertable {
28+
trait Convertible {
2929
fn is_err(&self) -> bool;
3030
}
3131

32-
impl Convertable for HANDLE {
32+
impl Convertible for HANDLE {
3333
fn is_err(&self) -> bool {
3434
*self == handleapi::INVALID_HANDLE_VALUE
3535
}
3636
}
37-
impl Convertable for i32 {
37+
impl Convertible for i32 {
3838
fn is_err(&self) -> bool {
3939
*self == 0
4040
}
4141
}
4242

43-
fn cvt<T: Convertable>(vm: &VirtualMachine, res: T) -> PyResult<T> {
43+
fn cvt<T: Convertible>(vm: &VirtualMachine, res: T) -> PyResult<T> {
4444
if res.is_err() {
4545
Err(errno_err(vm))
4646
} else {

vm/src/sysmodule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ prefix -- prefix used to find the Python library
604604
thread_info -- a struct sequence with information about the thread implementation.
605605
version -- the version of this interpreter as a string
606606
version_info -- version information as a named tuple
607-
_base_executable -- __PYVENV_LAUNCHER__ enviroment variable if defined, else sys.executable.
607+
_base_executable -- __PYVENV_LAUNCHER__ environment variable if defined, else sys.executable.
608608
609609
__stdin__ -- the original stdin; don't touch!
610610
__stdout__ -- the original stdout; don't touch!

vm/src/vm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ impl VirtualMachine {
377377

378378
let res = inner_init();
379379

380-
self.expect_pyresult(res, "initializiation failed");
380+
self.expect_pyresult(res, "initialization failed");
381381

382382
self.initialized = true;
383383
}
@@ -1658,7 +1658,7 @@ impl VirtualMachine {
16581658
.unwrap();
16591659
Ok(match cmp(obj, other, op, self)? {
16601660
Either::A(obj) => PyArithmaticValue::from_object(self, obj).map(Either::A),
1661-
Either::B(arithmatic) => arithmatic.map(Either::B),
1661+
Either::B(arithmetic) => arithmetic.map(Either::B),
16621662
})
16631663
};
16641664

0 commit comments

Comments
 (0)