Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Unified Diff: mojo/public/tools/bindings/mojom_bindings_generator.py

Issue 285413003: Mojo: Remove dangerous default argument in mojom_bindings_generatory.py: ProcessFile(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/mojom_bindings_generator.py
diff --git a/mojo/public/tools/bindings/mojom_bindings_generator.py b/mojo/public/tools/bindings/mojom_bindings_generator.py
index 1300a8079bd15dec327e8d316f8d3eca0ccd1824..aee3b8c253c599d5127923753ef50eacd01e4511 100755
--- a/mojo/public/tools/bindings/mojom_bindings_generator.py
+++ b/mojo/public/tools/bindings/mojom_bindings_generator.py
@@ -73,15 +73,19 @@ def MakeImportStackMessage(imported_filename_stack):
zip(imported_filename_stack[1:], imported_filename_stack)]))
-# Disable Check for dangerous default arguments (they're "private" keyword
-# arguments):
+# Disable check for dangerous default arguments (they're "private" keyword
+# arguments; note that we want |_processed_files| to memoize across invocations
+# of |ProcessFile()|):
# pylint: disable=W0102
def ProcessFile(args, remaining_args, generator_modules, filename,
- _processed_files={}, _imported_filename_stack=[]):
+ _processed_files={}, _imported_filename_stack=None):
# Memoized results.
if filename in _processed_files:
return _processed_files[filename]
+ if _imported_filename_stack is None:
+ _imported_filename_stack = []
+
# Ensure we only visit each file once.
if filename in _imported_filename_stack:
print "%s: Error: Circular dependency" % filename + \
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698