# HG changeset patch # User Augie Fackler # Date 1585151807 14400 # Node ID 960770add699b3aa88ca6f8aa1b8691f0fc14f66 # Parent a89aa2d7b34d381d791b77756d8f17e05ead2ddb setup: relax -Werror for declaration-after-statement on Python 3.9 It turns out Python 3.9 introduces such declarations in the headers, eg cpython/abstract.h:189:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] so we have to be more relaxed when compiling for 3.9. Differential Revision: https://phab.mercurial-scm.org/D8327 diff -r a89aa2d7b34d -r 960770add699 setup.py --- a/setup.py Wed Mar 25 08:28:20 2020 -0700 +++ b/setup.py Wed Mar 25 11:56:47 2020 -0400 @@ -1270,8 +1270,9 @@ common_cflags = [] -# MSVC 2008 still needs declarations at the top of the scope. -if os.name != 'nt': +# MSVC 2008 still needs declarations at the top of the scope, but Python 3.9 +# makes declarations not at the top of a scope in the headers. +if os.name != 'nt' and sys.version_info[1] < 9: common_cflags = ['-Werror=declaration-after-statement'] osutil_cflags = []