Bug 1919789 - setproctitle.getproctitle() errors with Python 3.10: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
Summary: setproctitle.getproctitle() errors with Python 3.10: SystemError: PY_SSIZE_T_...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: python-setproctitle
Version: 35
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Haïkel Guémar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1902276 (view as bug list)
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2021-01-25 07:43 UTC by Tomáš Hrnčiar
Modified: 2022-12-13 15:17 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-12-13 15:17:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2021-01-25 07:43:17 UTC
copr-backend fails to build with Python 3.10.0a4.

=================================== FAILURES ===================================
____________________ TestCreaterepo.test_run_cmd_unsafe_ok _____________________

self = <tests.test_createrepo.TestCreaterepo object at 0x7fe258d822b0>
mc_popen = <MagicMock name='Popen' id='140610129400496'>

    def test_run_cmd_unsafe_ok(self, mc_popen):
        cmd = "foo --bar"
        mc_popen.return_value.communicate.return_value = ("stdout", "stderr")
        mc_popen.return_value.returncode = 0
    
>       assert run_cmd_unsafe(cmd, self.tmp_dir_name, lock_path="/tmp") == "stdout"

tests/test_createrepo.py:118: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

comm_str = 'foo --bar', lock_name = '/tmp/test_createrepo_1611336042.098019'
lock_path = '/tmp'

    def run_cmd_unsafe(comm_str, lock_name, lock_path="/var/lock/copr-backend"):
        # log.info("Running command: {}".format(comm_str))
        comm = split(comm_str)
>       title = getproctitle()
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

copr_backend/createrepo.py:26: SystemError
_________________ TestCreaterepo.test_run_cmd_unsafe_err_popen _________________

self = <tests.test_createrepo.TestCreaterepo object at 0x7fe258bbbcd0>
mc_popen = <MagicMock name='Popen' id='140610128035552'>

    def test_run_cmd_unsafe_err_popen(self, mc_popen):
        cmd = "foo --bar"
        mc_popen.side_effect = IOError()
    
        with pytest.raises(CreateRepoError) as err:
>           run_cmd_unsafe(cmd, self.tmp_dir_name, lock_path="/tmp") == "stdout"

tests/test_createrepo.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

comm_str = 'foo --bar', lock_name = '/tmp/test_createrepo_1611336042.1865735'
lock_path = '/tmp'

    def run_cmd_unsafe(comm_str, lock_name, lock_path="/var/lock/copr-backend"):
        # log.info("Running command: {}".format(comm_str))
        comm = split(comm_str)
>       title = getproctitle()
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

copr_backend/createrepo.py:26: SystemError
______________ TestCreaterepo.test_run_cmd_unsafe_err_return_code ______________

self = <tests.test_createrepo.TestCreaterepo object at 0x7fe258ccaf10>
mc_popen = <MagicMock name='Popen' id='140610129145184'>

    def test_run_cmd_unsafe_err_return_code(self, mc_popen):
        cmd = "foo --bar"
        mc_popen.return_value.communicate.return_value = ("stdout", "stderr")
        mc_popen.return_value.returncode = 1
    
    
        with pytest.raises(CreateRepoError) as err:
>           run_cmd_unsafe(cmd, self.tmp_dir_name, lock_path="/tmp") == "stdout"

tests/test_createrepo.py:139: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

comm_str = 'foo --bar', lock_name = '/tmp/test_createrepo_1611336042.2561789'
lock_path = '/tmp'

    def run_cmd_unsafe(comm_str, lock_name, lock_path="/var/lock/copr-backend"):
        # log.info("Running command: {}".format(comm_str))
        comm = split(comm_str)
>       title = getproctitle()
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

copr_backend/createrepo.py:26: SystemError
______________ TestCreaterepo.test_run_cmd_unsafe_err_communicate ______________

self = <tests.test_createrepo.TestCreaterepo object at 0x7fe258cae880>
mc_popen = <MagicMock name='Popen' id='140610129030784'>

    def test_run_cmd_unsafe_err_communicate(self, mc_popen):
        cmd = "foo --bar"
        mc_handle = MagicMock()
        mc_popen.return_value = MagicMock()
        mc_handle.returncode = 0
        mc_handle.side_effect = RuntimeError()
    
        with pytest.raises(CreateRepoError) as err:
>           run_cmd_unsafe(cmd, self.tmp_dir_name, lock_path="/tmp") == "stdout"

tests/test_createrepo.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

comm_str = 'foo --bar', lock_name = '/tmp/test_createrepo_1611336042.2812111'
lock_path = '/tmp'

    def run_cmd_unsafe(comm_str, lock_name, lock_path="/var/lock/copr-backend"):
        # log.info("Running command: {}".format(comm_str))
        comm = split(comm_str)
>       title = getproctitle()
E       SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

copr_backend/createrepo.py:26: SystemError

=========================== short test summary info ============================
FAILED tests/test_createrepo.py::TestCreaterepo::test_run_cmd_unsafe_ok - Sys...
FAILED tests/test_createrepo.py::TestCreaterepo::test_run_cmd_unsafe_err_popen
FAILED tests/test_createrepo.py::TestCreaterepo::test_run_cmd_unsafe_err_return_code
FAILED tests/test_createrepo.py::TestCreaterepo::test_run_cmd_unsafe_err_communicate
======= 4 failed, 157 passed, 9 skipped, 3 warnings in 81.07s (0:01:21) ========

https://docs.python.org/3.10/whatsnew/3.10.html#id2

The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() formats which use #: es#, et#, s#, u#, y#, z#, U# and Z#. See Parsing arguments and building values and the PEP 353.
https://docs.python.org/3.10/c-api/arg.html#arg-parsing
https://www.python.org/dev/peps/pep-0353
https://bugs.python.org/issue40943

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01893901-copr-backend/

For all our attempts to build copr-backend with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/copr-backend/

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.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
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 Miro Hrončok 2021-01-25 09:03:44 UTC
copr-backend is pure Python, no extension modules. The error is surely coming from a compiled C API Python code that copr invokes.

I suspect setproctitle: it is an extension module and has %check commented out with a very outdated comment.

Comment 2 Pavel Raiskup 2021-01-26 08:29:52 UTC
Moving to setproctitle, easily reproducible:

$ copr mock-config @python/python3.10 fedora-rawhide-x86_64 > /tmp/x.cfg
$ mock -r /tmp/x.cfg --install python3-setproctitle
$ mock -r /tmp/x.cfg --shell
<mock-chroot> sh-5.1# python3
Python 3.10.0a4 (default, Jan 15 2021, 00:00:00) 
[GCC 11.0.0 20210119 (Red Hat 11.0.0-0)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import setproctitle
>>> setproctitle.getproctitle()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

Comment 3 Ben Cotton 2021-02-09 15:42:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 4 Dick Marinus 2021-02-21 06:23:25 UTC
*** Bug 1902276 has been marked as a duplicate of this bug. ***

Comment 5 Miro Hrončok 2021-06-04 20:16:00 UTC
This is a mass-posted update. Sorry if it is not 100% accurate to this bugzilla.


The Python 3.10 rebuild is in progress in a Koji side tag. If you manage to fix the problem, please commit the fix in the rawhide branch, but don't build the package in regular rawhide.

You can either build the package in the side tag, with:

    $ fedpkg build --target=f35-python

Or you can the build and we will eventually build it for you.

Note that the rebuild is still in progress, so not all (build) dependencies of this package might be available right away.

Thanks.

See also https://fedoraproject.org/wiki/Changes/Python3.10

If you have general questions about the rebuild, please use this mailing list thread: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/G47SGOYIQLRDTWGOSLSWERZSSHXDEDH5/

Comment 6 Miro Hrončok 2021-06-07 23:00:20 UTC
The f35-python side tag has been merged to Rawhide. From now on, build as you would normally build.

Comment 7 Ben Cotton 2021-08-10 12:50:24 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 8 Ben Cotton 2022-11-29 16:51:27 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 9 Ben Cotton 2022-12-13 15:17:13 UTC
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13.

Fedora Linux 35 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


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