Skip to content
Permalink
Browse files

refactor

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Apr 12, 2013
1 parent 9eae4e1 commit f77ace06a101dff64debb6e01db96e8a1052b8fb
Showing with 10 additions and 8 deletions.
  1. +10 −8 topaz/objspace.py
@@ -502,15 +502,17 @@ def find_const(self, w_module, name):
return w_res

@jit.elidable
def _valid_const_name(self, name):
if not name[0].isupper():
return False
for i in range(1, len(name)):
ch = name[i]
if not (ch.isalnum() or ch == "_" or ord(ch) > 127):
return False
return True

def _check_const_name(self, name):
valid = name[0].isupper()
if valid:
for i in range(1, len(name)):
ch = name[i]
if not (ch.isalnum() or ch == "_" or ord(ch) > 127):
valid = False
break
if not valid:
if not self._valid_const_name(name):
raise self.error(self.w_NameError,
"wrong constant name %s" % name
)

0 comments on commit f77ace0

Please sign in to comment.