Staging
v0.8.1
v0.8.1
https://github.com/python/cpython
Revision ddc163df25191af5bf8000091dbf8f6500b1d7c9 authored by Victor Stinner on 24 September 2018, 12:03:01 UTC, committed by GitHub on 24 September 2018, 12:03:01 UTC
Fix a crash with musl libc (on Alpine Linux) when the script filename specified on the command line doesn't exist. pymain_open_filename() now gets the current core configuration from the interpreter state. Modify the code to make it closer to the master branch: * Rename _Py_CommandLineDetails to _PyCmdline * Remove _PyMain.config: replaced with a local variable 'local_config' in pymain_init() * Reorganize pymain_main(): move code using the "local config" into pymain_init() * As soon as possible, switch from the local config to the core configuration attached to the interpreter.
1 parent aeadf59
Tip revision: ddc163df25191af5bf8000091dbf8f6500b1d7c9 authored by Victor Stinner on 24 September 2018, 12:03:01 UTC
bpo-34783: Fix Py_Main() (GH-9526)
bpo-34783: Fix Py_Main() (GH-9526)
Tip revision: ddc163d
_uuidmodule.c
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifdef HAVE_UUID_UUID_H
#include <uuid/uuid.h>
#endif
#ifdef HAVE_UUID_H
#include <uuid.h>
#endif
static PyObject *
py_uuid_generate_time_safe(void)
{
uuid_t uuid;
#ifdef HAVE_UUID_GENERATE_TIME_SAFE
int res;
res = uuid_generate_time_safe(uuid);
return Py_BuildValue("y#i", (const char *) uuid, sizeof(uuid), res);
#elif defined(HAVE_UUID_CREATE)
uint32_t status;
uuid_create(&uuid, &status);
# if defined(HAVE_UUID_ENC_BE)
unsigned char buf[sizeof(uuid)];
uuid_enc_be(buf, &uuid);
return Py_BuildValue("y#i", buf, sizeof(uuid), (int) status);
# else
return Py_BuildValue("y#i", (const char *) &uuid, sizeof(uuid), (int) status);
# endif
#else
uuid_generate_time(uuid);
return Py_BuildValue("y#O", (const char *) uuid, sizeof(uuid), Py_None);
#endif
}
static PyMethodDef uuid_methods[] = {
{"generate_time_safe", (PyCFunction) py_uuid_generate_time_safe, METH_NOARGS, NULL},
{NULL, NULL, 0, NULL} /* sentinel */
};
static struct PyModuleDef uuidmodule = {
PyModuleDef_HEAD_INIT,
.m_name = "_uuid",
.m_size = -1,
.m_methods = uuid_methods,
};
PyMODINIT_FUNC
PyInit__uuid(void)
{
PyObject *mod;
assert(sizeof(uuid_t) == 16);
#ifdef HAVE_UUID_GENERATE_TIME_SAFE
int has_uuid_generate_time_safe = 1;
#else
int has_uuid_generate_time_safe = 0;
#endif
mod = PyModule_Create(&uuidmodule);
if (mod == NULL) {
return NULL;
}
if (PyModule_AddIntConstant(mod, "has_uuid_generate_time_safe",
has_uuid_generate_time_safe) < 0) {
Py_DECREF(mod);
return NULL;
}
return mod;
}
Computing file changes ...