History

python/ext/py-source.c: add with interface (PEP 343)

Paul Brossier committed 9 years ago

Commit f1f2e7e1 parent cc469dd1 file · +16 −0Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/ext/py-source.c+16−0
@@ -272,6 +272,18 @@ Pyaubio_source_seek (Py_source *self, PyObject *args) · 271 unmodified lines
272 Py_RETURN_NONE;272 Py_RETURN_NONE;
273}273}
274 274
275static char Pyaubio_source_enter_doc[] = "";
276static PyObject* Pyaubio_source_enter(Py_source *self, PyObject *unused) {
277 Py_INCREF(self);
278 return (PyObject*)self;
279}
280
281static char Pyaubio_source_exit_doc[] = "";
282static PyObject* Pyaubio_source_exit(Py_source *self, PyObject *unused) {
283 Pyaubio_source_close(self, unused);
284 return Pyaubio_source_close(self, unused);
285}
286
275static PyMethodDef Py_source_methods[] = {287static PyMethodDef Py_source_methods[] = {
276 {"get_samplerate", (PyCFunction) Pyaubio_source_get_samplerate,288 {"get_samplerate", (PyCFunction) Pyaubio_source_get_samplerate,
277 METH_NOARGS, Py_source_get_samplerate_doc},289 METH_NOARGS, Py_source_get_samplerate_doc},
@@ -285,6 +297,10 @@ static PyMethodDef Py_source_methods[] = { · 7 unmodified lines
285 METH_NOARGS, Py_source_close_doc},297 METH_NOARGS, Py_source_close_doc},
286 {"seek", (PyCFunction) Pyaubio_source_seek,298 {"seek", (PyCFunction) Pyaubio_source_seek,
287 METH_VARARGS, Py_source_seek_doc},299 METH_VARARGS, Py_source_seek_doc},
300 {"__enter__", (PyCFunction)Pyaubio_source_enter, METH_NOARGS,
301 Pyaubio_source_enter_doc},
302 {"__exit__", (PyCFunction)Pyaubio_source_exit, METH_VARARGS,
303 Pyaubio_source_exit_doc},
288 {NULL} /* sentinel */304 {NULL} /* sentinel */
289};305};
290 306

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t