mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-17 01:51:39 +09:00
Remove the __inside_vm hack for procedural macros
This commit is contained in:
@@ -21,7 +21,7 @@ use super::objtype::PyClassRef;
|
||||
/// - a text string encoded using the specified encoding\n \
|
||||
/// - any object implementing the buffer API.\n \
|
||||
/// - an integer";
|
||||
#[pyclass(name = "bytes", __inside_vm)]
|
||||
#[pyclass(name = "bytes")]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PyBytes {
|
||||
inner: PyByteInner,
|
||||
@@ -71,7 +71,7 @@ pub fn init(context: &PyContext) {
|
||||
});
|
||||
}
|
||||
|
||||
#[pyimpl(__inside_vm)]
|
||||
#[pyimpl]
|
||||
impl PyBytesRef {
|
||||
#[pymethod(name = "__new__")]
|
||||
fn bytes_new(
|
||||
|
||||
@@ -327,13 +327,13 @@ impl Iterator for DictIter {
|
||||
|
||||
macro_rules! dict_iterator {
|
||||
( $name: ident, $iter_name: ident, $class: ident, $iter_class: ident, $class_name: literal, $iter_class_name: literal, $result_fn: expr) => {
|
||||
#[pyclass(name = $class_name, __inside_vm)]
|
||||
#[pyclass(name = $class_name)]
|
||||
#[derive(Debug)]
|
||||
struct $name {
|
||||
pub dict: PyDictRef,
|
||||
}
|
||||
|
||||
#[pyimpl(__inside_vm)]
|
||||
#[pyimpl]
|
||||
impl $name {
|
||||
fn new(dict: PyDictRef) -> Self {
|
||||
$name { dict: dict }
|
||||
@@ -356,7 +356,7 @@ macro_rules! dict_iterator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyclass(name = $iter_class_name, __inside_vm)]
|
||||
#[pyclass(name = $iter_class_name)]
|
||||
#[derive(Debug)]
|
||||
struct $iter_name {
|
||||
pub dict: PyDictRef,
|
||||
@@ -364,7 +364,7 @@ macro_rules! dict_iterator {
|
||||
pub position: Cell<usize>,
|
||||
}
|
||||
|
||||
#[pyimpl(__inside_vm)]
|
||||
#[pyimpl]
|
||||
impl $iter_name {
|
||||
fn new(dict: PyDictRef) -> Self {
|
||||
$iter_name {
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::vm::VirtualMachine;
|
||||
|
||||
pub type PyGeneratorRef = PyRef<PyGenerator>;
|
||||
|
||||
#[pyclass(name = "generator", __inside_vm)]
|
||||
#[pyclass(name = "generator")]
|
||||
#[derive(Debug)]
|
||||
pub struct PyGenerator {
|
||||
frame: FrameRef,
|
||||
@@ -21,7 +21,7 @@ impl PyValue for PyGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(__inside_vm)]
|
||||
#[pyimpl]
|
||||
impl PyGenerator {
|
||||
pub fn new(frame: FrameRef, vm: &VirtualMachine) -> PyGeneratorRef {
|
||||
PyGenerator { frame }.into_ref(vm)
|
||||
|
||||
@@ -32,7 +32,7 @@ use crate::obj::objtype::PyClassRef;
|
||||
/// Base 0 means to interpret the base from the string as an integer literal.
|
||||
/// >>> int('0b100', base=0)
|
||||
/// 4
|
||||
#[pyclass(__inside_vm)]
|
||||
#[pyclass]
|
||||
#[derive(Debug)]
|
||||
pub struct PyInt {
|
||||
value: BigInt,
|
||||
@@ -111,7 +111,7 @@ impl_try_from_object_int!(
|
||||
(u64, to_u64),
|
||||
);
|
||||
|
||||
#[pyimpl(__inside_vm)]
|
||||
#[pyimpl]
|
||||
impl PyInt {
|
||||
#[pymethod(name = "__eq__")]
|
||||
fn eq(&self, other: PyObjectRef, vm: &VirtualMachine) -> PyObjectRef {
|
||||
@@ -476,7 +476,6 @@ impl PyInt {
|
||||
}
|
||||
|
||||
#[derive(FromArgs)]
|
||||
#[__inside_vm]
|
||||
struct IntOptions {
|
||||
#[pyarg(positional_only, optional = true)]
|
||||
val_options: OptionalArg<PyObjectRef>,
|
||||
|
||||
@@ -30,7 +30,7 @@ use super::objtype::{self, PyClassRef};
|
||||
/// or repr(object).
|
||||
/// encoding defaults to sys.getdefaultencoding().
|
||||
/// errors defaults to 'strict'."
|
||||
#[pyclass(name = "str", __inside_vm)]
|
||||
#[pyclass(name = "str")]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PyString {
|
||||
// TODO: shouldn't be public
|
||||
@@ -74,7 +74,7 @@ impl TryIntoRef<PyString> for &str {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl(__inside_vm)]
|
||||
#[pyimpl]
|
||||
impl PyString {
|
||||
// TODO: should with following format
|
||||
// class str(object='')
|
||||
|
||||
Reference in New Issue
Block a user