Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0b64714

Browse filesBrowse files
gh-116349: Deprecate platform.java_ver function (#116471)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent 4d95273 commit 0b64714
Copy full SHA for 0b64714

File tree

5 files changed

+26
-4
lines changed
Filter options

5 files changed

+26
-4
lines changed

‎Doc/library/platform.rst

Copy file name to clipboardExpand all lines: Doc/library/platform.rst
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ Java Platform
196196
``(os_name, os_version, os_arch)``. Values which cannot be determined are set to
197197
the defaults given as parameters (which all default to ``''``).
198198

199+
.. deprecated-removed:: 3.13 3.15
200+
It was largely untested, had a confusing API,
201+
and was only useful for Jython support.
202+
199203

200204
Windows Platform
201205
----------------

‎Doc/whatsnew/3.13.rst

Copy file name to clipboardExpand all lines: Doc/whatsnew/3.13.rst
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,10 @@ Deprecated
814814
* The undocumented and unused ``tarfile`` attribute of :class:`tarfile.TarFile`
815815
is deprecated and scheduled for removal in Python 3.16.
816816

817+
* :func:`platform.java_ver` is deprecated and will be removed in 3.15.
818+
It was largely untested, had a confusing API,
819+
and was only useful for Jython support.
820+
(Contributed by Nikita Sobolev in :gh:`116349`.)
817821

818822
Pending Removal in Python 3.14
819823
------------------------------
@@ -973,6 +977,11 @@ Pending Removal in Python 3.15
973977
They will be removed in Python 3.15.
974978
(Contributed by Victor Stinner in :gh:`105096`.)
975979

980+
* :func:`platform.java_ver` is deprecated and will be removed in 3.15.
981+
It was largely untested, had a confusing API,
982+
and was only useful for Jython support.
983+
(Contributed by Nikita Sobolev in :gh:`116349`.)
984+
976985
Pending Removal in Python 3.16
977986
------------------------------
978987

‎Lib/platform.py

Copy file name to clipboardExpand all lines: Lib/platform.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def mac_ver(release='', versioninfo=('', '', ''), machine=''):
503503
return release, versioninfo, machine
504504

505505
def _java_getprop(name, default):
506-
506+
"""This private helper is deprecated in 3.13 and will be removed in 3.15"""
507507
from java.lang import System
508508
try:
509509
value = System.getProperty(name)
@@ -525,6 +525,8 @@ def java_ver(release='', vendor='', vminfo=('', '', ''), osinfo=('', '', '')):
525525
given as parameters (which all default to '').
526526
527527
"""
528+
import warnings
529+
warnings._deprecated('java_ver', remove=(3, 15))
528530
# Import the needed APIs
529531
try:
530532
import java.lang

‎Lib/test/test_platform.py

Copy file name to clipboardExpand all lines: Lib/test/test_platform.py
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,13 @@ def raises_oserror(*a):
318318
platform._uname_cache = None
319319

320320
def test_java_ver(self):
321-
res = platform.java_ver()
322-
if sys.platform == 'java': # Is never actually checked in CI
323-
self.assertTrue(all(res))
321+
import re
322+
msg = re.escape(
323+
"'java_ver' is deprecated and slated for removal in Python 3.15"
324+
)
325+
with self.assertWarnsRegex(DeprecationWarning, msg):
326+
res = platform.java_ver()
327+
self.assertEqual(len(res), 4)
324328

325329
def test_win32_ver(self):
326330
res = platform.win32_ver()
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:func:`platform.java_ver` is deprecated and will be removed in 3.15.
2+
It was largely untested, had a confusing API,
3+
and was only useful for Jython support.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.