mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-11 08:42:35 +03:00
Merge pull request #3069 from jdufresne/deref
Fix dereferencing type-punned pointer will break strict-aliasing
This commit is contained in:
commit
64400a5169
|
@ -17,6 +17,11 @@ class TestImagePath(PillowTestCase):
|
||||||
self.assertEqual(p[0], (0.0, 1.0))
|
self.assertEqual(p[0], (0.0, 1.0))
|
||||||
self.assertEqual(p[-1], (8.0, 9.0))
|
self.assertEqual(p[-1], (8.0, 9.0))
|
||||||
self.assertEqual(list(p[:1]), [(0.0, 1.0)])
|
self.assertEqual(list(p[:1]), [(0.0, 1.0)])
|
||||||
|
with self.assertRaises(TypeError) as cm:
|
||||||
|
p['foo']
|
||||||
|
self.assertEqual(
|
||||||
|
str(cm.exception),
|
||||||
|
"Path indices must be integers, not str")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list(p),
|
list(p),
|
||||||
[(0.0, 1.0), (2.0, 3.0), (4.0, 5.0), (6.0, 7.0), (8.0, 9.0)])
|
[(0.0, 1.0), (2.0, 3.0), (4.0, 5.0), (6.0, 7.0), (8.0, 9.0)])
|
||||||
|
|
|
@ -571,7 +571,7 @@ path_subscript(PyPathObject* self, PyObject* item) {
|
||||||
else {
|
else {
|
||||||
PyErr_Format(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"Path indices must be integers, not %.200s",
|
"Path indices must be integers, not %.200s",
|
||||||
Py_TYPE(&item)->tp_name);
|
Py_TYPE(item)->tp_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user