##// END OF EJS Templates
attr: don't attempt to .encode() a str on Python 2...
Gregory Szorc -
r41999:89f01ea9 default
parent child Browse files
Show More
@@ -555,7 +555,10 b' def _add_init(cls, frozen):'
555
555
556 # We cache the generated init methods for the same kinds of attributes.
556 # We cache the generated init methods for the same kinds of attributes.
557 sha1 = hashlib.sha1()
557 sha1 = hashlib.sha1()
558 sha1.update(repr(attrs).encode("utf-8"))
558 r = repr(attrs)
559 if not isinstance(r, bytes):
560 r = r.encode('utf-8')
561 sha1.update(r)
559 unique_filename = "<attrs generated init {0}>".format(
562 unique_filename = "<attrs generated init {0}>".format(
560 sha1.hexdigest()
563 sha1.hexdigest()
561 )
564 )
General Comments 0
You need to be logged in to leave comments. Login now