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

Address DeprecationWarning for configparser.readfp() #7393

Merged
merged 2 commits into from
Nov 3, 2022

Conversation

jonemo
Copy link
Contributor

@jonemo jonemo commented Nov 2, 2022

Issue #, if available: No related issue

Description of changes:

Running scripts/ci/run-tests results in 20 instances of this deprecation warning from Python's configparser:

DeprecationWarning: This method will be removed in Python 3.12. Use 'parser.read_file()' instead.

All lines of code that trigger this warning follow this pattern:

configparser.readfp(StringIO(some_string))

Since Python 3.2, configparser has a read_string method that can be used instead:

configparser.read_string(some_string)

After the changes in this PR, the unit and functional tests still pass and the deprecation warnings are gone.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…ad_string()

DeprecationWarning: This method will be removed in Python 3.12. Use 'parser.read_file()' instead.

https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.read_string
@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2022

Codecov Report

Merging #7393 (6b582cd) into develop (26346d4) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           develop   #7393   +/-   ##
=======================================
  Coverage     0.08%   0.08%           
=======================================
  Files          205     205           
  Lines        16455   16455           
=======================================
  Hits            14      14           
  Misses       16441   16441           
Impacted Files Coverage Δ
awscli/compat.py 0.00% <0.00%> (ø)
awscli/customizations/codeartifact/login.py 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@nateprewitt nateprewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@jonemo jonemo merged commit 313d875 into aws:develop Nov 3, 2022
@jonemo jonemo deleted the python312-deprecation-warning branch November 3, 2022 17:33
aws-sdk-python-automation added a commit that referenced this pull request Nov 3, 2022
* release-1.27.2:
  Bumping version to 1.27.2
  Update changelog based on model updates
  Address DeprecationWarning for configparser.readfp() (#7393)
godd9170 pushed a commit to godd9170/aws-cli that referenced this pull request Mar 7, 2023
* Replace RawConfigParser.readfp(StringIO(str)) with RawConfigParser.read_string()

DeprecationWarning: This method will be removed in Python 3.12. Use 'parser.read_file()' instead.

https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.read_string

* remove usage of six for configparser.RawConfigParser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants