summaryrefslogtreecommitdiff
path: root/cffi/api.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2017-01-26 11:14:28 +0100
committerArmin Rigo <arigo@tunes.org>2017-01-26 11:14:28 +0100
commitd55000271fc0f0356e99be9523d45e5d3c90afef (patch)
tree8b5c4beffd37fbe34c7de1598e2073eeb370e2f8 /cffi/api.py
parentf0a21999115b31814835e8a8e55c916a49c4ee89 (diff)
downloadcffi-d55000271fc0f0356e99be9523d45e5d3c90afef.tar.gz
complain clearly if set_source() is given a /-separated name
Diffstat (limited to 'cffi/api.py')
-rw-r--r--cffi/api.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/cffi/api.py b/cffi/api.py
index d3ec791..43b78f8 100644
--- a/cffi/api.py
+++ b/cffi/api.py
@@ -593,11 +593,15 @@ class FFI(object):
ensure('extra_link_args', '/MANIFEST')
def set_source(self, module_name, source, source_extension='.c', **kwds):
+ import os
if hasattr(self, '_assigned_source'):
raise ValueError("set_source() cannot be called several times "
"per ffi object")
if not isinstance(module_name, basestring):
raise TypeError("'module_name' must be a string")
+ if os.sep in module_name or (os.altsep and os.altsep in module_name):
+ raise ValueError("'module_name' must not contain '/': use a dotted "
+ "name to make a 'package.module' location")
self._assigned_source = (str(module_name), source,
source_extension, kwds)