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

Move away from cgi.parse_header #873

Closed
domdfcoding opened this issue May 9, 2022 · 4 comments · Fixed by #876
Closed

Move away from cgi.parse_header #873

domdfcoding opened this issue May 9, 2022 · 4 comments · Fixed by #876
Assignees
Milestone

Comments

@domdfcoding
Copy link

Overview Description

babel currently uses cgi.parse_header here to parse mime type headers.
The cgi module is deprecated in Python 3.11 by PEP 594, and is scheduled for removal in 3.13.
The recommended replacement is email.message.Message; there is an example in the PEP showing how to use it instead.

@akx akx added this to the Babel 2.11 milestone May 10, 2022
@akx akx self-assigned this May 10, 2022
akx added a commit to akx/babel that referenced this issue May 10, 2022
cgi.parse_header is due to be deprecated

Fixes python-babel#873
@akx akx closed this as completed in #876 May 10, 2022
akx added a commit that referenced this issue May 10, 2022
cgi.parse_header is due to be deprecated

Fixes #873
@hugovk
Copy link
Contributor

hugovk commented Oct 30, 2022

Python 3.11 was released on Monday, so this deprecation warning is now showing up.

Do you have a rough idea when this will be released?

Thank you!

@akx
Copy link
Member

akx commented Oct 31, 2022

@hugovk I'll try go get that done this week! :)

@akx
Copy link
Member

akx commented Nov 1, 2022

@hugovk Babel 2.11.0 is freshly out of the oven! Find it at a PyPI CDN endpoint near you. 😁 https://github.com/python-babel/babel/releases/tag/v2.11.0

@hugovk
Copy link
Contributor

hugovk commented Nov 1, 2022

Thank you! 🚀

radez added a commit to radez/cherrypy that referenced this issue Feb 19, 2024
the module was deprecatied in py 3.11 and removed in py 3.13
there are examples of using the email module to resolve this:
PEP 594
python-babel/babel#873
https://stackoverflow.com/questions/69068527/python-3-cgi-parse-header

This method doesn't seem to work for cherrypy.
The email.message module is trying to create a higher level
object that is intelligent about the headers it has defined. The
cgi.parse_header function is a very low level unintelligent function
that simply parses header content based on structure and does not
inspect the contents. Because of the intelligence of the email.message
object cherrypy can't use it in the very generic way that the
cgi.parse_header function was being used.

Fix cherrypy#2014
radez added a commit to radez/cherrypy that referenced this issue Feb 19, 2024
the module was deprecatied in py 3.11 and removed in py 3.13
there are examples of using the email module to resolve this:
PEP 594
python-babel/babel#873
https://stackoverflow.com/questions/69068527/python-3-cgi-parse-header

This method doesn't seem to work for cherrypy.
The email.message module is trying to create a higher level
object that is intelligent about the headers it has defined. The
cgi.parse_header function is a very low level unintelligent function
that simply parses header content based on structure and does not
inspect the contents. Because of the intelligence of the email.message
object cherrypy can't use it in the very generic way that the
cgi.parse_header function was being used.

Fix cherrypy#2014
radez added a commit to radez/cherrypy that referenced this issue Feb 19, 2024
the module was deprecatied in py 3.11 and removed in py 3.13
there are examples of using the email module to resolve this:
PEP 594
python-babel/babel#873
https://stackoverflow.com/questions/69068527/python-3-cgi-parse-header

This method doesn't seem to work for cherrypy.
The email.message module is trying to create a higher level
object that is intelligent about the headers it has defined. The
cgi.parse_header function is a very low level unintelligent function
that simply parses header content based on structure and does not
inspect the contents. Because of the intelligence of the email.message
object cherrypy can't use it in the very generic way that the
cgi.parse_header function was being used.

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

Successfully merging a pull request may close this issue.

3 participants