Mercurial > hg-stable
changeset 41836:ae189674bdad
global: use raw strings for __slots__
Otherwise Python 2 will coerce unicode to str at module load time.
We don't like automatic string coercions.
Differential Revision: https://phab.mercurial-scm.org/D6046
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 02 Mar 2019 12:51:04 -0800 |
parents | c6a5009ed04a |
children | b275dbb60089 |
files | mercurial/changelog.py mercurial/statprof.py mercurial/util.py |
diffstat | 3 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Thu Feb 28 07:45:51 2019 -0800 +++ b/mercurial/changelog.py Sat Mar 02 12:51:04 2019 -0800 @@ -183,8 +183,8 @@ """ __slots__ = ( - u'_offsets', - u'_text', + r'_offsets', + r'_text', ) def __new__(cls, text):
--- a/mercurial/statprof.py Thu Feb 28 07:45:51 2019 -0800 +++ b/mercurial/statprof.py Sat Mar 02 12:51:04 2019 -0800 @@ -203,7 +203,7 @@ class CodeSite(object): cache = {} - __slots__ = (u'path', u'lineno', u'function', u'source') + __slots__ = (r'path', r'lineno', r'function', r'source') def __init__(self, path, lineno, function): assert isinstance(path, bytes) @@ -263,7 +263,7 @@ return r'%s:%s' % (self.filename(), self.function) class Sample(object): - __slots__ = (u'stack', u'time') + __slots__ = (r'stack', r'time') def __init__(self, stack, time): self.stack = stack
--- a/mercurial/util.py Thu Feb 28 07:45:51 2019 -0800 +++ b/mercurial/util.py Sat Mar 02 12:51:04 2019 -0800 @@ -1216,7 +1216,7 @@ Holds a reference to nodes on either side as well as a key-value pair for the dictionary entry. """ - __slots__ = (u'next', u'prev', u'key', u'value', u'cost') + __slots__ = (r'next', r'prev', r'key', r'value', r'cost') def __init__(self): self.next = None