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 dependency is deprecated in Python 3.11, slated for removal in Python 3.13 #2803

Closed
bmw opened this issue Nov 1, 2022 · 4 comments
Closed
Labels
bug This issue is a confirmed bug. dependencies This issue is a problem in a dependency. p2 This is a standard priority issue

Comments

@bmw
Copy link

bmw commented Nov 1, 2022

Describe the bug

Python 3.11 deprecated the cgi module which botocore uses here. See python/cpython#91217.

Expected Behavior

botocore doesn't use deprecated code

Current Behavior

botocore uses deprecated code resulting in deprecation warnings when run on Python 3.11

Reproduction Steps

$ python -Werror -c 'import botocore.session'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/tr/_jqrlt554c107b5lcxl3td_40000gn/T/tmp.HC2Evak2iS/venv/lib/python3.11/site-packages/botocore/session.py", line 26, in <module>
    import botocore.client
  File "/private/var/folders/tr/_jqrlt554c107b5lcxl3td_40000gn/T/tmp.HC2Evak2iS/venv/lib/python3.11/site-packages/botocore/client.py", line 17, in <module>
    from botocore import waiter, xform_name
  File "/private/var/folders/tr/_jqrlt554c107b5lcxl3td_40000gn/T/tmp.HC2Evak2iS/venv/lib/python3.11/site-packages/botocore/waiter.py", line 18, in <module>
    from botocore.docs.docstring import WaiterDocstring
  File "/private/var/folders/tr/_jqrlt554c107b5lcxl3td_40000gn/T/tmp.HC2Evak2iS/venv/lib/python3.11/site-packages/botocore/docs/__init__.py", line 15, in <module>
    from botocore.docs.service import ServiceDocumenter
  File "/private/var/folders/tr/_jqrlt554c107b5lcxl3td_40000gn/T/tmp.HC2Evak2iS/venv/lib/python3.11/site-packages/botocore/docs/service.py", line 14, in <module>
    from botocore.docs.client import ClientDocumenter, ClientExceptionsDocumenter
  File "/private/var/folders/tr/_jqrlt554c107b5lcxl3td_40000gn/T/tmp.HC2Evak2iS/venv/lib/python3.11/site-packages/botocore/docs/client.py", line 14, in <module>
    from botocore.docs.example import ResponseExampleDocumenter
  File "/private/var/folders/tr/_jqrlt554c107b5lcxl3td_40000gn/T/tmp.HC2Evak2iS/venv/lib/python3.11/site-packages/botocore/docs/example.py", line 13, in <module>
    from botocore.docs.shape import ShapeDocumenter
  File "/private/var/folders/tr/_jqrlt554c107b5lcxl3td_40000gn/T/tmp.HC2Evak2iS/venv/lib/python3.11/site-packages/botocore/docs/shape.py", line 19, in <module>
    from botocore.utils import is_json_value_header
  File "/private/var/folders/tr/_jqrlt554c107b5lcxl3td_40000gn/T/tmp.HC2Evak2iS/venv/lib/python3.11/site-packages/botocore/utils.py", line 15, in <module>
    import cgi
  File "/Users/bmw/.pyenv/versions/3.11.0rc2/lib/python3.11/cgi.py", line 57, in <module>
    warnings._deprecated(__name__, remove=(3,13))
  File "/Users/bmw/.pyenv/versions/3.11.0rc2/lib/python3.11/warnings.py", line 514, in _deprecated
    warn(msg, DeprecationWarning, stacklevel=3)
DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.28.5

Environment details (OS name and version, etc.)

macOS and linux

@bmw bmw added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Nov 1, 2022
@tim-finnigan tim-finnigan added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2022
@tim-finnigan
Copy link
Contributor

Thanks for bringing this to our attention. The deprecation warning you referenced notes:

DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13

And here's more context in the Python documentation:

Deprecated since version 3.11, will be removed in version 3.13: This function, like the rest of the cgi module, is deprecated. It can be replaced with the functionality in the email package, which implements the same MIME RFCs.

It looks like only the cgi command used is parse_header() here. So it shouldn't be too difficult to implement an alternative before Python 3.13.

@tim-finnigan tim-finnigan changed the title botocore uses modules deprecated in Python 3.11 cgi dependency is deprecated in Python 3.11, slated for removal in Python 3.13 Nov 2, 2022
@tim-finnigan tim-finnigan added dependencies This issue is a problem in a dependency. p2 This is a standard priority issue and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Nov 2, 2022
@wimglenn
Copy link
Contributor

wimglenn commented Nov 9, 2022

@tim-finnigan #2794

@wimglenn
Copy link
Contributor

@bmw This can be closed.

@bmw
Copy link
Author

bmw commented Nov 21, 2022

Indeed it can! Thanks so much for picking this up.

@bmw bmw closed this as completed Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. dependencies This issue is a problem in a dependency. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

3 participants