Right now there are some left-over of Jython support in stdlib.
Jython2 is long dead, Jython3 is still under development.
See this message from Jython3 devs: Consider deprecating `platform.java_ver` because it is only helpful for Jython · Issue #116349 · python/cpython · GitHub
Problem: having 'Java'
as a platform.system()
is very strange. It does not represent the reality and is not even needed for the project it was designed for anymore.
Right now there are 0 platforms that I know of that use Java
to identify themselfs.
I recently tried GraalPy to see what does it do. Result of platform.uname()
on GraalPy:
>>> print(list(platform.uname()))
['Linux', 'd71df3245931', '5.15.49-linuxkit', '#1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022', 'x86_64', 'x86_64']
We also don’t use it inside our code base (some unrelated parts are removed):
» ag '["'\'']java'
Lib/test/support/__init__.py
521:is_jython = sys.platform.startswith('java')
Lib/test/test_platform.py
167: ('Jython', 'trunk', '6107'), "java1.5.0_16")
170: ('trunk:6107', 'Mar 26 2009'), "java1.5.0_16"),
323: "'java_ver' is deprecated and slated for removal in Python 3.15"
Lib/platform.py
523: warnings._deprecated('java_ver', remove=(3, 15))
530: vendor = _java_getprop('java.vendor', vendor)
531: release = _java_getprop('java.version', release)
533: vm_name = _java_getprop('java.vm.name', vm_name)
534: vm_vendor = _java_getprop('java.vm.vendor', vm_vendor)
535: vm_release = _java_getprop('java.vm.version', vm_release)
538: os_arch = _java_getprop('java.os.arch', os_arch)
539: os_name = _java_getprop('java.os.name', os_name)
540: os_version = _java_getprop('java.os.version', os_version)
956: elif system[:4] == 'java':
958: system = 'Java'
984: """ Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.
1080: if sys.platform.startswith('java'):
1274: elif system == 'Java':
Lib/pydoc_data/topics.py
13761: 'Java implementation) for the accepted range and handling of '
Doc/library/platform.rst
148: Returns the system/OS name, such as ``'Linux'``, ``'Darwin'``, ``'Java'``,
Doc/library/os.rst
60: ``'java'``.
My proposal:
- Collect feedback about this change here: tag anyone who might be interested
- Provide better ways of working with alternative implementations: improve
platform.python_implementation
and work on Introduce platform.vm_info (or similar) as a replacement for recently deprecated platform.java_ver. · Issue #116504 · python/cpython · GitHub - Deprecate
platform.system() == 'Java'
,platform.platform().system == 'Java'
, andos.name == 'java'
in 3.13 - Announce its removal
- Remove it in 3.15
Affected code paths:
- cpython/Lib/platform.py at c951e25c24910064a4c8b7959e2f0f7c0d4d0a63 · python/cpython · GitHub
- cpython/Lib/platform.py at c951e25c24910064a4c8b7959e2f0f7c0d4d0a63 · python/cpython · GitHub
Context:
java_ver
deprecation: Consider deprecating `platform.java_ver` because it is only helpful for Jython · Issue #116349 · python/cpython · GitHub- Previous issue about deprecating
os.name == 'java'
andplatform.system() == 'Java'
Deprecate / remove os.name=java · Issue #90613 · python/cpython · GitHub
Please, share your feedback!