mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Make fixes, improvements, and chibicc python bindings
- python now mixes audio 10x faster - python octal notation is restored - chibicc now builds code 3x faster - chibicc now has help documentation - chibicc can now generate basic python bindings - linenoise now supports some paredit-like features See #141
This commit is contained in:
parent
28997f3acb
commit
7061c79c22
121 changed files with 5272 additions and 1928 deletions
3
third_party/python/Python/cosmomodule.c
vendored
3
third_party/python/Python/cosmomodule.c
vendored
|
@ -35,6 +35,7 @@
|
|||
#include "third_party/python/Include/moduleobject.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
#include "third_party/python/Include/pyport.h"
|
||||
#include "third_party/python/Include/yoink.h"
|
||||
#include "third_party/xed/x86.h"
|
||||
/* clang-format off */
|
||||
|
@ -129,7 +130,7 @@ static PyObject *
|
|||
cosmo_ftrace(PyObject *self, PyObject *noargs)
|
||||
{
|
||||
ftrace_install();
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(crc32c_doc,
|
||||
|
|
2
third_party/python/Python/getargs.c
vendored
2
third_party/python/Python/getargs.c
vendored
|
@ -968,7 +968,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
|||
*p = PyUnicode_AsUnicodeAndSize(arg, &len);
|
||||
if (*p == NULL)
|
||||
RETURN_ERR_OCCURRED;
|
||||
if (Py_UNICODE_strlen(*p) != (size_t)len) {
|
||||
if (wcslen(*p) != (size_t)len) {
|
||||
PyErr_SetString(PyExc_ValueError, "embedded null character");
|
||||
RETURN_ERR_OCCURRED;
|
||||
}
|
||||
|
|
2
third_party/python/Python/modsupport.c
vendored
2
third_party/python/Python/modsupport.c
vendored
|
@ -301,7 +301,7 @@ do_mkvalue(const char **p_format, va_list *p_va, int flags)
|
|||
}
|
||||
else {
|
||||
if (n < 0)
|
||||
n = Py_UNICODE_strlen(u);
|
||||
n = wcslen(u);
|
||||
v = PyUnicode_FromUnicode(u, n);
|
||||
}
|
||||
return v;
|
||||
|
|
14
third_party/python/Python/mystrtoul.c
vendored
14
third_party/python/Python/mystrtoul.c
vendored
|
@ -137,11 +137,15 @@ PyOS_strtoul(const char *str, char **ptr, int base)
|
|||
/* skip all zeroes... */
|
||||
while (*str == '0')
|
||||
++str;
|
||||
while (Py_ISSPACE(Py_CHARMASK(*str)))
|
||||
++str;
|
||||
if (ptr)
|
||||
*ptr = (char *)str;
|
||||
return 0;
|
||||
if ('0' <= *str && *str <= '7') {
|
||||
base = 8; /* [jart] restore octal */
|
||||
} else {
|
||||
while (Py_ISSPACE(Py_CHARMASK(*str)))
|
||||
++str;
|
||||
if (ptr)
|
||||
*ptr = (char *)str;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
32
third_party/python/Python/recursive.c
vendored
Normal file
32
third_party/python/Python/recursive.c
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
/* clang-format off */
|
||||
|
||||
int
|
||||
(Py_EnterRecursiveCall)(const char *where)
|
||||
{
|
||||
return Py_EnterRecursiveCall(where);
|
||||
}
|
||||
|
||||
void
|
||||
(Py_LeaveRecursiveCall)(void)
|
||||
{
|
||||
Py_LeaveRecursiveCall();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue