This was recommended in #90309, and @serhiy-storchaka, @encukou, and I all concurred that this method should be deprecated as it's not used (according to searching GitHub) and likely was created when <script> support in browsers was not common which is no longer the case.
The problem is that it is almost not used, at least we have not find any examples in open sources. If we have no examples of use in real code, we cannot be sure that it works correctly. We cannot even be sure what is the purpose of it. We cannot maintain it.
Activity
encukou commented on Apr 22, 2026
IMO <script> support was common, but it was still common practice to include the “hiding” comment.
<!-- begin hiding is still valid JS.
I never concurred with the deprecation. What's the reason to remove this function again?
Can we soft-deprecate it instead?
serhiy-storchaka commented on Apr 22, 2026
The problem is that it is almost not used, at least we have not find any examples in open sources. If we have no examples of use in real code, we cannot be sure that it works correctly. We cannot even be sure what is the purpose of it. We cannot maintain it.
encukou commented on Apr 23, 2026
OK, looking more into this, I see the function doesn't work correctly unless there's only one key/value pair.
I withdraw my objection.
mathaimp commented on Apr 25, 2026
Can I work on this issue?
pythongh-148849: Deprecate http.cookies.BaseCookie.js_output()
Merge branch 'main' into pythongh-148849-deprecate-js-output
Merge branch 'main' into pythongh-148849-deprecate-js-output
pythongh-148849: Deprecate Morsel.js_output()
pythongh-148849: Fix duplicate Morsel.js_output doc entry and indenta…
pythongh-148849: Add Morsel._js_output() to avoid multiple warnings
gh-148849: Deprecate http.cookies.BaseCookie.js_output() (GH-148978)