mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Undiamond Python headers
This change gets the Python codebase into a state where it conforms to the conventions of this codebase. It's now possible to include headers from Python, without worrying about ordering. Python has traditionally solved that problem by "diamonding" everything in Python.h, but that's problematic since it means any change to any Python header invalidates all the build artifacts. Lastly it makes tooling not work. Since it is hard to explain to Emacs when I press C-c C-h to add an import line it shouldn't add the header that actually defines the symbol, and instead do follow the nonstandard Python convention. Progress has been made on letting Python load source code from the zip executable structure via the standard C library APIs. System calss now recognizes zip!FILENAME alternative URIs as equivalent to zip:FILENAME since Python uses colon as its delimiter. Some progress has been made on embedding the notice license terms into the Python object code. This is easier said than done since Python has an extremely complicated ownership story. - Some termios APIs have been added - Implement rewinddir() dirstream API - GetCpuCount() API added to Cosmopolitan Libc - More bugs in Cosmopolitan Libc have been fixed - zipobj.com now has flags for mangling the path - Fixed bug a priori with sendfile() on certain BSDs - Polyfill F_DUPFD and F_DUPFD_CLOEXEC across platforms - FIOCLEX / FIONCLEX now polyfilled for fast O_CLOEXEC changes - APE now supports a hybrid solution to no-self-modify for builds - Many BSD-only magnums added, e.g. O_SEARCH, O_SHLOCK, SF_NODISKIO
This commit is contained in:
parent
20bb8db9f8
commit
b420ed8248
762 changed files with 18410 additions and 53772 deletions
21
third_party/python/Include/sliceobject.h
vendored
21
third_party/python/Include/sliceobject.h
vendored
|
@ -1,11 +1,12 @@
|
|||
#ifndef Py_SLICEOBJECT_H
|
||||
#define Py_SLICEOBJECT_H
|
||||
#include "third_party/python/Include/object.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
/* clang-format off */
|
||||
|
||||
/* The unique ellipsis object "..." */
|
||||
|
||||
PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
|
||||
extern PyObject _Py_EllipsisObject; /* Don't use this directly */
|
||||
|
||||
#define Py_Ellipsis (&_Py_EllipsisObject)
|
||||
|
||||
|
@ -24,22 +25,22 @@ typedef struct {
|
|||
} PySliceObject;
|
||||
#endif
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PySlice_Type;
|
||||
PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
|
||||
extern PyTypeObject PySlice_Type;
|
||||
extern PyTypeObject PyEllipsis_Type;
|
||||
|
||||
#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
|
||||
PyObject * PySlice_New(PyObject* start, PyObject* stop,
|
||||
PyObject* step);
|
||||
#ifndef Py_LIMITED_API
|
||||
PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
|
||||
PyAPI_FUNC(int) _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
|
||||
PyObject * _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop);
|
||||
int _PySlice_GetLongIndices(PySliceObject *self, PyObject *length,
|
||||
PyObject **start_ptr, PyObject **stop_ptr,
|
||||
PyObject **step_ptr);
|
||||
#endif
|
||||
PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length,
|
||||
int PySlice_GetIndices(PyObject *r, Py_ssize_t length,
|
||||
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
|
||||
PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
|
||||
int PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
|
||||
Py_ssize_t *start, Py_ssize_t *stop,
|
||||
Py_ssize_t *step, Py_ssize_t *slicelength);
|
||||
|
||||
|
@ -51,9 +52,9 @@ PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length,
|
|||
((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \
|
||||
0))
|
||||
#endif
|
||||
PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice,
|
||||
int PySlice_Unpack(PyObject *slice,
|
||||
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
|
||||
PyAPI_FUNC(Py_ssize_t) PySlice_AdjustIndices(Py_ssize_t length,
|
||||
Py_ssize_t PySlice_AdjustIndices(Py_ssize_t length,
|
||||
Py_ssize_t *start, Py_ssize_t *stop,
|
||||
Py_ssize_t step);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue