Fixing for Python 2.3 and later.
authormdw <mdw>
Wed, 27 Apr 2005 23:40:07 +0000 (23:40 +0000)
committermdw <mdw>
Wed, 27 Apr 2005 23:40:07 +0000 (23:40 +0000)
14 files changed:
.gdbinit
Makefile
algorithms.c
bytestring.c
catacomb-python.h
ec.c
field.c
group.c
mp.c
passphrase.c
pgen.c
pubkey.c
pwsafe
rand.c

index 49672f3..440e5b5 100644 (file)
--- a/.gdbinit
+++ b/.gdbinit
@@ -1,4 +1,6 @@
-file py/python2.2-2.2.1/debian/python2.2/usr/bin/python2.2
-dir py/python2.2-2.2.1/builddir
-cd build/lib.linux-i686-2.2
+file py/python2.4-2.4+2.4.1rc2/debian/python2.4/usr/bin/python2.4
+dir py/python2.4-2.4+2.4.1rc2
 set env LD_LIBRARY_PATH=/home/mdw/src/catacomb/deb-build/.libs
+set env PYTHONPATH=/usr/lib/python2.4/lib-dynload
+cd build/lib.linux-i686-2.4
+set args pwsafe list
index 96c081f..1ec8212 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 ## Makefile
 
-PYTHON = python2.2
+PYTHON = python2.4
 prefix=/usr/local
 
 all: setup.py
index 6eda802..a740a71 100644 (file)
@@ -236,7 +236,7 @@ static PyTypeObject keysz_pytype_skel = {
   sizeof(keysz_pyobj),                 /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
-  _PyObject_Del,                       /* @tp_dealloc@ */
+  0,                                   /* @tp_dealloc@ */
   0,                                   /* @tp_print@ */
   0,                                   /* @tp_getattr@ */
   0,                                   /* @tp_setattr@ */
@@ -274,7 +274,7 @@ static PyTypeObject keysz_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -284,7 +284,7 @@ static PyTypeObject keyszany_pytype_skel = {
   sizeof(keysz_pyobj),                 /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
-  _PyObject_Del,                       /* @tp_dealloc@ */
+  0,                                   /* @tp_dealloc@ */
   0,                                   /* @tp_print@ */
   0,                                   /* @tp_getattr@ */
   0,                                   /* @tp_setattr@ */
@@ -322,7 +322,7 @@ static PyTypeObject keyszany_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   keyszany_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -332,7 +332,7 @@ static PyTypeObject keyszrange_pytype_skel = {
   sizeof(keyszrange_pyobj),            /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
-  _PyObject_Del,                       /* @tp_dealloc@ */
+  0,                                   /* @tp_dealloc@ */
   0,                                   /* @tp_print@ */
   0,                                   /* @tp_getattr@ */
   0,                                   /* @tp_setattr@ */
@@ -371,7 +371,7 @@ sizes, and requires the key length to be a multiple of some value.",
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   keyszrange_pynew,                    /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -381,7 +381,7 @@ static PyTypeObject keyszset_pytype_skel = {
   sizeof(keyszset_pyobj),              /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
-  _PyObject_Del,                       /* @tp_dealloc@ */
+  0,                                   /* @tp_dealloc@ */
   0,                                   /* @tp_print@ */
   0,                                   /* @tp_getattr@ */
   0,                                   /* @tp_setattr@ */
@@ -420,7 +420,7 @@ few listed sizes.",
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   keyszset_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -470,7 +470,7 @@ PyObject *gccipher_pywrap(gccipher *cc)
                    Py_TPFLAGS_BASETYPE |
                    Py_TPFLAGS_HEAPTYPE);
   g->ty.tp_alloc = PyType_GenericAlloc;
-  g->ty.tp_free = _PyObject_Del;
+  g->ty.tp_free = 0;
   g->ty.tp_new = gcipher_pynew;
   PyType_Ready(&g->ty);
   return ((PyObject *)g);
@@ -481,7 +481,7 @@ static void gcipher_pydealloc(PyObject *me)
   if (GCIPHER_F(me) & f_freeme)
     GC_DESTROY(GCIPHER_C(me));
   Py_DECREF(me->ob_type);
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *gccget_name(PyObject *me, void *hunoz)
@@ -634,7 +634,7 @@ static PyTypeObject gccipher_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -682,7 +682,7 @@ static PyTypeObject gcipher_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -715,7 +715,7 @@ PyObject *gchash_pywrap(gchash *ch)
                    Py_TPFLAGS_BASETYPE |
                    Py_TPFLAGS_HEAPTYPE);
   g->ty.tp_alloc = PyType_GenericAlloc;
-  g->ty.tp_free = _PyObject_Del;
+  g->ty.tp_free = 0;
   g->ty.tp_new = ghash_pynew;
   PyType_Ready(&g->ty);
   return ((PyObject *)g);
@@ -737,7 +737,7 @@ static void ghash_pydealloc(PyObject *me)
   if (GHASH_F(me) & f_freeme)
     GH_DESTROY(GHASH_H(me));
   Py_DECREF(me->ob_type);
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *gchget_name(PyObject *me, void *hunoz)
@@ -831,7 +831,7 @@ static PyTypeObject gchash_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -879,7 +879,7 @@ static PyTypeObject ghash_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -932,7 +932,7 @@ PyObject *gcmac_pywrap(gcmac *cm)
                    Py_TPFLAGS_BASETYPE |
                    Py_TPFLAGS_HEAPTYPE);
   g->ty.tp_alloc = PyType_GenericAlloc;
-  g->ty.tp_free = _PyObject_Del;
+  g->ty.tp_free = 0;
   g->ty.tp_new = gmac_pynew;
   PyType_Ready(&g->ty);
   return ((PyObject *)g);
@@ -952,7 +952,7 @@ PyObject *gmac_pywrap(PyObject *cobj, gmac *m, unsigned f)
                    Py_TPFLAGS_BASETYPE |
                    Py_TPFLAGS_HEAPTYPE);
   g->ty.tp_alloc = PyType_GenericAlloc;
-  g->ty.tp_free = _PyObject_Del;
+  g->ty.tp_free = 0;
   g->ty.tp_new = gmhash_pynew;
   PyType_Ready(&g->ty);
   g->m = m;
@@ -1031,7 +1031,7 @@ static PyTypeObject gcmac_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1079,7 +1079,7 @@ static PyTypeObject gmac_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1127,7 +1127,7 @@ static PyTypeObject gmhash_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
index c649125..61627f4 100644 (file)
@@ -42,9 +42,7 @@ PyObject *bytestring_pywrap(const void *p, size_t n)
 #ifdef CACHE_HASH
   x->ob_shash = -1;
 #endif
-#ifdef INTERN_STRINGS
-  x->ob_sinterned = NULL;
-#endif
+  x->ob_sstate = SSTATE_NOT_INTERNED;
   return ((PyObject *)x);
 }
 
@@ -163,7 +161,7 @@ static PyTypeObject bytestring_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   0,                                   /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
index c93ef07..368c7bb 100644 (file)
 MODULES(DO)
 #undef DO
 
+#define FREEOBJ(obj)                                                   \
+  (((PyObject *)(obj))->ob_type->tp_free((PyObject *)(obj)))
+
 /*----- Bytestrings -------------------------------------------------------*/
 
 PyTypeObject *bytestring_pyobj;
diff --git a/ec.c b/ec.c
index 8fd32ca..59384bc 100644 (file)
--- a/ec.c
+++ b/ec.c
@@ -179,7 +179,7 @@ static void ecpt_pydealloc(PyObject *x)
 {
   EC_DESTROY(ECPT_P(x));
   Py_DECREF(ECPT_COBJ(x));
-  PyObject_DEL(x);
+  FREEOBJ(x);
 }
 
 static PyObject *ecpt_pymul(PyObject *x, PyObject *y)
@@ -472,16 +472,6 @@ static int ecptxl(ec_curve *c, ec *p, PyObject *x, PyObject *y, PyObject *z)
     return (ecptxl_1(c, p, x));
 }
 
-static int ecpt_fromobjects(PyObject *cc, ec *p,
-                           PyObject *x, PyObject *y, PyObject *z)
-{
-  ec_curve *c = 0;
-
-  if (cc && PyType_IsSubtype((PyTypeObject *)cc, ecptcurve_pytype))
-    c = ECCURVE_C(cc);
-  return (ecptxl(c, p, x, y, z));
-}
-
 static PyObject *ecptnc_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
 {
   PyObject *x = 0, *y = 0, *z = 0;
@@ -643,7 +633,7 @@ static PyTypeObject ecpt_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   ecptnc_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -664,6 +654,7 @@ static PyMethodDef ecpt_pymethods[] = {
 #define METHNAME(func) epmeth_##func
   METH (toraw,         "X.toraw() -> BIN")
   METH (dbl,           "X.dbl() -> X + X")
+  METH (oncurvep,      "X.oncurvep() -> BOOL")
 #undef METHNAME
   { 0 }
 };
@@ -756,7 +747,7 @@ static PyTypeObject ecptcurve_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -921,7 +912,7 @@ static PyObject *eccurve_dopywrap(PyTypeObject *ty,
                       Py_TPFLAGS_CHECKTYPES |
                       Py_TPFLAGS_HEAPTYPE);
   cobj->ty.tp_alloc = PyType_GenericAlloc;
-  cobj->ty.tp_free =_PyObject_Del;
+  cobj->ty.tp_free = 0;
   cobj->ty.tp_new = ecpt_pynew;
   PyType_Ready(&cobj->ty);
   return ((PyObject *)cobj);
@@ -1068,7 +1059,7 @@ static PyTypeObject eccurve_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1122,7 +1113,7 @@ static PyTypeObject ecprimecurve_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   ecprimecurve_pynew,                  /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1176,7 +1167,7 @@ static PyTypeObject ecprimeprojcurve_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   ecprimeprojcurve_pynew,              /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1230,7 +1221,7 @@ static PyTypeObject ecbincurve_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   ecbincurve_pynew,                    /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1284,7 +1275,7 @@ static PyTypeObject ecbinprojcurve_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   ecbinprojcurve_pynew,                        /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1319,7 +1310,7 @@ static void ecinfo_pydealloc(PyObject *me)
   MP_DROP(ei->r);
   MP_DROP(ei->h);
   Py_DECREF(ECINFO_COBJ(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *ecinfo_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
@@ -1489,7 +1480,7 @@ static PyTypeObject ecinfo_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   ecinfo_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
diff --git a/field.c b/field.c
index ea7d6de..aa071b2 100644 (file)
--- a/field.c
+++ b/field.c
@@ -67,7 +67,7 @@ static PyObject *field_dopywrap(PyTypeObject *ty, field *f)
                       Py_TPFLAGS_CHECKTYPES |
                       Py_TPFLAGS_HEAPTYPE);
   fobj->ty.tp_alloc = PyType_GenericAlloc;
-  fobj->ty.tp_free = _PyObject_Del;
+  fobj->ty.tp_free = 0;
   fobj->ty.tp_new = fe_pynew;
   PyType_Ready(&fobj->ty);
   return ((PyObject *)fobj);
@@ -293,7 +293,7 @@ static void fe_pydealloc(PyObject *me)
 {
   Py_DECREF(FE_FOBJ(me));
   MP_DROP(FE_X(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 #define UNOP(name, check)                                              \
@@ -452,7 +452,7 @@ static PyTypeObject fe_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -581,7 +581,7 @@ static PyTypeObject field_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -659,7 +659,7 @@ static PyTypeObject primefield_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   primefield_pynew,                    /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -726,7 +726,7 @@ static PyTypeObject niceprimefield_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   niceprimefield_pynew,                        /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -786,7 +786,7 @@ static PyTypeObject binfield_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -859,7 +859,7 @@ static PyTypeObject binpolyfield_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   binpolyfield_pynew,                  /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -941,7 +941,7 @@ static PyTypeObject binnormfield_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   binnormfield_pynew,                  /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
diff --git a/group.c b/group.c
index f3a01ab..7ae387a 100644 (file)
--- a/group.c
+++ b/group.c
@@ -86,7 +86,7 @@ static void fginfo_pydealloc(PyObject *me)
   mp_drop(FGINFO_DP(me)->p);
   mp_drop(FGINFO_DP(me)->q);
   mp_drop(FGINFO_DP(me)->g);
-  _PyObject_Del(me);
+  FREEOBJ(me);
 }
 
 static PyObject *meth__DHInfo_generate(PyObject *me,
@@ -319,7 +319,7 @@ static PyTypeObject fginfo_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -367,7 +367,7 @@ static PyTypeObject dhinfo_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   fginfo_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -415,7 +415,7 @@ static PyTypeObject bindhinfo_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   fginfo_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -516,7 +516,7 @@ static PyObject *group_dopywrap(PyTypeObject *ty, group *g)
                       Py_TPFLAGS_CHECKTYPES |
                       Py_TPFLAGS_HEAPTYPE);
   gobj->ty.tp_alloc = PyType_GenericAlloc;
-  gobj->ty.tp_free =_PyObject_Del;
+  gobj->ty.tp_free = 0;
   gobj->ty.tp_new = ge_pynew;
   PyType_Ready(&gobj->ty);
   return ((PyObject *)gobj);
@@ -584,7 +584,7 @@ static void ge_pydealloc(PyObject *me)
 {
   G_DESTROY(GE_G(me), GE_X(me));
   Py_DECREF(GE_GOBJ(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static void group_pydealloc(PyObject *me)
@@ -1005,7 +1005,7 @@ static PyTypeObject ge_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1074,7 +1074,7 @@ static PyTypeObject group_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1151,7 +1151,7 @@ static PyTypeObject primegroup_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   primegroup_pynew,                    /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1228,7 +1228,7 @@ static PyTypeObject bingroup_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   bingroup_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1306,7 +1306,7 @@ static PyTypeObject ecgroup_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   ecgroup_pynew,                       /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
diff --git a/mp.c b/mp.c
index a2bd7dc..e14b3a0 100644 (file)
--- a/mp.c
+++ b/mp.c
@@ -179,7 +179,7 @@ end:
 static void mp_pydealloc(PyObject *o)
 {
   MP_DROP(MP_X(o));
-  PyObject_DEL(o);
+  FREEOBJ(o);
 }
 
 static PyObject *mp_pyrepr(PyObject *o)
@@ -863,7 +863,7 @@ Notes:\n\
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   mp_pynew,                            /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1102,7 +1102,7 @@ end:
 static void mpmont_pydealloc(PyObject *me)
 {
   mpmont_destroy(MPMONT_PY(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *mpmont_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
@@ -1201,7 +1201,7 @@ static PyTypeObject *mpmont_pytype, mpmont_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   mpmont_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1255,7 +1255,7 @@ end:
 static void mpbarrett_pydealloc(PyObject *me)
 {
   mpbarrett_destroy(MPBARRETT_PY(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *mpbarrett_pynew(PyTypeObject *ty,
@@ -1340,7 +1340,7 @@ static PyTypeObject *mpbarrett_pytype, mpbarrett_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   mpbarrett_pynew,                     /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1384,7 +1384,7 @@ end:
 static void mpreduce_pydealloc(PyObject *me)
 {
   mpreduce_destroy(MPREDUCE_PY(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *mpreduce_pynew(PyTypeObject *ty,
@@ -1468,7 +1468,7 @@ static PyTypeObject *mpreduce_pytype, mpreduce_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   mpreduce_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1637,7 +1637,7 @@ static PyTypeObject *mpcrt_pytype, mpcrt_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   mpcrt_pynew,                         /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1932,7 +1932,7 @@ Notes:\n\
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   gf_pynew,                            /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -2001,7 +2001,7 @@ end:
 static void gfreduce_pydealloc(PyObject *me)
 {
   gfreduce_destroy(GFREDUCE_PY(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *gfreduce_pynew(PyTypeObject *ty,
@@ -2085,7 +2085,7 @@ static PyTypeObject *gfreduce_pytype, gfreduce_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   gfreduce_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -2114,7 +2114,7 @@ static PyObject *gfn_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
     goto end;
   gg = PyObject_New(gfn_pyobj, ty);
   if (gfn_create(p, beta, &gg->ntop, &gg->pton)) {
-    PyObject_DEL(gg);
+    FREEOBJ(gg);
     gg = 0;
     VALERR("can't invert transformation matrix");
   }
@@ -2156,7 +2156,7 @@ static void gfn_pydealloc(PyObject *me)
 {
   gfn_destroy(GFN_PTON(me));
   gfn_destroy(GFN_NTOP(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyGetSetDef gfn_pygetset[] = {
@@ -2220,7 +2220,7 @@ and normal basis representations.",
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   gfn_pynew,                           /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
index a72bd90..cf4d81e 100644 (file)
@@ -41,6 +41,7 @@ static PyTypeObject *pixie_pytype;
 #define PIXIE_PYCHECK(o) PyObject_TypeCheck((o), pixie_pytype)
 #define PIXIE_FD(o) (((pixie_pyobj *)(o))->fd)
 
+#ifdef WANT_CONVPIXIE
 static int convpixie(PyObject *o, void *p)
 {
   if (!PIXIE_PYCHECK(o))
@@ -50,6 +51,7 @@ static int convpixie(PyObject *o, void *p)
 end:
   return (0);
 }
+#endif
 
 static PyObject *pixie_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
 {
@@ -71,8 +73,7 @@ end:
 static void pixie_pydealloc(PyObject *me)
 {
   close(PIXIE_FD(me));
-  PyObject_DEL(me);
-  
+  FREEOBJ(me);  
 }
 
 static PyObject *pixmeth_read(PyObject *me, PyObject *arg, PyObject *kw)
@@ -172,7 +173,7 @@ static PyTypeObject pixie_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   pixie_pynew,                         /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
diff --git a/pgen.c b/pgen.c
index e201b62..a2b7634 100644 (file)
--- a/pgen.c
+++ b/pgen.c
@@ -68,7 +68,7 @@ static PyObject *pfilt_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
 }
 
 static void pfilt_pydealloc(PyObject *me)
-  { pfilt_destroy(PFILT_F(me)); PyObject_DEL(me); }
+  { pfilt_destroy(PFILT_F(me)); FREEOBJ(me); }
 
 static PyObject *pfmeth_step(PyObject *me, PyObject *arg)
 {
@@ -241,7 +241,7 @@ static PyTypeObject pfilt_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   pfilt_pynew,                         /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -273,7 +273,7 @@ end:
 static void rabin_pydealloc(PyObject *me)
 {
   rabin_destroy(RABIN_R(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *rmeth_test(PyObject *me, PyObject *arg)
@@ -374,7 +374,7 @@ static PyTypeObject rabin_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   rabin_pynew,                         /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -398,7 +398,7 @@ static PyObject *pgevent_pywrap(pgen_event *ev)
 static CONVFUNC(pgevent, pgen_event *, PGEVENT_EV)
 
 static void pgevent_kill(PyObject *me) { PGEVENT_EV(me) = 0; }
-static void pgevent_pydealloc(PyObject *me) { PyObject_DEL(me); }
+static void pgevent_pydealloc(PyObject *me) { FREEOBJ(me); }
 
 #define PGEVENT_CHECK(me) do {                                         \
   if (!PGEVENT_EV(me)) {                                               \
@@ -492,7 +492,7 @@ static PyTypeObject pgevent_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -635,7 +635,7 @@ static PyTypeObject pgev_pytype_skel = {
   sizeof(pgev_pyobj),                  /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
-  _PyObject_Del,                       /* @tp_dealloc@ */
+  0,                                   /* @tp_dealloc@ */
   0,                                   /* @tp_print@ */
   0,                                   /* @tp_getattr@ */
   0,                                   /* @tp_setattr@ */
@@ -673,7 +673,7 @@ static PyTypeObject pgev_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -747,7 +747,7 @@ static PyTypeObject pgstep_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   pgstep_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -772,7 +772,7 @@ end:
 static void pgjump_pydealloc(PyObject *me)
 {
   Py_DECREF(PGJUMP_FOBJ(me));
-  _PyObject_Del(me);
+  FREEOBJ(me);
 }
 
 static PyObject *pjget_jump(PyObject *me, void *hunoz)
@@ -829,7 +829,7 @@ static PyTypeObject pgjump_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   pgjump_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -890,7 +890,7 @@ static PyTypeObject pgtest_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   pgtest_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
index e002972..ef44845 100644 (file)
--- a/pubkey.c
+++ b/pubkey.c
@@ -52,7 +52,7 @@ static void dsa_pydealloc(PyObject *me)
   dsa_pyobj *g = (dsa_pyobj *)me;
   Py_DECREF(g->G); Py_DECREF(g->u); Py_DECREF(g->p);
   Py_DECREF(g->rng); Py_DECREF(g->hash);
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *dsa_setup(PyTypeObject *ty, PyObject *G, PyObject *u,
@@ -76,7 +76,7 @@ static PyObject *dsa_setup(PyTypeObject *ty, PyObject *G, PyObject *u,
   rng = g->rng; Py_INCREF(rng); g->hash = hash; Py_INCREF(hash);
   return ((PyObject *)g);
 end:
-  PyObject_DEL(g);
+  FREEOBJ(g);
   return (0);
 }
 
@@ -254,7 +254,7 @@ static PyTypeObject dsapub_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   dsapub_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -302,7 +302,7 @@ static PyTypeObject dsapriv_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   dsapriv_pynew,                       /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -467,7 +467,7 @@ static PyTypeObject kcdsapub_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   kcdsapub_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -515,7 +515,7 @@ static PyTypeObject kcdsapriv_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   kcdsapriv_pynew,                     /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -568,7 +568,7 @@ static void rsapub_pydealloc(PyObject *me)
 {
   rsa_pubdestroy(RSA_PUBCTX(me));
   rsa_pubfree(RSA_PUB(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *rsaget_n(PyObject *me, void *hunoz)
@@ -643,7 +643,7 @@ static void rsapriv_pydealloc(PyObject *me)
   rsa_privdestroy(RSA_PRIVCTX(me));
   rsa_privfree(RSA_PRIV(me));
   Py_DECREF(RSA_RNG(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *rsaget_d(PyObject *me, void *hunoz)
@@ -801,7 +801,7 @@ static PyTypeObject rsapub_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   rsapub_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -849,7 +849,7 @@ static PyTypeObject rsapriv_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   rsapriv_pynew,                       /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
diff --git a/pwsafe b/pwsafe
index 82e039d..6b36bf4 100755 (executable)
--- a/pwsafe
+++ b/pwsafe
@@ -1,4 +1,5 @@
 #! /usr/bin/python2.2
+# -*-python-*-
 
 import catacomb as C
 import gdbm, struct
@@ -7,7 +8,10 @@ from getopt import getopt, GetoptError
 from os import environ
 from fnmatch import fnmatch
 
-file = '%s/.pwsafe' % environ['HOME']
+if 'PWSAFE' in environ:
+  file = environ['PWSAFE']
+else:
+  file = '%s/.pwsafe' % environ['HOME']
 
 class DecryptError (Exception):
   pass
@@ -232,6 +236,13 @@ def cmd_topixie(av):
     pptag = av[0]
   C.Pixie().set(pptag, pw[tag])
 
+def cmd_del(av):
+  if len(av) != 1:
+    return 1
+  pw = PW(file, 'w')
+  tag = av[0]
+  del pw[tag]
+
 def asciip(s):
   for ch in s:
     if ch < ' ' or ch > '~': return False
@@ -255,6 +266,7 @@ commands = { 'create': [cmd_create,
              'changepp' : [cmd_changepp, ''],
              'copy' : [cmd_copy, 'DEST-FILE [GLOB-PATTERN]'],
              'to-pixie' : [cmd_topixie, 'TAG [PIXIE-TAG]'],
+             'delete' : [cmd_del, 'TAG'],
              'dump' : [cmd_dump, '']}
 
 def version():
diff --git a/rand.c b/rand.c
index 6ae19ca..d4f1fd0 100644 (file)
--- a/rand.c
+++ b/rand.c
@@ -227,7 +227,7 @@ static void grand_pydealloc(PyObject *me)
   grand_pyobj *g = (grand_pyobj *)me;
   if (g->f & f_freeme)
     GR_DESTROY(g->r);
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 static PyObject *grget_name(PyObject *me, void *hunoz)
@@ -305,7 +305,7 @@ static PyTypeObject grand_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -362,7 +362,7 @@ static PyTypeObject lcrand_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   lcrand_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -419,7 +419,7 @@ static PyTypeObject fibrand_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   fibrand_pynew,                       /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -553,7 +553,7 @@ static PyTypeObject truerand_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   truerand_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -654,7 +654,7 @@ static PyTypeObject sslprf_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   sslprf_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -702,7 +702,7 @@ static PyTypeObject tlsdx_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   tlsdx_pynew,                         /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -750,7 +750,7 @@ static PyTypeObject tlsprf_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   tlsprf_pynew,                                /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -830,7 +830,7 @@ static PyTypeObject dsarand_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   dsarand_pynew,                       /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -961,7 +961,7 @@ static PyTypeObject bbs_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   bbs_pynew,                           /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -1119,7 +1119,7 @@ static PyTypeObject bbspriv_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   bbspriv_pynew,                       /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };