Skip to content

Fixed IndexError when using @staticmethod with *args combination #1

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

Merged
merged 1 commit into from
Nov 5, 2015

Conversation

anti1869
Copy link
Contributor

@anti1869 anti1869 commented Nov 5, 2015

In this case with at least Python 3.4.3:

class Foo(object):
    @staticmethod
    def bar(*args):
        """Some docs"""

There is

Exception occurred:
  File "/Users/anti1869/Sites/video/venv-v/lib/python3.4/site-packages/sphinx_autodoc_typehints.py", line 49, in process_signature
    del argspec.args[0]
IndexError: list assignment index out of range

As you can see from the trace, args is empty in FullArgSpec.

FullArgSpec(args=[], varargs='args', varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})

So I decided to add simple check.

agronholm added a commit that referenced this pull request Nov 5, 2015
Fixed IndexError when using @staticmethod with *args combination
@agronholm agronholm merged commit a5aca6a into tox-dev:master Nov 5, 2015
@agronholm
Copy link
Collaborator

Didn't realize staticmethods would still be considered methods. Thanks!

wheerd pushed a commit to wheerd/sphinx-autodoc-typehints that referenced this pull request Nov 21, 2016
Improved formatting of type annotations.
tikuma-lsuhsc added a commit to tikuma-lsuhsc/sphinx-autodoc-typehints that referenced this pull request Jun 20, 2024
gaborbernat pushed a commit that referenced this pull request Jun 21, 2024
* test update (non-reproducible)

* fix candidate #1

* fixes issue #462

* Fix annotation check exception (#462)
Fix processing type aliases

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* reverted test_integration.py

* make _SchemaMeta hashable for ruff pre-commit test

* pre-commit ci fix try no 2

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* _get_type_hint(): fixed the type  hint of localns arg

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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