New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile error with pytime.h - struct timespec declared inside parameter list #70040
Comments
When including pytime.h: n file included from /usr/include/python3.5m/Python.h:65:0,
from src/package.c:25:
/usr/include/python3.5m/pytime.h:136:56: error: ‘struct timespec’ declared inside parameter list [-Werror]
PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts);
^
/usr/include/python3.5m/pytime.h:136:56: error: its scope is only this definition or declaration, which is probably not what you want [-Werror]
cc1: all warnings being treated as errors
error: command 'gcc' failed with exit status 1 |
This is using https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz GCC v5.3.0 Using Werror obviously |
What platform, C library, etc do you have? According to Posix, struct timespec is normally defined in <time.h>, but can also be gotten via various other include files, many of which are included before "pytime.h". In particular, <Python.h> includes "pyport.h", which has conditional code for including <time.h>, <sys/select.h> and <sys/stat.h>. All of these should define timespec. It might be useful to check your pyconfig.h file to see if stuff like the following is defined: /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1 |
Closing as there isn't enough information here for us to do anything about it and there has been no response from the OP to follow-up questions. |
This warning seems a bit temperamental as to when it will show up, but I think I have a reproducer: a #include <stdint.h>
#define PY_SSIZE_T_CLEAN
#include <Python.h>
static struct PyModuleDef module = {
PyModuleDef_HEAD_INIT, "test", NULL, -1
};
PyMODINIT_FUNC
PyInit_test(void)
{
return PyModule_Create(&module);
} will produce the warning when compiled with Inserting Linux (NixOS), Python 3.10, GCC 12.3.0. @iritkatriel Are you willing to reopen? |
@alexshpilkin, since Python require C11, this should not be a problem, IIUYC. |
@erlend-aasland Ah, didn’t know that 3.11 is C11-only, thanks! Or that even 3.10 is essentially on life support. It leaves a bit of a bad taste that this (admittedly very minor) bug got waited out in this manner, but at this point yes, I agree it’s an ex-bug. |
I'll quote Irit's response on why this was closed:
The OP did not include a reproducer; even basic things like platform, architecture, etc. was missing. Martin responded the day after the bug report was registered, but the reporter never responded back. I'm not sure how to interpret your post ("bad taste", "waited out"). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: