Python3 complains when iterate bytes string

Using Python3 to iterate a bytes string, int will be presented.
However, in Python2, str will be presented.

Closes-Bug: #1792120
Change-Id: Id30f5f1da989fdb71e0f9b627e875e0c41f89b30
This commit is contained in:
Hong Hui Xiao 2018-09-11 09:05:33 +00:00
parent 4aff206e55
commit 98c1553af9
1 changed files with 6 additions and 1 deletions

View File

@ -280,7 +280,12 @@ class DHCPApp(df_base_app.DFlowApp):
return {}
for opt in requested_opts:
opt_int = ord(opt)
# For python3 opt is already int.
if isinstance(opt, str):
opt_int = ord(opt)
else:
opt_int = opt
if opt_int in default_opts:
# already answered by the default options
continue