Skip to content

Commit 47d7b0c

Browse files
Replace DEPRECATE_FUNCTION macro option
Instead of an option to supply a separate deprecation message it now has an option to leave the docstring undisturbed, needed by overloaded functions where not all overloads are deprecated.
1 parent a41a237 commit 47d7b0c

3 files changed

Lines changed: 5 additions & 29 deletions

File tree

src/interface/shared/exception.i

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,14 @@ fail:
8282
%enddef // EXCEPTION
8383

8484
// Macro to deprecate a function
85-
%define DEPRECATE_FUNCTION(method, message)
85+
%define DEPRECATE_FUNCTION(method, preserve_doc)
8686
%fragment("_set_python_exception");
87+
#if #preserve_doc == ""
8788
%feature("docstring") method "Deprecated."
88-
%exception method {
89-
#if #message != ""
90-
PyErr_WarnEx(PyExc_DeprecationWarning, message, 1);
91-
#else
92-
PyErr_WarnEx(PyExc_DeprecationWarning,
93-
"Python scripts should not need to call " #method, 1);
9489
#endif
90+
%exception method {
91+
PyErr_WarnEx(PyExc_DeprecationWarning,
92+
"Python scripts should not need to call " #method, 1);
9593
try {
9694
$action
9795
}

src/swig-0_27_7/basicio_wrap.cxx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5048,7 +5048,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_write__SWIG_0(PyObject *self, PyObject *args)
50485048
{
50495049
PyErr_WarnEx(PyExc_DeprecationWarning,
50505050
"Python scripts should not need to call ""Exiv2::BasicIo::write", 1);
5051-
50525051
try {
50535052
{
50545053
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5107,7 +5106,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_write__SWIG_1(PyObject *self, PyObject *args)
51075106
{
51085107
PyErr_WarnEx(PyExc_DeprecationWarning,
51095108
"Python scripts should not need to call ""Exiv2::BasicIo::write", 1);
5110-
51115109
try {
51125110
{
51135111
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5199,7 +5197,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_putb(PyObject *self, PyObject *args) {
51995197
{
52005198
PyErr_WarnEx(PyExc_DeprecationWarning,
52015199
"Python scripts should not need to call ""Exiv2::BasicIo::putb", 1);
5202-
52035200
try {
52045201
result = (int)(arg1)->putb(arg2);
52055202
}
@@ -5245,7 +5242,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_read__SWIG_0(PyObject *self, PyObject *args)
52455242
{
52465243
PyErr_WarnEx(PyExc_DeprecationWarning,
52475244
"Python scripts should not need to call ""Exiv2::BasicIo::read", 1);
5248-
52495245
try {
52505246
{
52515247
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5304,7 +5300,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_read__SWIG_1(PyObject *self, PyObject *args)
53045300
{
53055301
PyErr_WarnEx(PyExc_DeprecationWarning,
53065302
"Python scripts should not need to call ""Exiv2::BasicIo::read", 1);
5307-
53085303
try {
53095304
{
53105305
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5398,7 +5393,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_getb(PyObject *self, PyObject *args) {
53985393
{
53995394
PyErr_WarnEx(PyExc_DeprecationWarning,
54005395
"Python scripts should not need to call ""Exiv2::BasicIo::getb", 1);
5401-
54025396
try {
54035397
result = (int)(arg1)->getb();
54045398
}
@@ -5446,7 +5440,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_transfer(PyObject *self, PyObject *args) {
54465440
{
54475441
PyErr_WarnEx(PyExc_DeprecationWarning,
54485442
"Python scripts should not need to call ""Exiv2::BasicIo::transfer", 1);
5449-
54505443
try {
54515444
{
54525445
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5511,7 +5504,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_seek(PyObject *self, PyObject *args) {
55115504
{
55125505
PyErr_WarnEx(PyExc_DeprecationWarning,
55135506
"Python scripts should not need to call ""Exiv2::BasicIo::seek", 1);
5514-
55155507
try {
55165508
{
55175509
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5651,7 +5643,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_tell(PyObject *self, PyObject *args) {
56515643
{
56525644
PyErr_WarnEx(PyExc_DeprecationWarning,
56535645
"Python scripts should not need to call ""Exiv2::BasicIo::tell", 1);
5654-
56555646
try {
56565647
result = (long)((Exiv2::BasicIo const *)arg1)->tell();
56575648
}
@@ -5774,7 +5765,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_eof(PyObject *self, PyObject *args) {
57745765
{
57755766
PyErr_WarnEx(PyExc_DeprecationWarning,
57765767
"Python scripts should not need to call ""Exiv2::BasicIo::eof", 1);
5777-
57785768
try {
57795769
result = (bool)((Exiv2::BasicIo const *)arg1)->eof();
57805770
}

src/swig-0_28_5/basicio_wrap.cxx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5151,7 +5151,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_write__SWIG_0(PyObject *self, PyObject *args)
51515151
{
51525152
PyErr_WarnEx(PyExc_DeprecationWarning,
51535153
"Python scripts should not need to call ""Exiv2::BasicIo::write", 1);
5154-
51555154
try {
51565155
{
51575156
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5210,7 +5209,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_write__SWIG_1(PyObject *self, PyObject *args)
52105209
{
52115210
PyErr_WarnEx(PyExc_DeprecationWarning,
52125211
"Python scripts should not need to call ""Exiv2::BasicIo::write", 1);
5213-
52145212
try {
52155213
{
52165214
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5302,7 +5300,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_putb(PyObject *self, PyObject *args) {
53025300
{
53035301
PyErr_WarnEx(PyExc_DeprecationWarning,
53045302
"Python scripts should not need to call ""Exiv2::BasicIo::putb", 1);
5305-
53065303
try {
53075304
result = (int)(arg1)->putb(arg2);
53085305
}
@@ -5348,7 +5345,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_read__SWIG_0(PyObject *self, PyObject *args)
53485345
{
53495346
PyErr_WarnEx(PyExc_DeprecationWarning,
53505347
"Python scripts should not need to call ""Exiv2::BasicIo::read", 1);
5351-
53525348
try {
53535349
{
53545350
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5407,7 +5403,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_read__SWIG_1(PyObject *self, PyObject *args)
54075403
{
54085404
PyErr_WarnEx(PyExc_DeprecationWarning,
54095405
"Python scripts should not need to call ""Exiv2::BasicIo::read", 1);
5410-
54115406
try {
54125407
{
54135408
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5537,7 +5532,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_readOrThrow(PyObject *self, PyObject *args) {
55375532
{
55385533
PyErr_WarnEx(PyExc_DeprecationWarning,
55395534
"Python scripts should not need to call ""Exiv2::BasicIo::readOrThrow", 1);
5540-
55415535
try {
55425536
(arg1)->readOrThrow(arg2,SWIG_STD_MOVE(arg3),SWIG_STD_MOVE(arg4));
55435537
}
@@ -5584,7 +5578,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_getb(PyObject *self, PyObject *args) {
55845578
{
55855579
PyErr_WarnEx(PyExc_DeprecationWarning,
55865580
"Python scripts should not need to call ""Exiv2::BasicIo::getb", 1);
5587-
55885581
try {
55895582
result = (int)(arg1)->getb();
55905583
}
@@ -5632,7 +5625,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_transfer(PyObject *self, PyObject *args) {
56325625
{
56335626
PyErr_WarnEx(PyExc_DeprecationWarning,
56345627
"Python scripts should not need to call ""Exiv2::BasicIo::transfer", 1);
5635-
56365628
try {
56375629
{
56385630
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5697,7 +5689,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_seek(PyObject *self, PyObject *args) {
56975689
{
56985690
PyErr_WarnEx(PyExc_DeprecationWarning,
56995691
"Python scripts should not need to call ""Exiv2::BasicIo::seek", 1);
5700-
57015692
try {
57025693
{
57035694
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
@@ -5783,7 +5774,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_seekOrThrow(PyObject *self, PyObject *args) {
57835774
{
57845775
PyErr_WarnEx(PyExc_DeprecationWarning,
57855776
"Python scripts should not need to call ""Exiv2::BasicIo::seekOrThrow", 1);
5786-
57875777
try {
57885778
(arg1)->seekOrThrow(arg2,arg3,SWIG_STD_MOVE(arg4));
57895779
}
@@ -5919,7 +5909,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_tell(PyObject *self, PyObject *args) {
59195909
{
59205910
PyErr_WarnEx(PyExc_DeprecationWarning,
59215911
"Python scripts should not need to call ""Exiv2::BasicIo::tell", 1);
5922-
59235912
try {
59245913
result = ((Exiv2::BasicIo const *)arg1)->tell();
59255914
}
@@ -6042,7 +6031,6 @@ SWIGINTERN PyObject *_wrap_BasicIo_eof(PyObject *self, PyObject *args) {
60426031
{
60436032
PyErr_WarnEx(PyExc_DeprecationWarning,
60446033
"Python scripts should not need to call ""Exiv2::BasicIo::eof", 1);
6045-
60466034
try {
60476035
result = (bool)((Exiv2::BasicIo const *)arg1)->eof();
60486036
}

0 commit comments

Comments
 (0)