Commit 7813b1dd authored by yangguo@chromium.org's avatar yangguo@chromium.org

Fixing python deprecations.

Original patch by Alexey Stukalov <astukalov@gmail.com>.

BUG=v8:1391
TEST=

Review URL: https://chromiumcodereview.appspot.com/10412022

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11604 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0bfedfb5
#!/usr/bin/env python #!/usr/bin/env python
# #
# Copyright 2006-2008 the V8 project authors. All rights reserved. # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are # modification, are permitted provided that the following conditions are
# met: # met:
...@@ -195,14 +195,14 @@ def ReadMacros(lines): ...@@ -195,14 +195,14 @@ def ReadMacros(lines):
macro_match = MACRO_PATTERN.match(line) macro_match = MACRO_PATTERN.match(line)
if macro_match: if macro_match:
name = macro_match.group(1) name = macro_match.group(1)
args = map(string.strip, macro_match.group(2).split(',')) args = [match.strip() for match in macro_match.group(2).split(',')]
body = macro_match.group(3).strip() body = macro_match.group(3).strip()
macros.append((re.compile("\\b%s\\(" % name), TextMacro(args, body))) macros.append((re.compile("\\b%s\\(" % name), TextMacro(args, body)))
else: else:
python_match = PYTHON_MACRO_PATTERN.match(line) python_match = PYTHON_MACRO_PATTERN.match(line)
if python_match: if python_match:
name = python_match.group(1) name = python_match.group(1)
args = map(string.strip, python_match.group(2).split(',')) args = [match.strip() for match in python_match.group(2).split(',')]
body = python_match.group(3).strip() body = python_match.group(3).strip()
fun = eval("lambda " + ",".join(args) + ': ' + body) fun = eval("lambda " + ",".join(args) + ': ' + body)
macros.append((re.compile("\\b%s\\(" % name), PythonMacro(args, fun))) macros.append((re.compile("\\b%s\\(" % name), PythonMacro(args, fun)))
......
#!/usr/bin/python2.4 #!/usr/bin/python2.4
# Copyright 2009 the V8 project authors. All rights reserved. # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are # modification, are permitted provided that the following conditions are
# met: # met:
...@@ -154,7 +154,7 @@ class JavaScriptMinifier(object): ...@@ -154,7 +154,7 @@ class JavaScriptMinifier(object):
return var_name return var_name
while True: while True:
identifier_first_char = self.identifier_counter % 52 identifier_first_char = self.identifier_counter % 52
identifier_second_char = self.identifier_counter / 52 identifier_second_char = self.identifier_counter // 52
new_identifier = self.CharFromNumber(identifier_first_char) new_identifier = self.CharFromNumber(identifier_first_char)
if identifier_second_char != 0: if identifier_second_char != 0:
new_identifier = ( new_identifier = (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment