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

v2.0.1 - AttributeError: 'InvalidExpression' object has no attribute 'name' #138

Closed
allanleal opened this issue Sep 4, 2023 · 1 comment · Fixed by #139
Closed

v2.0.1 - AttributeError: 'InvalidExpression' object has no attribute 'name' #138

allanleal opened this issue Sep 4, 2023 · 1 comment · Fixed by #139
Labels
bug Something isn't working

Comments

@allanleal
Copy link

allanleal commented Sep 4, 2023

Hello @sizmailov . I'd like to report that upon upgrading to v2.0.0 and v2.0.1, I'm encountering the following error (which did not exist before):

Traceback (most recent call last):
  File "/home/allan/miniconda3/envs/reaktoro/bin/pybind11-stubgen", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/__init__.py", line 242, in main
    run(
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/__init__.py", line 278, in run
    module = parser.handle_module(
             ^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/error_handlers.py", line 31, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 176, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 192, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 98, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 411, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 89, in handle_module
    obj = self.handle_module_member(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/filter.py", line 119, in handle_module_member
    return super().handle_module_member(path, module, obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 132, in handle_module_member
    return self.handle_module(path, member)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/error_handlers.py", line 31, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 176, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 192, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 98, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 411, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 89, in handle_module
    obj = self.handle_module_member(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/filter.py", line 119, in handle_module_member
    return super().handle_module_member(path, module, obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 132, in handle_module_member
    return self.handle_module(path, member)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/error_handlers.py", line 31, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 176, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 192, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 98, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 411, in handle_module
    result = super().handle_module(path, module)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 89, in handle_module
    obj = self.handle_module_member(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/filter.py", line 119, in handle_module_member
    return super().handle_module_member(path, module, obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 130, in handle_module_member
    return self.handle_class(path, member)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/error_handlers.py", line 41, in handle_class
    result = super().handle_class(path, class_)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 80, in handle_class
    result = super().handle_class(path, class_)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 48, in handle_class
    obj = self.handle_class_member(
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/filter.py", line 76, in handle_class_member
    return super().handle_class_member(path, class_, member)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 623, in handle_class_member
    result = super().handle_class_member(path, class_, obj)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/filter.py", line 127, in handle_class_member
    return super().handle_class_member(path, class_, obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/filter.py", line 107, in handle_class_member
    return super().handle_class_member(path, class_, member)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 728, in handle_class_member
    result = super().handle_class_member(path, class_, obj)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 73, in handle_class_member
    return self.handle_method(path, member)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/filter.py", line 81, in handle_method
    return super().handle_method(path, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 608, in handle_method
    result = super().handle_method(path, method)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 35, in handle_method
    methods = super().handle_method(path, method)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 306, in handle_method
    for func in self.handle_function(path, method)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 444, in handle_function
    parsed_funcs = self.parse_function_docstring(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 628, in parse_function_docstring
    args=self.parse_args_str(match.group("args")),
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/parse.py", line 528, in parse_args_str
    annotation = self.parse_annotation_str(annotation_str)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 120, in parse_annotation_str
    result = super().parse_annotation_str(annotation_str)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 302, in parse_annotation_str
    result = super().parse_annotation_str(annotation_str)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 347, in parse_annotation_str
    result = super().parse_annotation_str(annotation_str)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 373, in parse_annotation_str
    result = super().parse_annotation_str(annotation_str)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 650, in parse_annotation_str
    result = super().parse_annotation_str(annotation_str)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/allan/miniconda3/envs/reaktoro/lib/python3.11/site-packages/pybind11_stubgen/parser/mixins/fix.py", line 593, in parse_annotation_str
    if param.name in self.__flags:
       ^^^^^^^^^^
AttributeError: 'InvalidExpression' object has no attribute 'name'
@sizmailov sizmailov added the bug Something isn't working label Sep 4, 2023
@sizmailov
Copy link
Owner

Hi! Thanks for the report.

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

Successfully merging a pull request may close this issue.

2 participants