mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Implement tree-shaking for Python sources
This commit is contained in:
parent
81287b7ec0
commit
44c87b83ff
110 changed files with 899 additions and 1922 deletions
22
third_party/python/Objects/fileobject.c
vendored
22
third_party/python/Objects/fileobject.c
vendored
|
@ -23,6 +23,7 @@
|
|||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/tupleobject.h"
|
||||
#include "third_party/python/Include/unicodeobject.h"
|
||||
#include "third_party/python/Include/yoink.h"
|
||||
/* clang-format off */
|
||||
|
||||
/* File object implementation (what's left of it -- see io.py) */
|
||||
|
@ -46,27 +47,6 @@
|
|||
|
||||
/* External C interface */
|
||||
|
||||
PyObject *
|
||||
PyFile_FromFd(int fd, const char *name, const char *mode, int buffering, const char *encoding,
|
||||
const char *errors, const char *newline, int closefd)
|
||||
{
|
||||
PyObject *io, *stream;
|
||||
_Py_IDENTIFIER(open);
|
||||
|
||||
io = PyImport_ImportModule("io");
|
||||
if (io == NULL)
|
||||
return NULL;
|
||||
stream = _PyObject_CallMethodId(io, &PyId_open, "isisssi", fd, mode,
|
||||
buffering, encoding, errors,
|
||||
newline, closefd);
|
||||
Py_DECREF(io);
|
||||
if (stream == NULL)
|
||||
return NULL;
|
||||
/* ignore name attribute because the name attribute of _BufferedIOMixin
|
||||
and TextIOWrapper is read only */
|
||||
return stream;
|
||||
}
|
||||
|
||||
PyObject *
|
||||
PyFile_GetLine(PyObject *f, int n)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue