Bug 2038886 - tuned fails to build with Python 3.11: AttributeError: 'ConfigParser' object has no attribute 'readfp'
Summary: tuned fails to build with Python 3.11: AttributeError: 'ConfigParser' object ...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Fedora
Classification: Fedora
Component: tuned
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-01-10 13:29 UTC by Tomáš Hrnčiar
Modified: 2022-03-23 10:15 UTC (History)
5 users (show)

Fixed In Version: tuned-2.18.0-3.20220317gite1045f2d.fc37
Clone Of:
Environment:
Last Closed: 2022-02-10 11:15:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-01-10 13:29:18 UTC
tuned fails to build with Python 3.11.0a3.

======================================================================
ERROR: test_load_config_data (profiles.test_loader.LoaderTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tests/unit/profiles/test_loader.py", line 98, in test_load_config_data
    config = self._loader._load_config_data(\
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/loader.py", line 106, in _load_config_data
    config_obj.readfp(f)
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigParser' object has no attribute 'readfp'

======================================================================
ERROR: test_load_with_include (profiles.test_loader.LoaderTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tests/unit/profiles/test_loader.py", line 82, in test_load_with_include
    merged_profile = self._loader.load(['dummy3'])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/loader.py", line 56, in load
    self._load_profile(profile_names, profiles, processed_files)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/loader.py", line 90, in _load_profile
    config = self._load_config_data(filename)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/loader.py", line 106, in _load_config_data
    config_obj.readfp(f)
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigParser' object has no attribute 'readfp'

======================================================================
ERROR: test_load_without_include (profiles.test_loader.LoaderTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tests/unit/profiles/test_loader.py", line 65, in test_load_without_include
    merged_profile = self._loader.load(['dummy','dummy2'])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/loader.py", line 56, in load
    self._load_profile(profile_names, profiles, processed_files)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/loader.py", line 90, in _load_profile
    config = self._load_config_data(filename)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/loader.py", line 106, in _load_config_data
    config_obj.readfp(f)
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigParser' object has no attribute 'readfp'

======================================================================
ERROR: test_variables (profiles.test_loader.LoaderTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tests/unit/profiles/test_loader.py", line 111, in test_variables
    config = self._loader.load(['dummy4'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/loader.py", line 56, in load
    self._load_profile(profile_names, profiles, processed_files)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/loader.py", line 90, in _load_profile
    config = self._load_config_data(filename)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/loader.py", line 106, in _load_config_data
    config_obj.readfp(f)
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigParser' object has no attribute 'readfp'

======================================================================
ERROR: test_get_known_names_summary (profiles.test_locator.LocatorTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tests/unit/profiles/test_locator.py", line 73, in test_get_known_names_summary
    self.assertEqual(("balanced", "this is balanced"), sorted(self.locator.get_known_names_summary())[0])
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/locator.py", line 123, in get_known_names_summary
    return [(profile, self.get_profile_attrs(profile, [consts.PROFILE_ATTR_SUMMARY], [""])[2]) for profile in sorted(self.list_profiles())]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/locator.py", line 123, in <listcomp>
    return [(profile, self.get_profile_attrs(profile, [consts.PROFILE_ATTR_SUMMARY], [""])[2]) for profile in sorted(self.list_profiles())]
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/locator.py", line 92, in get_profile_attrs
    config = self.parse_config(profile_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/locator.py", line 67, in parse_config
    config.readfp(StringIO("[" + consts.MAGIC_HEADER_NAME + "]\n" + f.read()))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigParser' object has no attribute 'readfp'

======================================================================
ERROR: test_get_profile_attrs (profiles.test_locator.LocatorTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tests/unit/profiles/test_locator.py", line 76, in test_get_profile_attrs
    attrs = self.locator.get_profile_attrs("balanced", ["summary", "wrong_attr"], ["this is default", "this is wrong attr"])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/locator.py", line 92, in get_profile_attrs
    config = self.parse_config(profile_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/locator.py", line 67, in parse_config
    config.readfp(StringIO("[" + consts.MAGIC_HEADER_NAME + "]\n" + f.read()))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigParser' object has no attribute 'readfp'

======================================================================
ERROR: test_from_file (profiles.test_variables.VariablesTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tests/unit/profiles/test_variables.py", line 17, in test_from_file
    v.add_from_file(self.test_dir + "/variables")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/variables.py", line 57, in add_from_file
    config.readfp(StringIO("[" + consts.MAGIC_HEADER_NAME + "]\n" + f.read()))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigParser' object has no attribute 'readfp'

======================================================================
ERROR: test_from_unit (profiles.test_variables.VariablesTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tests/unit/profiles/test_variables.py", line 26, in test_from_unit
    v.add_from_cfg(mock_unit)
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/variables.py", line 68, in add_from_cfg
    self.add_from_file(os.path.normpath(cfg[item]))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/profiles/variables.py", line 57, in add_from_file
    config.readfp(StringIO("[" + consts.MAGIC_HEADER_NAME + "]\n" + f.read()))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigParser' object has no attribute 'readfp'

======================================================================
ERROR: setUpClass (utils.test_global_config.GlobalConfigTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tests/unit/utils/test_global_config.py", line 18, in setUpClass
    cls._global_config = global_config.GlobalConfig(\
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/utils/global_config.py", line 21, in __init__
    self.load_config(file_name=config_file)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/tuned-2.17.0-rc.1/tuned/utils/global_config.py", line 51, in load_config
    config_parser.readfp(StringIO("[" + consts.MAGIC_HEADER_NAME + "]\n" + f.read()))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ConfigParser' object has no attribute 'readfp'

----------------------------------------------------------------------
Ran 105 tests in 0.045s

FAILED (errors=9)
make: *** [Makefile:228: test] Error 1

Removed from the configparser module: the SafeConfigParser class, the filename property of the ParsingError class, the readfp() method of the ConfigParser class, deprecated since Python 3.2. (Contributed by Hugo van Kemenade in bpo-45173.)

https://bugs.python.org/issue45173
https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03121853-tuned/

For all our attempts to build tuned with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/tuned/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Jaroslav Škarvada 2022-01-10 19:41:47 UTC
Upstream PR that should fix the problem:
https://github.com/redhat-performance/tuned/pull/397

Comment 2 Ben Cotton 2022-02-08 21:13:29 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 3 Tomáš Hrnčiar 2022-02-10 11:15:20 UTC
Changes in configparser module were reverted in Python 3.11 and will be part of Python 3.12, thus I am closing this bugzilla. However, I highly encourage you to work with the upstream to fix it so we won't have to deal with it next year.

Comment 4 Jaroslav Škarvada 2022-03-23 10:15:44 UTC
(In reply to Tomáš Hrnčiar from comment #3)
> Changes in configparser module were reverted in Python 3.11 and will be part
> of Python 3.12, thus I am closing this bugzilla. However, I highly encourage
> you to work with the upstream to fix it so we won't have to deal with it
> next year.

FYI: it's already fixed in TuneD upstream and updated TuneD packages are already in Fedora:
tuned-2.18.0-3.20220317gite1045f2d.fc37 or newer.


Note You need to log in before you can comment on or make changes to this bug.