From 7a803ffe09ad1132452bc3c026713cff332ec38e Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Wed, 24 Nov 2004 10:00:27 +0000 Subject: Allow anything callable to be used for tar/deb extract Author: jgg Date: 2002-02-07 03:35:26 GMT Allow anything callable to be used for tar/deb extract --- python/tar.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'python/tar.cc') diff --git a/python/tar.cc b/python/tar.cc index 40350d2c..f1dd7c31 100644 --- a/python/tar.cc +++ b/python/tar.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: tar.cc,v 1.2 2002/01/08 06:53:04 jgg Exp $ +// $Id: tar.cc,v 1.3 2002/02/07 03:35:26 jgg Exp $ /* ###################################################################### Tar Inteface @@ -97,10 +97,16 @@ PyObject *tarExtract(PyObject *Self,PyObject *Args) PyObject *Function; char *Comp; - if (PyArg_ParseTuple(Args,"O!O!s",&PyFile_Type,&File,&PyFunction_Type, + if (PyArg_ParseTuple(Args,"O!Os",&PyFile_Type,&File, &Function,&Comp) == 0) return 0; + if (PyCallable_Check(Function) == 0) + { + PyErr_SetString(PyExc_TypeError,"argument 2: expected something callable."); + return 0; + } + { // Open the file and associate the tar FileFd Fd(fileno(PyFile_AsFile(File)),false); @@ -132,9 +138,15 @@ PyObject *debExtract(PyObject *Self,PyObject *Args) PyObject *Function; char *Chunk; - if (PyArg_ParseTuple(Args,"O!O!s",&PyFile_Type,&File,&PyFunction_Type, + if (PyArg_ParseTuple(Args,"O!Os",&PyFile_Type,&File, &Function,&Chunk) == 0) return 0; + + if (PyCallable_Check(Function) == 0) + { + PyErr_SetString(PyExc_TypeError,"argument 2: expected something callable."); + return 0; + } { // Open the file and associate the tar -- cgit v1.2.3