From b3935708f1b8857c45bb63abac390b013c450694 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 3 Jan 2024 22:29:11 +0100 Subject: [PATCH] =?UTF-8?q?`plistlib.readPlist()`=20is=20missing=20from=20?= =?UTF-8?q?Python=20=E2=89=A5=203.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function has been deprecated since Python 3.4, replaced by `plistlib.load()`. --- pkg_resources/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index ab6afe955d..584ce5bc4a 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -414,10 +414,10 @@ def _macos_vers(_cache=[]): if version == '': plist = '/System/Library/CoreServices/SystemVersion.plist' if os.path.exists(plist): - if hasattr(plistlib, 'readPlist'): - plist_content = plistlib.readPlist(plist) - if 'ProductVersion' in plist_content: - version = plist_content['ProductVersion'] + with open(plist, 'rb') as fh: + plist_content = plistlib.load(fh) + if 'ProductVersion' in plist_content: + version = plist_content['ProductVersion'] _cache.append(version.split('.')) return _cache[0]