Describe the bug
Positional-only arguments are mishandled in signatures with / always being put at the start of a signature with positional-only arguments regardless of how many arguments are positional only.
To Reproduce
With the following test code being targeted by mkdocstrings
# test.py def bar(foo: str, baz: int, /, *, bar: int = 123) -> None: """meow"""
and the following mkdocs.yml
# mkdocs.yml site_name: "Docs" plugins: - search - mkdocstrings: default_handler: python watch: - test.py
build documentation from this module and watch it place / at the start of bar's signature as shown in the following screenshot.
Expected behavior
/ should appear after baz in the signature.
Screenshots
System (please complete the following information):
mkdocstrings-pythonversion: 0.7.0- mkdocstrings version: 0.19.0
- griffe version: 0.20.0
- mkdocs version: 1.3.0
- Python version: 3.10
- OS: Windows
Additional context
This leads to an error being raised in cases where black is used to reformat function signatures with positional only arguments as / cannot be the first argument of a function syntax wise.
I can't really read this code but from what I can tell the responsible code might be here
| {%- if parameter.kind.value == "positional-only" -%} | |
| {%- if ns.render_pos_only_separator -%} | |
| {%- set ns.render_pos_only_separator = False %}/, {% endif -%} |
(where it's adding in / the moment it finds a positional only argument that isn't named self or cls rather than waiting until it reaches the end of the positional only arguments). I did try griffe with the example code and it seemed to be handling positional-only arguments properly.
