mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
gh-116349: Deprecate platform.java_ver function (#116471)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
4d952737e6
commit
0b647141d5
5 changed files with 26 additions and 4 deletions
|
|
@ -196,6 +196,10 @@ Java Platform
|
||||||
``(os_name, os_version, os_arch)``. Values which cannot be determined are set to
|
``(os_name, os_version, os_arch)``. Values which cannot be determined are set to
|
||||||
the defaults given as parameters (which all default 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
|
Windows Platform
|
||||||
----------------
|
----------------
|
||||||
|
|
|
||||||
|
|
@ -814,6 +814,10 @@ Deprecated
|
||||||
* The undocumented and unused ``tarfile`` attribute of :class:`tarfile.TarFile`
|
* The undocumented and unused ``tarfile`` attribute of :class:`tarfile.TarFile`
|
||||||
is deprecated and scheduled for removal in Python 3.16.
|
is deprecated and scheduled for removal in Python 3.16.
|
||||||
|
|
||||||
|
* :func:`platform.java_ver` is deprecated and will be removed in 3.15.
|
||||||
|
It was largely untested, had a confusing API,
|
||||||
|
and was only useful for Jython support.
|
||||||
|
(Contributed by Nikita Sobolev in :gh:`116349`.)
|
||||||
|
|
||||||
Pending Removal in Python 3.14
|
Pending Removal in Python 3.14
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
@ -973,6 +977,11 @@ Pending Removal in Python 3.15
|
||||||
They will be removed in Python 3.15.
|
They will be removed in Python 3.15.
|
||||||
(Contributed by Victor Stinner in :gh:`105096`.)
|
(Contributed by Victor Stinner in :gh:`105096`.)
|
||||||
|
|
||||||
|
* :func:`platform.java_ver` is deprecated and will be removed in 3.15.
|
||||||
|
It was largely untested, had a confusing API,
|
||||||
|
and was only useful for Jython support.
|
||||||
|
(Contributed by Nikita Sobolev in :gh:`116349`.)
|
||||||
|
|
||||||
Pending Removal in Python 3.16
|
Pending Removal in Python 3.16
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -503,7 +503,7 @@ def mac_ver(release='', versioninfo=('', '', ''), machine=''):
|
||||||
return release, versioninfo, machine
|
return release, versioninfo, machine
|
||||||
|
|
||||||
def _java_getprop(name, default):
|
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
|
from java.lang import System
|
||||||
try:
|
try:
|
||||||
value = System.getProperty(name)
|
value = System.getProperty(name)
|
||||||
|
|
@ -525,6 +525,8 @@ def java_ver(release='', vendor='', vminfo=('', '', ''), osinfo=('', '', '')):
|
||||||
given as parameters (which all default to '').
|
given as parameters (which all default to '').
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
import warnings
|
||||||
|
warnings._deprecated('java_ver', remove=(3, 15))
|
||||||
# Import the needed APIs
|
# Import the needed APIs
|
||||||
try:
|
try:
|
||||||
import java.lang
|
import java.lang
|
||||||
|
|
|
||||||
|
|
@ -318,9 +318,13 @@ class PlatformTest(unittest.TestCase):
|
||||||
platform._uname_cache = None
|
platform._uname_cache = None
|
||||||
|
|
||||||
def test_java_ver(self):
|
def test_java_ver(self):
|
||||||
res = platform.java_ver()
|
import re
|
||||||
if sys.platform == 'java': # Is never actually checked in CI
|
msg = re.escape(
|
||||||
self.assertTrue(all(res))
|
"'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)
|
||||||
|
|
||||||
def test_win32_ver(self):
|
def test_win32_ver(self):
|
||||||
res = platform.win32_ver()
|
res = platform.win32_ver()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
:func:`platform.java_ver` is deprecated and will be removed in 3.15.
|
||||||
|
It was largely untested, had a confusing API,
|
||||||
|
and was only useful for Jython support.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue