Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support calling functions with named args #24

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

pvcnt
Copy link
Contributor

@pvcnt pvcnt commented Dec 4, 2024

This is a minimal PR to fix #22. I'm not familiar at all with Rust, my coding style may hence not be optimal.


// Handle named arguments.
let py_kwargs = PyDict::new(py);
for name in args.names_map()?.iter() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was unable to use map here due to my lack of knowledge with Rust.

src/lib.rs Outdated
.collect::<PyResult<Vec<PyObject>>>()?;

// Handle named arguments.
let py_kwargs = PyDict::new(py);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could not understand why new_bound does not work.

Copy link
Owner

Choose a reason for hiding this comment

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

new_bound is for a newer version of pyo3 than this package was on. It's there now.

.github/workflows/CI.yml Outdated Show resolved Hide resolved
@inducer inducer force-pushed the support-named-args branch from ac358b6 to 0f93f42 Compare December 4, 2024 20:07
@inducer inducer enabled auto-merge (rebase) December 4, 2024 20:09
@inducer inducer force-pushed the support-named-args branch from 0f93f42 to 93e4a19 Compare December 4, 2024 20:11
@inducer inducer merged commit 58d51fe into inducer:main Dec 4, 2024
11 checks passed
@pvcnt pvcnt deleted the support-named-args branch December 4, 2024 20:18
@pvcnt
Copy link
Contributor Author

pvcnt commented Dec 4, 2024

Awesome, thank you for your help @inducer! May I ask for a new release, if that is possible? 😇

@inducer
Copy link
Owner

inducer commented Dec 4, 2024

Sure thing. https://github.com/inducer/starlark-pyo3/releases/tag/v2024.1.5

Here's the build that should eventually upload the release to the package index: https://github.com/inducer/starlark-pyo3/actions/runs/12167634055

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.

Cannot call a function with named arguments
2 participants