Skip to content

Commit 249c391

Browse files
committed
Use str.isascii
1 parent aca6884 commit 249c391

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

tools/building.py

+1-12
Original file line numberDiff line numberDiff line change
@@ -476,17 +476,6 @@ def check_closure_compiler(cmd, args, env, allowed_to_fail):
476476
return True
477477

478478

479-
# Remove this once we require python3.7 and can use std.isascii.
480-
# See: https://docs.python.org/3/library/stdtypes.html#str.isascii
481-
def isascii(s):
482-
try:
483-
s.encode('ascii')
484-
except UnicodeEncodeError:
485-
return False
486-
else:
487-
return True
488-
489-
490479
def get_closure_compiler_and_env(user_args):
491480
env = shared.env_with_node_in_path()
492481
closure_cmd = get_closure_compiler()
@@ -623,7 +612,7 @@ def run_closure_cmd(cmd, filename, env):
623612
tempfiles = shared.get_temp_files()
624613

625614
def move_to_safe_7bit_ascii_filename(filename):
626-
if isascii(filename):
615+
if filename.isascii():
627616
return os.path.abspath(filename)
628617
safe_filename = tempfiles.get('.js').name # Safe 7-bit filename
629618
shutil.copyfile(filename, safe_filename)

0 commit comments

Comments
 (0)