8000 bpo-35954: Clarify string conversion in ConfigParser by remilapeyre · Pull Request #11918 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-35954: Clarify string conversion in ConfigParser #11918

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Convert key to string when accessing ConfigParser"
This reverts commit c8fff23.
  • Loading branch information
Rémi Lapeyre committed Jan 20, 2020
commit 3f84272af38d53698c2c3d06c481155970987899
3 changes: 1 addition & 2 deletions Lib/configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,7 @@ def remove_section(self, section):
return existed

def __getitem__(self, key):
key = str(key)
if not key in self:
if key != self.default_section and not self.has_section(key):
raise KeyError(key)
return self._proxies[key]

Expand Down
5 changes: 0 additions & 5 deletions Lib/test/test_configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,6 @@ def test_basic_from_dict(self):
},
})

def test_string_conversion(self):
cf = self.newconfig()
cf[123] = {}
self.assertEqual(cf[123], {})

def test_case_sensitivity(self):
cf = self.newconfig()
cf.add_section("A")
Expand Down
0