summaryrefslogtreecommitdiff
path: root/cffi/backend_ctypes.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2012-07-27 18:54:53 +0200
committerArmin Rigo <arigo@tunes.org>2012-07-27 18:54:53 +0200
commite9bae85ecad79eb431944b172c5ce5f1e6127246 (patch)
tree82041783e3317914cf9f1c264f742fb1b7b9cd5e /cffi/backend_ctypes.py
parent9e0aeaee43838155930d65ecf53d5b3304f3c8de (diff)
downloadcffi-e9bae85ecad79eb431944b172c5ce5f1e6127246.tar.gz
Fix: the code incorrectly accepted e.g. 'ffi.new(ffi.new("int*"))',
by taking the type of the inner cdata object.
Diffstat (limited to 'cffi/backend_ctypes.py')
-rw-r--r--cffi/backend_ctypes.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/cffi/backend_ctypes.py b/cffi/backend_ctypes.py
index e900247..ac5a02e 100644
--- a/cffi/backend_ctypes.py
+++ b/cffi/backend_ctypes.py
@@ -904,6 +904,8 @@ class CTypesBackend(object):
return BType._offsetof(fieldname)
def newp(self, BType, source):
+ if not issubclass(BType, CTypesData):
+ raise TypeError
return BType._newp(source)
def cast(self, BType, source):