Hello,

A little mail to signal a possible memory leak in an example of the doc, not very probable, but it may happen sometimes (and more often if we're already low on memory):

https://docs.python.org/2/extending/newtypes.html

in:
        self->first = PyString_FromString("");
        if (self->first == NULL) {
            Py_DECREF(self);
            return NULL;
        }

        self->last = PyString_FromString("");
        if (self->last == NULL) {
            Py_DECREF(self);
            return NULL;
        }

I think it should be (add line in bold):

        self->first = PyString_FromString("");
        if (self->first == NULL) {
            Py_DECREF(self);
            return NULL;
        }

        self->last = PyString_FromString("");
        if (self->last == NULL) {
            Py_DECREF(self->first); /* self->first is != NULL if we get here. */
            Py_DECREF(self);
            return NULL;
        }

Best Regards,

Joel Stienlet