Mailing List Archive

[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration
New submission from Karolina Surma <warumnicht@tutanota.com>:

Hello all,
I want to build Python 3.10~b2 documentation using Sphinx 4.0.2 (released in May 2021) as RPM in Fedora with aim to ship it in Fedora 35.

The build fails with the following error:

Warning, treated as error:
/builddir/build/BUILD/Python-3.10.0b2/Doc/c-api/complex.rst:49:Error in declarator or parameters
Error in declarator or parameters
Invalid C declaration: Expected identifier, got keyword: complex [error at 39]
Py_complex _Py_c_neg(Py_complex complex)
---------------------------------------^
make: *** [Makefile:51: build] Error 2


The Sphinx changelog mentions in Bug fixes in https://www.sphinx-doc.org/en/master/changes.html#id21 the likely cause:
C, properly reject function declarations when a keyword is used as parameter name.

----------
assignee: docs@python
components: Documentation
messages: 395874
nosy: docs@python, ksurma
priority: normal
severity: normal
status: open
title: Docs fail to build with Sphinx 4 due to Invalid C declaration
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:

Hmm. It's probably not the best name, and we can certainly change it.

But I'm a bit confused by the error message: `complex` isn't a keyword in either C or C++, so I'm not sure why Sphinx thinks it is.

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:

As a test, gcc and clang both seem happy to treat this as valid C. I think Sphinx is wrong to reject this.

mdickinson@mirzakhani Desktop % cat test.c
typedef struct {
double real;
double imag;
} Py_complex;

Py_complex _Py_c_neg(Py_complex complex);
mdickinson@mirzakhani Desktop % gcc -Wall -Wextra -std=c17 -c test.c
mdickinson@mirzakhani Desktop % clang -Wall -Wextra -std=c17 -c test.c
mdickinson@mirzakhani Desktop %

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Change by Mark Dickinson <dickinsm@gmail.com>:


----------
keywords: +patch
pull_requests: +25329
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26744

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:


New changeset 7247f6f433846c6e37308a550e8e5eb6be379856 by Mark Dickinson in branch 'main':
bpo-44426: Use of 'complex' as a C variable name confuses Sphinx; change it to 'num'. (GH-26744)
https://github.com/python/cpython/commit/7247f6f433846c6e37308a550e8e5eb6be379856


----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>:


----------
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +25345
pull_request: https://github.com/python/cpython/pull/26760

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>:


----------
pull_requests: +25346
pull_request: https://github.com/python/cpython/pull/26761

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:


New changeset c689e0a7e2a25621da82f22cc64d089eae05e753 by Miss Islington (bot) in branch '3.10':
bpo-44426: Use of 'complex' as a C variable name confuses Sphinx; change it to 'num'. (GH-26744) (GH-26760)
https://github.com/python/cpython/commit/c689e0a7e2a25621da82f22cc64d089eae05e753


----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:


New changeset 686c6f303a6e9e54b50401be0ae3dc6aa2fcf05a by Miss Islington (bot) in branch '3.9':
bpo-44426: Use of 'complex' as a C variable name confuses Sphinx; change it to 'num'. (GH-26744) (GH-26761)
https://github.com/python/cpython/commit/686c6f303a6e9e54b50401be0ae3dc6aa2fcf05a


----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:

> and we can certainly change it

Done. Closing here, but I've opened a Sphinx issue at https://github.com/sphinx-doc/sphinx/issues/9354

----------
nosy: -miss-islington
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.11, Python 3.9

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Karolina Surma <warumnicht@tutanota.com> added the comment:

Thanks for the fix, this indeed worked. Documentation however still doesn't build successfully, this time with a traceback:

Warning, treated as error:
/builddir/build/BUILD/Python-3.10.0b2/Doc/c-api/object.rst:314:Error in declarator or parameters
Error in declarator or parameters
Invalid C declaration: Expected identifier, got keyword: default [error at 62]
Py_ssize_t PyObject_LengthHint(PyObject *o, Py_ssize_t default)
--------------------------------------------------------------^
make: *** [Makefile:51: build] Error 2

I'm afraid there will be more on the way as this item is resolved.

----------
resolution: fixed ->
status: closed -> open

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:

Thanks. That one's a genuine keyword. Looks like what we probably need to do is get a list of all these errors, so that they can all be fixed at once. Presumably running without the "-W" flag would make that easier.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Karolina Surma <warumnicht@tutanota.com> added the comment:

Thanks for the suggestion, I reran the build without -W option.

Fortunately, the output shows that the reported errors shall be the only ones.

Build logs from the test build for reference: https://download.copr.fedorainfracloud.org/results/ksurma/pygments-2.9.0/fedora-rawhide-x86_64/02257459-python3-docs/build.log.gz

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:

Thanks; this looks like an easy fix, then. No time right now, but I'll aim to get to it at some point before the end of the weekend, if no-one beats me to it.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Change by Mark Dickinson <dickinsm@gmail.com>:


----------
assignee: docs@python -> mark.dickinson

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Matej Cepl <mcepl@cepl.eu> added the comment:

Actually, for 3.8.10 I had to add one more keyword which confused Sphinx: default.

----------
nosy: +mcepl
Added file: https://bugs.python.org/file50117/bpo44426-complex-keyword-sphinx.patch

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Change by Mark Dickinson <dickinsm@gmail.com>:


----------
pull_requests: +25379
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/26798

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:

Fixed in GH-26798 (not yet merged). With that change, the documentation builds cleanly for me with Python 3.9.5 / Sphinx 4.0.2 / blurb 1.0.8 / python-docs-theme 2021.5, using the command

$ python -m sphinx -b html -W . build/html

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>:


----------
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +25385
pull_request: https://github.com/python/cpython/pull/26804

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>:


----------
pull_requests: +25386
pull_request: https://github.com/python/cpython/pull/26805

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:


New changeset 291848195f85e23c01adb76d5a0ff9c6eb7f2614 by Mark Dickinson in branch 'main':
bpo-44426: Fix use of the C keyword 'default' as a variable name (GH-26798)
https://github.com/python/cpython/commit/291848195f85e23c01adb76d5a0ff9c6eb7f2614


----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:


New changeset 139c5778c26aaf25b51fcfabd88c99ba728beaea by Miss Islington (bot) in branch '3.10':
bpo-44426: Fix use of the C keyword 'default' as a variable name (GH-26798) (GH-26804)
https://github.com/python/cpython/commit/139c5778c26aaf25b51fcfabd88c99ba728beaea


----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:


New changeset 533bff4e9fe221a7c9cf12795fd2d002e87bfa6a by Miss Islington (bot) in branch '3.9':
bpo-44426: Fix use of the C keyword 'default' as a variable name (GH-26798) (GH-26805)
https://github.com/python/cpython/commit/533bff4e9fe221a7c9cf12795fd2d002e87bfa6a


----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Mark Dickinson <dickinsm@gmail.com> added the comment:

I think this should be good now.

----------
resolution: -> fixed
stage: patch review -> resolved
status: open -> pending

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue44426] Docs fail to build with Sphinx 4 due to Invalid C declaration [ In reply to ]
Karolina Surma <warumnicht@tutanota.com> added the comment:

It looks good on my end, documentation builds just fine. Thank you!

----------
status: pending -> open

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue44426>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

1 2  View All