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

ValueError for some signature #76

Closed
tristanlatr opened this issue Apr 19, 2022 · 1 comment · Fixed by #82
Closed

ValueError for some signature #76

tristanlatr opened this issue Apr 19, 2022 · 1 comment · Fixed by #82
Labels
type: bug Something isn't working

Comments

@tristanlatr
Copy link
Contributor

Describe the bug
docspec_python is crashing on some signature.

To Reproduce
Steps to reproduce the behavior:

  1. Try to parse a function with the following signature : (x, y, /), it crashes.

Expected behavior
A clear and concise description of what you expected to happen.

Traceback

signature = '(x, y, /)', mod_from_text = <function _docspec_python.mod_from_text at 0x10e802ca0>

>   ???

pydocspec/pydocspec/test/test_astbuilder.py:608: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pydocspec/pydocspec/test/test_astbuilder.py:585: in test_function_signature
    ???
pydocspec/test/__init__.py:71: in mod_from_text
    docspec_modules = list(_docspec_python.load_python_modules(
pydocspec/test/__init__.py:66: in load_python_modules
    yield docspec_python.parse_python_module(f, filename='<fromtext>',
.tox/test/lib/python3.8/site-packages/docspec_python/__init__.py:133: in parse_python_module
    return parser.parse(ast, filename, module_name)
.tox/test/lib/python3.8/site-packages/docspec_python/parser.py:110: in parse
    member = self.parse_declaration(module, node)
.tox/test/lib/python3.8/site-packages/docspec_python/parser.py:128: in parse_declaration
    return self.parse_funcdef(parent, node, False, decorations)
.tox/test/lib/python3.8/site-packages/docspec_python/parser.py:257: in parse_funcdef
    args = self.parse_parameters(parameters)
.tox/test/lib/python3.8/site-packages/docspec_python/parser.py:350: in parse_parameters
    node = index.next()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nr.util.iter._sequence_walker.SequenceWalker object at 0x11bd15160>

    def next(self) -> T:
      """ Returns the next element in the sequence. Note that this cannot be used to advance the walker beyond the
      end of the sequence; use #advance() instead. """
      if self.has_next():
        self.index += 1
        return self.sequence[self.index]
      else:
>       raise ValueError('no next element for the walker to move to')
E       ValueError: no next element for the walker to move to

.tox/test/lib/python3.8/site-packages/nr/util/iter/_sequence_walker.py:37: ValueError
____________________________________ test_function_signature_posonly[mod_from_text0-(x, y=0, /)] _____________________________________

signature = '(x, y=0, /)', mod_from_text = <function _docspec_python.mod_from_text at 0x10e802ca0>

>   ???

pydocspec/pydocspec/test/test_astbuilder.py:608: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pydocspec/pydocspec/test/test_astbuilder.py:585: in test_function_signature
    ???
pydocspec/test/__init__.py:71: in mod_from_text
    docspec_modules = list(_docspec_python.load_python_modules(
pydocspec/test/__init__.py:66: in load_python_modules
    yield docspec_python.parse_python_module(f, filename='<fromtext>',
.tox/test/lib/python3.8/site-packages/docspec_python/__init__.py:133: in parse_python_module
    return parser.parse(ast, filename, module_name)
.tox/test/lib/python3.8/site-packages/docspec_python/parser.py:110: in parse
    member = self.parse_declaration(module, node)
.tox/test/lib/python3.8/site-packages/docspec_python/parser.py:128: in parse_declaration
    return self.parse_funcdef(parent, node, False, decorations)
.tox/test/lib/python3.8/site-packages/docspec_python/parser.py:257: in parse_funcdef
    args = self.parse_parameters(parameters)
.tox/test/lib/python3.8/site-packages/docspec_python/parser.py:350: in parse_parameters
    node = index.next()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nr.util.iter._sequence_walker.SequenceWalker object at 0x11bdfa3a0>

    def next(self) -> T:
      """ Returns the next element in the sequence. Note that this cannot be used to advance the walker beyond the
      end of the sequence; use #advance() instead. """
      if self.has_next():
        self.index += 1
        return self.sequence[self.index]
      else:
>       raise ValueError('no next element for the walker to move to')
E       ValueError: no next element for the walker to move to

.tox/test/lib/python3.8/site-packages/nr/util/iter/_sequence_walker.py:37: ValueError
@tristanlatr tristanlatr added the type: bug Something isn't working label Apr 19, 2022
NiklasRosenstein added a commit that referenced this issue Mar 9, 2023
@NiklasRosenstein NiklasRosenstein linked a pull request Mar 9, 2023 that will close this issue
@NiklasRosenstein
Copy link
Owner

Hey @tristanlatr, seems like this was fixed some time along the way? I've added a test for your particular case in #76.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants