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

Python 3.7: RuntimeError: generator raised StopIteration #144

Open
scat25 opened this issue Mar 7, 2019 · 3 comments
Open

Python 3.7: RuntimeError: generator raised StopIteration #144

scat25 opened this issue Mar 7, 2019 · 3 comments

Comments

@scat25
Copy link

scat25 commented Mar 7, 2019

Using cppclean with Python 3.7 results in a RuntimeError for most of our Projects.
It's probably a result of PEP 479: https://www.python.org/dev/peps/pep-0479/

Traceback (most recent call last):
  File "c:\program files\python37\lib\site-packages\cpp\ast.py", line 887, in _get_matching_char
    token = get_next_token()
  File "c:\program files\python37\lib\site-packages\cpp\ast.py", line 904, in _get_next_token
    return next(self.tokens)
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\Python37\Scripts\cppclean", line 166, in <module>
    sys.exit(main())
  File "C:\Program Files\Python37\Scripts\cppclean", line 159, in main
    quiet=args.quiet):
  File "c:\program files\python37\lib\site-packages\cpp\find_warnings.py", line 633, in run
    hunter.find_warnings()
  File "c:\program files\python37\lib\site-packages\cpp\find_warnings.py", line 129, in find_warnings
    self._find_source_warnings()
  File "c:\program files\python37\lib\site-packages\cpp\find_warnings.py", line 575, in _find_source_warnings
    included_files, forward_declarations = self._read_and_parse_includes()
  File "c:\program files\python37\lib\site-packages\cpp\find_warnings.py", line 182, in _read_and_parse_includes
    module = self._get_module(node)
  File "c:\program files\python37\lib\site-packages\cpp\find_warnings.py", line 156, in _get_module
    ast_list = [_f for _f in builder.generate() if _f]
  File "c:\program files\python37\lib\site-packages\cpp\find_warnings.py", line 156, in <listcomp>
    ast_list = [_f for _f in builder.generate() if _f]
  File "c:\program files\python37\lib\site-packages\cpp\ast.py", line 675, in generate
    result = self._generate_one(token)
  File "c:\program files\python37\lib\site-packages\cpp\ast.py", line 702, in _generate_one
    return method()
  File "c:\program files\python37\lib\site-packages\cpp\ast.py", line 1441, in handle_template
    templated_types)
  File "c:\program files\python37\lib\site-packages\cpp\ast.py", line 1601, in _get_class
    return self._get_method(name_tokens, 0, None, False)
  File "c:\program files\python37\lib\site-packages\cpp\ast.py", line 1009, in _get_method
    parameters = list(self._get_parameters())
RuntimeError: generator raised StopIteration
@Niederb
Copy link
Contributor

Niederb commented Nov 2, 2019

I had the same errors on classes that had some kind of export macro and are final at same time:
class EXPORT_MACRO Foo final {};
I made a small PR (#152) to fix the issue. It works for me, maybe it also helps you.

@scat25
Copy link
Author

scat25 commented Nov 4, 2019

It fixes some of the errors but not all

@Niederb
Copy link
Contributor

Niederb commented Nov 13, 2019

Sorry for the slow reply.
Yes, I also have still some issues. I might look into them at some point.
Meanwhile for me I just changed the code a bit to ignore the thrown RuntimeError, such that at least the remaining files are processed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants