Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/utils/urlutil.py @ 50646:9e69d9d6f4cf
safehasattr: pass attribute name as string instead of bytes
This is a step toward replacing `util.safehasattr` usage with plain `hasattr`.
The builtin function behave poorly in Python2 but this was fixed in Python3.
These change are done one by one as they tend to have a small odd to trigger
puzzling breackage.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 02 Feb 2023 17:38:14 +0100 |
parents | f35cf52acabd |
children | 0ab3956540a6 |
comparison
equal
deleted
inserted
replaced
50645:ecaf00089461 | 50646:9e69d9d6f4cf |
---|---|
231 ) | 231 ) |
232 | 232 |
233 self.path = path | 233 self.path = path |
234 | 234 |
235 # leave the query string escaped | 235 # leave the query string escaped |
236 for a in (b'user', b'passwd', b'host', b'port', b'path', b'fragment'): | 236 for a in ('user', 'passwd', 'host', 'port', 'path', 'fragment'): |
237 v = getattr(self, a) | 237 v = getattr(self, a) |
238 if v is not None: | 238 if v is not None: |
239 setattr(self, a, urlreq.unquote(v)) | 239 setattr(self, a, urlreq.unquote(v)) |
240 | 240 |
241 def copy(self): | 241 def copy(self): |