Bug 1890880 - breezy fails to build with Python 3.10: Py_REFCNT= needs to be replaced with Py_SET_REFCNT
Summary: breezy fails to build with Python 3.10: Py_REFCNT= needs to be replaced with ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: breezy
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ondřej Pohořelský
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2020-10-23 07:54 UTC by Tomáš Hrnčiar
Modified: 2020-11-24 09:45 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-24 09:45:55 UTC
Type: Bug


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2020-10-23 07:54:04 UTC
breezy fails to build with Python 3.10.0a1.

breezy/_static_tuple_c.c: In function ‘StaticTuple_Intern’:
breezy/_static_tuple_c.c:100:21: error: lvalue required as left operand of assignment
  100 |     Py_REFCNT(self) -= 1;
      |                     ^~
breezy/_static_tuple_c.c: In function ‘StaticTuple_dealloc’:
breezy/_static_tuple_c.c:119:25: error: lvalue required as left operand of assignment
  119 |         Py_REFCNT(self) = 2;
      |                         ^

  Cannot build extension "breezy._static_tuple_c".
  Use "build_ext --allow-python-fallback" to use slower python implementations instead.

error: command '/usr/bin/gcc' failed with exit code 1

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

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

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 2020-10-23 08:03:42 UTC
https://docs.python.org/3.10/whatsnew/3.10.html#id2

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

#if PY_VERSION_HEX < 0x030900A4
#  define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)
#endif

https://bugs.python.org/issue39573

Comment 2 Miro Hrončok 2020-10-26 11:49:12 UTC
For the record, this is **not** fixed in breezy 3.1.0:

[breezy (3.1.0)]$ rg Py_REFCNT breezy-3.1.0
breezy-3.1.0/breezy/_static_tuple_c.c
100:    Py_REFCNT(self) -= 1;
119:        Py_REFCNT(self) = 2;

Comment 3 Victor Stinner 2020-11-19 11:05:35 UTC
I reported the issue to breezy upstream: https://bugs.launchpad.net/brz/+bug/1904868

Comment 4 Victor Stinner 2020-11-19 20:14:34 UTC
My fix got merged into the 3.1 branch: https://bazaar.launchpad.net/~brz/brz/3.1/revision/7647

Comment 5 Tomáš Hrnčiar 2020-11-20 07:37:05 UTC
Thank you for the patch Victor. I can confirm that breezy builds alright in our Copr: https://copr.fedorainfracloud.org/coprs/g/python/python3.10/build/1776306/


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