Bug 1794572

Summary: Python ctypes broken (with upstream patch)
Product: [Fedora] Fedora Reporter: markusN <neteler>
Component: python3Assignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 31CC: cstratak, dmalcolm, m.cyprian, mhroncok, pviktori, python-sig, rkuska, shcherbina.iryna, slavek.kabrda, tomspur, torsava, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: python3-3.7.6-2.fc31 python3-3.7.6-2.fc30 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-03 01:22:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description markusN 2020-01-23 20:38:41 UTC
Description of problem:


The ctypes wrapper (in e.g. GRASS GIS, which uses ctypesgen for wrapping for many years) is broken with certain Python versions (see below) due to a bug introduced in Python 3.7.6:

...
    ('checker', CFUNCTYPE(UNCHECKED(c_int), String)),
   File "/usr/lib/python3.8/ctypes/__init__.py", line 101, in CFUNCTYPE
     class CFunctionType(_CFuncPtr):
 TypeError: item 1 in _argtypes_ passes a union by value, which is
 unsupported.
...


Upstream bug report:
https://bugs.python.org/issue16575

There is an upstream PR, fixing this issue:
https://github.com/python/cpython/pull/17960

# ... with this the patch to be applied prior to compile Python:
https://github.com/python/cpython/commit/eb9ba2f66df2195a9c6295e73ab3d545a1445f05.patch


Version-Release number of selected component (if applicable):
Python 3.7.6 - 3.8.1

An upstream fix is (at time) scheduled for Python 3.8.2 in February but earlier versions down to 3.7.6 also need the fix.


[1] https://trac.osgeo.org/grass/ticket/4015

Comment 1 markusN 2020-01-24 22:09:26 UTC
Related FAF report: https://retrace.fedoraproject.org/faf/reports/2806082/

Comment 2 markusN 2020-01-24 22:11:41 UTC
Tested today:

Downgrading Python to 3.7.4 with `dnf downgrade python` reinstates the proper ctypes wrapping in GRASS GIS (I am one of the maintainers of the package).

Comment 3 Miro Hrončok 2020-01-25 14:48:51 UTC
Markus, almost the entire group of people who take care of the Python package in Fedora are at devconf.cz now, but we are aware of this and will work on it as soon as we will be able too, most probably early next week.

Comment 4 Miro Hrončok 2020-01-28 10:00:55 UTC
Our GitHub PR: https://github.com/fedora-python/cpython/pull/6

Comment 5 Miro Hrončok 2020-01-28 10:13:39 UTC
Rawhide PR with Python 3.8: https://src.fedoraproject.org/rpms/python3/pull-request/164 (will most likely fail due to unrelated test failures we are observing ATM)
Fedora 31 PR with Python 3.7: https://src.fedoraproject.org/rpms/python3/pull-request/165

Comment 6 Miro Hrončok 2020-01-28 11:27:42 UTC
Can you please test with the build from here? https://src.fedoraproject.org/rpms/python3/pull-request/165 (simple-koji-ci link on the right ->) https://koji.fedoraproject.org/koji/taskinfo?taskID=41126556

Comment 7 markusN 2020-01-28 13:35:58 UTC
Great, installing

python3-3.7.6-2.fc32.x86_64
python3-devel-3.7.6-2.fc32.x86_64
python3-libs-3.7.6-2.fc32.x86_64
python-unversioned-command-3.7.6-2.fc32.noarch
python3-tkinter-3.7.6-2.fc32.x86_64

brings the GUI of GRASS GIS  (ctypes needed) back to functioning.

Comment 8 Fedora Update System 2020-01-31 01:30:28 UTC
python3-3.7.6-2.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-9ea732a266

Comment 9 Fedora Update System 2020-01-31 02:26:09 UTC
python3-3.7.6-2.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-a810cdabac

Comment 10 Fedora Update System 2020-02-03 01:22:04 UTC
python3-3.7.6-2.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2020-02-15 02:54:06 UTC
python3-3.7.6-2.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.