From 4beda5ab2676d6b007034b6f9906724c813fce68 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 19 Nov 2009 10:16:15 +0200 Subject: [PATCH] Permit header object generation from PyCObjects - needed for generating header objects from other extension modules & might be handy in some other cases too - patently type-unsafe but as long as python doesn't provide a better way, not really our headache --- python/header-py.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/header-py.c b/python/header-py.c index 9272fc8..a0f93c1 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -365,6 +365,8 @@ static PyObject *hdr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) if (obj == NULL) { h = headerNew(); + } else if (PyCObject_Check(obj)) { + h = PyCObject_AsVoidPtr(obj); } else if (hdrObject_Check(obj)) { h = headerCopy(((hdrObject*) obj)->h); } else if (PyBytes_Check(obj)) { -- 2.7.4