Implement tree-shaking for Python sources

This commit is contained in:
Justine Tunney 2021-09-05 01:20:03 -07:00
parent 81287b7ec0
commit 44c87b83ff
110 changed files with 899 additions and 1922 deletions

View file

@ -17,8 +17,11 @@
#include "third_party/python/Include/pyerrors.h"
#include "third_party/python/Include/pythonrun.h"
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/yoink.h"
/* clang-format off */
PYTHON_PROVIDE("_ast");
/* File automatically generated by Parser/asdl_c.py. */
static PyTypeObject AST_type;
@ -7862,6 +7865,7 @@ failed:
static struct PyModuleDef _astmodule = {
PyModuleDef_HEAD_INIT, "_ast"
};
PyMODINIT_FUNC
PyInit__ast(void)
{
@ -8112,5 +8116,3 @@ int PyAST_Check(PyObject* obj)
return -1;
return PyObject_IsInstance(obj, (PyObject*)&AST_type);
}

View file

@ -53,9 +53,12 @@
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/warnings.h"
#include "third_party/python/Include/weakrefobject.h"
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Python/importdl.h"
/* clang-format off */
PYTHON_PROVIDE("_cosmo");
static int cosmo_constants(PyObject *m)
{
if(PyModule_AddStringMacro(m, MODE)) return -1;

View file

@ -32,9 +32,12 @@
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/warnings.h"
#include "third_party/python/Include/weakrefobject.h"
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Python/importdl.h"
/* clang-format off */
PYTHON_PROVIDE("_imp");
#define CACHEDIR "__pycache__"
/* See _PyImport_FixupExtensionObject() below */

View file

@ -30,9 +30,12 @@
#include "third_party/python/Include/setobject.h"
#include "third_party/python/Include/sliceobject.h"
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Modules/hashtable.h"
/* clang-format off */
PYTHON_PROVIDE("marshal");
/* Write Python objects to files and read them back.
This is primarily intended for writing and reading compiled Python code,
even though dicts, lists, sets and frozensets, not commonly seen in

View file

@ -21,8 +21,8 @@
#include "third_party/python/Include/ast.h"
#include "third_party/python/Include/boolobject.h"
#include "third_party/python/Include/code.h"
#include "third_party/python/Include/cosmo.h"
#include "third_party/python/Include/codecs.h"
#include "third_party/python/Include/cosmo.h"
#include "third_party/python/Include/dictobject.h"
#include "third_party/python/Include/errcode.h"
#include "third_party/python/Include/fileobject.h"
@ -47,6 +47,7 @@
#include "third_party/python/Include/traceback.h"
#include "third_party/python/Include/unicodeobject.h"
#include "third_party/python/Include/warnings.h"
#include "third_party/python/Include/yoink.h"
/* clang-format off */
/* Python interpreter top-level routines, including init/exit */