Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'cgi' is deprecated and slated for removal in Python 3.13 #39359

Open
gsnedders opened this issue Apr 4, 2023 · 5 comments
Open

'cgi' is deprecated and slated for removal in Python 3.13 #39359

gsnedders opened this issue Apr 4, 2023 · 5 comments

Comments

@gsnedders
Copy link
Member

  /Volumes/gsnedders/projects/wpt/web-platform-tests/tools/wptserve/wptserve/request.py:4: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
    import cgi
@jgraham
Copy link
Contributor

jgraham commented May 5, 2023

The FieldStorage class can typically be replaced with urllib.parse.parse_qsl() for GET and HEAD requests, and the email.message module or multipart for POST and PUT. Most utility functions have replacements.

So it seems like we get to reimplement the bits of FieldStorage that we're using, and we get fully two minor releases between initial deprecation and final removal. Good good.

@nakyong
Copy link

nakyong commented Nov 12, 2024

when running wpt test on window with python 3.13, it looks having issue bacause of cgi. When it will be fixed?

@MichaelMcDonnell
Copy link

It is possible to replace cgi with legacy-cgi. I'm working on supporting Python 3.13 in #49503.

@gsnedders
Copy link
Member Author

It is possible to replace cgi with legacy-cgi.

It's surprising that legacy-cgi requires on Python 3.10, given there's been little of way in changes to cgi/cgitb in many years; I don't see any obvious reason for it to do so.

It is potentially unfortunate that we expose cgi.FieldStorage in our API (and to tests), because it makes it significantly riskier to change.

Given we'd need this vendored either way, maybe we should just copy cgi.py (plus license) into our tree, and effectively start maintaining a fork.

@jgraham
Copy link
Contributor

jgraham commented Jan 8, 2025

#49970 is an initial attempt at the plan @gsnedders set out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants