Skip to content

Commit 797f165

Browse files
Make Python self available to setitem/delitem
1 parent eb52ed7 commit 797f165

File tree

9 files changed

+318
-100
lines changed

9 files changed

+318
-100
lines changed

src/interface/shared/slots.i

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727
%noexception __delitem__%mangle(type);
2828
%inline %{
2929
static PyObject* __setitem__%mangle(type)(
30-
type* self, char* key, item_type value) {
30+
type* self, char* key, item_type value, PyObject* py_self) {
3131
setfunc;
3232
return SWIG_Py_Void();
3333
};
34-
static PyObject* __delitem__%mangle(type)(type* self, char* key) {
34+
static PyObject* __delitem__%mangle(type)(
35+
type* self, char* key, PyObject* py_self) {
3536
delfunc;
3637
return SWIG_Py_Void();
3738
};
@@ -99,11 +100,12 @@ static PyObject* __getitem__%mangle(type)_closure(
99100
%noexception __delitem__%mangle(type);
100101
%inline %{
101102
static PyObject* __setitem__%mangle(type)(
102-
type* self, size_t idx, item_type value) {
103+
type* self, size_t idx, item_type value, PyObject* py_self) {
103104
setfunc;
104105
return SWIG_Py_Void();
105106
};
106-
static PyObject* __delitem__%mangle(type)(type* self, size_t idx) {
107+
static PyObject* __delitem__%mangle(type)(
108+
type* self, size_t idx, PyObject* py_self) {
107109
delfunc;
108110
return SWIG_Py_Void();
109111
};

src/swig-0_27_7/exif_wrap.cxx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5390,11 +5390,12 @@ static PyObject* set_value_from_py(Exiv2::Exifdatum* datum,
53905390

53915391

53925392
static PyObject* __setitem__Exiv2_ExifData(
5393-
Exiv2::ExifData* self, char* key, PyObject* value) {
5393+
Exiv2::ExifData* self, char* key, PyObject* value, PyObject* py_self) {
53945394
return set_value_from_py(&(*self)[key], value);
53955395
return SWIG_Py_Void();
53965396
};
5397-
static PyObject* __delitem__Exiv2_ExifData(Exiv2::ExifData* self, char* key) {
5397+
static PyObject* __delitem__Exiv2_ExifData(
5398+
Exiv2::ExifData* self, char* key, PyObject* py_self) {
53985399
auto pos = self->findKey(Exiv2::ExifKey(key));
53995400
if (pos == self->end())
54005401
return PyErr_Format(PyExc_KeyError, "'%s'", key);
@@ -7160,6 +7161,7 @@ SWIGINTERN PyObject *_wrap___setitem__Exiv2_ExifData(PyObject *self, PyObject *a
71607161
Exiv2::ExifData *arg1 = (Exiv2::ExifData *) 0 ;
71617162
char *arg2 = (char *) 0 ;
71627163
PyObject *arg3 = (PyObject *) 0 ;
7164+
PyObject *arg4 = (PyObject *) 0 ;
71637165
void *argp1 = 0 ;
71647166
int res1 = 0 ;
71657167
int res2 ;
@@ -7173,6 +7175,9 @@ SWIGINTERN PyObject *_wrap___setitem__Exiv2_ExifData(PyObject *self, PyObject *a
71737175
{
71747176
arg3 = NULL;
71757177
}
7178+
{
7179+
arg4 = self;
7180+
}
71767181
if (!PyArg_UnpackTuple(args, "__setitem__Exiv2_ExifData", 2, 3, &obj0, &obj1, &obj2)) SWIG_fail;
71777182
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Exiv2__ExifData, 0 | 0 );
71787183
if (!SWIG_IsOK(res1)) {
@@ -7187,7 +7192,7 @@ SWIGINTERN PyObject *_wrap___setitem__Exiv2_ExifData(PyObject *self, PyObject *a
71877192
if (obj2) {
71887193
arg3 = obj2;
71897194
}
7190-
result = (PyObject *)__setitem__Exiv2_ExifData(arg1,arg2,arg3);
7195+
result = (PyObject *)__setitem__Exiv2_ExifData(arg1,arg2,arg3,arg4);
71917196
resultobj = result;
71927197
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
71937198
return resultobj;
@@ -7201,6 +7206,7 @@ SWIGINTERN PyObject *_wrap___delitem__Exiv2_ExifData(PyObject *self, PyObject *a
72017206
PyObject *resultobj = 0;
72027207
Exiv2::ExifData *arg1 = (Exiv2::ExifData *) 0 ;
72037208
char *arg2 = (char *) 0 ;
7209+
PyObject *arg3 = (PyObject *) 0 ;
72047210
void *argp1 = 0 ;
72057211
int res1 = 0 ;
72067212
int res2 ;
@@ -7210,6 +7216,9 @@ SWIGINTERN PyObject *_wrap___delitem__Exiv2_ExifData(PyObject *self, PyObject *a
72107216
PyObject * obj1 = 0 ;
72117217
PyObject *result = 0 ;
72127218

7219+
{
7220+
arg3 = self;
7221+
}
72137222
if (!PyArg_UnpackTuple(args, "__delitem__Exiv2_ExifData", 2, 2, &obj0, &obj1)) SWIG_fail;
72147223
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Exiv2__ExifData, 0 | 0 );
72157224
if (!SWIG_IsOK(res1)) {
@@ -7221,7 +7230,7 @@ SWIGINTERN PyObject *_wrap___delitem__Exiv2_ExifData(PyObject *self, PyObject *a
72217230
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "__delitem__Exiv2_ExifData" "', argument " "2"" of type '" "char *""'");
72227231
}
72237232
arg2 = reinterpret_cast< char * >(buf2);
7224-
result = (PyObject *)__delitem__Exiv2_ExifData(arg1,arg2);
7233+
result = (PyObject *)__delitem__Exiv2_ExifData(arg1,arg2,arg3);
72257234
resultobj = result;
72267235
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
72277236
return resultobj;

src/swig-0_27_7/iptc_wrap.cxx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5383,11 +5383,12 @@ static PyObject* set_value_from_py(Exiv2::Iptcdatum* datum,
53835383

53845384

53855385
static PyObject* __setitem__Exiv2_IptcData(
5386-
Exiv2::IptcData* self, char* key, PyObject* value) {
5386+
Exiv2::IptcData* self, char* key, PyObject* value, PyObject* py_self) {
53875387
return set_value_from_py(&(*self)[key], value);
53885388
return SWIG_Py_Void();
53895389
};
5390-
static PyObject* __delitem__Exiv2_IptcData(Exiv2::IptcData* self, char* key) {
5390+
static PyObject* __delitem__Exiv2_IptcData(
5391+
Exiv2::IptcData* self, char* key, PyObject* py_self) {
53915392
auto pos = self->findKey(Exiv2::IptcKey(key));
53925393
if (pos == self->end())
53935394
return PyErr_Format(PyExc_KeyError, "'%s'", key);
@@ -6958,6 +6959,7 @@ SWIGINTERN PyObject *_wrap___setitem__Exiv2_IptcData(PyObject *self, PyObject *a
69586959
Exiv2::IptcData *arg1 = (Exiv2::IptcData *) 0 ;
69596960
char *arg2 = (char *) 0 ;
69606961
PyObject *arg3 = (PyObject *) 0 ;
6962+
PyObject *arg4 = (PyObject *) 0 ;
69616963
void *argp1 = 0 ;
69626964
int res1 = 0 ;
69636965
int res2 ;
@@ -6971,6 +6973,9 @@ SWIGINTERN PyObject *_wrap___setitem__Exiv2_IptcData(PyObject *self, PyObject *a
69716973
{
69726974
arg3 = NULL;
69736975
}
6976+
{
6977+
arg4 = self;
6978+
}
69746979
if (!PyArg_UnpackTuple(args, "__setitem__Exiv2_IptcData", 2, 3, &obj0, &obj1, &obj2)) SWIG_fail;
69756980
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Exiv2__IptcData, 0 | 0 );
69766981
if (!SWIG_IsOK(res1)) {
@@ -6985,7 +6990,7 @@ SWIGINTERN PyObject *_wrap___setitem__Exiv2_IptcData(PyObject *self, PyObject *a
69856990
if (obj2) {
69866991
arg3 = obj2;
69876992
}
6988-
result = (PyObject *)__setitem__Exiv2_IptcData(arg1,arg2,arg3);
6993+
result = (PyObject *)__setitem__Exiv2_IptcData(arg1,arg2,arg3,arg4);
69896994
resultobj = result;
69906995
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
69916996
return resultobj;
@@ -6999,6 +7004,7 @@ SWIGINTERN PyObject *_wrap___delitem__Exiv2_IptcData(PyObject *self, PyObject *a
69997004
PyObject *resultobj = 0;
70007005
Exiv2::IptcData *arg1 = (Exiv2::IptcData *) 0 ;
70017006
char *arg2 = (char *) 0 ;
7007+
PyObject *arg3 = (PyObject *) 0 ;
70027008
void *argp1 = 0 ;
70037009
int res1 = 0 ;
70047010
int res2 ;
@@ -7008,6 +7014,9 @@ SWIGINTERN PyObject *_wrap___delitem__Exiv2_IptcData(PyObject *self, PyObject *a
70087014
PyObject * obj1 = 0 ;
70097015
PyObject *result = 0 ;
70107016

7017+
{
7018+
arg3 = self;
7019+
}
70117020
if (!PyArg_UnpackTuple(args, "__delitem__Exiv2_IptcData", 2, 2, &obj0, &obj1)) SWIG_fail;
70127021
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Exiv2__IptcData, 0 | 0 );
70137022
if (!SWIG_IsOK(res1)) {
@@ -7019,7 +7028,7 @@ SWIGINTERN PyObject *_wrap___delitem__Exiv2_IptcData(PyObject *self, PyObject *a
70197028
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "__delitem__Exiv2_IptcData" "', argument " "2"" of type '" "char *""'");
70207029
}
70217030
arg2 = reinterpret_cast< char * >(buf2);
7022-
result = (PyObject *)__delitem__Exiv2_IptcData(arg1,arg2);
7031+
result = (PyObject *)__delitem__Exiv2_IptcData(arg1,arg2,arg3);
70237032
resultobj = result;
70247033
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
70257034
return resultobj;

0 commit comments

Comments
 (0)