Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/server.py @ 50610:b08aed45ef00
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:27:43 +0100 |
parents | eb49f8fb11d8 |
children | d718eddf01d9 |
comparison
equal
deleted
inserted
replaced
50609:eb49f8fb11d8 | 50610:b08aed45ef00 |
---|---|
342 import threading | 342 import threading |
343 | 343 |
344 threading.active_count() # silence pyflakes and bypass demandimport | 344 threading.active_count() # silence pyflakes and bypass demandimport |
345 _mixin = socketserver.ThreadingMixIn | 345 _mixin = socketserver.ThreadingMixIn |
346 except ImportError: | 346 except ImportError: |
347 if util.safehasattr(os, b"fork"): | 347 if util.safehasattr(os, "fork"): |
348 _mixin = socketserver.ForkingMixIn | 348 _mixin = socketserver.ForkingMixIn |
349 else: | 349 else: |
350 | 350 |
351 class _mixin: | 351 class _mixin: |
352 pass | 352 pass |