Skip to content

Commit 21e88f2

Browse files
committed
keep original Arguments as PythonArguments
1 parent b4d0eaf commit 21e88f2

File tree

37 files changed

+663
-5555
lines changed

37 files changed

+663
-5555
lines changed

ast-pyo3/src/gen/to_py_ast.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ impl<R> PyNode for ast::ExcepthandlerExceptHandler<R> {
808808
}
809809
}
810810

811-
impl<R> PyNode for ast::Arguments<R> {
811+
impl<R> PyNode for ast::PythonArguments<R> {
812812
#[inline]
813813
fn py_type_cache() -> &'static OnceCell<(Py<PyAny>, Py<PyAny>)> {
814814
static PY_TYPE: OnceCell<(Py<PyAny>, Py<PyAny>)> = OnceCell::new();
@@ -2288,7 +2288,7 @@ impl ToPyAst for ast::ExcepthandlerExceptHandler<TextRange> {
22882288
}
22892289
}
22902290

2291-
impl ToPyAst for ast::Arguments<TextRange> {
2291+
impl ToPyAst for ast::PythonArguments<TextRange> {
22922292
#[inline]
22932293
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
22942294
let cache = Self::py_type_cache().get().unwrap();
@@ -4312,7 +4312,7 @@ impl ToPyAst for ast::ExcepthandlerExceptHandler<SourceRange> {
43124312
}
43134313
}
43144314

4315-
impl ToPyAst for ast::Arguments<SourceRange> {
4315+
impl ToPyAst for ast::PythonArguments<SourceRange> {
43164316
#[inline]
43174317
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
43184318
let cache = Self::py_type_cache().get().unwrap();
@@ -4820,7 +4820,7 @@ fn init_types(py: Python) -> PyResult<()> {
48204820
cache_py_type::<ast::Comprehension>(ast_module)?;
48214821
cache_py_type::<ast::Excepthandler>(ast_module)?;
48224822
cache_py_type::<ast::ExcepthandlerExceptHandler>(ast_module)?;
4823-
cache_py_type::<ast::Arguments>(ast_module)?;
4823+
cache_py_type::<ast::PythonArguments>(ast_module)?;
48244824
cache_py_type::<ast::Arg>(ast_module)?;
48254825
cache_py_type::<ast::Keyword>(ast_module)?;
48264826
cache_py_type::<ast::Alias>(ast_module)?;

ast-pyo3/src/gen/wrapper_located.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3289,10 +3289,10 @@ impl ExcepthandlerExceptHandler {
32893289

32903290
#[pyclass(module="rustpython_ast.located", name="_arguments", extends=super::Ast, frozen)]
32913291
#[derive(Clone, Debug)]
3292-
pub struct Arguments(pub &'static ast::Arguments<SourceRange>);
3292+
pub struct Arguments(pub &'static ast::PythonArguments<SourceRange>);
32933293

3294-
impl From<&'static ast::Arguments<SourceRange>> for Arguments {
3295-
fn from(node: &'static ast::Arguments<SourceRange>) -> Self {
3294+
impl From<&'static ast::PythonArguments<SourceRange>> for Arguments {
3295+
fn from(node: &'static ast::PythonArguments<SourceRange>) -> Self {
32963296
Arguments(node)
32973297
}
32983298
}
@@ -3304,7 +3304,7 @@ impl ToPyObject for Arguments {
33043304
}
33053305
}
33063306

3307-
impl ToPyWrapper for ast::Arguments<SourceRange> {
3307+
impl ToPyWrapper for ast::PythonArguments<SourceRange> {
33083308
#[inline]
33093309
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
33103310
Ok(Arguments(self).to_object(py))
@@ -4392,7 +4392,7 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
43924392
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
43934393
super::init_type::<Excepthandler, ast::Excepthandler>(py, m)?;
43944394
super::init_type::<ExcepthandlerExceptHandler, ast::ExcepthandlerExceptHandler>(py, m)?;
4395-
super::init_type::<Arguments, ast::Arguments>(py, m)?;
4395+
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
43964396
super::init_type::<Arg, ast::Arg>(py, m)?;
43974397
super::init_type::<Keyword, ast::Keyword>(py, m)?;
43984398
super::init_type::<Alias, ast::Alias>(py, m)?;

ast-pyo3/src/gen/wrapper_ranged.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3289,10 +3289,10 @@ impl ExcepthandlerExceptHandler {
32893289

32903290
#[pyclass(module="rustpython_ast.ranged", name="_arguments", extends=super::Ast, frozen)]
32913291
#[derive(Clone, Debug)]
3292-
pub struct Arguments(pub &'static ast::Arguments<TextRange>);
3292+
pub struct Arguments(pub &'static ast::PythonArguments<TextRange>);
32933293

3294-
impl From<&'static ast::Arguments<TextRange>> for Arguments {
3295-
fn from(node: &'static ast::Arguments<TextRange>) -> Self {
3294+
impl From<&'static ast::PythonArguments<TextRange>> for Arguments {
3295+
fn from(node: &'static ast::PythonArguments<TextRange>) -> Self {
32963296
Arguments(node)
32973297
}
32983298
}
@@ -3304,7 +3304,7 @@ impl ToPyObject for Arguments {
33043304
}
33053305
}
33063306

3307-
impl ToPyWrapper for ast::Arguments<TextRange> {
3307+
impl ToPyWrapper for ast::PythonArguments<TextRange> {
33083308
#[inline]
33093309
fn to_py_wrapper(&'static self, py: Python) -> PyResult<Py<PyAny>> {
33103310
Ok(Arguments(self).to_object(py))
@@ -4096,7 +4096,7 @@ pub fn add_to_module(py: Python, m: &PyModule) -> PyResult<()> {
40964096
super::init_type::<Comprehension, ast::Comprehension>(py, m)?;
40974097
super::init_type::<Excepthandler, ast::Excepthandler>(py, m)?;
40984098
super::init_type::<ExcepthandlerExceptHandler, ast::ExcepthandlerExceptHandler>(py, m)?;
4099-
super::init_type::<Arguments, ast::Arguments>(py, m)?;
4099+
super::init_type::<Arguments, ast::PythonArguments>(py, m)?;
41004100
super::init_type::<Arg, ast::Arg>(py, m)?;
41014101
super::init_type::<Keyword, ast::Keyword>(py, m)?;
41024102
super::init_type::<Alias, ast::Alias>(py, m)?;

ast-pyo3/src/py_ast.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ impl ToPyAst for ConversionFlag {
7878
}
7979
}
8080

81-
impl<R> ToPyAst for ast::FunctionArguments<R>
81+
impl<R> ToPyAst for ast::Arguments<R>
8282
where
83-
Self: Clone,
84-
ast::Arguments<R>: ToPyAst,
83+
R: Clone,
84+
ast::PythonArguments<R>: ToPyAst,
8585
{
8686
#[inline]
8787
fn to_py_ast<'py>(&self, py: Python<'py>) -> PyResult<&'py PyAny> {
88-
let arguments = ast::Arguments::from(self.clone());
88+
let arguments = self.to_python_arguments();
8989
arguments.to_py_ast(py)
9090
}
9191
}

ast-pyo3/src/wrapper.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ impl<T: ToPyWrapper> ToPyWrapper for Vec<T> {
9494
}
9595

9696
#[pyclass(module = "rustpython_ast", name = "AST", subclass)]
97-
impl<R> ToPyWrapper for ast::FunctionArguments<R>
97+
impl<R> ToPyWrapper for ast::Arguments<R>
9898
where
9999
Self: Clone,
100-
ast::Arguments<R>: ToPyWrapper,
100+
ast::PythonArguments<R>: ToPyWrapper,
101101
{
102102
#[inline]
103103
fn to_py_wrapper(&'static self, _py: Python) -> PyResult<Py<PyAny>> {

0 commit comments

Comments
 (0)