Skip to content

Commit

Permalink
fix python2/3 compatibility (#776)
Browse files Browse the repository at this point in the history
The former code does not allow python 2 unicode strings.
Because of the "OR" the second "isinstance" is evaluated
for python 2 and 3 but should be used for python 3 only.
  • Loading branch information
GIC-de authored and stacywsmith committed Aug 28, 2017
1 parent 8016b51 commit e7fb00e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/jnpr/junos/rpcmeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,8 @@ def _exec_rpc(*vargs, **kvargs):
if not isinstance(arg_value, (tuple, list)):
arg_value = [arg_value]
for a in arg_value:
if ((sys.version < '3' and
not isinstance(a, (bool, str, unicode))) or
not isinstance(a, (bool, str))):
if not isinstance(a, (bool, str, unicode)
if sys.version < '3' else (bool, str)):
raise TypeError("The value %s for argument %s"
" is of %s. Argument "
"values must be a string, "
Expand Down

0 comments on commit e7fb00e

Please sign in to comment.