Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

byte处理问题,include文件路径问题 #214

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions thriftpy/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ def p_header_unit(p):
def p_include(p):
'''include : INCLUDE LITERAL'''
thrift = thrift_stack[-1]

if thrift.__thrift_file__ is None:
raise ThriftParserError('Unexcepted include statement while loading'
'from file like object.')

for include_dir in include_dirs_:
replace_include_dirs = [os.path.dirname(thrift.__thrift_file__)] \
+ include_dirs_
for include_dir in replace_include_dirs:
path = os.path.join(include_dir, p[2])
if os.path.exists(path):
child = parse(path)
Expand Down Expand Up @@ -153,7 +153,6 @@ def p_const_map_item(p):
def p_const_ref(p):
'''const_ref : IDENTIFIER'''
child = thrift_stack[-1]

for name in p[1].split('.'):
father = child
child = getattr(child, name, None)
Expand Down Expand Up @@ -609,7 +608,7 @@ def _cast_bool(v):


def _cast_byte(v):
assert isinstance(v, str)
assert isinstance(v, int)
return v


Expand Down