1.1 --- a/inspector.py Thu Dec 08 21:45:09 2016 +0100
1.2 +++ b/inspector.py Thu Dec 08 22:50:32 2016 +0100
1.3 @@ -495,11 +495,18 @@
1.4 else:
1.5 bases.append(base_class)
1.6
1.7 + # Detect conflicting definitions. Such definitions cause conflicts in
1.8 + # the storage of namespace-related information.
1.9 +
1.10 + class_name = self.get_object_path(n.name)
1.11 + ref = self.get_object(class_name)
1.12 +
1.13 + if ref.static():
1.14 + raise InspectError("Multiple definitions for the same name are not permitted.", class_name, n)
1.15 +
1.16 # Record bases for the class and retain the class name.
1.17 # Note that the function class does not inherit from the object class.
1.18
1.19 - class_name = self.get_object_path(n.name)
1.20 -
1.21 if not bases and class_name != "__builtins__.core.object" and \
1.22 class_name != "__builtins__.core.function":
1.23
1.24 @@ -577,9 +584,17 @@
1.25 else:
1.26 original_name = None
1.27
1.28 + # Detect conflicting definitions. Such definitions cause conflicts in
1.29 + # the storage of namespace-related information.
1.30 +
1.31 + function_name = self.get_object_path(name)
1.32 + ref = self.get_object(function_name)
1.33 +
1.34 + if ref.static():
1.35 + raise InspectError("Multiple definitions for the same name are not permitted.", function_name, n)
1.36 +
1.37 # Initialise argument and local records.
1.38
1.39 - function_name = self.get_object_path(name)
1.40 argnames = get_argnames(n.argnames)
1.41 is_method = self.in_class and not self.in_function
1.42