summaryrefslogtreecommitdiff
path: root/cffi/recompiler.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2017-01-20 09:41:04 +0100
committerArmin Rigo <arigo@tunes.org>2017-01-20 09:41:04 +0100
commitac5e396f1fb685a09e6f4e72b7fb5276a1344847 (patch)
tree92b792b5167ba5b8cafa3e223caefaaf936e0d2f /cffi/recompiler.py
parent6cc5a24826ea683dff26bc56c347c10d68351137 (diff)
downloadcffi-ac5e396f1fb685a09e6f4e72b7fb5276a1344847.tar.gz
Follow-up on b87441f6f36c
Diffstat (limited to 'cffi/recompiler.py')
-rw-r--r--cffi/recompiler.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/cffi/recompiler.py b/cffi/recompiler.py
index 2e5d29b..ddf5130 100644
--- a/cffi/recompiler.py
+++ b/cffi/recompiler.py
@@ -1,5 +1,6 @@
import os, sys, io
from . import ffiplatform, model
+from .error import VerificationError
from .cffi_opcode import *
VERSION = "0x2601"
@@ -211,7 +212,7 @@ class Recompiler:
method = getattr(self, '_generate_cpy_%s_%s' % (kind,
step_name))
except AttributeError:
- raise ffiplatform.VerificationError(
+ raise VerificationError(
"not implemented in recompile(): %r" % name)
try:
self._current_quals = quals
@@ -354,12 +355,12 @@ class Recompiler:
included_module_name, included_source = (
ffi_to_include._assigned_source[:2])
except AttributeError:
- raise ffiplatform.VerificationError(
+ raise VerificationError(
"ffi object %r includes %r, but the latter has not "
"been prepared with set_source()" % (
self.ffi, ffi_to_include,))
if included_source is None:
- raise ffiplatform.VerificationError(
+ raise VerificationError(
"not implemented yet: ffi.include() of a Python-based "
"ffi inside a C-based ffi")
prnt(' "%s",' % (included_module_name,))
@@ -464,12 +465,12 @@ class Recompiler:
included_module_name, included_source = (
ffi_to_include._assigned_source[:2])
except AttributeError:
- raise ffiplatform.VerificationError(
+ raise VerificationError(
"ffi object %r includes %r, but the latter has not "
"been prepared with set_source()" % (
self.ffi, ffi_to_include,))
if included_source is not None:
- raise ffiplatform.VerificationError(
+ raise VerificationError(
"not implemented yet: ffi.include() of a C-based "
"ffi inside a Python-based ffi")
prnt('from %s import ffi as _ffi%d' % (included_module_name, i))
@@ -839,7 +840,7 @@ class Recompiler:
prnt(' { %s = &p->%s; (void)tmp; }' % (
ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual),
fname))
- except ffiplatform.VerificationError as e:
+ except VerificationError as e:
prnt(' /* %s */' % str(e)) # cannot verify it, ignore
prnt('}')
prnt('struct _cffi_align_%s { char x; %s y; };' % (approxname, cname))
@@ -1002,7 +1003,7 @@ class Recompiler:
def _generate_cpy_const(self, is_int, name, tp=None, category='const',
check_value=None):
if (category, name) in self._seen_constants:
- raise ffiplatform.VerificationError(
+ raise VerificationError(
"duplicate declaration of %s '%s'" % (category, name))
self._seen_constants.add((category, name))
#
@@ -1101,7 +1102,7 @@ class Recompiler:
def _generate_cpy_macro_ctx(self, tp, name):
if tp == '...':
if self.target_is_python:
- raise ffiplatform.VerificationError(
+ raise VerificationError(
"cannot use the syntax '...' in '#define %s ...' when "
"using the ABI mode" % (name,))
check_value = None
@@ -1234,7 +1235,7 @@ class Recompiler:
def _generate_cpy_extern_python_ctx(self, tp, name):
if self.target_is_python:
- raise ffiplatform.VerificationError(
+ raise VerificationError(
"cannot use 'extern \"Python\"' in the ABI mode")
if tp.ellipsis:
raise NotImplementedError("a vararg function is extern \"Python\"")
@@ -1315,7 +1316,7 @@ class Recompiler:
if tp.length is None:
self.cffi_types[index] = CffiOp(OP_OPEN_ARRAY, item_index)
elif tp.length == '...':
- raise ffiplatform.VerificationError(
+ raise VerificationError(
"type %s badly placed: the '...' array length can only be "
"used on global arrays or on fields of structures" % (
str(tp).replace('/*...*/', '...'),))