make_instrumenting_probes: Fix map() Python 3 compatibility
map() returns a list in Python 2. Python 3 returns an iterator. Wrapping in a list() results in the same behaviour on both. Traceback (most recent call last): File "../../third_party/blink/renderer/build/scripts/make_instrumenting_probes.py", line 283, in <module> main() File "../../third_party/blink/renderer/build/scripts/make_instrumenting_probes.py", line 262, in main cpp_file.write(cpp_template.render(template_context)) File "C:\Google\chromium\src\third_party\jinja2\asyncsupport.py", line 76, in render return original_render(self, *args, **kwargs) File "C:\Google\chromium\src\third_party\jinja2\environment.py", line 1008, in render return self.environment.handle_exception(exc_info, True) File "C:\Google\chromium\src\third_party\jinja2\environment.py", line 780, in handle_exception reraise(exc_type, exc_value, tb) File "C:\Google\chromium\src\third_party\jinja2\_compat.py", line 37, in reraise raise value.with_traceback(tb) File "C:\Google\chromium\src\third_party\blink\renderer\build\scripts\templates\instrumenting_probes_impl.cc.tmpl", line 129, in <module> void {{probe.name}}Impl({{ params_list(probe) }}) { File "C:\Google\chromium\src\third_party\jinja2\runtime.py", line 579, in _invoke rv = self._func(*arguments) File "C:\Google\chromium\src\third_party\blink\renderer\build\scripts\templates\instrumenting_probes_impl.cc.tmpl", line 91, in <module> {%- for param in probe.params %} File "C:\Google\chromium\src\third_party\jinja2\runtime.py", line 435, in __init__ self._after = self._safe_next() File "C:\Google\chromium\src\third_party\jinja2\runtime.py", line 455, in _safe_next return next(self._iterator) File "../../third_party/blink/renderer/build/scripts/make_instrumenting_probes.py", line 148, in __init__ self.default_value = parts[1] if len(parts) != 1 else None TypeError: object of type 'map' has no len() Traceback (most recent call last): File "../../third_party/blink/renderer/build/scripts/make_instrumenting_probes.py", line 283, in <module> main() File "../../third_party/blink/renderer/build/scripts/make_instrumenting_probes.py", line 262, in main cpp_file.write(cpp_template.render(template_context)) File "C:\Google\chromium\src\third_party\jinja2\asyncsupport.py", line 76, in render return original_render(self, *args, **kwargs) File "C:\Google\chromium\src\third_party\jinja2\environment.py", line 1008, in render return self.environment.handle_exception(exc_info, True) File "C:\Google\chromium\src\third_party\jinja2\environment.py", line 780, in handle_exception reraise(exc_type, exc_value, tb) File "C:\Google\chromium\src\third_party\jinja2\_compat.py", line 37, in reraise raise value.with_traceback(tb) File "C:\Google\chromium\src\third_party\blink\renderer\build\scripts\templates\instrumenting_probes_impl.cc.tmpl", line 130, in <module> {{sink_class}}* probe_sink = To{{sink_class}}({{probe.params[0].name}}); File "C:\Google\chromium\src\third_party\jinja2\environment.py", line 430, in getattr return getattr(obj, attribute) jinja2.exceptions.UndefinedError: map object has no element 0 Bug: 941669 Change-Id: Ie584b13c8b3e54ee9f06faffd57d93917c88ccfc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033510 Auto-Submit: Raul Tambre <raul@tambre.ee> Reviewed-by:Kent Tamura <tkent@chromium.org> Commit-Queue: Raul Tambre <raul@tambre.ee> Cr-Commit-Position: refs/heads/master@{#738465}
Showing
Please register or sign in to comment