File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 2929"""
3030
3131import ast
32- from six import string_types
3332import inspect
33+ from six import string_types
3434from six .moves import builtins
35+ import sys
36+ import types
3537
3638from bpython import line as line_properties
3739from bpython ._py3compat import py3
4749 _name_type_nodes = (ast .Name ,)
4850
4951
52+ # inspect.isclass is broken in Python 2.6
53+ if sys .version_info [:2 ] == (2 , 6 ):
54+ def isclass (obj ):
55+ return isinstance (obj , (type , types .ClassType ))
56+ else :
57+ isclass = inspect .isclass
58+
59+
5060class EvaluationError (Exception ):
5161 """Raised if an exception occurred in safe_eval."""
5262
@@ -267,7 +277,7 @@ def safe_get_attribute_new_style(obj, attr):
267277 if not is_new_style (obj ):
268278 raise ValueError ("%r is not a new-style class or object" % obj )
269279 to_look_through = (obj .__mro__
270- if inspect . isclass (obj )
280+ if isclass (obj )
271281 else (obj ,) + type (obj ).__mro__ )
272282
273283 for cls in to_look_through :
You can’t perform that action at this time.
0 commit comments