Skip to content

Commit 4c56563

Browse files
authored
GH-133336: Remove reserved -J flag for Jython (#133444)
1 parent c336f1c commit 4c56563

File tree

5 files changed

+16
-18
lines changed

5 files changed

+16
-18
lines changed

Doc/using/cmdline.rst

+7-9
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,13 @@ Miscellaneous options
670670
.. versionchanged:: 3.10
671671
Removed the ``-X oldparser`` option.
672672

673+
.. versionremoved:: next
674+
675+
:option:`!-J` is no longer reserved for use by Jython_,
676+
and now has no special meaning.
677+
678+
.. _Jython: https://www.jython.org/
679+
673680
.. _using-on-controlling-color:
674681

675682
Controlling color
@@ -694,15 +701,6 @@ output. To control the color output only in the Python interpreter, the
694701
precedence over ``NO_COLOR``, which in turn takes precedence over
695702
``FORCE_COLOR``.
696703

697-
Options you shouldn't use
698-
~~~~~~~~~~~~~~~~~~~~~~~~~
699-
700-
.. option:: -J
701-
702-
Reserved for use by Jython_.
703-
704-
.. _Jython: https://www.jython.org/
705-
706704

707705
.. _using-on-envvars:
708706

Doc/whatsnew/2.6.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ Interpreter Changes
17471747
-------------------------------
17481748

17491749
Two command-line options have been reserved for use by other Python
1750-
implementations. The :option:`-J` switch has been reserved for use by
1750+
implementations. The :option:`!-J` switch has been reserved for use by
17511751
Jython for Jython-specific options, such as switches that are passed to
17521752
the underlying JVM. :option:`-X` has been reserved for options
17531753
specific to a particular implementation of Python such as CPython,

Doc/whatsnew/3.14.rst

+5
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,11 @@ Other language changes
805805
:keyword:`async with`).
806806
(Contributed by Bénédikt Tran in :gh:`128398`.)
807807

808+
* :option:`!-J` is no longer a reserved flag for Jython_,
809+
and now has no special meaning.
810+
(Contributed by Adam Turner in :gh:`133336`.)
811+
812+
.. _Jython: https://www.jython.org/
808813

809814
.. _whatsnew314-pep765:
810815

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:option:`!-J` is no longer reserved for use by Jython.
2+
Patch by Adam Turner.

Python/getopt.c

+1-8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static const wchar_t *opt_ptr = L"";
3737

3838
/* Python command line short and long options */
3939

40-
#define SHORT_OPTS L"bBc:dEhiIJm:OPqRsStuvVW:xX:?"
40+
#define SHORT_OPTS L"bBc:dEhiIm:OPqRsStuvVW:xX:?"
4141

4242
static const _PyOS_LongOption longopts[] = {
4343
/* name, has_arg, val (used in switch in initconfig.c) */
@@ -133,13 +133,6 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
133133
return opt->val;
134134
}
135135

136-
if (option == 'J') {
137-
if (_PyOS_opterr) {
138-
fprintf(stderr, "-J is reserved for Jython\n");
139-
}
140-
return '_';
141-
}
142-
143136
if ((ptr = wcschr(SHORT_OPTS, option)) == NULL) {
144137
if (_PyOS_opterr) {
145138
fprintf(stderr, "Unknown option: -%c\n", (char)option);

0 commit comments

Comments
 (0)