Fix bug 699 - "PySide.QtCore.Property doesn't throw a TypeError if the first arg isn't a PyType."
This commit is contained in:
parent
6f8f728241
commit
3cd2cad128
3 changed files with 25 additions and 7 deletions
|
|
@ -168,14 +168,14 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pData->constant && (pData->fset || pData->notify)) {
|
|
||||||
free(pData);
|
|
||||||
PyErr_SetString(PyExc_AttributeError, "A constant property cannot have a WRITE method or a NOTIFY signal.");
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
pData->typeName = PySide::Signal::getTypeName(type);
|
pData->typeName = PySide::Signal::getTypeName(type);
|
||||||
return 1;
|
|
||||||
|
if (!pData->typeName)
|
||||||
|
PyErr_SetString(PyExc_TypeError, "Invalid property type or type name.");
|
||||||
|
else if (pData->constant && (pData->fset || pData->notify))
|
||||||
|
PyErr_SetString(PyExc_TypeError, "A constant property cannot have a WRITE method or a NOTIFY signal.");
|
||||||
|
|
||||||
|
return PyErr_Occurred() ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qpropertyFree(void *self)
|
void qpropertyFree(void *self)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ PYSIDE_TEST(bug_462.py)
|
||||||
PYSIDE_TEST(bug_505.py)
|
PYSIDE_TEST(bug_505.py)
|
||||||
PYSIDE_TEST(bug_515.py)
|
PYSIDE_TEST(bug_515.py)
|
||||||
PYSIDE_TEST(bug_656.py)
|
PYSIDE_TEST(bug_656.py)
|
||||||
|
PYSIDE_TEST(bug_699.py)
|
||||||
PYSIDE_TEST(bug_706.py)
|
PYSIDE_TEST(bug_706.py)
|
||||||
PYSIDE_TEST(blocking_signals_test.py)
|
PYSIDE_TEST(blocking_signals_test.py)
|
||||||
PYSIDE_TEST(child_event_test.py)
|
PYSIDE_TEST(child_event_test.py)
|
||||||
|
|
|
||||||
17
tests/QtCore/bug_699.py
Normal file
17
tests/QtCore/bug_699.py
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import unittest
|
||||||
|
from PySide.QtCore import *
|
||||||
|
|
||||||
|
class TestBug699 (unittest.TestCase):
|
||||||
|
|
||||||
|
def defClass(self):
|
||||||
|
class Foo (QObject):
|
||||||
|
def foo(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
prop = Property(foo, foo)
|
||||||
|
|
||||||
|
def testIt(self):
|
||||||
|
self.assertRaises(TypeError, self.defClass)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue