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

Improve error messages for #[pyfunction] defined inside #[pymethods] #4349

Merged

Commits on Jul 16, 2024

  1. Improve error messages for #[pyfunction] defined inside #[pymethods]

    Make error message more specific when `#[pyfunction]` is used in
    `#[pymethods]`.
    
    Effectively, this replaces the error message:
    
    ```
    error: static method needs #[staticmethod] attribute
    ```
    
    To:
    ```
    functions inside #[pymethods] do not need to be annotated with #[pyfunction]
    ```
    
    ...and also removes the other misleading error messages to the function in
    question.
    
    Fixes PyO3#4340
    
    Co-authored-by: László Vaskó <[email protected]>
    csernazs and vlaci committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    56f70a2 View commit details
    Browse the repository at this point in the history
  2. review fixes

    csernazs committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    7eba98c View commit details
    Browse the repository at this point in the history