[Pkg-gnupg-commit] [gpgme] 63/132: python: Call SWIG_NewPointerObj rather than SWIG_Python_NewPointerObj.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Apr 26 01:01:25 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gpgme.
commit d35651917097ae2eee7d52396d53d010bc34df19
Author: Tobias Mueller <muelli at cryptobitch.de>
Date: Tue Dec 20 18:01:27 2016 +0100
python: Call SWIG_NewPointerObj rather than SWIG_Python_NewPointerObj.
* lang/python/gpgme.i (pygpgme_wrap_gpgme_data_t): Provide a "self"
variable for SWIG_NewPointerObj and call SWIG_NewPointerObj rather than
SWIG_Python_NewPointerObj.
--
SWIG_Python_NewPointerObj seems to be an implementation detail, because
SWIG's documentation does not mention that function at all. In fact,
SWIG_NewPointerObj is a call to SWIG_Python_NewPointerObj with the first
parameter being either NULL or the "self" variable, depending on whether
SWIG is called with the -builtin flag. So far, the first parameter was
hard-coded to NULL. This change also hard-codes it to NULL but makes
it more explicit. The benefit is that the documented function is being
used and that compilation works regardless of the -builtin flag.
Partially reverts: 856bcfe2934237011984fab0bc69800a7c25c34b
Signed-off-by: Tobias Mueller <muelli at cryptobitch.de>
---
lang/python/gpgme.i | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index c7d89db..e21aa6c 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -620,7 +620,17 @@ FILE *fdopen(int fildes, const char *mode);
PyObject *
_gpg_wrap_gpgme_data_t(gpgme_data_t data)
{
- return SWIG_Python_NewPointerObj(NULL, data, SWIGTYPE_p_gpgme_data, 0);
+ /*
+ * If SWIG is invoked without -builtin, the macro SWIG_NewPointerObj
+ * expects a variable named "self".
+ *
+ * XXX: It is not quite clear why passing NULL as self is okay, but
+ * it works with -builtin, and it seems to work just fine without
+ * it too.
+ */
+ PyObject* self = NULL;
+ (void) self;
+ return SWIG_NewPointerObj(data, SWIGTYPE_p_gpgme_data, 0);
}
gpgme_ctx_t
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git
More information about the Pkg-gnupg-commit
mailing list