https://github.com/python/cpython/commit/7a4a6cf2b8d48b302c734a5cee59f42973c8fd36
commit: 7a4a6cf2b8d48b302c734a5cee59f42973c8fd36
branch: main
author: Alexey Makridenko <[email protected]>
committer: malemburg <[email protected]>
date: 2025-05-16T16:17:54+02:00
summary:
gh-133604: remove deprecated `java_ver` function (#133888)
files:
A Misc/NEWS.d/next/Library/2025-05-11-12-56-52.gh-issue-133604.kFxhc8.rst
M Doc/deprecations/pending-removal-in-3.15.rst
M Doc/library/platform.rst
M Doc/whatsnew/3.13.rst
M Doc/whatsnew/3.15.rst
M Lib/platform.py
M Lib/test/test_platform.py
diff --git a/Doc/deprecations/pending-removal-in-3.15.rst
b/Doc/deprecations/pending-removal-in-3.15.rst
index 8953aedf989869..707253a91ecd40 100644
--- a/Doc/deprecations/pending-removal-in-3.15.rst
+++ b/Doc/deprecations/pending-removal-in-3.15.rst
@@ -51,7 +51,7 @@ Pending removal in Python 3.15
* :mod:`platform`:
- * :func:`~platform.java_ver` has been deprecated since Python 3.13.
+ * :func:`!platform.java_ver` has been deprecated since Python 3.13.
This function is only useful for Jython support, has a confusing API,
and is largely untested.
diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst
index 5c999054323be5..06de152a742f28 100644
--- a/Doc/library/platform.rst
+++ b/Doc/library/platform.rst
@@ -188,24 +188,6 @@ Cross platform
:attr:`processor` is resolved late instead of immediately.
-Java platform
--------------
-
-
-.. function:: java_ver(release='', vendor='', vminfo=('','',''),
osinfo=('','',''))
-
- Version interface for Jython.
-
- Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a
- tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple
- ``(os_name, os_version, os_arch)``. Values which cannot be determined are
set to
- the defaults given as parameters (which all default to ``''``).
-
- .. deprecated-removed:: 3.13 3.15
- It was largely untested, had a confusing API,
- and was only useful for Jython support.
-
-
Windows platform
----------------
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst
index 7ae184058111d8..e64eb19bddb522 100644
--- a/Doc/whatsnew/3.13.rst
+++ b/Doc/whatsnew/3.13.rst
@@ -1908,7 +1908,7 @@ New Deprecations
* :mod:`platform`:
- * Deprecate :func:`~platform.java_ver`,
+ * Deprecate :func:`!platform.java_ver`,
to be removed in Python 3.15.
This function is only useful for Jython support, has a confusing API,
and is largely untested.
diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst
index 14d96420f698fa..9e9a168db0e725 100644
--- a/Doc/whatsnew/3.15.rst
+++ b/Doc/whatsnew/3.15.rst
@@ -121,6 +121,14 @@ Deprecated
Removed
=======
+platform
+--------
+
+* Removed the :func:`!platform.java_ver` function,
+ which was deprecated since Python 3.13.
+ (Contributed by Alexey Makridenko in :gh:`133604`.)
+
+
sysconfig
---------
diff --git a/Lib/platform.py b/Lib/platform.py
index 55e211212d4209..077db81264a57c 100644
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -29,7 +29,7 @@
#
# History:
#
-# <see CVS and SVN checkin messages for history>
+# <see checkin messages for history>
#
# 1.0.9 - added invalidate_caches() function to invalidate cached values
# 1.0.8 - changed Windows support to read version from kernel32.dll
@@ -110,7 +110,7 @@
"""
-__version__ = '1.0.9'
+__version__ = '1.1.0'
import collections
import os
@@ -528,53 +528,6 @@ def ios_ver(system="", release="", model="",
is_simulator=False):
return IOSVersionInfo(system, release, model, is_simulator)
-def _java_getprop(name, default):
- """This private helper is deprecated in 3.13 and will be removed in 3.15"""
- from java.lang import System
- try:
- value = System.getProperty(name)
- if value is None:
- return default
- return value
- except AttributeError:
- return default
-
-def java_ver(release='', vendor='', vminfo=('', '', ''), osinfo=('', '', '')):
-
- """ Version interface for Jython.
-
- Returns a tuple (release, vendor, vminfo, osinfo) with vminfo being
- a tuple (vm_name, vm_release, vm_vendor) and osinfo being a
- tuple (os_name, os_version, os_arch).
-
- Values which cannot be determined are set to the defaults
- given as parameters (which all default to '').
-
- """
- import warnings
- warnings._deprecated('java_ver', remove=(3, 15))
- # Import the needed APIs
- try:
- import java.lang # noqa: F401
- except ImportError:
- return release, vendor, vminfo, osinfo
-
- vendor = _java_getprop('java.vendor', vendor)
- release = _java_getprop('java.version', release)
- vm_name, vm_release, vm_vendor = vminfo
- vm_name = _java_getprop('java.vm.name', vm_name)
- vm_vendor = _java_getprop('java.vm.vendor', vm_vendor)
- vm_release = _java_getprop('java.vm.version', vm_release)
- vminfo = vm_name, vm_release, vm_vendor
- os_name, os_version, os_arch = osinfo
- os_arch = _java_getprop('java.os.arch', os_arch)
- os_name = _java_getprop('java.os.name', os_name)
- os_version = _java_getprop('java.os.version', os_version)
- osinfo = os_name, os_version, os_arch
-
- return release, vendor, vminfo, osinfo
-
-
AndroidVer = collections.namedtuple(
"AndroidVer", "release api_level manufacturer model device is_emulator")
@@ -1034,13 +987,6 @@ def uname():
version = '16bit'
system = 'Windows'
- elif system[:4] == 'java':
- release, vendor, vminfo, osinfo = java_ver()
- system = 'Java'
- version = ', '.join(vminfo)
- if not version:
- version = vendor
-
# System specific extensions
if system == 'OpenVMS':
# OpenVMS seems to have release and version mixed up
@@ -1370,15 +1316,6 @@ def platform(aliased=False, terse=False):
platform = _platform(system, release, machine, processor,
'with',
libcname+libcversion)
- elif system == 'Java':
- # Java platforms
- r, v, vminfo, (os_name, os_version, os_arch) = java_ver()
- if terse or not os_name:
- platform = _platform(system, release, version)
- else:
- platform = _platform(system, release, version,
- 'on',
- os_name, os_version, os_arch)
else:
# Generic handler
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index 818e807dd3a6fb..3b673a47c8c137 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -383,15 +383,6 @@ def raises_oserror(*a):
finally:
platform._uname_cache = None
- def test_java_ver(self):
- import re
- msg = re.escape(
- "'java_ver' is deprecated and slated for removal in Python 3.15"
- )
- with self.assertWarnsRegex(DeprecationWarning, msg):
- res = platform.java_ver()
- self.assertEqual(len(res), 4)
-
@unittest.skipUnless(support.MS_WINDOWS, 'This test only makes sense on
Windows')
def test_win32_ver(self):
release1, version1, csd1, ptype1 = 'a', 'b', 'c', 'd'
diff --git
a/Misc/NEWS.d/next/Library/2025-05-11-12-56-52.gh-issue-133604.kFxhc8.rst
b/Misc/NEWS.d/next/Library/2025-05-11-12-56-52.gh-issue-133604.kFxhc8.rst
new file mode 100644
index 00000000000000..526ac38f09bab3
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-05-11-12-56-52.gh-issue-133604.kFxhc8.rst
@@ -0,0 +1 @@
+Remove :func:`!platform.java_ver` which was deprecated since Python 3.13.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]