Tidier string type check for eval
This commit is contained in:
parent
503b4e1f81
commit
856212c9d7
@ -33,6 +33,7 @@ import os
|
|||||||
import __future__
|
import __future__
|
||||||
|
|
||||||
from hy._compat import PY3, PY33, MAGIC, builtins, long_type, wr_long
|
from hy._compat import PY3, PY33, MAGIC, builtins, long_type, wr_long
|
||||||
|
from hy._compat import string_types
|
||||||
|
|
||||||
|
|
||||||
def ast_compile(ast, filename, mode):
|
def ast_compile(ast, filename, mode):
|
||||||
@ -109,12 +110,7 @@ def hy_eval(hytree, namespace, module_name):
|
|||||||
foo.end_column = 0
|
foo.end_column = 0
|
||||||
replace_hy_obj(hytree, foo)
|
replace_hy_obj(hytree, foo)
|
||||||
|
|
||||||
try:
|
if not isinstance(module_name, string_types):
|
||||||
checktype = basestring
|
|
||||||
except NameError:
|
|
||||||
checktype = str
|
|
||||||
|
|
||||||
if not isinstance(module_name, checktype):
|
|
||||||
raise HyTypeError(foo, "Module name must be a string")
|
raise HyTypeError(foo, "Module name must be a string")
|
||||||
|
|
||||||
_ast, expr = hy_compile(hytree, module_name, get_expr=True)
|
_ast, expr = hy_compile(hytree, module_name, get_expr=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user