From 8b85cfd411af794e77e9be645316607063234975 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 19 Dec 2021 16:12:59 -0500 Subject: Rename path_string to path_bytes since that's what it actually does (#1067) --- src/OpenSSL/_util.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/OpenSSL/_util.py') 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): -- cgit v1.2.1