Author vstinner
Recipients vstinner
Date 2020-11-18.10:47:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605696478.69.0.28023827375.issue42398@roundup.psfhosted.org>
In-reply-to
Content
When building the Fedora package of Python 3.10, *sometimes* the "make regen-all" fail to build with errors like:
------------
/builddir/build/BUILD/Python-3.9.0/Modules/_weakref.c:131:5: error: '_WEAKREF_GETWEAKREFCOUNT_METHODDEF' undeclared here (not in a function)
  131 |     _WEAKREF_GETWEAKREFCOUNT_METHODDEF
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/Python-3.9.0/Modules/_weakref.c:132:5: error: expected '}' before '_WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF'
  132 |     _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------

Example: https://src.fedoraproject.org/rpms/python3.9/pull-request/40

The _WEAKREF_GETWEAKREFCOUNT_METHODDEF macro is defined by Modules/clinic/_weakref.c.h which is included by Modules/_weakref.c (at line 13).

It seems like while Modules/_weakref.o was being built, Modules/clinic/_weakref.c.h was being generated "at the same time".

The "make regen-all" command runs "make clinic" and "make regen-importlib" targets:

* "make regen-importlib" builds Modules/_weakref.o from Modules/_weakref.c and  Modules/clinic/_weakref.c.h

* "make clinic" always rewrites "Modules/clinic/_weakref.c.h" file


On Fedora, packages are built using MAKEFLAGS="-j<N>" where <N> is a number, like "-j4". Since there is no dependency between "clinic" and "regen-importlib" targets, these two targets *can* be run in parallel.

It seems like "make clinic" always rewrites *all* generated files and the half of writes are *not* atomic.


Attached PR makes all writes of clinic.py atomic *and* also avoids modifying the file modification file if the content does not change, as done in other "make regen-all" targets (using Tools/scripts/update_file.py).
History
Date User Action Args
2020-11-18 10:47:58vstinnersetrecipients: + vstinner
2020-11-18 10:47:58vstinnersetmessageid: <1605696478.69.0.28023827375.issue42398@roundup.psfhosted.org>
2020-11-18 10:47:58vstinnerlinkissue42398 messages
2020-11-18 10:47:58vstinnercreate