History

Merge pull request #40 from nphilipp/develop--py3k-fixes

Miscellaneous fixes for Python, mostly version 3

Paul Brossier committed 10 years ago

Commit 4041a6d2 parents 7c785e6 b8ed85e10 files · +34 −20Browse files

Showing the changes to python/ext (6 of 10 files). Show all

Unified · Split

6 files
  1. python/ext/aubio-types.h +5 −0
  2. python/ext/aubiowraphell.h +2 −2
  3. python/ext/py-cvec.c +1 −1
  4. python/ext/py-filter.c +1 −1
  5. python/ext/py-sink.c +1 −1
  6. python/ext/py-source.c +1 −1
python/ext/aubio-types.h+5−0
@@ -39,6 +39,11 @@ · 38 unmodified lines
3939 #define AUBIO_NPY_SMPL NPY_FLOAT
4040 #endif
4141
42+// compat with Python < 2.6
43+#ifndef Py_TYPE
44+#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
45+#endif
46+
4247 // special python type for cvec
4348 typedef struct
4449 {
python/ext/aubiowraphell.h+2−2
@@ -13,7 +13,7 @@ Py_ ## NAME ## _init (Py_ ## NAME * self, PyObject * args, PyObject * kwds) \ · 12 unmodified lines
1313 { \
1414 self->o = new_aubio_## NAME ( PARAMS ); \
1515 if (self->o == NULL) { \
16− PyErr_SetString (PyExc_StandardError, "error creating object"); \
16+ PyErr_SetString (PyExc_RuntimeError, "error creating object"); \
1717 return -1; \
1818 } \
1919 \
@@ -25,7 +25,7 @@ static void \ · 5 unmodified lines
2525 Py_ ## NAME ## _del ( Py_ ## NAME * self) \
2626 { \
2727 del_aubio_ ## NAME (self->o); \
28− self->ob_type->tp_free ((PyObject *) self); \
28+ Py_TYPE(self)->tp_free ((PyObject *) self); \
2929 }
3030
3131 #define AUBIO_MEMBERS_START(NAME) \
python/ext/py-cvec.c+1−1
@@ -59,7 +59,7 @@ static void · 58 unmodified lines
5959 Py_cvec_del (Py_cvec * self)
6060 {
6161 del_cvec (self->o);
62− self->ob_type->tp_free ((PyObject *) self);
62+ Py_TYPE(self)->tp_free ((PyObject *) self);
6363 }
6464
6565 static PyObject *
python/ext/py-filter.c+1−1
@@ -57,7 +57,7 @@ Py_filter_del (Py_filter * self) · 56 unmodified lines
5757 {
5858 del_fvec(self->out);
5959 del_aubio_filter (self->o);
60− self->ob_type->tp_free ((PyObject *) self);
60+ Py_TYPE(self)->tp_free ((PyObject *) self);
6161 }
6262
6363 static PyObject *
python/ext/py-sink.c+1−1
@@ -115,7 +115,7 @@ Py_sink_init (Py_sink * self, PyObject * args, PyObject * kwds) · 114 unmodified lines
115115 aubio_sink_preset_samplerate ( self->o, self->samplerate );
116116 }
117117 if (self->o == NULL) {
118− PyErr_SetString (PyExc_StandardError, "error creating sink with this uri");
118+ PyErr_SetString (PyExc_RuntimeError, "error creating sink with this uri");
119119 return -1;
120120 }
121121 self->samplerate = aubio_sink_get_samplerate ( self->o );
python/ext/py-source.c+1−1
@@ -139,7 +139,7 @@ Py_source_init (Py_source * self, PyObject * args, PyObject * kwds) · 138 unmodified lines
139139 if (self->o == NULL) {
140140 char_t errstr[30 + strlen(self->uri)];
141141 sprintf(errstr, "error creating source with %s", self->uri);
142− PyErr_SetString (PyExc_StandardError, errstr);
142+ PyErr_SetString (PyExc_RuntimeError, errstr);
143143 return -1;
144144 }
145145 self->samplerate = aubio_source_get_samplerate ( self->o );

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