classification
Title: Cpython "pystate.h" subdirectory wrong
Type: compile error Stage:
Components: C API Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, jpelizza
Priority: normal Keywords:

Created on 2020-05-16 07:40 by jpelizza, last changed 2020-05-20 11:49 by eric.smith.

Messages (4)
msg369019 - (view) Author: (jpelizza) Date: 2020-05-16 07:40
Line 9 of pystate.h is:
#include "cpython/initconfig.h"
should be:
#include "./initconfig.h"
since pystate.h is already inside cpython dir.
msg369051 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-05-16 15:11
Won't either one work, since "Include" is in the "search path"? Is this causing an actual problem? You have this marked as "compile error", but haven't shown any information about the error, such as what compiler, how it's being invoked, and what the error message is. We need some more information.

If this were to be changed (which I'm not advocating unless there's a real problem), would it be better as "initconfig.h" or "./initconfig.h"? I think they're equivalent.
msg369427 - (view) Author: (jpelizza) Date: 2020-05-20 07:46
In hindsight I provided absolutely nothing, new to this, bound to make dumb mistakes.

Compiler error:

In file included from /usr/include/python3.8/pystate.h:129,
                 from /usr/include/python3.8/genobject.h:11,
                 from /usr/include/python3.8/Python.h:121,
                 from cpppython.cpp:2:
/usr/include/python3.8/cpython/pystate.h:9:10: fatal error: cpython/initconfig.h: No such file or directory
    9 | #include "cpython/initconfig.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Compiler version:
gcc version 9.3.0 (Arch Linux 9.3.0-1)

About the change, yeah "initconfig.h" and the other one are the same, if it is a real problem then there is no need for "./"

After changing it to just "initconfig.h" the code compiled normally. From my understanding since initconfig.h is already inside the folder cpython using "cpython/initconfig.h" will try to look for another cpython folder inside the cpython folder and then look for initconfig thus the error.
msg369445 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-05-20 11:49
Thanks for the info.

It's weird that this is just showing up for you, and I assume works everywhere else. How are you invoking the compiler, via make, or something else?

And, what's the gcc command line look like when this specific file fails?

I grepped the source code, and didn't see anywhere else where we import something this way, so maybe that's a reason to change it.

As for the "./" think: maybe using it would be a better hint as to what's going on.

But I'd like to hear from other core devs and get their opinion on any change, first.
History
Date User Action Args
2020-05-20 11:49:15eric.smithsetmessages: + msg369445
2020-05-20 07:46:23jpelizzasetmessages: + msg369427
2020-05-16 15:11:36eric.smithsetnosy: + eric.smith
messages: + msg369051
2020-05-16 07:40:57jpelizzacreate