return PyUnicode_Decode(str, len, encoding, errors);
}
+static void
+UnicodeResultProcessor_dealloc(UnicodeResultProcessor *self)
+{
+ Py_XDECREF(self->encoding);
+ Py_XDECREF(self->errors);
+ self->ob_type->tp_free((PyObject*)self);
+}
+
static PyMethodDef UnicodeResultProcessor_methods[] = {
{"process", (PyCFunction)UnicodeResultProcessor_process, METH_O,
"The value processor itself."},
"sqlalchemy.cprocessors.UnicodeResultProcessor", /* tp_name */
sizeof(UnicodeResultProcessor), /* tp_basicsize */
0, /* tp_itemsize */
- 0, /* tp_dealloc */
+ (destructor)UnicodeResultProcessor_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
static PyObject *
BaseRowProxy_reduce(PyObject *self)
{
- PyObject *method, *state;
- PyObject *module, *reconstructor, *cls;
+ PyObject *method, *state;
+ PyObject *module, *reconstructor, *cls;
- method = PyObject_GetAttrString(self, "__getstate__");
- if (method == NULL)
+ method = PyObject_GetAttrString(self, "__getstate__");
+ if (method == NULL)
return NULL;
state = PyObject_CallObject(method, NULL);
static PyMethodDef BaseRowProxy_methods[] = {
{"values", (PyCFunction)BaseRowProxy_values, METH_NOARGS,
"Return the values represented by this BaseRowProxy as a list."},
- {"__reduce__", (PyCFunction)BaseRowProxy_reduce, METH_NOARGS,
- "Pickle support method."},
+ {"__reduce__", (PyCFunction)BaseRowProxy_reduce, METH_NOARGS,
+ "Pickle support method."},
{NULL} /* Sentinel */
};
from sqlalchemy.test.schema import Table, Column
import sqlalchemy as sa
from sqlalchemy.sql import column
-from sqlalchemy.processors import to_decimal_processor_factory
+from sqlalchemy.processors import to_decimal_processor_factory, \
+ to_unicode_processor_factory
from sqlalchemy.test.util import gc_collect
from decimal import Decimal as _python_Decimal
import gc
def go():
to_decimal_processor_factory(_python_Decimal, 10)(1.2)
go()
+
+ @testing.requires.cextensions
+ def test_UnicodeResultProcessor_init(self):
+ @profile_memory
+ def go():
+ to_unicode_processor_factory('utf8')
+ go()
+
+