[Python-modules-commits] r14331 - in packages/pyside/trunk/debian (3 files)
odyx-guest at users.alioth.debian.org
odyx-guest at users.alioth.debian.org
Tue Aug 31 13:22:59 UTC 2010
Date: Tuesday, August 31, 2010 @ 13:22:52
Author: odyx-guest
Revision: 14331
+ u_268bf77_fixed_signal_signature_parser.patch
Import from upstream to fix the incorrect signal signatures
(upstream bug: #311)
Added:
packages/pyside/trunk/debian/patches/u_268bf77_fixed_signal_signature_parser.patch
Modified:
packages/pyside/trunk/debian/changelog
packages/pyside/trunk/debian/patches/series
Modified: packages/pyside/trunk/debian/changelog
===================================================================
--- packages/pyside/trunk/debian/changelog 2010-08-31 12:53:10 UTC (rev 14330)
+++ packages/pyside/trunk/debian/changelog 2010-08-31 13:22:52 UTC (rev 14331)
@@ -1,3 +1,12 @@
+pyside (0.4.0-2~exp0) UNRELEASED; urgency=low
+
+ * Patches:
+ - u_268bf77_fixed_signal_signature_parser.patch
+ Import from upstream to fix the incorrect signal signatures
+ (upstream bug: #311)
+
+ -- Didier Raboud <didier at raboud.com> Tue, 31 Aug 2010 15:04:41 +0200
+
pyside (0.4.0-1) experimental; urgency=low
* New 0.4.0 upstream release (Closes: #591981)
Modified: packages/pyside/trunk/debian/patches/series
===================================================================
--- packages/pyside/trunk/debian/patches/series 2010-08-31 12:53:10 UTC (rev 14330)
+++ packages/pyside/trunk/debian/patches/series 2010-08-31 13:22:52 UTC (rev 14331)
@@ -1,4 +1,5 @@
u_c130273_fix_py25_QtScript_property.patch
+u_268bf77_fixed_signal_signature_parser.patch
libPythonVersionPostfix.patch
usePySpecificShiboken.patch
lessBuildVerbosity.patch
Added: packages/pyside/trunk/debian/patches/u_268bf77_fixed_signal_signature_parser.patch
===================================================================
--- packages/pyside/trunk/debian/patches/u_268bf77_fixed_signal_signature_parser.patch (rev 0)
+++ packages/pyside/trunk/debian/patches/u_268bf77_fixed_signal_signature_parser.patch 2010-08-31 13:22:52 UTC (rev 14331)
@@ -0,0 +1,118 @@
+From 268bf7735b787d2310e18b3aed262bd27b9d24c6 Mon Sep 17 00:00:00 2001
+From: Renato Filho <renato.filho at openbossa.org>
+Date: Thu, 26 Aug 2010 12:02:59 -0300
+Subject: [PATCH] Fixed signal signature parser.
+
+Fixes bug #311.
+
+Reviewer: Luciano Wolf <luciano.wolf at openbossa.org>
+ Hugo Parente Lima <hugo.pl at gmail.com>
+---
+ libpyside/qsignal.cpp | 21 +++++++++++++--------
+ tests/signals/CMakeLists.txt | 1 +
+ tests/signals/bug_311.py | 42 ++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 56 insertions(+), 8 deletions(-)
+ create mode 100644 tests/signals/bug_311.py
+
+diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp
+index f465a7b..6c54203 100644
+--- a/libpyside/qsignal.cpp
++++ b/libpyside/qsignal.cpp
+@@ -250,15 +250,21 @@ char* signal_get_type_name(PyObject* type)
+ char *typeName = NULL;
+ if (type->ob_type == &Shiboken::SbkBaseWrapperType_Type) {
+ Shiboken::SbkBaseWrapperType *objType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(type);
++ Q_ASSERT(objType->original_name);
+ typeName = strdup(objType->original_name);
+ } else {
+- //tp_name return the full name
+- Shiboken::AutoDecRef otypeName(PyObject_GetAttrString(type, "__name__"));
+- typeName = strdup(PyString_AS_STRING(otypeName.object()));
+- }
+- if (Shiboken::TypeResolver::getType(typeName) == Shiboken::TypeResolver::ObjectType) {
+- typeName = reinterpret_cast<char*>(realloc(typeName, strlen(typeName) + 1));
+- typeName = strcat(typeName, "*");
++ // Translate python types to Qt names
++ PyTypeObject *objType = reinterpret_cast<PyTypeObject*>(type);
++ if (objType == &PyString_Type)
++ typeName = strdup("QString");
++ else if (objType == &PyInt_Type)
++ typeName = strdup("int");
++ else if (objType == &PyLong_Type)
++ typeName = strdup("long");
++ else if (objType == &PyFloat_Type)
++ typeName = strdup("qreal");
++ else
++ typeName = strdup("object");
+ }
+ return typeName;
+ } else if (PyString_Check(type)) {
+@@ -277,7 +283,6 @@ char* signal_build_signature(const char *name, const char *signature)
+ char* signal_parse_signature(PyObject *args)
+ {
+ char *signature = 0;
+-
+ if (args && (PyString_Check(args) || (!PySequence_Check(args) && (args != Py_None))))
+ return signal_get_type_name(args);
+
+diff --git a/tests/signals/CMakeLists.txt b/tests/signals/CMakeLists.txt
+index eda247d..a69aa06 100644
+--- a/tests/signals/CMakeLists.txt
++++ b/tests/signals/CMakeLists.txt
+@@ -1,4 +1,5 @@
+ PYSIDE_TEST(args_dont_match_test.py)
++PYSIDE_TEST(bug_311.py)
+ PYSIDE_TEST(decorators_test.py)
+ PYSIDE_TEST(invalid_callback_test.py)
+ PYSIDE_TEST(lambda_gui_test.py)
+diff --git a/tests/signals/bug_311.py b/tests/signals/bug_311.py
+new file mode 100644
+index 0000000..42ed5f3
+--- /dev/null
++++ b/tests/signals/bug_311.py
+@@ -0,0 +1,42 @@
++#!/usr/bin/env python
++# -*- coding: utf-8 -*-
++
++import unittest
++from PySide import QtCore
++from helper import UsesQCoreApplication
++
++class DerivedDate(QtCore.QDate):
++ def __init__(self,y,m,d):
++ super(DerivedDate,self).__init__(y,m,d)
++
++class Emitter(QtCore.QObject):
++ dateSignal1 = QtCore.Signal(QtCore.QDate)
++ dateSignal2 = QtCore.Signal(DerivedDate)
++ tupleSignal = QtCore.Signal(tuple)
++
++class SignaltoSignalTest(UsesQCoreApplication):
++ def myCb(self, dt):
++ self._dt = dt
++
++ def testBug(self):
++ e = Emitter()
++ d = DerivedDate(2010,8,24)
++ self._dt = None
++ e.dateSignal1.connect(self.myCb)
++ e.dateSignal1.emit(d)
++ self.assertEqual(self._dt, d)
++
++ self._dt = None
++ e.dateSignal2.connect(self.myCb)
++ e.dateSignal2.emit(d)
++ self.assertEqual(self._dt, d)
++
++ myTuple = (5, 6, 7)
++ self._dt = None
++ e.tupleSignal.connect(self.myCb)
++ e.tupleSignal.emit(myTuple)
++ self.assertEqual(myTuple, self._dt)
++
++if __name__ == '__main__':
++ unittest.main()
++
+--
+1.6.1
+
More information about the Python-modules-commits
mailing list