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

Side by Side Diff: Modules/_uuidmodule.c

Issue 20519: ctypes.create_string_buffer creates reference cycles
Patch Set: Created 5 years, 7 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
« no previous file with comments | « Lib/uuid.py ('k') | setup.py » ('j') | setup.py » ('J')
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);
haypo 2015/09/24 13:37:20 Do you think that it's worth to release the GIL he
gustavo 2015/10/26 20:08:21 Generate_random takes about 5 µs each call on my b
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);
haypo 2015/09/24 13:37:20 Ditto.
gustavo 2015/10/26 20:08:21 generate_time takes 0.1 µs, not worth it.
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 {
43 return PyModule_Create(&uuidmodule);
44 }
OLDNEW
« no previous file with comments | « Lib/uuid.py ('k') | setup.py » ('j') | setup.py » ('J')

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