Staging
v0.5.1
https://github.com/python/cpython
Revision 887b5f8fc622267e1fd48862ea9d0dfd4a0abdc6 authored by Miss Islington (bot) on 30 April 2018, 07:27:50 UTC, committed by GitHub on 30 April 2018, 07:27:50 UTC

In text and entry boxes, this affects selection by double-click,
movement left/right by control-left/right, and deletion left/right
by control-BACKSPACE/DEL.
(cherry picked from commit 5ff3a161c8a6b525c5e5b3e36e9c43f5a95bda60)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
1 parent 736f17f
Raw File
Tip revision: 887b5f8fc622267e1fd48862ea9d0dfd4a0abdc6 authored by Miss Islington (bot) on 30 April 2018, 07:27:50 UTC
bpo-21474: Update IDLE word/identifier definition from ascii to unicode. (GH-6643)
Tip revision: 887b5f8
_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 HAVE_UUID_CREATE
    uint32_t status;
    uuid_create(&uuid, &status);
    return Py_BuildValue("y#i", (const char *) &uuid, sizeof(uuid), (int) status);
#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) {
        return NULL;
    }

    return mod;
}
back to top