mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +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
27
third_party/python/Objects/abstract.c
vendored
27
third_party/python/Objects/abstract.c
vendored
|
@ -1,9 +1,26 @@
|
|||
/* clang-format off */
|
||||
/* Abstract Object Interface (many thanks to Jim Fulton) */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "libc/assert.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/bytearrayobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/funcobject.h"
|
||||
#include "third_party/python/Include/iterobject.h"
|
||||
#include "third_party/python/Include/listobject.h"
|
||||
#include "third_party/python/Include/longintrepr.h"
|
||||
#include "third_party/python/Include/methodobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Abstract Object Interface (many thanks to Jim Fulton) */
|
||||
|
||||
/* Shorthands to return certain errors */
|
||||
|
||||
|
|
10
third_party/python/Objects/accu.c
vendored
10
third_party/python/Objects/accu.c
vendored
|
@ -1,8 +1,10 @@
|
|||
/* clang-format off */
|
||||
/* Accumulator struct implementation */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/assert.h"
|
||||
#include "third_party/python/Include/accu.h"
|
||||
#include "third_party/python/Include/listobject.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Accumulator struct implementation */
|
||||
|
||||
static PyObject *
|
||||
join_list_unicode(PyObject *lst)
|
||||
|
|
10
third_party/python/Objects/boolobject.c
vendored
10
third_party/python/Objects/boolobject.c
vendored
|
@ -1,8 +1,10 @@
|
|||
/* clang-format off */
|
||||
/* Boolean type, a subtype of int */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/longintrepr.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Boolean type, a subtype of int */
|
||||
|
||||
/* We define bool_repr to return "False" or "True" */
|
||||
|
||||
|
|
26
third_party/python/Objects/bytearrayobject.c
vendored
26
third_party/python/Objects/bytearrayobject.c
vendored
|
@ -1,12 +1,26 @@
|
|||
/* clang-format off */
|
||||
/* PyByteArray (bytearray) implementation */
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytearrayobject.h"
|
||||
#include "third_party/python/Include/bytes_methods.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/codecs.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyctype.h"
|
||||
#include "third_party/python/Include/pydebug.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pystrhex.h"
|
||||
#include "third_party/python/Include/pythonrun.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* PyByteArray (bytearray) implementation */
|
||||
|
||||
/*[clinic input]
|
||||
class bytearray "PyByteArrayObject *" "&PyByteArray_Type"
|
||||
|
@ -831,7 +845,7 @@ bytearray_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds)
|
|||
if (count > 0) {
|
||||
if (PyByteArray_Resize((PyObject *)self, count))
|
||||
return -1;
|
||||
memset(PyByteArray_AS_STRING(self), 0, count);
|
||||
bzero(PyByteArray_AS_STRING(self), count);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
10
third_party/python/Objects/bytes_methods.c
vendored
10
third_party/python/Objects/bytes_methods.c
vendored
|
@ -1,7 +1,13 @@
|
|||
/* clang-format off */
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytes_methods.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/pyctype.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
/* clang-format off */
|
||||
|
||||
PyDoc_STRVAR_shared(_Py_isspace__doc__,
|
||||
"B.isspace() -> bool\n\
|
||||
|
|
31
third_party/python/Objects/bytesobject.c
vendored
31
third_party/python/Objects/bytesobject.c
vendored
|
@ -1,11 +1,30 @@
|
|||
/* clang-format off */
|
||||
/* bytes object implementation */
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytearrayobject.h"
|
||||
#include "third_party/python/Include/bytes_methods.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/codecs.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyctype.h"
|
||||
#include "third_party/python/Include/pydebug.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pyport.h"
|
||||
#include "third_party/python/Include/pystrhex.h"
|
||||
#include "third_party/python/Include/pystrtod.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* bytes object implementation */
|
||||
|
||||
/*[clinic input]
|
||||
class bytes "PyBytesObject *" "&PyBytes_Type"
|
||||
|
@ -3204,7 +3223,7 @@ void
|
|||
_PyBytesWriter_Init(_PyBytesWriter *writer)
|
||||
{
|
||||
/* Set all attributes before small_buffer to 0 */
|
||||
memset(writer, 0, offsetof(_PyBytesWriter, small_buffer));
|
||||
bzero(writer, offsetof(_PyBytesWriter, small_buffer));
|
||||
#ifdef Py_DEBUG
|
||||
memset(writer->small_buffer, 0xCB, sizeof(writer->small_buffer));
|
||||
#endif
|
||||
|
|
8
third_party/python/Objects/capsule.c
vendored
8
third_party/python/Objects/capsule.c
vendored
|
@ -1,8 +1,12 @@
|
|||
#include "third_party/python/Include/import.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pycapsule.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
/* clang-format off */
|
||||
/* Wrap void * pointers to be passed between C modules */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
|
||||
/* Internal structure of PyCapsule */
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
|
|
7
third_party/python/Objects/cellobject.c
vendored
7
third_party/python/Objects/cellobject.c
vendored
|
@ -1,8 +1,11 @@
|
|||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/cellobject.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
/* clang-format off */
|
||||
/* Cell object implementation */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
|
||||
PyObject *
|
||||
PyCell_New(PyObject *obj)
|
||||
{
|
||||
|
|
18
third_party/python/Objects/classobject.c
vendored
18
third_party/python/Objects/classobject.c
vendored
|
@ -1,8 +1,18 @@
|
|||
/* clang-format off */
|
||||
/* Class object implementation (dead now except for methods) */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/classobject.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/methodobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Class object implementation (dead now except for methods) */
|
||||
|
||||
#define TP_DESCR_GET(t) ((t)->tp_descr_get)
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*[clinic input]
|
||||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*[clinic input]
|
||||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
|
57
third_party/python/Objects/clinic/dictobject.inc
vendored
57
third_party/python/Objects/clinic/dictobject.inc
vendored
|
@ -1,43 +1,42 @@
|
|||
/* clang-format off */
|
||||
/*[clinic input]
|
||||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
||||
PyDoc_STRVAR(dict_fromkeys__doc__,
|
||||
"fromkeys($type, iterable, value=None, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Returns a new dict with keys from iterable and values equal to value.");
|
||||
PyDoc_STRVAR(
|
||||
dict_fromkeys__doc__,
|
||||
"fromkeys($type, iterable, value=None, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Returns a new dict with keys from iterable and values equal to value.");
|
||||
|
||||
#define DICT_FROMKEYS_METHODDEF \
|
||||
{"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS|METH_CLASS, dict_fromkeys__doc__},
|
||||
#define DICT_FROMKEYS_METHODDEF \
|
||||
{"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS | METH_CLASS, \
|
||||
dict_fromkeys__doc__},
|
||||
|
||||
static PyObject *
|
||||
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value);
|
||||
static PyObject *dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable,
|
||||
PyObject *value);
|
||||
|
||||
static PyObject *
|
||||
dict_fromkeys(PyTypeObject *type, PyObject *args)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *iterable;
|
||||
PyObject *value = Py_None;
|
||||
static PyObject *dict_fromkeys(PyTypeObject *type, PyObject *args) {
|
||||
PyObject *return_value = NULL;
|
||||
PyObject *iterable;
|
||||
PyObject *value = Py_None;
|
||||
|
||||
if (!PyArg_UnpackTuple(args, "fromkeys",
|
||||
1, 2,
|
||||
&iterable, &value)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = dict_fromkeys_impl(type, iterable, value);
|
||||
if (!PyArg_UnpackTuple(args, "fromkeys", 1, 2, &iterable, &value)) {
|
||||
goto exit;
|
||||
}
|
||||
return_value = dict_fromkeys_impl(type, iterable, value);
|
||||
|
||||
exit:
|
||||
return return_value;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(dict___contains____doc__,
|
||||
"__contains__($self, key, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"True if D has a key k, else False.");
|
||||
PyDoc_STRVAR(dict___contains____doc__, "__contains__($self, key, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"True if D has a key k, else False.");
|
||||
|
||||
#define DICT___CONTAINS___METHODDEF \
|
||||
{"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
|
||||
#define DICT___CONTAINS___METHODDEF \
|
||||
{"__contains__", (PyCFunction)dict___contains__, METH_O | METH_COEXIST, \
|
||||
dict___contains____doc__},
|
||||
/*[clinic end generated code: output=926326109e3d9839 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
/*[clinic input]
|
||||
preserve
|
||||
[clinic start generated code]*/
|
||||
|
|
20
third_party/python/Objects/codeobject.c
vendored
20
third_party/python/Objects/codeobject.c
vendored
|
@ -1,7 +1,23 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/math.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/code.h"
|
||||
#include "third_party/python/Include/complexobject.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
#include "third_party/python/Include/pystate.h"
|
||||
#include "third_party/python/Include/setobject.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
#define NAME_CHARS \
|
||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
|
||||
|
|
18
third_party/python/Objects/complexobject.c
vendored
18
third_party/python/Objects/complexobject.c
vendored
|
@ -1,6 +1,20 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/math.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/complexobject.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyctype.h"
|
||||
#include "third_party/python/Include/pyfpe.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pymath.h"
|
||||
#include "third_party/python/Include/pystrtod.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Complex object implementation */
|
||||
/* Borrows heavily from floatobject.c */
|
||||
|
|
15
third_party/python/Objects/descrobject.c
vendored
15
third_party/python/Objects/descrobject.c
vendored
|
@ -1,6 +1,17 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Descriptors -- a new, flexible way to describe attributes */
|
||||
|
||||
|
|
2
third_party/python/Objects/dict-common.h
vendored
2
third_party/python/Objects/dict-common.h
vendored
|
@ -1,5 +1,7 @@
|
|||
#ifndef Py_DICT_COMMON_H
|
||||
#define Py_DICT_COMMON_H
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
/* clang-format off */
|
||||
|
||||
typedef struct {
|
||||
|
|
18
third_party/python/Objects/dictobject.c
vendored
18
third_party/python/Objects/dictobject.c
vendored
|
@ -1,4 +1,16 @@
|
|||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pystate.h"
|
||||
#include "third_party/python/Include/setobject.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
#include "third_party/python/Objects/dict-common.h"
|
||||
#include "third_party/python/pyconfig.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Dictionary object implementation using a hash table */
|
||||
|
||||
/* The distribution includes a separate file, Objects/dictnotes.txt,
|
||||
|
@ -110,9 +122,7 @@ converting the dict to the combined table.
|
|||
*/
|
||||
#define PyDict_MINSIZE 8
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Objects/dict-common.h"
|
||||
#include "third_party/python/Objects/stringlib/eq.inc" /* to get unicode_eq() */
|
||||
#include "third_party/python/Objects/stringlib/eq.inc"
|
||||
|
||||
/*[clinic input]
|
||||
class dict "PyDictObject *" "&PyDict_Type"
|
||||
|
@ -549,7 +559,7 @@ static PyDictKeysObject *new_keys_object(Py_ssize_t size)
|
|||
dk->dk_lookup = lookdict_unicode_nodummy;
|
||||
dk->dk_nentries = 0;
|
||||
memset(&dk->dk_indices[0], 0xff, es * size);
|
||||
memset(DK_ENTRIES(dk), 0, sizeof(PyDictKeyEntry) * usable);
|
||||
bzero(DK_ENTRIES(dk), sizeof(PyDictKeyEntry) * usable);
|
||||
return dk;
|
||||
}
|
||||
|
||||
|
|
13
third_party/python/Objects/enumobject.c
vendored
13
third_party/python/Objects/enumobject.c
vendored
|
@ -1,7 +1,16 @@
|
|||
#include "libc/assert.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/enumobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/methodobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
/* clang-format off */
|
||||
/* enumerate object */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
/* enumerate object */
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
|
|
25
third_party/python/Objects/exceptions.c
vendored
25
third_party/python/Objects/exceptions.c
vendored
|
@ -1,3 +1,18 @@
|
|||
#define PY_SSIZE_T_CLEAN
|
||||
#include "libc/errno.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/osdefs.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/traceback.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
/* clang-format off */
|
||||
/*
|
||||
* New exceptions.c written in Iceland by Richard Jones and Georg Brandl.
|
||||
|
@ -5,12 +20,6 @@
|
|||
* Thanks go to Tim Peters and Michael Hudson for debugging.
|
||||
*/
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/osdefs.h"
|
||||
|
||||
|
||||
/* Compatibility aliases */
|
||||
PyObject *PyExc_EnvironmentError = NULL;
|
||||
PyObject *PyExc_IOError = NULL;
|
||||
|
@ -771,10 +780,6 @@ MiddlingExtendsException(PyExc_ImportError, ModuleNotFoundError, ImportError,
|
|||
* OSError extends Exception
|
||||
*/
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
#include "errmap.h"
|
||||
#endif
|
||||
|
||||
/* Where a function has a single filename, such as open() or some
|
||||
* of the os module functions, PyErr_SetFromErrnoWithFilename() is
|
||||
* called, giving a third argument which is the filename. But, so
|
||||
|
|
28
third_party/python/Objects/fileobject.c
vendored
28
third_party/python/Objects/fileobject.c
vendored
|
@ -1,9 +1,25 @@
|
|||
/* clang-format off */
|
||||
/* File object implementation (what's left of it -- see io.py) */
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/stdio/unlocked.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/fileobject.h"
|
||||
#include "third_party/python/Include/fileutils.h"
|
||||
#include "third_party/python/Include/import.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* File object implementation (what's left of it -- see io.py) */
|
||||
|
||||
#if defined(HAVE_GETC_UNLOCKED) && !defined(_Py_MEMORY_SANITIZER)
|
||||
/* clang MemorySanitizer doesn't yet understand getc_unlocked. */
|
||||
|
@ -35,8 +51,8 @@ PyFile_FromFd(int fd, const char *name, const char *mode, int buffering, const c
|
|||
if (io == NULL)
|
||||
return NULL;
|
||||
stream = _PyObject_CallMethodId(io, &PyId_open, "isisssi", fd, mode,
|
||||
buffering, encoding, errors,
|
||||
newline, closefd);
|
||||
buffering, encoding, errors,
|
||||
newline, closefd);
|
||||
Py_DECREF(io);
|
||||
if (stream == NULL)
|
||||
return NULL;
|
||||
|
|
29
third_party/python/Objects/floatobject.c
vendored
29
third_party/python/Objects/floatobject.c
vendored
|
@ -1,12 +1,35 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/math.h"
|
||||
#include "libc/runtime/fenv.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytearrayobject.h"
|
||||
#include "third_party/python/Include/codecs.h"
|
||||
#include "third_party/python/Include/complexobject.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dtoa.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyctype.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pyfpe.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pymath.h"
|
||||
#include "third_party/python/Include/pystrtod.h"
|
||||
#include "third_party/python/Include/structseq.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Float object implementation */
|
||||
|
||||
/* XXX There should be overflow checks here, but it's hard to check
|
||||
for any kind of float exception without losing portability. */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/runtime/fenv.h"
|
||||
|
||||
/* Special free list
|
||||
free_list is a singly-linked list of available PyFloatObjects, linked
|
||||
via abuse of their ob_type members.
|
||||
|
|
17
third_party/python/Objects/frameobject.c
vendored
17
third_party/python/Objects/frameobject.c
vendored
|
@ -1,11 +1,20 @@
|
|||
/* clang-format off */
|
||||
/* Frame object implementation */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/cellobject.h"
|
||||
#include "third_party/python/Include/code.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/frameobject.h"
|
||||
#include "third_party/python/Include/genobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/opcode.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Frame object implementation */
|
||||
|
||||
#define OFF(x) offsetof(PyFrameObject, x)
|
||||
|
||||
|
|
18
third_party/python/Objects/funcobject.c
vendored
18
third_party/python/Objects/funcobject.c
vendored
|
@ -1,11 +1,21 @@
|
|||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/cellobject.h"
|
||||
#include "third_party/python/Include/classobject.h"
|
||||
#include "third_party/python/Include/code.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/eval.h"
|
||||
#include "third_party/python/Include/funcobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Function object implementation */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/code.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
|
||||
PyObject *
|
||||
PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
|
||||
{
|
||||
|
|
19
third_party/python/Objects/genobject.c
vendored
19
third_party/python/Objects/genobject.c
vendored
|
@ -1,11 +1,20 @@
|
|||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/frameobject.h"
|
||||
#include "third_party/python/Include/genobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/opcode.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/traceback.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
/* clang-format off */
|
||||
/* Generator object implementation */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/frameobject.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/opcode.h"
|
||||
|
||||
static PyObject *gen_close(PyGenObject *, PyObject *);
|
||||
static PyObject *async_gen_asend_new(PyAsyncGenObject *, PyObject *);
|
||||
static PyObject *async_gen_athrow_new(PyAsyncGenObject *, PyObject *);
|
||||
|
|
10
third_party/python/Objects/iterobject.c
vendored
10
third_party/python/Objects/iterobject.c
vendored
|
@ -1,8 +1,14 @@
|
|||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/iterobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
/* clang-format off */
|
||||
/* Iterator objects */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
Py_ssize_t it_index;
|
||||
|
|
21
third_party/python/Objects/listobject.c
vendored
21
third_party/python/Objects/listobject.c
vendored
|
@ -1,8 +1,21 @@
|
|||
/* clang-format off */
|
||||
/* List object implementation */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/assert.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/accu.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/listobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
#include "third_party/python/Include/pystate.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* List object implementation */
|
||||
|
||||
/* Ensure ob_item has room for at least newsize elements, and set
|
||||
* ob_size to newsize. If newsize > ob_size on entry, the content
|
||||
|
|
40
third_party/python/Objects/longobject.c
vendored
40
third_party/python/Objects/longobject.c
vendored
|
@ -1,11 +1,28 @@
|
|||
/* clang-format off */
|
||||
/* Long (arbitrary precision) integer object implementation */
|
||||
|
||||
/* XXX The functional organization of this file is terrible */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/math.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytearrayobject.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/longintrepr.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyctype.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pymath.h"
|
||||
#include "third_party/python/Include/structseq.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Long (arbitrary precision) integer object implementation */
|
||||
/* XXX The functional organization of this file is terrible */
|
||||
|
||||
#ifndef NSMALLPOSINTS
|
||||
#define NSMALLPOSINTS 257
|
||||
|
@ -3189,7 +3206,7 @@ x_mul(PyLongObject *a, PyLongObject *b)
|
|||
if (z == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(z->ob_digit, 0, Py_SIZE(z) * sizeof(digit));
|
||||
bzero(z->ob_digit, Py_SIZE(z) * sizeof(digit));
|
||||
if (a == b) {
|
||||
/* Efficient squaring per HAC, Algorithm 14.16:
|
||||
* http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf
|
||||
|
@ -3401,9 +3418,7 @@ k_mul(PyLongObject *a, PyLongObject *b)
|
|||
|
||||
/* Zero-out the digits higher than the ah*bh copy. */
|
||||
i = Py_SIZE(ret) - 2*shift - Py_SIZE(t1);
|
||||
if (i)
|
||||
memset(ret->ob_digit + 2*shift + Py_SIZE(t1), 0,
|
||||
i * sizeof(digit));
|
||||
if (i) bzero(ret->ob_digit + 2*shift + Py_SIZE(t1), i * sizeof(digit));
|
||||
|
||||
/* 3. t2 <- al*bl, and copy into the low digits. */
|
||||
if ((t2 = k_mul(al, bl)) == NULL) {
|
||||
|
@ -3416,8 +3431,7 @@ k_mul(PyLongObject *a, PyLongObject *b)
|
|||
|
||||
/* Zero out remaining digits. */
|
||||
i = 2*shift - Py_SIZE(t2); /* number of uninitialized digits */
|
||||
if (i)
|
||||
memset(ret->ob_digit + Py_SIZE(t2), 0, i * sizeof(digit));
|
||||
if (i) bzero(ret->ob_digit + Py_SIZE(t2), i * sizeof(digit));
|
||||
|
||||
/* 4 & 5. Subtract ah*bh (t1) and al*bl (t2). We do al*bl first
|
||||
* because it's fresher in cache.
|
||||
|
@ -3539,7 +3553,7 @@ k_lopsided_mul(PyLongObject *a, PyLongObject *b)
|
|||
ret = _PyLong_New(asize + bsize);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
memset(ret->ob_digit, 0, Py_SIZE(ret) * sizeof(digit));
|
||||
bzero(ret->ob_digit, Py_SIZE(ret) * sizeof(digit));
|
||||
|
||||
/* Successive slices of b are copied into bslice. */
|
||||
bslice = _PyLong_New(asize);
|
||||
|
|
22
third_party/python/Objects/memoryobject.c
vendored
22
third_party/python/Objects/memoryobject.c
vendored
|
@ -1,9 +1,23 @@
|
|||
/* clang-format off */
|
||||
/* Memoryview object implementation */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/import.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/memoryobject.h"
|
||||
#include "third_party/python/Include/methodobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pystrhex.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Memoryview object implementation */
|
||||
|
||||
/****************************************************************************/
|
||||
/* ManagedBuffer Object */
|
||||
|
|
16
third_party/python/Objects/methodobject.c
vendored
16
third_party/python/Objects/methodobject.c
vendored
|
@ -1,10 +1,18 @@
|
|||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/methodobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/moduleobject.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Method object implementation */
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
|
||||
/* Free list for method objects to safe malloc/free overhead
|
||||
* The m_self element is used to chain the objects.
|
||||
*/
|
||||
|
@ -17,7 +25,7 @@ static int numfree = 0;
|
|||
/* undefine macro trampoline to PyCFunction_NewEx */
|
||||
#undef PyCFunction_New
|
||||
|
||||
PyAPI_FUNC(PyObject *)
|
||||
PyObject *
|
||||
PyCFunction_New(PyMethodDef *ml, PyObject *self)
|
||||
{
|
||||
return PyCFunction_NewEx(ml, self, NULL);
|
||||
|
|
20
third_party/python/Objects/moduleobject.c
vendored
20
third_party/python/Objects/moduleobject.c
vendored
|
@ -1,6 +1,18 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/moduleobject.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pgenheaders.h"
|
||||
#include "third_party/python/Include/pydebug.h"
|
||||
#include "third_party/python/Include/pystate.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/sysmodule.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
/* clang-format off */
|
||||
|
||||
static Py_ssize_t max_module_number;
|
||||
|
||||
|
@ -213,7 +225,7 @@ PyModule_Create2(struct PyModuleDef* module, int module_api_version)
|
|||
Py_DECREF(m);
|
||||
return NULL;
|
||||
}
|
||||
memset(m->md_state, 0, module->m_size);
|
||||
bzero(m->md_state, module->m_size);
|
||||
}
|
||||
|
||||
if (module->m_methods != NULL) {
|
||||
|
@ -388,7 +400,7 @@ PyModule_ExecDef(PyObject *module, PyModuleDef *def)
|
|||
PyErr_NoMemory();
|
||||
return -1;
|
||||
}
|
||||
memset(md->md_state, 0, def->m_size);
|
||||
bzero(md->md_state, def->m_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
15
third_party/python/Objects/namespaceobject.c
vendored
15
third_party/python/Objects/namespaceobject.c
vendored
|
@ -1,6 +1,17 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/assert.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/listobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/namespaceobject.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
|
|
35
third_party/python/Objects/object.c
vendored
35
third_party/python/Objects/object.c
vendored
|
@ -1,6 +1,35 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytearrayobject.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/cellobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/classobject.h"
|
||||
#include "third_party/python/Include/complexobject.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/enumobject.h"
|
||||
#include "third_party/python/Include/fileobject.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/frameobject.h"
|
||||
#include "third_party/python/Include/funcobject.h"
|
||||
#include "third_party/python/Include/genobject.h"
|
||||
#include "third_party/python/Include/import.h"
|
||||
#include "third_party/python/Include/iterobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/memoryobject.h"
|
||||
#include "third_party/python/Include/namespaceobject.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/odictobject.h"
|
||||
#include "third_party/python/Include/pycapsule.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/rangeobject.h"
|
||||
#include "third_party/python/Include/setobject.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/traceback.h"
|
||||
#include "third_party/python/Include/weakrefobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
_Py_IDENTIFIER(Py_Repr);
|
||||
_Py_IDENTIFIER(__bytes__);
|
||||
|
@ -2060,7 +2089,7 @@ _PyTrash_thread_destroy_chain(void)
|
|||
/* For Py_LIMITED_API, we need an out-of-line version of _Py_Dealloc.
|
||||
Define this here, so we can undefine the macro. */
|
||||
#undef _Py_Dealloc
|
||||
PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
|
||||
void _Py_Dealloc(PyObject *);
|
||||
void
|
||||
_Py_Dealloc(PyObject *op)
|
||||
{
|
||||
|
|
25
third_party/python/Objects/obmalloc.c
vendored
25
third_party/python/Objects/obmalloc.c
vendored
|
@ -1,9 +1,14 @@
|
|||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/sysv/consts/map.h"
|
||||
#include "libc/sysv/consts/prot.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pydebug.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/sysv/consts/map.h"
|
||||
#include "libc/sysv/consts/map.h"
|
||||
#include "libc/sysv/consts/prot.h"
|
||||
#include "libc/sysv/consts/prot.h"
|
||||
|
||||
/* Defined in tracemalloc.c */
|
||||
extern void _PyMem_DumpTraceback(int fd, const void *ptr);
|
||||
|
@ -1272,7 +1277,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize)
|
|||
if ((pool->freeblock = *(block **)bp) != NULL) {
|
||||
UNLOCK();
|
||||
if (use_calloc)
|
||||
memset(bp, 0, nbytes);
|
||||
bzero(bp, nbytes);
|
||||
return (void *)bp;
|
||||
}
|
||||
/*
|
||||
|
@ -1286,7 +1291,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize)
|
|||
*(block **)(pool->freeblock) = NULL;
|
||||
UNLOCK();
|
||||
if (use_calloc)
|
||||
memset(bp, 0, nbytes);
|
||||
bzero(bp, nbytes);
|
||||
return (void *)bp;
|
||||
}
|
||||
/* Pool is full, unlink from used pools. */
|
||||
|
@ -1296,7 +1301,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize)
|
|||
pool->nextpool = next;
|
||||
UNLOCK();
|
||||
if (use_calloc)
|
||||
memset(bp, 0, nbytes);
|
||||
bzero(bp, nbytes);
|
||||
return (void *)bp;
|
||||
}
|
||||
|
||||
|
@ -1377,7 +1382,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize)
|
|||
pool->freeblock = *(block **)bp;
|
||||
UNLOCK();
|
||||
if (use_calloc)
|
||||
memset(bp, 0, nbytes);
|
||||
bzero(bp, nbytes);
|
||||
return (void *)bp;
|
||||
}
|
||||
/*
|
||||
|
@ -1394,7 +1399,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize)
|
|||
*(block **)(pool->freeblock) = NULL;
|
||||
UNLOCK();
|
||||
if (use_calloc)
|
||||
memset(bp, 0, nbytes);
|
||||
bzero(bp, nbytes);
|
||||
return (void *)bp;
|
||||
}
|
||||
|
||||
|
|
20
third_party/python/Objects/odictobject.c
vendored
20
third_party/python/Objects/odictobject.c
vendored
|
@ -1,4 +1,20 @@
|
|||
#include "libc/assert.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/odictobject.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
#include "third_party/python/Include/pystate.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Objects/dict-common.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Ordered Dictionary object implementation.
|
||||
|
||||
This implementation is necessarily explicitly equivalent to the pure Python
|
||||
|
@ -465,10 +481,6 @@ later:
|
|||
|
||||
*/
|
||||
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Objects/dict-common.h"
|
||||
|
||||
typedef struct _odictnode _ODictNode;
|
||||
|
||||
/* PyODictObject */
|
||||
|
|
12
third_party/python/Objects/rangeobject.c
vendored
12
third_party/python/Objects/rangeobject.c
vendored
|
@ -1,6 +1,14 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/rangeobject.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Support objects whose length is > PY_SSIZE_T_MAX.
|
||||
|
||||
|
|
19
third_party/python/Objects/setobject.c
vendored
19
third_party/python/Objects/setobject.c
vendored
|
@ -1,6 +1,17 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/assert.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
#include "third_party/python/Include/pystate.h"
|
||||
#include "third_party/python/Include/setobject.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* set object implementation
|
||||
|
||||
|
@ -345,7 +356,7 @@ set_table_resize(PySetObject *so, Py_ssize_t minused)
|
|||
|
||||
/* Make the set empty, using the new table. */
|
||||
assert(newtable != oldtable);
|
||||
memset(newtable, 0, sizeof(setentry) * newsize);
|
||||
bzero(newtable, sizeof(setentry) * newsize);
|
||||
so->fill = oldused;
|
||||
so->used = oldused;
|
||||
so->mask = newsize - 1;
|
||||
|
@ -451,7 +462,7 @@ set_discard_key(PySetObject *so, PyObject *key)
|
|||
static void
|
||||
set_empty_to_minsize(PySetObject *so)
|
||||
{
|
||||
memset(so->smalltable, 0, sizeof(so->smalltable));
|
||||
bzero(so->smalltable, sizeof(so->smalltable));
|
||||
so->fill = 0;
|
||||
so->used = 0;
|
||||
so->mask = PySet_MINSIZE - 1;
|
||||
|
|
15
third_party/python/Objects/sliceobject.c
vendored
15
third_party/python/Objects/sliceobject.c
vendored
|
@ -1,6 +1,17 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/methodobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/*
|
||||
Written by Jim Hugunin and Chris Chase.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* clang-format off */
|
||||
/* stringlib: find/index implementation */
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
|
||||
#ifndef STRINGLIB_FASTSEARCH_H
|
||||
#error must include fastsearch.inc before including this module
|
||||
|
|
9
third_party/python/Objects/structseq.c
vendored
9
third_party/python/Objects/structseq.c
vendored
|
@ -1,6 +1,11 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/structseq.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Implementation helper: a struct that looks like a tuple. See timemodule
|
||||
and posixmodule for example uses. */
|
||||
|
|
19
third_party/python/Objects/tupleobject.c
vendored
19
third_party/python/Objects/tupleobject.c
vendored
|
@ -1,6 +1,17 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/accu.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/pystate.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Tuple object implementation */
|
||||
|
||||
|
@ -882,8 +893,8 @@ _PyTuple_Resize(PyObject **pv, Py_ssize_t newsize)
|
|||
_Py_NewReference((PyObject *) sv);
|
||||
/* Zero out items added by growing */
|
||||
if (newsize > oldsize)
|
||||
memset(&sv->ob_item[oldsize], 0,
|
||||
sizeof(*sv->ob_item) * (newsize - oldsize));
|
||||
bzero(&sv->ob_item[oldsize],
|
||||
sizeof(*sv->ob_item) * (newsize - oldsize));
|
||||
*pv = (PyObject *) sv;
|
||||
_PyObject_GC_TRACK(sv);
|
||||
return 0;
|
||||
|
|
26
third_party/python/Objects/typeobject.c
vendored
26
third_party/python/Objects/typeobject.c
vendored
|
@ -1,7 +1,29 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/cellobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/compile.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/frameobject.h"
|
||||
#include "third_party/python/Include/funcobject.h"
|
||||
#include "third_party/python/Include/import.h"
|
||||
#include "third_party/python/Include/iterobject.h"
|
||||
#include "third_party/python/Include/listobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Include/typeslots.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
#include "third_party/python/Include/weakrefobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* Type object implementation */
|
||||
|
||||
|
|
2
third_party/python/Objects/unicodectype.c
vendored
2
third_party/python/Objects/unicodectype.c
vendored
|
@ -1,5 +1,5 @@
|
|||
#include "third_party/python/Include/unicodeobject.h"
|
||||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
|
||||
/*
|
||||
Unicode character type helpers.
|
||||
|
|
81
third_party/python/Objects/unicodeobject.c
vendored
81
third_party/python/Objects/unicodeobject.c
vendored
|
@ -1,9 +1,39 @@
|
|||
/* clang-format off */
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/ucnhash.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytearrayobject.h"
|
||||
#include "third_party/python/Include/bytes_methods.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/codecs.h"
|
||||
#include "third_party/python/Include/complexobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/fileobject.h"
|
||||
#include "third_party/python/Include/fileutils.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/listobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/memoryobject.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/osmodule.h"
|
||||
#include "third_party/python/Include/pycapsule.h"
|
||||
#include "third_party/python/Include/pyctype.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pystrtod.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Include/ucnhash.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
#include "third_party/python/Objects/stringlib/eq.inc"
|
||||
/* clang-format off */
|
||||
|
||||
/*
|
||||
|
||||
|
@ -2620,10 +2650,10 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
|
|||
|
||||
/* parse the width.precision part, e.g. "%2.5s" => width=2, precision=5 */
|
||||
width = -1;
|
||||
if (Py_ISDIGIT((unsigned)*f)) {
|
||||
if (Py_ISDIGIT(*f)) {
|
||||
width = *f - '0';
|
||||
f++;
|
||||
while (Py_ISDIGIT((unsigned)*f)) {
|
||||
while (Py_ISDIGIT(*f)) {
|
||||
if (width > (PY_SSIZE_T_MAX - ((int)*f - '0')) / 10) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"width too big");
|
||||
|
@ -2636,10 +2666,10 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
|
|||
precision = -1;
|
||||
if (*f == '.') {
|
||||
f++;
|
||||
if (Py_ISDIGIT((unsigned)*f)) {
|
||||
if (Py_ISDIGIT(*f)) {
|
||||
precision = (*f - '0');
|
||||
f++;
|
||||
while (Py_ISDIGIT((unsigned)*f)) {
|
||||
while (Py_ISDIGIT(*f)) {
|
||||
if (precision > (PY_SSIZE_T_MAX - ((int)*f - '0')) / 10) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"precision too big");
|
||||
|
@ -3753,7 +3783,7 @@ mbstowcs_errorpos(const char *str, size_t len)
|
|||
size_t converted;
|
||||
wchar_t ch;
|
||||
|
||||
memset(&mbs, 0, sizeof mbs);
|
||||
bzero(&mbs, sizeof mbs);
|
||||
while (len)
|
||||
{
|
||||
converted = mbrtowc(&ch, str, len, &mbs);
|
||||
|
@ -5007,33 +5037,6 @@ ascii_decode(const char *start, const char *end, Py_UCS1 *dest)
|
|||
* won't work; also, tests have shown that skipping the "optimised
|
||||
* version" will even speed up m68k.
|
||||
*/
|
||||
#if !defined(__m68k__)
|
||||
#if SIZEOF_LONG <= SIZEOF_VOID_P
|
||||
assert(_Py_IS_ALIGNED(dest, SIZEOF_LONG));
|
||||
if (_Py_IS_ALIGNED(p, SIZEOF_LONG)) {
|
||||
/* Fast path, see in STRINGLIB(utf8_decode) for
|
||||
an explanation. */
|
||||
/* Help allocation */
|
||||
const char *_p = p;
|
||||
Py_UCS1 * q = dest;
|
||||
while (_p < aligned_end) {
|
||||
unsigned long value = *(const unsigned long *) _p;
|
||||
if (value & ASCII_CHAR_MASK)
|
||||
break;
|
||||
*((unsigned long *)q) = value;
|
||||
_p += SIZEOF_LONG;
|
||||
q += SIZEOF_LONG;
|
||||
}
|
||||
p = _p;
|
||||
while (p < end) {
|
||||
if ((unsigned char)*p & 0x80)
|
||||
break;
|
||||
*q++ = *p++;
|
||||
}
|
||||
return p - start;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
while (p < end) {
|
||||
/* Fast path, see in STRINGLIB(utf8_decode) in stringlib/codecs.h
|
||||
for an explanation. */
|
||||
|
@ -5192,8 +5195,6 @@ onError:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
|
||||
/* Simplified UTF-8 decoder using surrogateescape error handler,
|
||||
used to decode the command line arguments on Mac OS X and Android.
|
||||
|
||||
|
@ -5246,8 +5247,6 @@ _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size)
|
|||
return unicode;
|
||||
}
|
||||
|
||||
#endif /* __APPLE__ or __ANDROID__ */
|
||||
|
||||
/* Primary internal function which creates utf8 encoded bytes objects.
|
||||
|
||||
Allocation strategy: if the string is short, convert into a stack buffer
|
||||
|
@ -8312,7 +8311,7 @@ PyUnicode_BuildEncodingMap(PyObject* string)
|
|||
mlevel3 = mresult->level23 + 16*count2;
|
||||
memcpy(mlevel1, level1, 32);
|
||||
memset(mlevel2, 0xFF, 16*count2);
|
||||
memset(mlevel3, 0, 128*count3);
|
||||
bzero(mlevel3, 128*count3);
|
||||
count3 = 0;
|
||||
for (i = 1; i < length; i++) {
|
||||
int o1, o2, o3, i2, i3;
|
||||
|
@ -13583,7 +13582,7 @@ _PyUnicodeWriter_Update(_PyUnicodeWriter *writer)
|
|||
void
|
||||
_PyUnicodeWriter_Init(_PyUnicodeWriter *writer)
|
||||
{
|
||||
memset(writer, 0, sizeof(*writer));
|
||||
bzero(writer, sizeof(*writer));
|
||||
|
||||
/* ASCII is the bare minimum */
|
||||
writer->min_char = 127;
|
||||
|
|
10
third_party/python/Objects/weakrefobject.c
vendored
10
third_party/python/Objects/weakrefobject.c
vendored
|
@ -1,6 +1,12 @@
|
|||
/* clang-format off */
|
||||
#include "third_party/python/Include/Python.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/modsupport.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/weakrefobject.h"
|
||||
#include "third_party/quickjs/quickjs.h"
|
||||
/* clang-format off */
|
||||
|
||||
#define GET_WEAKREFS_LISTPTR(o) \
|
||||
((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue