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

conf: Test for segfaulting iterator in ConfigParser #2172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 16 additions & 0 deletions tests/conf/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,19 @@ def test_empty_option(self):
conf.config_file_path = FN
conf.read()
self.assertEqual(conf.reposdir, '')

def test_iterator_segfault(self):
# Verify the behavior fixed in https://bugzilla.redhat.com/show_bug.cgi?id=2330562
empty_conf_path = tests.support.resource_path('etc/empty.conf')

parser = ConfigParser()
parser.read(empty_conf_path)
self.assertTrue(parser.hasSection("main"))

sectObj = parser.getData()["main"]

# segfaulting before with Python 3.13.1
[item for item in sectObj]
jan-kolarik marked this conversation as resolved.
Show resolved Hide resolved

# segfaulting before with Python 3.13.0
[item for item in iter(sectObj)]
1 change: 1 addition & 0 deletions tests/etc/empty.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[main]
Loading