Skip to content

Commit b759808

Browse files
committed
PyObj -> PyObject
1 parent 4e5f897 commit b759808

55 files changed

Lines changed: 390 additions & 392 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

derive/src/pymodule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub fn impl_pymodule(attr: AttributeArgs, module_item: Item) -> Result<TokenStre
7676
parse_quote! {
7777
pub(crate) fn extend_module(
7878
vm: &::rustpython_vm::VirtualMachine,
79-
module: &::rustpython_vm::PyObj,
79+
module: &::rustpython_vm::PyObject,
8080
) {
8181
#module_extend_items
8282
}

stdlib/src/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ mod array {
2828
AsBuffer, AsMapping, Comparable, Constructor, IterNext, IterNextIterable, Iterable,
2929
PyComparisonOp,
3030
},
31-
IdProtocol, Py, PyComparisonValue, PyObj, PyObjectRef, PyRef, PyResult, PyValue,
31+
IdProtocol, Py, PyComparisonValue, PyObject, PyObjectRef, PyRef, PyResult, PyValue,
3232
TryFromObject, TypeProtocol, VirtualMachine,
3333
};
3434
use crossbeam_utils::atomic::AtomicCell;
@@ -1168,7 +1168,7 @@ mod array {
11681168
impl Comparable for PyArray {
11691169
fn cmp(
11701170
zelf: &Py<Self>,
1171-
other: &PyObj,
1171+
other: &PyObject,
11721172
op: PyComparisonOp,
11731173
vm: &VirtualMachine,
11741174
) -> PyResult<PyComparisonValue> {

stdlib/src/math.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod math {
66
builtins::{try_bigint_to_f64, try_f64_to_bigint, PyFloat, PyInt, PyIntRef},
77
function::{ArgIntoFloat, ArgIterable, OptionalArg, PosArgs},
88
utils::Either,
9-
PyObj, PyObjectRef, PyRef, PyResult, PySequence, TypeProtocol, VirtualMachine,
9+
PyObject, PyObjectRef, PyRef, PyResult, PySequence, TypeProtocol, VirtualMachine,
1010
};
1111
use num_bigint::BigInt;
1212
use num_traits::{One, Signed, Zero};
@@ -408,7 +408,7 @@ mod math {
408408
}
409409
}
410410

411-
fn try_magic_method(func_name: &str, vm: &VirtualMachine, value: &PyObj) -> PyResult {
411+
fn try_magic_method(func_name: &str, vm: &VirtualMachine, value: &PyObject) -> PyResult {
412412
let method = vm.get_method_or_type_error(value.to_owned(), func_name, || {
413413
format!(
414414
"type '{}' doesn't define '{}' method",

stdlib/src/resource.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod resource {
55
use crate::vm::{
66
function::{IntoPyException, IntoPyObject},
77
stdlib::os,
8-
PyObj, PyObjectRef, PyResult, PyStructSequence, TryFromBorrowedObject, VirtualMachine,
8+
PyObject, PyObjectRef, PyResult, PyStructSequence, TryFromBorrowedObject, VirtualMachine,
99
};
1010
use std::{io, mem};
1111

@@ -113,7 +113,7 @@ mod resource {
113113

114114
struct Limits(libc::rlimit);
115115
impl TryFromBorrowedObject for Limits {
116-
fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObj) -> PyResult<Self> {
116+
fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> {
117117
let seq = vm.extract_elements::<libc::rlim_t>(obj)?;
118118
match *seq {
119119
[cur, max] => Ok(Self(libc::rlimit {

vm/src/builtins/bytearray.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use crate::{
2828
IterNextIterable, Iterable, PyComparisonOp, Unconstructible, Unhashable,
2929
},
3030
utils::Either,
31-
IdProtocol, PyClassDef, PyClassImpl, PyComparisonValue, PyContext, PyObj, PyObjectRef, PyRef,
32-
PyResult, PyValue, TypeProtocol, VirtualMachine,
31+
IdProtocol, PyClassDef, PyClassImpl, PyComparisonValue, PyContext, PyObject, PyObjectRef,
32+
PyRef, PyResult, PyValue, TypeProtocol, VirtualMachine,
3333
};
3434
use bstr::ByteSlice;
3535
use crossbeam_utils::atomic::AtomicCell;
@@ -697,7 +697,7 @@ impl PyByteArray {
697697
impl Comparable for PyByteArray {
698698
fn cmp(
699699
zelf: &crate::Py<Self>,
700-
other: &PyObj,
700+
other: &PyObject,
701701
op: PyComparisonOp,
702702
vm: &VirtualMachine,
703703
) -> PyResult<PyComparisonValue> {
@@ -801,7 +801,7 @@ impl Iterable for PyByteArray {
801801
}
802802
}
803803

804-
// fn set_value(obj: &crate::PyObj, value: Vec<u8>) {
804+
// fn set_value(obj: &PyObject, value: Vec<u8>) {
805805
// obj.borrow_mut().kind = PyObjectPayload::Bytes { value };
806806
// }
807807

vm/src/builtins/bytes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::{
1616
IterNextIterable, Iterable, PyComparisonOp, Unconstructible,
1717
},
1818
utils::Either,
19-
IdProtocol, PyClassImpl, PyComparisonValue, PyContext, PyObj, PyObjectRef, PyRef, PyResult,
19+
IdProtocol, PyClassImpl, PyComparisonValue, PyContext, PyObject, PyObjectRef, PyRef, PyResult,
2020
PyValue, TryFromBorrowedObject, TypeProtocol, VirtualMachine,
2121
};
2222
use bstr::ByteSlice;
@@ -608,7 +608,7 @@ impl Hashable for PyBytes {
608608
impl Comparable for PyBytes {
609609
fn cmp(
610610
zelf: &crate::Py<Self>,
611-
other: &PyObj,
611+
other: &PyObject,
612612
op: PyComparisonOp,
613613
vm: &VirtualMachine,
614614
) -> PyResult<PyComparisonValue> {
@@ -687,7 +687,7 @@ impl IterNext for PyBytesIterator {
687687
}
688688

689689
impl TryFromBorrowedObject for PyBytes {
690-
fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObj) -> PyResult<Self> {
690+
fn try_from_borrowed_object(vm: &VirtualMachine, obj: &PyObject) -> PyResult<Self> {
691691
PyBytesInner::try_from_borrowed_object(vm, obj).map(|x| x.into())
692692
}
693693
}

vm/src/builtins/code.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use super::{PyStrRef, PyTupleRef, PyTypeRef};
66
use crate::{
77
bytecode::{self, BorrowedConstant, Constant, ConstantBag},
88
function::FuncArgs,
9-
IdProtocol, PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue, StaticType,
10-
TypeProtocol, VirtualMachine,
9+
IdProtocol, PyClassImpl, PyContext, PyObject, PyObjectRef, PyRef, PyResult, PyValue,
10+
StaticType, TypeProtocol, VirtualMachine,
1111
};
1212
use num_traits::Zero;
1313
use std::fmt;
@@ -28,7 +28,7 @@ pub struct PyConstant(pub PyObjectRef);
2828
// Ellipsis(PyObjectRef),
2929
// }
3030

31-
fn borrow_obj_constant(obj: &crate::PyObj) -> BorrowedConstant<PyConstant> {
31+
fn borrow_obj_constant(obj: &PyObject) -> BorrowedConstant<PyConstant> {
3232
match_class!(match obj {
3333
ref i @ super::int::PyInt => {
3434
let value = i.as_bigint();

vm/src/builtins/complex.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
types::{Comparable, Constructor, Hashable, PyComparisonOp},
55
IdProtocol,
66
PyArithmeticValue::{self, *},
7-
PyClassImpl, PyComparisonValue, PyContext, PyObj, PyObjectRef, PyRef, PyResult, PyValue,
7+
PyClassImpl, PyComparisonValue, PyContext, PyObject, PyObjectRef, PyRef, PyResult, PyValue,
88
TypeProtocol, VirtualMachine,
99
};
1010
use num_complex::Complex64;
@@ -73,7 +73,7 @@ pub fn init(context: &PyContext) {
7373
PyComplex::extend_class(context, &context.types.complex_type);
7474
}
7575

76-
fn to_op_complex(value: &crate::PyObj, vm: &VirtualMachine) -> PyResult<Option<Complex64>> {
76+
fn to_op_complex(value: &PyObject, vm: &VirtualMachine) -> PyResult<Option<Complex64>> {
7777
let r = if let Some(complex) = value.payload_if_subclass::<PyComplex>(vm) {
7878
Some(complex.value)
7979
} else {
@@ -410,7 +410,7 @@ impl PyComplex {
410410
impl Comparable for PyComplex {
411411
fn cmp(
412412
zelf: &crate::Py<Self>,
413-
other: &PyObj,
413+
other: &PyObject,
414414
op: PyComparisonOp,
415415
vm: &VirtualMachine,
416416
) -> PyResult<PyComparisonValue> {

vm/src/builtins/dict.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use crate::{
1515
vm::{ReprGuard, VirtualMachine},
1616
IdProtocol, ItemProtocol,
1717
PyArithmeticValue::*,
18-
PyAttributes, PyClassDef, PyClassImpl, PyComparisonValue, PyContext, PyObj, PyObjectRef, PyRef,
19-
PyResult, PyValue, TypeProtocol,
18+
PyAttributes, PyClassDef, PyClassImpl, PyComparisonValue, PyContext, PyObject, PyObjectRef,
19+
PyRef, PyResult, PyValue, TypeProtocol,
2020
};
2121
use rustpython_common::lock::PyMutex;
2222
use std::fmt;
@@ -451,7 +451,7 @@ impl AsMapping for PyDict {
451451
impl Comparable for PyDict {
452452
fn cmp(
453453
zelf: &crate::Py<Self>,
454-
other: &PyObj,
454+
other: &PyObject,
455455
op: PyComparisonOp,
456456
vm: &VirtualMachine,
457457
) -> PyResult<PyComparisonValue> {
@@ -744,7 +744,7 @@ macro_rules! dict_view {
744744
impl Comparable for $name {
745745
fn cmp(
746746
zelf: &crate::Py<Self>,
747-
other: &PyObj,
747+
other: &PyObject,
748748
op: PyComparisonOp,
749749
vm: &VirtualMachine,
750750
) -> PyResult<PyComparisonValue> {

vm/src/builtins/float.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
types::{Comparable, Constructor, Hashable, PyComparisonOp},
77
IdProtocol,
88
PyArithmeticValue::{self, *},
9-
PyClassImpl, PyComparisonValue, PyContext, PyObj, PyObjectRef, PyRef, PyResult, PyValue,
9+
PyClassImpl, PyComparisonValue, PyContext, PyObject, PyObjectRef, PyRef, PyResult, PyValue,
1010
TryFromObject, TypeProtocol, VirtualMachine,
1111
};
1212
use num_bigint::{BigInt, ToBigInt};
@@ -50,7 +50,7 @@ impl From<f64> for PyFloat {
5050
}
5151
}
5252

53-
impl PyObj {
53+
impl PyObject {
5454
pub fn try_to_f64(&self, vm: &VirtualMachine) -> PyResult<Option<f64>> {
5555
if let Some(float) = self.payload_if_exact::<PyFloat>(vm) {
5656
return Ok(Some(float.value));
@@ -73,13 +73,13 @@ impl PyObj {
7373
}
7474
}
7575

76-
pub fn try_float(obj: &crate::PyObj, vm: &VirtualMachine) -> PyResult<f64> {
76+
pub fn try_float(obj: &PyObject, vm: &VirtualMachine) -> PyResult<f64> {
7777
obj.try_to_f64(vm)?.ok_or_else(|| {
7878
vm.new_type_error(format!("must be real number, not {}", obj.class().name()))
7979
})
8080
}
8181

82-
pub(crate) fn to_op_float(obj: &PyObj, vm: &VirtualMachine) -> PyResult<Option<f64>> {
82+
pub(crate) fn to_op_float(obj: &PyObject, vm: &VirtualMachine) -> PyResult<Option<f64>> {
8383
let v = if let Some(float) = obj.payload_if_subclass::<PyFloat>(vm) {
8484
Some(float.value)
8585
} else if let Some(int) = obj.payload_if_subclass::<PyInt>(vm) {
@@ -494,7 +494,7 @@ impl PyFloat {
494494
impl Comparable for PyFloat {
495495
fn cmp(
496496
zelf: &crate::Py<Self>,
497-
other: &PyObj,
497+
other: &PyObject,
498498
op: PyComparisonOp,
499499
vm: &VirtualMachine,
500500
) -> PyResult<PyComparisonValue> {
@@ -540,7 +540,7 @@ impl Hashable for PyFloat {
540540
}
541541

542542
// Retrieve inner float value:
543-
pub(crate) fn get_value(obj: &crate::PyObj) -> f64 {
543+
pub(crate) fn get_value(obj: &PyObject) -> f64 {
544544
obj.payload::<PyFloat>().unwrap().value
545545
}
546546

0 commit comments

Comments
 (0)