On 22/11/14 11:32, Tomasz Buchert wrote:
> On 20/11/14 11:54, Tomasz Buchert wrote:
> [...]
> Here is a NMU debdiff for this bug.
> The Debian patches for Python3 support broke Python2 package.
> It's a story about naming the entry function for a module
> module which is slightly different in both version of Python.
>
> Note that there is a newer upstream version of pyhunspell.
> If you look for more "minimal" patch, I can make for you,
> since gbp pq renamed the original patches.
>
> Tomasz

Sorry for too overloaded debdiff. Here is a concise one.

Tomasz
diff -Nru pyhunspell-0.1/debian/changelog pyhunspell-0.1/debian/changelog
--- pyhunspell-0.1/debian/changelog	2013-06-29 20:27:33.000000000 +0200
+++ pyhunspell-0.1/debian/changelog	2014-11-22 12:08:04.000000000 +0100
@@ -1,3 +1,10 @@
+pyhunspell (0.1-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix Python3 patch that broke Python 2 module (Closes: #770085)
+
+ -- Tomasz Buchert <tomasz.buch...@inria.fr>  Sat, 22 Nov 2014 11:11:31 +0100
+
 pyhunspell (0.1-1) unstable; urgency=low
 
   * Initial release. (Closes: #714459)
diff -Nru pyhunspell-0.1/debian/patches/python3.patch pyhunspell-0.1/debian/patches/python3.patch
--- pyhunspell-0.1/debian/patches/python3.patch	2013-06-29 20:47:03.000000000 +0200
+++ pyhunspell-0.1/debian/patches/python3.patch	2014-11-22 12:08:04.000000000 +0100
@@ -34,7 +34,7 @@
  	"HunSpell",		/* tp_name */
  	sizeof(HunSpell),	/* tp_basicsize */
  	0,			/* tp_itemsize */
-@@ -259,28 +262,42 @@
+@@ -259,28 +262,51 @@
  	0,			/* tp_new */
  };
  
@@ -54,8 +54,17 @@
  
 -void
 -inithunspell(void)
-+PyObject*
-+PyInit_hunspell(void)
++#if PY_MAJOR_VERSION >= 3
++#define PYRETURN(x) return (x)
++#else
++#define PYRETURN(x) return
++#endif
++
++#if PY_MAJOR_VERSION >= 3
++PyMODINIT_FUNC PyInit_hunspell(void)
++#else
++PyMODINIT_FUNC inithunspell(void)
++#endif
  {
  	PyObject *mod;
  
@@ -68,17 +77,17 @@
 +#endif
  	if (mod == NULL) {
 -		return;
-+		return NULL;
++		PYRETURN(NULL);
  	}
  
  	// Fill in some slots in the type, and make it ready
  	HunSpellType.tp_new = PyType_GenericNew;
  	if (PyType_Ready(&HunSpellType) < 0) {
 -		return;
-+		return NULL;
++		PYRETURN(NULL);
  	}
  	// Add the type to the module.
  	Py_INCREF(&HunSpellType);
  	PyModule_AddObject(mod, "HunSpell", (PyObject *)&HunSpellType);
-+	return mod;
++	PYRETURN(mod);
  }

Reply via email to