Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commandserver.py @ 50589:ef5435e7604e
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:21:04 +0100 |
parents | 6e749d4abf05 |
children | 48e69a056754 |
comparison
equal
deleted
inserted
replaced
50588:6e749d4abf05 | 50589:ef5435e7604e |
---|---|
382 hellomsg += b'encoding: ' + encoding.encoding | 382 hellomsg += b'encoding: ' + encoding.encoding |
383 hellomsg += b'\n' | 383 hellomsg += b'\n' |
384 if self.cmsg: | 384 if self.cmsg: |
385 hellomsg += b'message-encoding: %s\n' % self.cmsg.encoding | 385 hellomsg += b'message-encoding: %s\n' % self.cmsg.encoding |
386 hellomsg += b'pid: %d' % procutil.getpid() | 386 hellomsg += b'pid: %d' % procutil.getpid() |
387 if util.safehasattr(os, b'getpgid'): | 387 if util.safehasattr(os, 'getpgid'): |
388 hellomsg += b'\n' | 388 hellomsg += b'\n' |
389 hellomsg += b'pgid: %d' % os.getpgid(0) | 389 hellomsg += b'pgid: %d' % os.getpgid(0) |
390 | 390 |
391 # write the hello msg in -one- chunk | 391 # write the hello msg in -one- chunk |
392 self.cout.write(hellomsg) | 392 self.cout.write(hellomsg) |