summaryrefslogtreecommitdiff
path: root/python/tar.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-11-24 10:00:27 +0000
committerArch Librarian <arch@canonical.com>2004-11-24 10:00:27 +0000
commit7a803ffe09ad1132452bc3c026713cff332ec38e (patch)
tree3659c10d6a6df4178bdfc5cad92475a82ffe5ee0 /python/tar.cc
parent20fca5e4812edce735df1586c7bf2d79cfb01b73 (diff)
downloadpython-apt-7a803ffe09ad1132452bc3c026713cff332ec38e.tar.gz
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
Diffstat (limited to 'python/tar.cc')
-rw-r--r--python/tar.cc18
1 files changed, 15 insertions, 3 deletions
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