Skip to content

Commit acfa401

Browse files
committed
PyValue -> PyPayload
1 parent fdd32b2 commit acfa401

93 files changed

Lines changed: 297 additions & 293 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/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub fn py_freeze(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
112112
result_to_tokens(compile_bytecode::impl_py_freeze(input.into()))
113113
}
114114

115-
#[proc_macro_derive(PyValue)]
115+
#[proc_macro_derive(PyPayload)]
116116
pub fn pyvalue(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
117117
let input = parse_macro_input!(input as DeriveInput);
118118
result_to_tokens(pyvalue::impl_pyvalue(input))

‎derive/src/pyclass.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ pub(crate) fn impl_define_exception(exc_def: PyExceptionDef) -> Result<TokenStre
316316
pub struct #class_name {}
317317

318318
// We need this to make extend mechanism work:
319-
impl ::rustpython_vm::PyValue for #class_name {
319+
impl ::rustpython_vm::PyPayload for #class_name {
320320
fn class(vm: &::rustpython_vm::VirtualMachine) -> &::rustpython_vm::builtins::PyTypeRef {
321321
&vm.ctx.exceptions.#ctx_name
322322
}

‎derive/src/pyvalue.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub(crate) fn impl_pyvalue(input: DeriveInput) -> Result<TokenStream> {
66
let ty = &input.ident;
77

88
let ret = quote! {
9-
impl ::rustpython_vm::PyValue for #ty {
9+
impl ::rustpython_vm::PyPayload for #ty {
1010
fn class(_vm: &::rustpython_vm::VirtualMachine) -> &rustpython_vm::builtins::PyTypeRef {
1111
<Self as ::rustpython_vm::pyclass::StaticType>::static_type()
1212
}

‎stdlib/src/array.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ mod array {
3333
AsBuffer, AsMapping, Comparable, Constructor, IterNext, IterNextIterable, Iterable,
3434
PyComparisonOp,
3535
},
36-
AsPyObject, Py, PyObject, PyObjectRef, PyRef, PyResult, PyValue, TryFromBorrowedObject,
37-
TryFromObject, VirtualMachine,
36+
AsPyObject, Py, PyObject, PyObjectRef, PyPayload, PyRef, PyResult,
37+
TryFromBorrowedObject, TryFromObject, VirtualMachine,
3838
},
3939
};
4040
use itertools::Itertools;
@@ -585,7 +585,7 @@ mod array {
585585

586586
#[pyattr]
587587
#[pyclass(name = "array")]
588-
#[derive(Debug, PyValue)]
588+
#[derive(Debug, PyPayload)]
589589
pub struct PyArray {
590590
array: PyRwLock<ArrayContentType>,
591591
exports: AtomicUsize,
@@ -1282,7 +1282,7 @@ mod array {
12821282

12831283
#[pyattr]
12841284
#[pyclass(name = "array_iterator")]
1285-
#[derive(Debug, PyValue)]
1285+
#[derive(Debug, PyPayload)]
12861286
pub struct PyArrayIter {
12871287
position: AtomicUsize,
12881288
array: PyArrayRef,

‎stdlib/src/csv.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mod _csv {
1616
match_class,
1717
protocol::{PyIter, PyIterReturn},
1818
types::{IterNext, IterNextIterable},
19-
AsPyObject, Py, PyObjectRef, PyResult, PyValue, TryFromObject, VirtualMachine,
19+
AsPyObject, Py, PyObjectRef, PyPayload, PyResult, TryFromObject, VirtualMachine,
2020
};
2121
use itertools::{self, Itertools};
2222
use std::fmt;
@@ -160,7 +160,7 @@ mod _csv {
160160
}
161161

162162
#[pyclass(noattr, module = "_csv", name = "reader")]
163-
#[derive(PyValue)]
163+
#[derive(PyPayload)]
164164
pub(super) struct Reader {
165165
iter: PyIter,
166166
state: PyMutex<ReadState>,
@@ -250,7 +250,7 @@ mod _csv {
250250
}
251251

252252
#[pyclass(noattr, module = "_csv", name = "writer")]
253-
#[derive(PyValue)]
253+
#[derive(PyPayload)]
254254
pub(super) struct Writer {
255255
write: PyObjectRef,
256256
state: PyMutex<WriteState>,

‎stdlib/src/hashlib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod hashlib {
66
use crate::vm::{
77
builtins::{PyBytes, PyBytesRef, PyStrRef, PyTypeRef},
88
function::{FuncArgs, OptionalArg},
9-
PyResult, PyValue, VirtualMachine,
9+
PyPayload, PyResult, VirtualMachine,
1010
};
1111
use blake2::{Blake2b512, Blake2s256};
1212
use digest::DynDigest;
@@ -46,7 +46,7 @@ mod hashlib {
4646

4747
#[pyattr]
4848
#[pyclass(module = "hashlib", name = "hasher")]
49-
#[derive(PyValue)]
49+
#[derive(PyPayload)]
5050
struct PyHasher {
5151
name: String,
5252
buffer: PyRwLock<HashWrapper>,

‎stdlib/src/json.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ mod _json {
99
function::{IntoPyObject, IntoPyResult, OptionalArg},
1010
protocol::PyIterReturn,
1111
types::{Callable, Constructor},
12-
AsPyObject, Py, PyObjectRef, PyResult, PyValue, VirtualMachine,
12+
AsPyObject, Py, PyObjectRef, PyPayload, PyResult, VirtualMachine,
1313
};
1414
use num_bigint::BigInt;
1515
use std::str::FromStr;
1616

1717
#[pyattr(name = "make_scanner")]
1818
#[pyclass(name = "Scanner")]
19-
#[derive(Debug, PyValue)]
19+
#[derive(Debug, PyPayload)]
2020
struct JsonScanner {
2121
strict: bool,
2222
object_hook: Option<PyObjectRef>,

‎stdlib/src/pyexpat.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mod _pyexpat {
3535
builtins::{PyStr, PyStrRef, PyTypeRef},
3636
function::ArgBytesLike,
3737
function::{IntoFuncArgs, OptionalArg},
38-
PyContext, PyObjectRef, PyRef, PyResult, PyValue, TryFromObject, VirtualMachine,
38+
PyContext, PyObjectRef, PyPayload, PyRef, PyResult, TryFromObject, VirtualMachine,
3939
};
4040
use rustpython_common::lock::PyRwLock;
4141
use std::io::Cursor;
@@ -44,7 +44,7 @@ mod _pyexpat {
4444

4545
#[pyattr]
4646
#[pyclass(name = "xmlparser", module = false)]
47-
#[derive(Debug, PyValue)]
47+
#[derive(Debug, PyPayload)]
4848
pub struct PyExpatLikeXmlParser {
4949
start_element: MutableObject,
5050
end_element: MutableObject,

‎stdlib/src/pystruct.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) mod _struct {
1616
match_class,
1717
protocol::PyIterReturn,
1818
types::{Constructor, IterNext, IterNextIterable},
19-
AsPyObject, Py, PyObjectRef, PyResult, PyValue, TryFromObject, VirtualMachine,
19+
AsPyObject, Py, PyObjectRef, PyPayload, PyResult, TryFromObject, VirtualMachine,
2020
};
2121
use crossbeam_utils::atomic::AtomicCell;
2222

@@ -161,7 +161,7 @@ pub(crate) mod _struct {
161161

162162
#[pyattr]
163163
#[pyclass(name = "unpack_iterator")]
164-
#[derive(Debug, PyValue)]
164+
#[derive(Debug, PyPayload)]
165165
struct UnpackIterator {
166166
format_spec: FormatSpec,
167167
buffer: ArgBytesLike,
@@ -238,7 +238,7 @@ pub(crate) mod _struct {
238238

239239
#[pyattr]
240240
#[pyclass(name = "Struct")]
241-
#[derive(Debug, PyValue)]
241+
#[derive(Debug, PyPayload)]
242242
struct PyStruct {
243243
spec: FormatSpec,
244244
format: PyStrRef,

‎stdlib/src/random.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod _random {
99
builtins::{PyInt, PyTypeRef},
1010
function::OptionalOption,
1111
types::Constructor,
12-
PyObjectRef, PyResult, PyValue, VirtualMachine,
12+
PyObjectRef, PyPayload, PyResult, VirtualMachine,
1313
};
1414
use num_bigint::{BigInt, Sign};
1515
use num_traits::{Signed, Zero};
@@ -56,7 +56,7 @@ mod _random {
5656

5757
#[pyattr]
5858
#[pyclass(name = "Random")]
59-
#[derive(Debug, PyValue)]
59+
#[derive(Debug, PyPayload)]
6060
struct PyRandom {
6161
rng: PyMutex<PyRng>,
6262
}

0 commit comments

Comments
 (0)