summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-12-05 23:05:28 +0000
committerTim Potter <tpot@samba.org>2002-12-05 23:05:28 +0000
commitf7f3d42acf00b0b4b99f37cbd320c9c2aed6858e (patch)
tree245b2242336091d93fad3de043e814d8cbdb827d /source3/python
parent902caf48ef0730a17bbb858c3ff9c68b823e5907 (diff)
downloadsamba-f7f3d42acf00b0b4b99f37cbd320c9c2aed6858e.tar.gz
samba-f7f3d42acf00b0b4b99f37cbd320c9c2aed6858e.tar.bz2
samba-f7f3d42acf00b0b4b99f37cbd320c9c2aed6858e.zip
Merge from HEAD:
>FUNCTION_MACRO change broke the Python modules. > >Also fix up string pasting (I thought this should only be a warning?) (This used to be commit 5bd90f310aa6303a5c949b46591f9fcf82a175b8)
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_tdbpack.c27
-rwxr-xr-xsource3/python/setup.py3
2 files changed, 20 insertions, 10 deletions
diff --git a/source3/python/py_tdbpack.c b/source3/python/py_tdbpack.c
index d70937e8e0..6d23dd840a 100644
--- a/source3/python/py_tdbpack.c
+++ b/source3/python/py_tdbpack.c
@@ -23,9 +23,18 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "Python.h"
+/* This module is supposed to be standalone, however for portability
+ it would be good to use the FUNCTION_MACRO preprocessor define. */
-#include "Python.h"
+#include "config.h"
+
+#ifdef HAVE_FUNCTION_MACRO
+#define FUNCTION_MACRO (__FUNCTION__)
+#else
+#define FUNCTION_MACRO (__FILE__)
+#endif
static PyObject * pytdbpack_number(char ch, PyObject *val_iter, PyObject *packed_list);
static PyObject * pytdbpack_str(char ch,
@@ -247,7 +256,7 @@ pytdbpack_data(const char *format_str,
default:
PyErr_Format(PyExc_ValueError,
"%s: format character '%c' is not supported",
- __FUNCTION__, ch);
+ FUNCTION_MACRO, ch);
return NULL;
}
}
@@ -477,7 +486,7 @@ pytdbunpack(PyObject *self,
if (i == 0) {
PyErr_Format(PyExc_ValueError,
"%s: '$' may not be first character in format",
- __FUNCTION__);
+ FUNCTION_MACRO);
return NULL;
}
while (packed_len > 0)
@@ -511,7 +520,7 @@ static void
pytdbunpack_err_too_short(void)
{
PyErr_Format(PyExc_IndexError,
- __FUNCTION__ ": data too short for unpack format");
+ "%s: data too short for unpack format", FUNCTION_MACRO);
}
@@ -598,7 +607,7 @@ pytdbunpack_buffer(char **pbuf, int *plen, PyObject *val_list)
if (slen < 0) { /* surely you jest */
PyErr_Format(PyExc_ValueError,
- __FUNCTION__ ": buffer seems to have negative length");
+ "%s: buffer seems to have negative length", FUNCTION_MACRO);
return NULL;
}
@@ -608,8 +617,8 @@ pytdbunpack_buffer(char **pbuf, int *plen, PyObject *val_list)
if (*plen < slen) {
PyErr_Format(PyExc_IndexError,
- __FUNCTION__ ": not enough data to unpack buffer: "
- "need %d bytes, have %d",
+ "%s: not enough data to unpack buffer: "
+ "need %d bytes, have %d", FUNCTION_MACRO,
(int) slen, *plen);
return NULL;
}
@@ -668,8 +677,8 @@ static PyObject *pytdbunpack_item(char ch,
}
else {
PyErr_Format(PyExc_ValueError,
- __FUNCTION__ ": format character '%c' is not supported",
- ch);
+ "%s: format character '%c' is not supported",
+ FUNCTION_MACRO, ch);
return NULL;
}
diff --git a/source3/python/setup.py b/source3/python/setup.py
index bf62f3b877..09a81fd914 100755
--- a/source3/python/setup.py
+++ b/source3/python/setup.py
@@ -179,6 +179,7 @@ setup(
# tdbpack/unpack extensions. Does not actually link to any Samba
# code, although it implements a compatible data format.
Extension(name = "tdbpack",
- sources = [os.path.join(samba_srcdir, "python", "py_tdbpack.c")]),
+ sources = [os.path.join(samba_srcdir, "python", "py_tdbpack.c")],
+ extra_compile_args = ["-I include"])
],
)