diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2021-12-19 16:12:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-20 05:12:59 +0800 |
commit | 8b85cfd411af794e77e9be645316607063234975 (patch) | |
tree | 3cc505d2bd8e2099b7040139550f242557f81176 /src/OpenSSL/_util.py | |
parent | de073c62c809b2cd67315c5b3ae99ef38fcd26a9 (diff) | |
download | pyopenssl-8b85cfd411af794e77e9be645316607063234975.tar.gz |
Rename path_string to path_bytes since that's what it actually does (#1067)
Diffstat (limited to 'src/OpenSSL/_util.py')
-rw-r--r-- | src/OpenSSL/_util.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/OpenSSL/_util.py b/src/OpenSSL/_util.py index 028989d..a3d5075 100644 --- a/src/OpenSSL/_util.py +++ b/src/OpenSSL/_util.py @@ -71,21 +71,21 @@ def make_assert(error): return openssl_assert -def path_string(s): +def path_bytes(s): """ - Convert a Python path to a :py:class:`bytes` string identifying the same - path and which can be passed into an OpenSSL API accepting a filename. + Convert a Python path to a :py:class:`bytes` for the path which can be + passed into an OpenSSL API accepting a filename. :param s: A path (valid for os.fspath). :return: An instance of :py:class:`bytes`. """ - strpath = os.fspath(s) # returns str or bytes + b = os.fspath(s) - if isinstance(strpath, str): - return strpath.encode(sys.getfilesystemencoding()) + if isinstance(b, str): + return b.encode(sys.getfilesystemencoding()) else: - return strpath + return b def byte_string(s): |