From 318acbf0a384039f985dd84fcb8c4783565cbef0 Mon Sep 17 00:00:00 2001 From: "Alexander A. Maly" Date: Mon, 28 Jan 2019 20:45:19 +0300 Subject: [PATCH] Fixing async bug in Python 3.7 In python 3.7 async became a reserved word, so change it to async_. Consider kicking out python from the project. --- scripts/gen_actor_source.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/gen_actor_source.py b/scripts/gen_actor_source.py index 9fb11182..8e0ffaf5 100755 --- a/scripts/gen_actor_source.py +++ b/scripts/gen_actor_source.py @@ -56,7 +56,7 @@ and '|' is 'or'): class Method := name: class Name returnType: class BaseType | None - async: bool + async_: bool arguments: (class Argument)* class BaseType := @@ -754,9 +754,9 @@ class Method: else: self.return_type = None if "async" in json_node: - self.async = bool(json_node["async"]) + self.async_ = bool(json_node["async"]) else: - self.async = self.return_type is None + self.async_ = self.return_type is None self.arguments = [] if "arguments" in json_node: for arg in json_node["arguments"]: @@ -1966,7 +1966,7 @@ private: method_index = self._module.methods.index(method) switch_body += "case 0x%04x: {\n" % method_index switch_body += " /* %s */\n" % method.name.get_ascii_value() - if method.async: + if method.async_: switch_body += " Q_EMIT asyncRun(index, args);\n" switch_body += " return ES_Async;\n" else: @@ -2057,7 +2057,7 @@ private: for method in self._module.methods: assert isinstance(method, Method) method_index = self._module.methods.index(method) - if method.async: + if method.async_: switch_body += "case 0x%04x: {\n" % method_index switch_body += " /* %s */\n" % method.name.get_ascii_value() args = [] @@ -2193,7 +2193,7 @@ private: """ body = "module_ = new %s(this);\n" % self._module.get_module_cpp_class_name() methods = self._module.methods - async_methods = list(filter(lambda method: method.async, methods)) + async_methods = list(filter(lambda method: method.async_, methods)) if self._module.settings: body += self._module.settings.get_settings_page_creation("settingsPage_").strip() + "\n\n" if async_methods: @@ -2495,7 +2495,7 @@ class AsyncThreadCppClass(CppClassBase): :return: implementation of void run() """ switch_body = "" - methods = filter(lambda module_method: module_method.async, self._module.methods) + methods = filter(lambda module_method: module_method.async_, self._module.methods) for method in methods: assert isinstance(method, Method) method_index = self._module.methods.index(method) -- GitLab