Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(45903)

Side by Side Diff: Modules/_uuidmodule.c

Issue 20519: ctypes.create_string_buffer creates reference cycles
Patch Set: Created 3 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« Lib/uuid.py ('K') | « Lib/uuid.py ('k') | setup.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "Python.h"
2 #include <uuid/uuid.h>
3
4 static PyObject *
5 _uuid_generate_random(void)
6 {
7 uuid_t out;
8 uuid_generate_random(out);
9 return PyBytes_FromStringAndSize((const char *) out, sizeof(out));
10 }
11
12 static PyObject *
13 _uuid_generate_time(void)
14 {
15 uuid_t out;
16 uuid_generate_time(out);
17 return PyBytes_FromStringAndSize((const char *) out, sizeof(out));
18 }
19
20
21 static PyMethodDef uuid_methods[] = {
22 {"generate_random", (PyCFunction)_uuid_generate_random, METH_NOARGS, NULL},
23 {"generate_time", (PyCFunction)_uuid_generate_time, METH_NOARGS, NULL},
24 {NULL, NULL, 0, NULL} /* sentinel */
25 };
26
27
28 static struct PyModuleDef uuidmodule = {
29 PyModuleDef_HEAD_INIT,
30 "_uuid",
31 NULL,
32 -1,
33 uuid_methods,
34 NULL,
35 NULL,
36 NULL,
37 NULL
38 };
39
40 PyMODINIT_FUNC
41 PyInit__uuid(void)
42 {
haypo 2015/10/27 03:35:14 Can you please add: assert(sizeof(uuid_t) == 16);
gustavo 2015/10/28 14:33:01 Added assert. Module still imports, as expected.
43 return PyModule_Create(&uuidmodule);
44 }
OLDNEW
« Lib/uuid.py ('K') | « Lib/uuid.py ('k') | setup.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+