[Python-checkins] python/dist/src/Mac/Modules/file _Filemodule.c, 1.23, 1.24 filesupport.py, 1.20, 1.21
jackjansen@users.sourceforge.net
jackjansen at users.sourceforge.net
Sun Jul 3 23:00:13 CEST 2005
Update of /cvsroot/python/python/dist/src/Mac/Modules/file
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25508/file
Modified Files:
_Filemodule.c filesupport.py
Log Message:
Updated (and regenerated) for name change in tp_init method arguments:
they are now _self, _args and _kwds.
Index: _Filemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/_Filemodule.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- _Filemodule.c 5 Nov 2004 07:02:58 -0000 1.23
+++ _Filemodule.c 3 Jul 2005 20:59:40 -0000 1.24
@@ -50,13 +50,13 @@
static int
UTCDateTime_Convert(PyObject *v, UTCDateTime *ptr)
{
- return PyArg_Parse(v, "(HlH)", &ptr->highSeconds, &ptr->lowSeconds, &ptr->fraction);
+ return PyArg_Parse(v, "(HlH)", &ptr->highSeconds, &ptr->lowSeconds, &ptr->fraction);
}
static PyObject *
UTCDateTime_New(UTCDateTime *ptr)
{
- return Py_BuildValue("(HlH)", ptr->highSeconds, ptr->lowSeconds, ptr->fraction);
+ return Py_BuildValue("(HlH)", ptr->highSeconds, ptr->lowSeconds, ptr->fraction);
}
/*
@@ -65,21 +65,21 @@
static int
myPyMac_GetOptFSSpecPtr(PyObject *v, FSSpec **spec)
{
- if (v == Py_None) {
- *spec = NULL;
- return 1;
- }
- return PyMac_GetFSSpec(v, *spec);
+ if (v == Py_None) {
+ *spec = NULL;
+ return 1;
+ }
+ return PyMac_GetFSSpec(v, *spec);
}
static int
myPyMac_GetOptFSRefPtr(PyObject *v, FSRef **ref)
{
- if (v == Py_None) {
- *ref = NULL;
- return 1;
- }
- return PyMac_GetFSRef(v, *ref);
+ if (v == Py_None) {
+ *ref = NULL;
+ return 1;
+ }
+ return PyMac_GetFSRef(v, *ref);
}
/*
@@ -89,7 +89,7 @@
PyMac_BuildHFSUniStr255(HFSUniStr255 *itself)
{
- return Py_BuildValue("u#", itself->unicode, itself->length);
+ return Py_BuildValue("u#", itself->unicode, itself->length);
}
static PyObject *File_Error;
@@ -114,6 +114,7 @@
it->ob_itself = *itself;
return (PyObject *)it;
}
+
static int FSCatalogInfo_Convert(PyObject *v, FSCatalogInfo *p_itself)
{
if (!FSCatalogInfo_Check(v))
@@ -349,43 +350,43 @@
#define FSCatalogInfo_repr NULL
#define FSCatalogInfo_hash NULL
-static int FSCatalogInfo_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
+static int FSCatalogInfo_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
{
static char *kw[] = {
- "nodeFlags",
- "volume",
- "parentDirID",
- "nodeID",
- "createDate",
- "contentModDate",
- "atributeModDate",
- "accessDate",
- "backupDate",
- "valence",
- "dataLogicalSize",
- "dataPhysicalSize",
- "rsrcLogicalSize",
- "rsrcPhysicalSize",
- "sharingFlags",
- "userPrivileges"
- , 0};
+ "nodeFlags",
+ "volume",
+ "parentDirID",
+ "nodeID",
+ "createDate",
+ "contentModDate",
+ "atributeModDate",
+ "accessDate",
+ "backupDate",
+ "valence",
+ "dataLogicalSize",
+ "dataPhysicalSize",
+ "rsrcLogicalSize",
+ "rsrcPhysicalSize",
+ "sharingFlags",
+ "userPrivileges"
+ , 0};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|HhllO&O&O&O&O&llllllb", kw, &((FSCatalogInfoObject *)self)->ob_itself.nodeFlags,
- &((FSCatalogInfoObject *)self)->ob_itself.volume,
- &((FSCatalogInfoObject *)self)->ob_itself.parentDirID,
- &((FSCatalogInfoObject *)self)->ob_itself.nodeID,
- UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.createDate,
- UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.contentModDate,
- UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.attributeModDate,
- UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.accessDate,
- UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.backupDate,
- &((FSCatalogInfoObject *)self)->ob_itself.valence,
- &((FSCatalogInfoObject *)self)->ob_itself.dataLogicalSize,
- &((FSCatalogInfoObject *)self)->ob_itself.dataPhysicalSize,
- &((FSCatalogInfoObject *)self)->ob_itself.rsrcLogicalSize,
- &((FSCatalogInfoObject *)self)->ob_itself.rsrcPhysicalSize,
- &((FSCatalogInfoObject *)self)->ob_itself.sharingFlags,
- &((FSCatalogInfoObject *)self)->ob_itself.userPrivileges))
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|HhllO&O&O&O&O&llllllb", kw, &((FSCatalogInfoObject *)_self)->ob_itself.nodeFlags,
+ &((FSCatalogInfoObject *)_self)->ob_itself.volume,
+ &((FSCatalogInfoObject *)_self)->ob_itself.parentDirID,
+ &((FSCatalogInfoObject *)_self)->ob_itself.nodeID,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.createDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.contentModDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.attributeModDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.accessDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.backupDate,
+ &((FSCatalogInfoObject *)_self)->ob_itself.valence,
+ &((FSCatalogInfoObject *)_self)->ob_itself.dataLogicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.dataPhysicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.rsrcLogicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.rsrcPhysicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.sharingFlags,
+ &((FSCatalogInfoObject *)_self)->ob_itself.userPrivileges))
{
return -1;
}
@@ -394,7 +395,7 @@
#define FSCatalogInfo_tp_alloc PyType_GenericAlloc
-static PyObject *FSCatalogInfo_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *FSCatalogInfo_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
{
PyObject *self;
@@ -473,6 +474,7 @@
it->ob_itself = *itself;
return (PyObject *)it;
}
+
static int FInfo_Convert(PyObject *v, FInfo *p_itself)
{
if (!FInfo_Check(v))
@@ -564,14 +566,14 @@
#define FInfo_repr NULL
#define FInfo_hash NULL
-static int FInfo_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
+static int FInfo_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
{
FInfo *itself = NULL;
static char *kw[] = {"itself", 0};
- if (PyArg_ParseTupleAndKeywords(args, kwds, "|O&", kw, FInfo_Convert, &itself))
+ if (PyArg_ParseTupleAndKeywords(_args, _kwds, "|O&", kw, FInfo_Convert, &itself))
{
- if (itself) memcpy(&((FInfoObject *)self)->ob_itself, itself, sizeof(FInfo));
+ if (itself) memcpy(&((FInfoObject *)_self)->ob_itself, itself, sizeof(FInfo));
return 0;
}
return -1;
@@ -579,7 +581,7 @@
#define FInfo_tp_alloc PyType_GenericAlloc
-static PyObject *FInfo_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *FInfo_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
{
PyObject *self;
@@ -660,6 +662,7 @@
it->ob_freeit = NULL;
return (PyObject *)it;
}
+
static int Alias_Convert(PyObject *v, AliasHandle *p_itself)
{
if (!Alias_Check(v))
@@ -863,14 +866,14 @@
static PyObject *Alias_get_data(AliasObject *self, void *closure)
{
int size;
- PyObject *rv;
-
- size = GetHandleSize((Handle)self->ob_itself);
- HLock((Handle)self->ob_itself);
- rv = PyString_FromStringAndSize(*(Handle)self->ob_itself, size);
- HUnlock((Handle)self->ob_itself);
- return rv;
-
+ PyObject *rv;
+
+ size = GetHandleSize((Handle)self->ob_itself);
+ HLock((Handle)self->ob_itself);
+ rv = PyString_FromStringAndSize(*(Handle)self->ob_itself, size);
+ HUnlock((Handle)self->ob_itself);
+ return rv;
+
}
#define Alias_set_data NULL
@@ -886,7 +889,7 @@
#define Alias_repr NULL
#define Alias_hash NULL
-static int Alias_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
+static int Alias_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
{
AliasHandle itself = NULL;
char *rawdata = NULL;
@@ -894,7 +897,7 @@
Handle h;
static char *kw[] = {"itself", "rawdata", 0};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O&s#", kw, Alias_Convert, &itself, &rawdata, &rawdatalen))
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|O&s#", kw, Alias_Convert, &itself, &rawdata, &rawdatalen))
return -1;
if (itself && rawdata)
{
@@ -916,16 +919,16 @@
HLock(h);
memcpy((char *)*h, rawdata, rawdatalen);
HUnlock(h);
- ((AliasObject *)self)->ob_itself = (AliasHandle)h;
+ ((AliasObject *)_self)->ob_itself = (AliasHandle)h;
return 0;
}
- ((AliasObject *)self)->ob_itself = itself;
+ ((AliasObject *)_self)->ob_itself = itself;
return 0;
}
#define Alias_tp_alloc PyType_GenericAlloc
-static PyObject *Alias_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *Alias_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
{
PyObject *self;
@@ -1253,49 +1256,6 @@
return _res;
}
-static OSErr
-_PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
-{
- FSRef fsr;
- OSErr err;
-
- *path = '\0';
- err = FSpMakeFSRef(fss, &fsr);
- if (err == fnfErr) {
- /* FSSpecs can point to non-existing files, fsrefs can't. */
- FSSpec fss2;
- int tocopy;
-
- err = FSMakeFSSpec(fss->vRefNum, fss->parID, "", &fss2);
- if (err)
- return err;
- err = FSpMakeFSRef(&fss2, &fsr);
- if (err)
- return err;
- err = (OSErr)FSRefMakePath(&fsr, path, len-1);
- if (err)
- return err;
- /* This part is not 100% safe: we append the filename part, but
- ** I'm not sure that we don't run afoul of the various 8bit
- ** encodings here. Will have to look this up at some point...
- */
- strcat(path, "/");
- tocopy = fss->name[0];
- if ((strlen(path) + tocopy) >= len)
- tocopy = len - strlen(path) - 1;
- if (tocopy > 0)
- strncat(path, fss->name+1, tocopy);
- }
- else {
- if (err)
- return err;
- err = (OSErr)FSRefMakePath(&fsr, path, len);
- if (err)
- return err;
- }
- return 0;
-}
-
static PyObject *FSSpec_as_pathname(FSSpecObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1304,11 +1264,11 @@
OSErr err;
if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- err = _PyMac_GetFullPathname(&_self->ob_itself, strbuf, sizeof(strbuf));
+ return NULL;
+ err = PyMac_GetFullPathname(&_self->ob_itself, strbuf, sizeof(strbuf));
if ( err ) {
- PyMac_Error(err);
- return NULL;
+ PyMac_Error(err);
+ return NULL;
}
_res = PyString_FromString(strbuf);
return _res;
@@ -1320,9 +1280,9 @@
PyObject *_res = NULL;
if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _res = Py_BuildValue("(iis#)", _self->ob_itself.vRefNum, _self->ob_itself.parID,
- &_self->ob_itself.name[1], _self->ob_itself.name[0]);
+ return NULL;
+ _res = Py_BuildValue("(iis#)", _self->ob_itself.vRefNum, _self->ob_itself.parID,
+ &_self->ob_itself.name[1], _self->ob_itself.name[0]);
return _res;
}
@@ -1384,22 +1344,22 @@
{
char buf[512];
PyOS_snprintf(buf, sizeof(buf), "%s((%d, %ld, '%.*s'))",
- self->ob_type->tp_name,
- self->ob_itself.vRefNum,
- self->ob_itself.parID,
- self->ob_itself.name[0], self->ob_itself.name+1);
+ self->ob_type->tp_name,
+ self->ob_itself.vRefNum,
+ self->ob_itself.parID,
+ self->ob_itself.name[0], self->ob_itself.name+1);
return PyString_FromString(buf);
}
#define FSSpec_hash NULL
-static int FSSpec_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
+static int FSSpec_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
{
PyObject *v = NULL;
char *rawdata = NULL;
int rawdatalen = 0;
static char *kw[] = {"itself", "rawdata", 0};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Os#", kw, &v, &rawdata, &rawdatalen))
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|Os#", kw, &v, &rawdata, &rawdatalen))
return -1;
if (v && rawdata)
{
@@ -1418,16 +1378,16 @@
PyErr_SetString(PyExc_TypeError, "FSSpec rawdata incorrect size");
return -1;
}
- memcpy(&((FSSpecObject *)self)->ob_itself, rawdata, rawdatalen);
+ memcpy(&((FSSpecObject *)_self)->ob_itself, rawdata, rawdatalen);
return 0;
}
- if (PyMac_GetFSSpec(v, &((FSSpecObject *)self)->ob_itself)) return 0;
+ if (PyMac_GetFSSpec(v, &((FSSpecObject *)_self)->ob_itself)) return 0;
return -1;
}
#define FSSpec_tp_alloc PyType_GenericAlloc
-static PyObject *FSSpec_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *FSSpec_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
{
PyObject *self;
@@ -1857,10 +1817,10 @@
UInt32 maxPathSize = MAXPATHNAME;
if (!PyArg_ParseTuple(_args, ""))
- return NULL;
+ return NULL;
_err = FSRefMakePath(&_self->ob_itself,
- path,
- maxPathSize);
+ path,
+ maxPathSize);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("s", path);
return _res;
@@ -1872,7 +1832,7 @@
PyObject *_res = NULL;
if (!PyArg_ParseTuple(_args, ""))
- return NULL;
+ return NULL;
_res = FSRef_FSRefMakePath(_self, _args);
return _res;
@@ -1936,14 +1896,14 @@
#define FSRef_repr NULL
#define FSRef_hash NULL
-static int FSRef_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
+static int FSRef_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
{
PyObject *v = NULL;
char *rawdata = NULL;
int rawdatalen = 0;
static char *kw[] = {"itself", "rawdata", 0};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Os#", kw, &v, &rawdata, &rawdatalen))
+ if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|Os#", kw, &v, &rawdata, &rawdatalen))
return -1;
if (v && rawdata)
{
@@ -1962,16 +1922,16 @@
PyErr_SetString(PyExc_TypeError, "FSRef rawdata incorrect size");
return -1;
}
- memcpy(&((FSRefObject *)self)->ob_itself, rawdata, rawdatalen);
+ memcpy(&((FSRefObject *)_self)->ob_itself, rawdata, rawdatalen);
return 0;
}
- if (PyMac_GetFSRef(v, &((FSRefObject *)self)->ob_itself)) return 0;
+ if (PyMac_GetFSRef(v, &((FSRefObject *)_self)->ob_itself)) return 0;
return -1;
}
#define FSRef_tp_alloc PyType_GenericAlloc
-static PyObject *FSRef_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static PyObject *FSRef_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
{
PyObject *self;
@@ -3032,13 +2992,13 @@
PyObject *obj;
if (!PyArg_ParseTuple(_args, "O", &obj))
- return NULL;
+ return NULL;
if (PyString_Check(obj)) {
- Py_INCREF(obj);
- return obj;
+ Py_INCREF(obj);
+ return obj;
}
if (PyUnicode_Check(obj))
- return PyUnicode_AsEncodedString(obj, "utf8", "strict");
+ return PyUnicode_AsEncodedString(obj, "utf8", "strict");
_res = PyObject_CallMethod(obj, "as_pathname", NULL);
return _res;
@@ -3149,86 +3109,86 @@
int
PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
{
- Str255 path;
- short refnum;
- long parid;
- OSErr err;
- FSRef fsr;
+ Str255 path;
+ short refnum;
+ long parid;
+ OSErr err;
+ FSRef fsr;
- if (FSSpec_Check(v)) {
- *spec = ((FSSpecObject *)v)->ob_itself;
- return 1;
- }
+ if (FSSpec_Check(v)) {
+ *spec = ((FSSpecObject *)v)->ob_itself;
+ return 1;
+ }
- if (PyArg_Parse(v, "(hlO&)",
- &refnum, &parid, PyMac_GetStr255, &path)) {
- err = FSMakeFSSpec(refnum, parid, path, spec);
- if ( err && err != fnfErr ) {
- PyMac_Error(err);
- return 0;
- }
- return 1;
- }
- PyErr_Clear();
- /* Otherwise we try to go via an FSRef. On OSX we go all the way,
- ** on OS9 we accept only a real FSRef object
- */
- if ( PyMac_GetFSRef(v, &fsr) ) {
- err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL);
- if (err != noErr) {
- PyMac_Error(err);
- return 0;
- }
- return 1;
- }
- return 0;
+ if (PyArg_Parse(v, "(hlO&)",
+ &refnum, &parid, PyMac_GetStr255, &path)) {
+ err = FSMakeFSSpec(refnum, parid, path, spec);
+ if ( err && err != fnfErr ) {
+ PyMac_Error(err);
+ return 0;
+ }
+ return 1;
+ }
+ PyErr_Clear();
+ /* Otherwise we try to go via an FSRef. On OSX we go all the way,
+ ** on OS9 we accept only a real FSRef object
+ */
+ if ( PyMac_GetFSRef(v, &fsr) ) {
+ err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL);
+ if (err != noErr) {
+ PyMac_Error(err);
+ return 0;
+ }
+ return 1;
+ }
+ return 0;
}
int
PyMac_GetFSRef(PyObject *v, FSRef *fsr)
{
- OSStatus err;
- FSSpec fss;
-
- if (FSRef_Check(v)) {
- *fsr = ((FSRefObject *)v)->ob_itself;
- return 1;
- }
+ OSStatus err;
+ FSSpec fss;
- /* On OSX we now try a pathname */
- if ( PyString_Check(v) || PyUnicode_Check(v)) {
- char *path = NULL;
- if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
- return NULL;
- if ( (err=FSPathMakeRef(path, fsr, NULL)) ) {
- PyMac_Error(err);
- return 0;
- }
- return 1;
- }
- /* XXXX Should try unicode here too */
- /* Otherwise we try to go via an FSSpec */
- if (FSSpec_Check(v)) {
- fss = ((FSSpecObject *)v)->ob_itself;
- if ((err=FSpMakeFSRef(&fss, fsr)) == 0)
- return 1;
- PyMac_Error(err);
- return 0;
- }
- PyErr_SetString(PyExc_TypeError, "FSRef, FSSpec or pathname required");
- return 0;
+ if (FSRef_Check(v)) {
+ *fsr = ((FSRefObject *)v)->ob_itself;
+ return 1;
+ }
+
+ /* On OSX we now try a pathname */
+ if ( PyString_Check(v) || PyUnicode_Check(v)) {
+ char *path = NULL;
+ if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
+ return 0;
+ if ( (err=FSPathMakeRef(path, fsr, NULL)) ) {
+ PyMac_Error(err);
+ return 0;
+ }
+ return 1;
+ }
+ /* XXXX Should try unicode here too */
+ /* Otherwise we try to go via an FSSpec */
+ if (FSSpec_Check(v)) {
+ fss = ((FSSpecObject *)v)->ob_itself;
+ if ((err=FSpMakeFSRef(&fss, fsr)) == 0)
+ return 1;
+ PyMac_Error(err);
+ return 0;
+ }
+ PyErr_SetString(PyExc_TypeError, "FSRef, FSSpec or pathname required");
+ return 0;
}
extern PyObject *
PyMac_BuildFSSpec(FSSpec *spec)
{
- return FSSpec_New(spec);
+ return FSSpec_New(spec);
}
extern PyObject *
PyMac_BuildFSRef(FSRef *spec)
{
- return FSRef_New(spec);
+ return FSRef_New(spec);
}
Index: filesupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/filesupport.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- filesupport.py 18 Jul 2004 05:58:09 -0000 1.20
+++ filesupport.py 3 Jul 2005 20:59:40 -0000 1.21
@@ -254,7 +254,7 @@
if ( PyString_Check(v) || PyUnicode_Check(v)) {
char *path = NULL;
if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
- return NULL;
+ return 0;
if ( (err=FSPathMakeRef(path, fsr, NULL)) ) {
PyMac_Error(err);
return 0;
@@ -389,22 +389,22 @@
]
# The same info, but in a different form
INITFORMAT = "HhllO&O&O&O&O&llllllb"
- INITARGS = """&((FSCatalogInfoObject *)self)->ob_itself.nodeFlags,
- &((FSCatalogInfoObject *)self)->ob_itself.volume,
- &((FSCatalogInfoObject *)self)->ob_itself.parentDirID,
- &((FSCatalogInfoObject *)self)->ob_itself.nodeID,
- UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.createDate,
- UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.contentModDate,
- UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.attributeModDate,
- UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.accessDate,
- UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.backupDate,
- &((FSCatalogInfoObject *)self)->ob_itself.valence,
- &((FSCatalogInfoObject *)self)->ob_itself.dataLogicalSize,
- &((FSCatalogInfoObject *)self)->ob_itself.dataPhysicalSize,
- &((FSCatalogInfoObject *)self)->ob_itself.rsrcLogicalSize,
- &((FSCatalogInfoObject *)self)->ob_itself.rsrcPhysicalSize,
- &((FSCatalogInfoObject *)self)->ob_itself.sharingFlags,
- &((FSCatalogInfoObject *)self)->ob_itself.userPrivileges"""
+ INITARGS = """&((FSCatalogInfoObject *)_self)->ob_itself.nodeFlags,
+ &((FSCatalogInfoObject *)_self)->ob_itself.volume,
+ &((FSCatalogInfoObject *)_self)->ob_itself.parentDirID,
+ &((FSCatalogInfoObject *)_self)->ob_itself.nodeID,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.createDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.contentModDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.attributeModDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.accessDate,
+ UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.backupDate,
+ &((FSCatalogInfoObject *)_self)->ob_itself.valence,
+ &((FSCatalogInfoObject *)_self)->ob_itself.dataLogicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.dataPhysicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.rsrcLogicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.rsrcPhysicalSize,
+ &((FSCatalogInfoObject *)_self)->ob_itself.sharingFlags,
+ &((FSCatalogInfoObject *)_self)->ob_itself.userPrivileges"""
INITNAMES = """
"nodeFlags",
"volume",
@@ -442,7 +442,7 @@
def output_tp_initBody(self):
Output("static char *kw[] = {%s, 0};", self.INITNAMES)
Output()
- Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|%s\", kw, %s))",
+ Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|%s\", kw, %s))",
self.INITFORMAT, self.INITARGS)
OutLbrace()
Output("return -1;")
@@ -498,9 +498,9 @@
Output("%s *itself = NULL;", self.itselftype)
Output("static char *kw[] = {\"itself\", 0};")
Output()
- Output("if (PyArg_ParseTupleAndKeywords(args, kwds, \"|O&\", kw, FInfo_Convert, &itself))")
+ Output("if (PyArg_ParseTupleAndKeywords(_args, _kwds, \"|O&\", kw, FInfo_Convert, &itself))")
OutLbrace()
- Output("if (itself) memcpy(&((%s *)self)->ob_itself, itself, sizeof(%s));",
+ Output("if (itself) memcpy(&((%s *)_self)->ob_itself, itself, sizeof(%s));",
self.objecttype, self.itselftype)
Output("return 0;")
OutRbrace()
@@ -540,7 +540,7 @@
Output("int rawdatalen = 0;")
Output("static char *kw[] = {\"itself\", \"rawdata\", 0};")
Output()
- Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))")
+ Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))")
Output("return -1;")
Output("if (v && rawdata)")
OutLbrace()
@@ -560,10 +560,10 @@
self.itselftype)
Output("return -1;")
OutRbrace()
- Output("memcpy(&((%s *)self)->ob_itself, rawdata, rawdatalen);", self.objecttype)
+ Output("memcpy(&((%s *)_self)->ob_itself, rawdata, rawdatalen);", self.objecttype)
Output("return 0;")
OutRbrace()
- Output("if (PyMac_GetFSSpec(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype)
+ Output("if (PyMac_GetFSSpec(v, &((%s *)_self)->ob_itself)) return 0;", self.objecttype)
Output("return -1;")
def outputRepr(self):
@@ -613,7 +613,7 @@
Output("int rawdatalen = 0;")
Output("static char *kw[] = {\"itself\", \"rawdata\", 0};")
Output()
- Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))")
+ Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))")
Output("return -1;")
Output("if (v && rawdata)")
OutLbrace()
@@ -633,10 +633,10 @@
self.itselftype)
Output("return -1;")
OutRbrace()
- Output("memcpy(&((%s *)self)->ob_itself, rawdata, rawdatalen);", self.objecttype)
+ Output("memcpy(&((%s *)_self)->ob_itself, rawdata, rawdatalen);", self.objecttype)
Output("return 0;")
OutRbrace()
- Output("if (PyMac_GetFSRef(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype)
+ Output("if (PyMac_GetFSRef(v, &((%s *)_self)->ob_itself)) return 0;", self.objecttype)
Output("return -1;")
class AliasDefinition(PEP253Mixin, ObjectDefinition):
@@ -689,7 +689,7 @@
Output("Handle h;")
Output("static char *kw[] = {\"itself\", \"rawdata\", 0};")
Output()
- Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&s#\", kw, %s_Convert, &itself, &rawdata, &rawdatalen))",
+ Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|O&s#\", kw, %s_Convert, &itself, &rawdata, &rawdatalen))",
self.prefix)
Output("return -1;")
Output("if (itself && rawdata)")
@@ -712,10 +712,10 @@
Output("HLock(h);")
Output("memcpy((char *)*h, rawdata, rawdatalen);")
Output("HUnlock(h);")
- Output("((%s *)self)->ob_itself = (%s)h;", self.objecttype, self.itselftype)
+ Output("((%s *)_self)->ob_itself = (%s)h;", self.objecttype, self.itselftype)
Output("return 0;")
OutRbrace()
- Output("((%s *)self)->ob_itself = itself;", self.objecttype)
+ Output("((%s *)_self)->ob_itself = itself;", self.objecttype)
Output("return 0;")
# Alias methods come in two flavors: those with the alias as arg1 and
More information about the Python-checkins
mailing list