view mercurial/__init__.py @ 51310:f0e7d51bb454 stable

pycompat: fix bytestr(bytes) in Python 3.11 In Python 3.10, the `bytes` type itself does not have a `__bytes__` attribute, but it does in 3.11. Yet `bytes(bytes)` does not give the wished output, so we have to add an exceptional case. The added case in the doctest reproduces the problem with Python 3.11. Impact: error treatment in expressions such as `repo[b'invalid']` gets broken.
author Georges Racinet <georges.racinet@octobus.net>
date Wed, 03 Jan 2024 18:33:39 +0100
parents 6000f5b25c9b
children
line wrap: on
line source

# __init__.py - Startup and module loading logic for Mercurial.
#
# Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.


# Allow 'from mercurial import demandimport' to keep working.
import hgdemandimport

demandimport = hgdemandimport