Skip to content

thriftpy2.load_fp can't load a thrift file with a include statement #285

@aisk

Description

@aisk

In the project's tests directory:

>>> import thriftpy2
>>> f = open('addressbook.thrift')
>>> thriftpy2.load_fp(f, 'addressbook_thrift')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/asaka/Codes/thriftpy2/thriftpy2/parser/__init__.py", line 171, in load_fp
    thrift = parse_fp(source, module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/asaka/Codes/thriftpy2/thriftpy2/parser/parser.py", line 655, in parse_fp
    parser.parse(data)
  File "/Users/asaka/Codes/thriftpy2/venv/lib/python3.12/site-packages/ply/yacc.py", line 333, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/asaka/Codes/thriftpy2/venv/lib/python3.12/site-packages/ply/yacc.py", line 1120, in parseopt_notrack
    p.callable(pslice)
  File "/Users/asaka/Codes/thriftpy2/thriftpy2/parser/parser.py", line 58, in p_include
    raise ThriftParserError('Unexpected include statement while loading '
thriftpy2.parser.exc.ThriftParserError: Unexpected include statement while loading from file like object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions