GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||
GeezerVison is showing github.com — gh-108765: Python.h no longer includes <unistd.h> by vstinner · Pull Request #108783 · python/cpython Conversation
|
|
I merged my PR. If it causes too many trouble in 3rd party C extensions (require to update too many C extensions before Python 3.13 beta1), I can make this change conditional only in the limited C API version 3.13, as I did for other headers in I consider that |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
breaks signalmodule.c |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Would you mind to elaborate your comment "a little bit"? What is broken? Is it a build issue? On which Python version? On which OS (name, version) and compiler (name, version)? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
signalmodule.c calls pause() and alarm() (under #ifdef HAVE_{PAUSE,ALARM} guards), which are defined in unistd.h On the Python version where you deleted unistd.h from Python.h, of course. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Hum, in fact, <unistd.h> is included indirectly by pycore_pythread.h. But well, I wrote PR #111402 to make it extra clear. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Which is not necessarily included when signalmodule.c is compiled ... it wasn't in my build. (Which I've abandoned ... I never actually intended to build the top of tree.)
Seems like the right thing to do. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
You didn't reply to my question about OS and compiler... Also, pycore_pythread.h was modified recently. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This fixes the following compilation error with Python 3.13.0a1:
```
c-ext/backend_c.c:275:13: error: implicit declaration of function ‘sysconf’; did you mean ‘sscanf’? [-Werror=implicit-function-declaration]
275 | count = sysconf(_SC_NPROCESSORS_ONLN);
| ^~~~~~~
| sscanf
```
According to https://docs.python.org/3.13/whatsnew/3.13.html:
Python.h no longer includes the <unistd.h> standard header file.
If needed, it should now be included explicitly.
For example, it provides the functions: read(), write(), close(), isatty(), lseek(), getpid(), getcwd(), sysconf() and getpagesize().
As a consequence, _POSIX_SEMAPHORES and _POSIX_THREADS macros are no longer defined by Python.h.
The HAVE_UNISTD_H and HAVE_PTHREAD_H macros defined by Python.h can be used to decide if <unistd.h> and <pthread.h> header files can be included.
See python/cpython#108783 .
This fixes the following compilation error with Python 3.13.0a1:
```
c-ext/backend_c.c:275:13: error: implicit declaration of function ‘sysconf’; did you mean ‘sscanf’? [-Werror=implicit-function-declaration]
275 | count = sysconf(_SC_NPROCESSORS_ONLN);
| ^~~~~~~
| sscanf
```
According to https://docs.python.org/3.13/whatsnew/3.13.html:
Python.h no longer includes the <unistd.h> standard header file.
If needed, it should now be included explicitly.
For example, it provides the functions: read(), write(), close(), isatty(), lseek(), getpid(), getcwd(), sysconf() and getpagesize().
As a consequence, _POSIX_SEMAPHORES and _POSIX_THREADS macros are no longer defined by Python.h.
The HAVE_UNISTD_H and HAVE_PTHREAD_H macros defined by Python.h can be used to decide if <unistd.h> and <pthread.h> header files can be included.
See python/cpython#108783 .
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.