Skip to content

Commit

Permalink
Remove last python 2 artifacts.
Browse files Browse the repository at this point in the history
  • Loading branch information
belangeo committed Nov 9, 2021
1 parent 8ca6311 commit fb26a04
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 44 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Expand Up @@ -6,7 +6,7 @@
"type": "python",
"request": "launch",
"program": "${file}",
"console": "internalConsole",
"console": "integratedTerminal",
"cwd": "${fileDirname}"
},
{
Expand Down
15 changes: 0 additions & 15 deletions include/pyomodule.h
Expand Up @@ -2102,21 +2102,6 @@ extern PyTypeObject MMLZStreamType;
}

/* Tables buffer protocol. */
#if PY_MAJOR_VERSION < 3
#define TABLESTREAM_READ_WRITE_BUFFER \
if ( index != 0 ) { \
PySys_WriteStdout("Pyo error: Table buffer, accessing non-existent bytes segment."); \
return -1; \
} \
*ptr = (void *)self->data; \
return (Py_ssize_t)self->size * sizeof(MYFLT);

#define TABLESTREAM_SEG_COUNT \
if ( lenp ) \
*lenp = (Py_ssize_t)self->size * sizeof(MYFLT); \
return 1;
#endif

#define TABLESTREAM_GET_BUFFER \
if (view == NULL) { \
PySys_WriteStdout("Pyo error: Table buffer, NULL view in getBuffer."); \
Expand Down
17 changes: 0 additions & 17 deletions src/engine/pyomodule.c
Expand Up @@ -2056,7 +2056,6 @@ static PyMethodDef pyo_functions[] =
{NULL, NULL, 0, NULL},
};

#if PY_MAJOR_VERSION >= 3
// TODO: Pyo likely has a bunch of state stored in global variables right now, they should ideally be stored
// in an interpreter specific struct as described in https://docs.python.org/3/howto/cporting.html
static struct PyModuleDef pyo_moduledef =
Expand All @@ -2071,7 +2070,6 @@ static struct PyModuleDef pyo_moduledef =
NULL,/* m_clear */
NULL,/* m_free */
};
#endif

static PyObject *
module_add_object(PyObject *module, const char *name, PyTypeObject *type)
Expand All @@ -2085,28 +2083,15 @@ module_add_object(PyObject *module, const char *name, PyTypeObject *type)
}

PyMODINIT_FUNC
#if PY_MAJOR_VERSION >= 3
#ifndef USE_DOUBLE
PyInit__pyo(void)
#else
PyInit__pyo64(void)
#endif
#else
#ifndef USE_DOUBLE
init_pyo(void)
#else
init_pyo64(void)
#endif
#endif

{
PyObject *m;

#if PY_MAJOR_VERSION >= 3
m = PyModule_Create(&pyo_moduledef);
#else
m = Py_InitModule3(LIB_BASE_NAME, pyo_functions, "Python digital signal processing module.");
#endif

module_add_object(m, "Server_base", &ServerType);
#ifdef USE_PORTMIDI
Expand Down Expand Up @@ -2459,7 +2444,5 @@ init_pyo64(void)
PyModule_AddIntConstant(m, "USE_DOUBLE", 1);
#endif

#if PY_MAJOR_VERSION >= 3
return m;
#endif
}
11 changes: 0 additions & 11 deletions src/objects/tablemodule.c
Expand Up @@ -91,11 +91,6 @@ TableStream_setSamplingRate(TableStream *self, double sr)
self->samplingRate = sr;
}

#if PY_MAJOR_VERSION < 3
static Py_ssize_t TableStream_getReadBuffer(TableStream *self, Py_ssize_t index, const void **ptr) { TABLESTREAM_READ_WRITE_BUFFER };
static Py_ssize_t TableStream_getWriteBuffer(TableStream *self, Py_ssize_t index, const void **ptr) { TABLESTREAM_READ_WRITE_BUFFER };
static Py_ssize_t TableStream_getSegCount(TableStream *self, Py_ssize_t *lenp) { TABLESTREAM_SEG_COUNT };
#endif
static int TableStream_getBuffer(PyObject *obj, Py_buffer *view, int flags)
{
TableStream *self = (TableStream *)obj;
Expand All @@ -104,12 +99,6 @@ static int TableStream_getBuffer(PyObject *obj, Py_buffer *view, int flags)

static PyBufferProcs TableStream_as_buffer =
{
#if PY_MAJOR_VERSION < 3
(readbufferproc)TableStream_getReadBuffer,
(writebufferproc)TableStream_getWriteBuffer,
(segcountproc)TableStream_getSegCount,
(charbufferproc)NULL,
#endif
(getbufferproc)TableStream_getBuffer,
(releasebufferproc)NULL,
};
Expand Down

0 comments on commit fb26a04

Please sign in to comment.