mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Fix warnings
This change fixes Cosmopolitan so it has fewer opinions about compiler warnings. The whole repository had to be cleaned up to be buildable in -Werror -Wall mode. This lets us benefit from things like strict const checking. Some actual bugs might have been caught too.
This commit is contained in:
parent
e2b3c3618e
commit
0d748ad58e
571 changed files with 1306 additions and 1888 deletions
1
third_party/python/Include/datetime.h
vendored
1
third_party/python/Include/datetime.h
vendored
|
@ -4,6 +4,7 @@
|
|||
#include "third_party/python/Include/object.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
/* clang-format off */
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
|
||||
/* Fields are packed into successive bytes, each viewed as unsigned and
|
||||
* big-endian, unless otherwise noted:
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "third_party/python/Include/pymacro.h"
|
||||
|
||||
#pragma GCC push_options
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
|
||||
/******************************************************************************/
|
||||
/* Module */
|
||||
|
@ -871,6 +873,7 @@ PyDoc_STRVAR(doc_ctx_to_sci_string,
|
|||
Convert a number to a string using scientific notation.\n\
|
||||
\n");
|
||||
|
||||
#pragma GCC pop_options
|
||||
|
||||
#endif /* DOCSTRINGS_H */
|
||||
|
||||
|
|
10
third_party/python/Modules/_hashmbedtls.c
vendored
10
third_party/python/Modules/_hashmbedtls.c
vendored
|
@ -54,10 +54,10 @@ PYTHON_PROVIDE("_hashlib.mbedtls_sha512");
|
|||
|
||||
struct Hasher {
|
||||
PyObject_HEAD
|
||||
PyObject *name;
|
||||
const PyObject *name;
|
||||
mbedtls_md_context_t ctx;
|
||||
#ifdef WITH_THREAD
|
||||
PyThread_type_lock lock;
|
||||
PyThread_type_lock lock;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -81,7 +81,7 @@ SetMbedtlsError(PyObject *exc, int rc)
|
|||
}
|
||||
|
||||
static struct Hasher *
|
||||
hasher_new(PyObject *name)
|
||||
hasher_new(const PyObject *name)
|
||||
{
|
||||
struct Hasher *self;
|
||||
if ((self = PyObject_New(struct Hasher, &hasher_type))) {
|
||||
|
@ -304,7 +304,7 @@ static PyTypeObject hasher_type = {
|
|||
};
|
||||
|
||||
static PyObject *
|
||||
NewHasher(PyObject *name_obj,
|
||||
NewHasher(const PyObject *name_obj,
|
||||
const mbedtls_md_info_t *digest,
|
||||
void *p, Py_ssize_t n)
|
||||
{
|
||||
|
@ -482,7 +482,7 @@ GenerateHashNameList(void)
|
|||
{
|
||||
int i;
|
||||
char *s;
|
||||
uint8_t *p;
|
||||
const uint8_t *p;
|
||||
PyObject *set, *name;
|
||||
if ((set = PyFrozenSet_New(0))) {
|
||||
for (p = mbedtls_md_list(); *p != MBEDTLS_MD_NONE; ++p) {
|
||||
|
|
3
third_party/python/Modules/_testcapimodule.c
vendored
3
third_party/python/Modules/_testcapimodule.c
vendored
|
@ -4305,6 +4305,7 @@ tracemalloc_track(PyObject *self, PyObject *args)
|
|||
Py_ssize_t size;
|
||||
int release_gil = 0;
|
||||
int res;
|
||||
(void)ptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "IOn|i", &domain, &ptr_obj, &size, &release_gil))
|
||||
return NULL;
|
||||
|
@ -4336,6 +4337,7 @@ tracemalloc_untrack(PyObject *self, PyObject *args)
|
|||
PyObject *ptr_obj;
|
||||
void *ptr;
|
||||
int res;
|
||||
(void)ptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "IO", &domain, &ptr_obj))
|
||||
return NULL;
|
||||
|
@ -4358,6 +4360,7 @@ tracemalloc_get_traceback(PyObject *self, PyObject *args)
|
|||
unsigned int domain;
|
||||
PyObject *ptr_obj;
|
||||
void *ptr;
|
||||
(void)ptr;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "IO", &domain, &ptr_obj))
|
||||
return NULL;
|
||||
|
|
|
@ -244,10 +244,13 @@ getcodec(PyObject *self, PyObject *encoding)
|
|||
return r;
|
||||
}
|
||||
|
||||
#pragma GCC push_options
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
static struct PyMethodDef __methods[] = {
|
||||
{"getcodec", (PyCFunction)getcodec, METH_O, ""},
|
||||
{0},
|
||||
};
|
||||
#pragma GCC pop_options
|
||||
|
||||
#ifdef USING_BINARY_PAIR_SEARCH
|
||||
static DBCHAR
|
||||
|
|
2
third_party/python/Modules/main.c
vendored
2
third_party/python/Modules/main.c
vendored
|
@ -405,6 +405,8 @@ Py_Main(int argc, wchar_t **argv)
|
|||
PyObject *warning_option = NULL;
|
||||
PyObject *warning_options = NULL;
|
||||
|
||||
(void)opt;
|
||||
|
||||
cf.cf_flags = 0;
|
||||
|
||||
orig_argc = argc; /* For Py_GetArgcArgv() */
|
||||
|
|
3
third_party/python/Modules/socketmodule.c
vendored
3
third_party/python/Modules/socketmodule.c
vendored
|
@ -687,7 +687,6 @@ internal_setblocking(PySocketSockObject *s, int block)
|
|||
#endif
|
||||
#if !defined(MS_WINDOWS) \
|
||||
&& !((defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO)))
|
||||
int delay_flag, new_delay_flag;
|
||||
#endif
|
||||
#ifdef SOCK_NONBLOCK
|
||||
if (block)
|
||||
|
@ -5655,7 +5654,7 @@ socket_inet_aton(PyObject *self, PyObject *args)
|
|||
#ifdef HAVE_INET_ATON
|
||||
|
||||
#ifdef USE_INET_ATON_WEAKLINK
|
||||
if (inet_aton != NULL) {
|
||||
if (__veil("r", inet_aton) != NULL) {
|
||||
#endif
|
||||
if (inet_aton(ip_addr, &buf))
|
||||
return PyBytes_FromStringAndSize((char *)(&buf),
|
||||
|
|
1
third_party/python/Modules/timemodule.c
vendored
1
third_party/python/Modules/timemodule.c
vendored
|
@ -1520,7 +1520,6 @@ pysleep(_PyTime_t secs)
|
|||
{
|
||||
_PyTime_t deadline, monotonic;
|
||||
#ifndef MS_WINDOWS
|
||||
struct timeval timeout;
|
||||
struct timespec timeout2;
|
||||
int err = 0;
|
||||
#else
|
||||
|
|
5
third_party/python/Modules/tlsmodule.c
vendored
5
third_party/python/Modules/tlsmodule.c
vendored
|
@ -285,7 +285,6 @@ tls_recv_into(struct Tls *self, PyObject *args)
|
|||
{
|
||||
LOG("TLS.recv_into\n");
|
||||
int rc;
|
||||
Py_ssize_t n;
|
||||
PyObject *res;
|
||||
Py_buffer buf;
|
||||
if (!PyArg_ParseTuple(args, "w*:recv_into", &buf)) return 0;
|
||||
|
@ -458,7 +457,7 @@ Creates TLS client.");
|
|||
static PyObject *
|
||||
newclient(PyObject *self, PyObject *args)
|
||||
{
|
||||
int rc, fd;
|
||||
int fd;
|
||||
PyObject *todo;
|
||||
struct Tls *tls;
|
||||
const char *host;
|
||||
|
@ -483,7 +482,7 @@ static struct PyModuleDef mbedtls_module = {
|
|||
PyMODINIT_FUNC
|
||||
PyInit_tls(void)
|
||||
{
|
||||
PyObject *m, *mbedtls_md_meth_names;
|
||||
PyObject *m;
|
||||
Py_TYPE(&tls_type) = &PyType_Type;
|
||||
if (PyType_Ready(&tls_type) < 0) return 0;
|
||||
if (!(m = PyModule_Create(&mbedtls_module))) return 0;
|
||||
|
|
|
@ -270,7 +270,7 @@ _PyUnicode_GetUcName(PyObject *self, Py_UCS4 code, char *buffer, int buflen,
|
|||
/* copy word string from lexicon. the last character in the
|
||||
word has bit 7 set. the last word in a string ends with
|
||||
0x80 */
|
||||
w = (_PyUnicode_Lexicon +
|
||||
w = (void *)(_PyUnicode_Lexicon +
|
||||
BitFieldExtract(_PyUnicode_LexiconOffset, word,
|
||||
_PyUnicode_LexiconOffsetBits));
|
||||
while (*w < 128) {
|
||||
|
|
5
third_party/python/Objects/descrobject.c
vendored
5
third_party/python/Objects/descrobject.c
vendored
|
@ -4,10 +4,10 @@
|
|||
│ Python 3 │
|
||||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/python/Include/descrobject.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"
|
||||
|
@ -297,7 +297,8 @@ _PyMethodDescr_FastCallKeywords(PyObject *descrobj,
|
|||
}
|
||||
|
||||
result = _PyMethodDef_RawFastCallKeywords(descr->d_method, self,
|
||||
args+1, nargs-1, kwnames);
|
||||
(void *)(args+1), nargs-1,
|
||||
kwnames);
|
||||
result = _Py_CheckFunctionResult((PyObject *)descr, result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
|
1
third_party/python/Objects/object.c
vendored
1
third_party/python/Objects/object.c
vendored
|
@ -464,6 +464,7 @@ int
|
|||
_PyObject_IsFreed(PyObject *op)
|
||||
{
|
||||
uintptr_t ptr = (uintptr_t)op;
|
||||
(void)ptr;
|
||||
if (_PyMem_IsFreed(&ptr, sizeof(ptr))) {
|
||||
return 1;
|
||||
}
|
||||
|
|
3
third_party/python/Objects/structseq.c
vendored
3
third_party/python/Objects/structseq.c
vendored
|
@ -4,13 +4,13 @@
|
|||
│ Python 3 │
|
||||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/python/Include/structseq.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
|
||||
|
@ -188,6 +188,7 @@ structseq_repr(PyStructSequence *obj)
|
|||
/* "typename(", limited to TYPE_MAXSIZE */
|
||||
len = strlen(typ->tp_name) > TYPE_MAXSIZE ? TYPE_MAXSIZE :
|
||||
strlen(typ->tp_name);
|
||||
#pragma GCC diagnostic ignored "-Wstringop-truncation"
|
||||
strncpy(pbuf, typ->tp_name, len);
|
||||
pbuf += len;
|
||||
*pbuf++ = '(';
|
||||
|
|
6
third_party/python/Python/ceval.c
vendored
6
third_party/python/Python/ceval.c
vendored
|
@ -5353,6 +5353,9 @@ dtrace_function_entry(PyFrameObject *f)
|
|||
char* filename;
|
||||
char* funcname;
|
||||
int lineno;
|
||||
(void)filename;
|
||||
(void)funcname;
|
||||
(void)lineno;
|
||||
filename = PyUnicode_AsUTF8(f->f_code->co_filename);
|
||||
funcname = PyUnicode_AsUTF8(f->f_code->co_name);
|
||||
lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
|
||||
|
@ -5365,6 +5368,9 @@ dtrace_function_return(PyFrameObject *f)
|
|||
char* filename;
|
||||
char* funcname;
|
||||
int lineno;
|
||||
(void)filename;
|
||||
(void)funcname;
|
||||
(void)lineno;
|
||||
filename = PyUnicode_AsUTF8(f->f_code->co_filename);
|
||||
funcname = PyUnicode_AsUTF8(f->f_code->co_name);
|
||||
lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
|
||||
|
|
9
third_party/python/Python/cosmomodule.c
vendored
9
third_party/python/Python/cosmomodule.c
vendored
|
@ -100,13 +100,13 @@ cosmo_rdtsc(PyObject *self, PyObject *noargs)
|
|||
return PyLong_FromUnsignedLong(rdtsc());
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
PyDoc_STRVAR(getcpucore_doc,
|
||||
"getcpucore($module)\n\
|
||||
--\n\n\
|
||||
Returns 0-indexed CPU core on which process is currently scheduled.");
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
||||
static PyObject *
|
||||
cosmo_getcpucore(PyObject *self, PyObject *noargs)
|
||||
{
|
||||
|
@ -137,7 +137,6 @@ Similar to zlib.crc32().");
|
|||
static PyObject *
|
||||
cosmo_crc32c(PyObject *self, PyObject *args)
|
||||
{
|
||||
Py_ssize_t n;
|
||||
Py_buffer data;
|
||||
unsigned crc, init = 0;
|
||||
if (!PyArg_ParseTuple(args, "y*|I:crc32c", &data, &init)) return 0;
|
||||
|
@ -283,8 +282,6 @@ cosmo_exit1(PyObject *self, PyObject *args)
|
|||
_Exit(1);
|
||||
}
|
||||
|
||||
static bool ftrace_installed = 0;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
} FtracerObject;
|
||||
|
@ -327,6 +324,7 @@ static PyTypeObject FtracerType = {
|
|||
.tp_methods = FtracerObject_methods,
|
||||
};
|
||||
|
||||
#ifdef FTRACE
|
||||
PyDoc_STRVAR(ftrace_doc,
|
||||
"ftrace($module)\n\
|
||||
--\n\n\
|
||||
|
@ -337,6 +335,7 @@ Enables logging of C function calls to stderr, e.g.\n\
|
|||
\n\
|
||||
Please be warned this prints massive amount of text. In order for it\n\
|
||||
to work, the concomitant .com.dbg binary needs to be present.");
|
||||
#endif
|
||||
|
||||
static PyObject *
|
||||
cosmo_ftrace(PyObject *self, PyObject *noargs)
|
||||
|
|
1
third_party/python/Python/fatality.c
vendored
1
third_party/python/Python/fatality.c
vendored
|
@ -17,7 +17,6 @@
|
|||
/* clang-format off */
|
||||
|
||||
_Py_IDENTIFIER(flush);
|
||||
_Py_IDENTIFIER(stdout);
|
||||
_Py_IDENTIFIER(stderr);
|
||||
|
||||
/* Import the site module (not into __main__ though) */
|
||||
|
|
5
third_party/python/Python/import.c
vendored
5
third_party/python/Python/import.c
vendored
|
@ -865,7 +865,7 @@ PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co,
|
|||
{
|
||||
struct stat stinfo;
|
||||
PyObject *m = NULL;
|
||||
PyObject *nameobj, *pathobj = NULL, *cpathobj = NULL, *external= NULL;
|
||||
PyObject *nameobj, *pathobj = NULL, *cpathobj = NULL;
|
||||
|
||||
nameobj = PyUnicode_FromString(name);
|
||||
if (nameobj == NULL)
|
||||
|
@ -1183,7 +1183,7 @@ _imp_create_builtin(PyObject *module, PyObject *spec)
|
|||
res = bsearch(&key, Builtins_Lookup.entries, Builtins_Lookup.n, sizeof(initentry), cmp_initentry);
|
||||
|
||||
if (res != NULL) {
|
||||
p = res->tab;
|
||||
p = (void *)res->tab;
|
||||
PyModuleDef *def;
|
||||
if (p->initfunc == NULL) {
|
||||
/* Cannot re-init internal module ("sys" or "builtins") */
|
||||
|
@ -2491,7 +2491,6 @@ static PyObject *SFLObject_get_code(SourcelessFileLoader *self, PyObject *arg) {
|
|||
FILE *fp = NULL;
|
||||
PyObject *res = NULL;
|
||||
char *rawbuf = NULL;
|
||||
size_t rawlen = 0;
|
||||
|
||||
if (!PyArg_Parse(arg, "z:get_code", &name)) return 0;
|
||||
if (!name) name = self->name;
|
||||
|
|
1
third_party/python/Python/initimport.c
vendored
1
third_party/python/Python/initimport.c
vendored
|
@ -30,7 +30,6 @@ _Py_InitImport(PyInterpreterState *interp, PyObject *sysmod)
|
|||
{
|
||||
PyObject *importlib;
|
||||
PyObject *impmod;
|
||||
PyObject *cosmomod;
|
||||
PyObject *sys_modules;
|
||||
PyObject *value;
|
||||
|
||||
|
|
7
third_party/python/Python/pylifecycle.c
vendored
7
third_party/python/Python/pylifecycle.c
vendored
|
@ -4,6 +4,7 @@
|
|||
│ Python 3 │
|
||||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/python/Include/pylifecycle.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
|
@ -13,8 +14,8 @@
|
|||
#include "libc/log/log.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/str/locale.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "third_party/python/Include/Python-ast.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/ast.h"
|
||||
|
@ -37,7 +38,6 @@
|
|||
#include "third_party/python/Include/parsetok.h"
|
||||
#include "third_party/python/Include/pydebug.h"
|
||||
#include "third_party/python/Include/pyerrors.h"
|
||||
#include "third_party/python/Include/pylifecycle.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
#include "third_party/python/Include/pystrcmp.h"
|
||||
#include "third_party/python/Include/pytime.h"
|
||||
|
@ -53,9 +53,6 @@
|
|||
|
||||
/* Python interpreter top-level routines, including init/exit */
|
||||
|
||||
_Py_IDENTIFIER(name);
|
||||
_Py_IDENTIFIER(flush);
|
||||
_Py_IDENTIFIER(stdout);
|
||||
_Py_IDENTIFIER(stderr);
|
||||
|
||||
/* Forward */
|
||||
|
|
5
third_party/python/Python/random.c
vendored
5
third_party/python/Python/random.c
vendored
|
@ -11,8 +11,8 @@
|
|||
#include "libc/fmt/conv.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/nexgen32e/rdtsc.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/auxv.h"
|
||||
#include "libc/sysv/consts/grnd.h"
|
||||
|
@ -392,7 +392,6 @@ void
|
|||
_PyRandom_Init(void)
|
||||
{
|
||||
char *env;
|
||||
const unsigned char *auxrng;
|
||||
unsigned char *secret = (unsigned char *)&_Py_HashSecret.uc;
|
||||
Py_ssize_t secret_size = sizeof(_Py_HashSecret_t);
|
||||
Py_BUILD_ASSERT(sizeof(_Py_HashSecret_t) == sizeof(_Py_HashSecret.uc));
|
||||
|
@ -431,7 +430,7 @@ _PyRandom_Init(void)
|
|||
}
|
||||
else {
|
||||
uint64_t x;
|
||||
int res, i, j;
|
||||
int i, j;
|
||||
/* _PyRandom_Init() is called very early in the Python initialization
|
||||
and so exceptions cannot be used (use raise=0).
|
||||
_PyRandom_Init() must not block Python initialization: call
|
||||
|
|
35
third_party/python/Python/sysmodule.c
vendored
35
third_party/python/Python/sysmodule.c
vendored
|
@ -1026,11 +1026,6 @@ sys_getwindowsversion(PyObject *self)
|
|||
int pos = 0;
|
||||
PyObject *version;
|
||||
struct NtOsVersionInfo ver;
|
||||
uint32_t realMajor, realMinor, realBuild;
|
||||
int64_t hKernel32;
|
||||
wchar_t kernel32_path[PATH_MAX];
|
||||
void *verblock;
|
||||
uint32_t verblock_size;
|
||||
|
||||
if (!IsWindows()) {
|
||||
PyErr_SetString(PyExc_SystemError, "this is not windows");
|
||||
|
@ -1055,36 +1050,6 @@ sys_getwindowsversion(PyObject *self)
|
|||
PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wSuiteMask));
|
||||
PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wProductType));
|
||||
|
||||
realMajor = ver.dwMajorVersion;
|
||||
realMinor = ver.dwMinorVersion;
|
||||
realBuild = ver.dwBuildNumber;
|
||||
|
||||
#if 0 // todo(jart): port me
|
||||
// GetVersion will lie if we are running in a compatibility mode.
|
||||
// We need to read the version info from a system file resource
|
||||
// to accurately identify the OS version. If we fail for any reason,
|
||||
// just return whatever GetVersion said.
|
||||
hKernel32 = GetModuleHandle("kernel32.dll");
|
||||
if (hKernel32 && GetModuleFileNameW(hKernel32, kernel32_path, MAX_PATH) &&
|
||||
(verblock_size = GetFileVersionInfoSizeW(kernel32_path, NULL)) &&
|
||||
(verblock = PyMem_RawMalloc(verblock_size))) {
|
||||
VS_FIXEDFILEINFO *ffi;
|
||||
UINT ffi_len;
|
||||
if (GetFileVersionInfoW(kernel32_path, 0, verblock_size, verblock) &&
|
||||
VerQueryValueW(verblock, L"", (LPVOID)&ffi, &ffi_len)) {
|
||||
realMajor = HIWORD(ffi->dwProductVersionMS);
|
||||
realMinor = LOWORD(ffi->dwProductVersionMS);
|
||||
realBuild = HIWORD(ffi->dwProductVersionLS);
|
||||
}
|
||||
PyMem_RawFree(verblock);
|
||||
}
|
||||
PyStructSequence_SET_ITEM(version, pos++, Py_BuildValue("(kkk)",
|
||||
realMajor,
|
||||
realMinor,
|
||||
realBuild
|
||||
));
|
||||
#endif
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
Py_DECREF(version);
|
||||
return NULL;
|
||||
|
|
2
third_party/python/launch.c
vendored
2
third_party/python/launch.c
vendored
|
@ -51,7 +51,7 @@ PYTHON_YOINK("launchpy");
|
|||
|
||||
extern char kLaunchPythonModuleName[]; /* generated by pyobj.com */
|
||||
const struct _frozen *PyImport_FrozenModules = _PyImport_FrozenModules;
|
||||
struct _inittab *PyImport_Inittab = _PyImport_Inittab;
|
||||
struct _inittab *PyImport_Inittab = (void *)_PyImport_Inittab;
|
||||
|
||||
int
|
||||
LaunchPythonModule(const char *name)
|
||||
|
|
3
third_party/python/pycomp.c
vendored
3
third_party/python/pycomp.c
vendored
|
@ -77,7 +77,6 @@ void
|
|||
GetOpts(int argc, char *argv[])
|
||||
{
|
||||
int opt;
|
||||
char *outdir;
|
||||
while ((opt = getopt(argc, argv, "hnO:o:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'O':
|
||||
|
@ -114,7 +113,7 @@ main(int argc, char *argv[])
|
|||
ssize_t rc;
|
||||
size_t i, n;
|
||||
struct stat st;
|
||||
char *s, *p, m[12];
|
||||
char *p, m[12];
|
||||
PyObject *code, *marshalled;
|
||||
ShowCrashReports();
|
||||
GetOpts(argc, argv);
|
||||
|
|
7
third_party/python/pyobj.c
vendored
7
third_party/python/pyobj.c
vendored
|
@ -215,9 +215,6 @@ const char *const kIgnoredModules[] = /* sorted */ {
|
|||
/* "xml.dom", */
|
||||
};
|
||||
|
||||
_Py_IDENTIFIER(stdout);
|
||||
_Py_IDENTIFIER(stderr);
|
||||
|
||||
struct Yoinks {
|
||||
size_t n;
|
||||
char **p;
|
||||
|
@ -469,13 +466,13 @@ Analyze(const char *modname, PyObject *code, struct Interner *globals)
|
|||
int rc;
|
||||
bool istry;
|
||||
unsigned a;
|
||||
size_t i, j, n;
|
||||
size_t i, n;
|
||||
char *p, *mod, *imp;
|
||||
int x, y, op, arg, rel;
|
||||
PyObject *co_code, *co_names, *co_consts, *name, *iter, *item;
|
||||
rc = 0;
|
||||
mod = 0;
|
||||
istry = rel = 0;
|
||||
istry = (rel = 0);
|
||||
assert(PyCode_Check(code));
|
||||
co_code = ((PyCodeObject *)code)->co_code;
|
||||
co_names = ((PyCodeObject *)code)->co_names;
|
||||
|
|
11
third_party/python/runpythonmodule.c
vendored
11
third_party/python/runpythonmodule.c
vendored
|
@ -66,7 +66,7 @@ PYTHON_YOINK("encodings.utf_8");
|
|||
|
||||
extern char kLaunchPythonModuleName[]; /* optionally generated by pyobj.com */
|
||||
const struct _frozen *PyImport_FrozenModules = _PyImport_FrozenModules;
|
||||
struct _inittab *PyImport_Inittab = _PyImport_Inittab;
|
||||
struct _inittab *PyImport_Inittab = (void *)_PyImport_Inittab;
|
||||
static int g_gotint;
|
||||
|
||||
static void
|
||||
|
@ -168,8 +168,9 @@ CompleteDir(const char *b, const char *q, const char *p,
|
|||
static void
|
||||
Complete(const char *p, linenoiseCompletions *c)
|
||||
{
|
||||
PyObject *o, *t, *i;
|
||||
const char *q, *s, *b;
|
||||
char *s;
|
||||
PyObject *o, *t;
|
||||
const char *q, *b;
|
||||
if (startswith(p, "import ")) {
|
||||
for (q = p + 7; *q; ++q) {
|
||||
if (!isalnum(*q) && *q != '_') {
|
||||
|
@ -208,7 +209,7 @@ Complete(const char *p, linenoiseCompletions *c)
|
|||
break;
|
||||
}
|
||||
}
|
||||
free(s);
|
||||
free((void *)s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,7 +244,7 @@ ReinterpretCommand(const char *line)
|
|||
if (n && line[n - 1] == '?') {
|
||||
return xstrcat("help(", gc(strndup(gc(line), n - 1)), ')');
|
||||
} else {
|
||||
return line;
|
||||
return xstrdup(line);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue