Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
10 additions
and
8 deletions.
-
+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 |
|
|
) |
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.