Title: Increase parameter limit for trait beyond 7 argumentsIntoPyNativeFn · Issue #6098 · RustPython/RustPython · GitHub
Open Graph Title: Increase parameter limit for trait beyond 7 argumentsIntoPyNativeFn · Issue #6098 · RustPython/RustPython
X Title: Increase parameter limit for trait beyond 7 argumentsIntoPyNativeFn · Issue #6098 · RustPython/RustPython
Description: Summary The current IntoPyNativeFn trait implementation has a hard limit of 7 parameters (excluding &VirtualMachine), which prevents defining Python methods with more arguments using the #[pymethod] attribute. Problem When trying to defi...
Open Graph Description: Summary The current IntoPyNativeFn trait implementation has a hard limit of 7 parameters (excluding &VirtualMachine), which prevents defining Python methods with more arguments using the #[pymethod...
X Description: Summary The current IntoPyNativeFn trait implementation has a hard limit of 7 parameters (excluding &VirtualMachine), which prevents defining Python methods with more arguments using the #[pyme...
Opengraph URL: https://github.com/RustPython/RustPython/issues/6098
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Increase parameter limit for trait beyond 7 argumentsIntoPyNativeFn","articleBody":"## Summary \n \nThe current `IntoPyNativeFn` trait implementation has a hard limit of 7 parameters (excluding `\u0026VirtualMachine`), which prevents defining Python methods with more arguments using the `#[pymethod]` attribute. \n \n## Problem \n \nWhen trying to define a Python method with more than 7 parameters, the compiler fails with:\nerror[E0277]: the trait bound is not satisfiedfn(..., ..., i32, f32, i32, i32, i32, i32, i32, i32, i32, ...) -\u003e ... {...::orb}: IntoPyNativeFn\u003c...\u003e\n\n \n## Example \n \nThis function fails to compile due to having 11 parameters: \n```rust \n#[pymethod] \nfn orb( \n query_path: String, \n source_path: String, \n nfeatures: i32, \n scale_factor: f32, \n nlevels: i32, \n edge_threshold: i32, \n first_level: i32, \n wta_k: i32, \n score_type: i32, \n patch_size: i32, \n fast_threshold: i32, \n vm: \u0026VirtualMachine, \n) -\u003e PyResult\u003cPyObjectRef\u003e { ... } \nWhile this function with 7 parameters compiles successfully:\n\n#[pymethod] \nfn sift( \n query_path: String, \n source_path: String, \n nfeatures: i32, \n n_octave_layers: i32, \n contrast_threshold: f64, \n edge_threshold: f64, \n sigma: f64, \n vm: \u0026VirtualMachine \n) -\u003e PyResult\u003cPyObjectRef\u003e { ... }\n\n\n\n\nExtend the macro to support more parameter combinations, perhaps up to 15-20 parameters. \n\n","author":{"url":"https://github.com/topcoco","@type":"Person","name":"topcoco"},"datePublished":"2025-08-16T11:02:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/6098/RustPython/issues/6098"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c7ff3d26-aa38-45f6-ed91-037633a184f3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8DAE:9F9DA:2145033:2DA7483:696ABC55 |
| html-safe-nonce | 516101af4e26c49a056f0828e146a778173f7e1b6ca197f05fb8bdcce2cc2cd4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REFFOjlGOURBOjIxNDUwMzM6MkRBNzQ4Mzo2OTZBQkM1NSIsInZpc2l0b3JfaWQiOiI1MzQ4MTIxMTEwMTM1ODgwNzg5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 842f5c879a8d923fe8628b38c223369c9ccf33d1f3e8410ac04ac44eb23774bf |
| hovercard-subject-tag | issue:3327168808 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/RustPython/RustPython/6098/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fa8b348627fd0c08917504695527392866a9799d09c4d5985272d64020d6372c/RustPython/RustPython/issues/6098 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fa8b348627fd0c08917504695527392866a9799d09c4d5985272d64020d6372c/RustPython/RustPython/issues/6098 |
| og:image:alt | Summary The current IntoPyNativeFn trait implementation has a hard limit of 7 parameters (excluding &VirtualMachine), which prevents defining Python methods with more arguments using the #[pymethod... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | topcoco |
| hostname | github.com |
| expected-hostname | github.com |
| None | 46ce962e0e18113ea447391b6ace8b02d4d2861e57b4fbab3658698f73d8855b |
| turbo-cache-control | no-preview |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 30300f30bb3949de255e84a146706a3bdb5c19c9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width