Don't force unicode strings for UUID coercion

Change Ic6b6308fb1960ec40407e6efde30137b64543e72 attempts to
fix difference between Python 2 and Python 3 values by switching
from using str() to formatting into a unicode string (u"%s").

This is equivalent to changing str() to unicode(), but that is
not correct for expected default string types for Python 2.
This requires either using six.text_type(), or just formatting
into a string, without forcing unicode ("%s"), to be correct on
either runtime.

Change-Id: I178f14cdc670d7a696778891e587ef75de208fc2
Closes-bug: #1763179
This commit is contained in:
Sean McGinnis 2018-04-11 21:02:53 +00:00
parent 5774995c3c
commit b719764ba8
1 changed files with 2 additions and 2 deletions

View File

@ -352,7 +352,7 @@ class UUID(StringPattern):
# like 'error' for this warning.
warnings.filterwarnings(action="once", append=True)
try:
uuid.UUID(u"%s" % value)
uuid.UUID("%s" % value)
except Exception:
# This is to ensure no breaking behaviour for current
# users
@ -367,7 +367,7 @@ class UUID(StringPattern):
repr(value).encode('utf8'),
FutureWarning)
return u"%s" % value
return "%s" % value
class MACAddress(StringPattern):