mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Constructor for PyByteArray
This commit is contained in:
@@ -95,16 +95,18 @@ pub(crate) fn init(context: &Context) {
|
||||
|
||||
#[pyimpl(
|
||||
flags(BASETYPE),
|
||||
with(Initializer, Hashable, Comparable, AsBuffer, AsMapping, AsSequence, Iterable)
|
||||
with(
|
||||
Constructor,
|
||||
Initializer,
|
||||
Hashable,
|
||||
Comparable,
|
||||
AsBuffer,
|
||||
AsMapping,
|
||||
AsSequence,
|
||||
Iterable
|
||||
)
|
||||
)]
|
||||
impl PyByteArray {
|
||||
#[pyslot]
|
||||
fn slot_new(cls: PyTypeRef, _args: FuncArgs, vm: &VirtualMachine) -> PyResult {
|
||||
PyByteArray::default()
|
||||
.into_ref_with_type(vm, cls)
|
||||
.map(Into::into)
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
#[pyproperty]
|
||||
fn exports(&self) -> usize {
|
||||
@@ -706,6 +708,16 @@ impl PyByteArray {
|
||||
};
|
||||
}
|
||||
|
||||
impl Constructor for PyByteArray {
|
||||
type Args = FuncArgs;
|
||||
|
||||
fn py_new(cls: PyTypeRef, _args: Self::Args, vm: &VirtualMachine) -> PyResult {
|
||||
PyByteArray::default()
|
||||
.into_ref_with_type(vm, cls)
|
||||
.map(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
impl Initializer for PyByteArray {
|
||||
type Args = ByteInnerNewOptions;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user