Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1941557

Summary: python-Bottleneck fails to build with Python 3.10: expected ‘(’ before ‘_PyObject_TypeCheck’
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-BottleneckAssignee: Björn 'besser82' Esser <besser82>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: besser82, mhroncok, thrnciar, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-06-14 10:34:50 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:
Bug Depends On:    
Bug Blocks: 1890881, 1969172    

Description Miro Hrončok 2021-03-22 11:06:45 UTC
python-Bottleneck fails to build with Python 3.10.0a6.

gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I/usr/lib64/python3.10/site-packages/numpy/core/include -I/usr/include/python3.10 -c bottleneck/src/reduce.c -o build/temp.linux-x86_64-3.10/bottleneck/src/reduce.o -O2
In file included from /usr/include/python3.10/Python.h:87,
                 from bottleneck/src/bottleneck.h:4,
                 from bottleneck/src/reduce.c:1:
bottleneck/src/reduce.c: In function ‘reducer’:
/usr/include/python3.10/object.h:242:38: error: expected ‘(’ before ‘_PyObject_TypeCheck’
  242 | #define PyObject_TypeCheck(ob, type) _PyObject_TypeCheck(_PyObject_CAST(ob), type)
      |                                      ^~~~~~~~~~~~~~~~~~~
/usr/lib64/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h:28:27: note: in expansion of macro ‘PyObject_TypeCheck’
   28 | #define PyArray_Check(op) PyObject_TypeCheck(op, &PyArray_Type)
      |                           ^~~~~~~~~~~~~~~~~~
bottleneck/src/reduce.c:2830:8: note: in expansion of macro ‘PyArray_Check’
 2830 |     if PyArray_Check(a_obj) {
      |        ^~~~~~~~~~~~~
bottleneck/src/reduce.c:2813:9: warning: unused variable ‘ndim’ [-Wunused-variable]
 2813 |     int ndim;
      |         ^~~~
error: command '/usr/bin/gcc' failed with exit code 1



https://docs.python.org/3.10/whatsnew/changelog.html

"""Convert PyObject_TypeCheck() macro to a static inline function."""
https://bugs.python.org/issue43181


The expression in: `if PyArray_Check(a_obj)` from bottleneck/src/reduce.c needs to be wrapped in parentheses.




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

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

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-03-22 14:34:52 UTC
See https://bugzilla.redhat.com/show_bug.cgi?id=1941559#c1 for an explanation.

Comment 2 Victor Stinner 2021-03-22 17:22:15 UTC
PyObject_TypeCheck() was changed by https://bugs.python.org/issue43181


bottleneck/src/reduce.c:2830:8: note: in expansion of macro ‘PyArray_Check’
 2830 |     if PyArray_Check(a_obj) {

This bug was already fixed in newer bottleneck: the latest version is 1.3.2, see: https://pypi.org/project/Bottleneck/

setup.py of the latest version of bottleneck fails on Python 3.10, I proposed a fix: https://github.com/pydata/bottleneck/pull/378

Comment 3 Miro Hrončok 2021-06-04 20:15:03 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 4 Miro Hrončok 2021-06-07 22:59:32 UTC
The f35-python side tag has been merged to Rawhide. From now on, build as you would normally build.

Comment 5 Miro Hrončok 2021-06-13 22:09:55 UTC
If somebody wants to backport a fix for the current Fedora version, this should do: https://github.com/pydata/bottleneck/commit/3c92be0f37906001df77896f688a8c9ce687b6c1

Comment 6 Miro Hrončok 2021-06-14 10:34:50 UTC
This package was successfully rebuilt with Python 3.10.

If you need this bugzilla open for tracking purposes, sorry for the automatic closing: feel free to reopen it.