Skip to content

Implement array math operator function#2175

Merged
coolreader18 merged 5 commits into
RustPython:masterfrom
qingshi163:dev_array_op
Sep 2, 2020
Merged

Implement array math operator function#2175
coolreader18 merged 5 commits into
RustPython:masterfrom
qingshi163:dev_array_op

Conversation

@qingshi163
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Member

@coolreader18 coolreader18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! A few nits regarding use of PyObject::new but otherwise this is good to merge!

Comment thread vm/src/stdlib/array.rs Outdated
Comment on lines +343 to +349
let obj = PyObject::new(
PyArray {
array: PyRwLock::new(sliced)
},
PyArray::class(vm),
None
);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let obj = PyObject::new(
PyArray {
array: PyRwLock::new(sliced)
},
PyArray::class(vm),
None
);
let obj = PyArray {
array: PyRwLock::new(sliced)
}
.into_simple_object(vm);

Comment thread vm/src/stdlib/array.rs Outdated
Comment on lines +374 to +380
PyObject::new(
PyArray {
array: PyRwLock::new(sliced)
},
PyArray::class(vm),
None
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, you can just do PyArray { .. }.into_simple_object(vm)

Copy link
Copy Markdown
Member

@coolreader18 coolreader18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!

@coolreader18 coolreader18 merged commit dad2b70 into RustPython:master Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants