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
Bug 1890442 - python-pycurl fails to build with Python 3.10: Py_TYPE= needs to be replaced with Py_SET_TYPE
Summary: python-pycurl fails to build with Python 3.10: Py_TYPE= needs to be replaced ...
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pycurl
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Kamil Dudka
QA Contact: Fedora Extras Quality Assurance
: 1891754 (view as bug list)
Depends On:
Blocks: PYTHON3.10 PYTHON39
TreeView+ depends on / blocked
Reported: 2020-10-22 08:47 UTC by Tomáš Hrnčiar
Modified: 2020-11-18 17:59 UTC (History)
6 users (show)

Fixed In Version: python-pycurl-
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-10-27 08:24:52 UTC
Type: Bug

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github pycurl pycurl pull 660 0 None closed src/module.c: make the code compile against python-3.10.0a1 2020-12-02 20:23:08 UTC

Description Tomáš Hrnčiar 2020-10-22 08:47:55 UTC
python-pycurl fails to build with Python 3.10.0a1.

RPM build errors:
src/easyperform.c: In function ‘do_curl_perform_rb’:
src/easyperform.c:31:5: warning: ‘PyEval_CallObjectWithKeywords’ is deprecated [-Wdeprecated-declarations]
   31 |     io = PyEval_CallObject(bytesio, NULL);
      |     ^~
In file included from /usr/include/python3.10/Python.h:146,
                 from src/pycurl.h:5,
                 from src/easyperform.c:1:
/usr/include/python3.10/ceval.h:17:43: note: declared here
   17 | Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/module.c: In function ‘PyInit_pycurl’:
src/module.c:353:25: error: lvalue required as left operand of assignment
  353 |     Py_TYPE(&Curl_Type) = &PyType_Type;
      |                         ^
src/module.c:354:30: error: lvalue required as left operand of assignment
  354 |     Py_TYPE(&CurlMulti_Type) = &PyType_Type;
      |                              ^
src/module.c:355:30: error: lvalue required as left operand of assignment
  355 |     Py_TYPE(&CurlShare_Type) = &PyType_Type;
      |                              ^
src/module.c:1406:5: warning: ‘PyEval_InitThreads’ is deprecated [-Wdeprecated-declarations]
 1406 |     PyEval_InitThreads();
      |     ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.10/Python.h:146,
                 from src/pycurl.h:5,
                 from src/module.c:1:
/usr/include/python3.10/ceval.h:122:37: note: declared here
  122 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
      |                                     ^~~~~~~~~~~~~~~~~~

For the build logs, see:

For all our attempts to build python-pycurl with Python 3.10, see:

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:

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 2020-10-23 08:04:56 UTC

Since Py_TYPE() is changed to the inline static function, Py_TYPE(obj) = new_type must be replaced with Py_SET_TYPE(obj, new_type): see Py_SET_TYPE() (available since Python 3.9). For backward compatibility, this macro can be used:

#if PY_VERSION_HEX < 0x030900A4
#  define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0)

Comment 2 Kamil Dudka 2020-10-26 09:53:17 UTC
Why do python developers do backward-incompatible changes in minor updates?

Comment 3 Petr Viktorin 2020-10-26 10:05:03 UTC
Python's versioning predates semver. As with any Y-release, 3.10 will have some backward incompatibilities.

Comment 4 Miro Hrončok 2020-10-26 10:47:03 UTC
In other words, 3.9 -> 3.10 is not considered a "minor" update.

See for example the release of Python 3.9.0: "Python 3.9.0 is the newest major release of the Python programming language..."

Comment 5 Kamil Dudka 2020-10-26 17:10:24 UTC
I wish we sticked to a more stable technology.  Porting everything to a new major release of python all the time is utterly wasteful.

I have opened a pull request upstream to fix this:

Comment 6 Miro Hrončok 2020-10-26 17:50:56 UTC
For this particular change, I've queried upstream about its necessity:

I would also like Python to be more stable.

Thanks for the PR, Kamil.

Comment 8 Tomáš Hrnčiar 2020-10-27 09:28:26 UTC
*** Bug 1891754 has been marked as a duplicate of this bug. ***

Comment 9 Miro Hrončok 2020-11-18 17:59:10 UTC
JFYI The change was reverted in Python 3.10, because it caused too much trouble (the amount of affected Fedora packages was too big).

This comment is mass posted in all relevant bugzillas. If you already worked upstream to fix the problem, you might want to let them know about the revert, but the new way of doing things also works.

Sorry for the trouble and thanks again for the fix.

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