)]}'
{"neutron/tests/common/net_helpers.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"bc2c67dfb3c9e90a281b8b4dc755249e6a03e1a5","unresolved":false,"context_lines":[{"line_number":301,"context_line":"        super(RootHelperProcess, self).__init__(cmd, *args, **kwargs)"},{"line_number":302,"context_line":"        self._wait_for_child_process()"},{"line_number":303,"context_line":""},{"line_number":304,"context_line":"    def kill(self, sig\u003dsignal.SIGKILL):"},{"line_number":305,"context_line":"        pid \u003d self.child_pid or str(self.pid)"},{"line_number":306,"context_line":"        try:"},{"line_number":307,"context_line":"            utils.execute([\u0027kill\u0027, \u0027-%d\u0027 % sig, pid], run_as_root\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_a2b17291","line":304,"updated":"2019-11-21 09:19:17.000000000","message":"I suggest, like in other methods, to add a \"skip_codes\" variable, with a default value. Something like:\n\ndef kill(self, sig\u003dsignal.SIGKILL, skip_codes\u003dNone):\n  skip_codes \u003d [\"No such process\"] if skip_codes is None or skip_codes\n  ...","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"7c1423d09e4051821d46aced2f145b19ecd174c8","unresolved":false,"context_lines":[{"line_number":301,"context_line":"        super(RootHelperProcess, self).__init__(cmd, *args, **kwargs)"},{"line_number":302,"context_line":"        self._wait_for_child_process()"},{"line_number":303,"context_line":""},{"line_number":304,"context_line":"    def kill(self, sig\u003dsignal.SIGKILL):"},{"line_number":305,"context_line":"        pid \u003d self.child_pid or str(self.pid)"},{"line_number":306,"context_line":"        try:"},{"line_number":307,"context_line":"            utils.execute([\u0027kill\u0027, \u0027-%d\u0027 % sig, pid], run_as_root\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_a57dfc1c","line":304,"in_reply_to":"3fa7e38b_a2b17291","updated":"2019-11-26 11:48:29.000000000","message":"Done","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"3dbbf11028a519659b912bb7db60e1da3aeb634b","unresolved":false,"context_lines":[{"line_number":304,"context_line":"    def kill(self, sig\u003dsignal.SIGKILL):"},{"line_number":305,"context_line":"        pid \u003d self.child_pid or str(self.pid)"},{"line_number":306,"context_line":"        try:"},{"line_number":307,"context_line":"            utils.execute([\u0027kill\u0027, \u0027-%d\u0027 % sig, pid], run_as_root\u003dTrue)"},{"line_number":308,"context_line":"        except exceptions.ProcessExecutionError as e:"},{"line_number":309,"context_line":"            # NOTE(slaweq): kill command returns errno.EPERM (1) for many"},{"line_number":310,"context_line":"            # different issues, e.g. when there is no such process to kill"}],"source_content_type":"text/x-python","patch_set":1,"id":"5faad753_456a7db3","line":307,"updated":"2019-09-10 13:48:20.000000000","message":"Instead of the try/catch context, I would use utils.execute(......, extra_ok_codes\u003d[errno.EPERM])","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"7c1423d09e4051821d46aced2f145b19ecd174c8","unresolved":false,"context_lines":[{"line_number":304,"context_line":"    def kill(self, sig\u003dsignal.SIGKILL):"},{"line_number":305,"context_line":"        pid \u003d self.child_pid or str(self.pid)"},{"line_number":306,"context_line":"        try:"},{"line_number":307,"context_line":"            utils.execute([\u0027kill\u0027, \u0027-%d\u0027 % sig, pid], run_as_root\u003dTrue)"},{"line_number":308,"context_line":"        except exceptions.ProcessExecutionError as e:"},{"line_number":309,"context_line":"            # NOTE(slaweq): kill command returns errno.EPERM (1) for many"},{"line_number":310,"context_line":"            # different issues, e.g. when there is no such process to kill"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_6573844f","line":307,"in_reply_to":"5faad753_456a7db3","updated":"2019-11-26 11:48:29.000000000","message":"But then I would not be able to check what kind of error message it was in fact so I think I will stay with try...except... here","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":21798,"name":"Bernard Cafarelli","email":"bcafarel@redhat.com","username":"bcafarel"},"change_message_id":"f96348ed598f23af5d18193adfd942cbee9b4d15","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            # (which we want to handle here) but also in cases like e.g. when"},{"line_number":312,"context_line":"            # user don\u0027t have privileges to kill process (which we don\u0027t want"},{"line_number":313,"context_line":"            # to silently hide)"},{"line_number":314,"context_line":"            if e.returncode !\u003d errno.EPERM or \"No such process\" not in str(e):"},{"line_number":315,"context_line":"                raise"},{"line_number":316,"context_line":"            LOG.debug(\"Process %s didn\u0027t exists already so it couldn\u0027t be \""},{"line_number":317,"context_line":"                      \"killed\", pid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5faad753_45959d3f","line":314,"range":{"start_line":314,"start_character":37,"end_line":314,"end_character":42},"updated":"2019-09-10 13:56:16.000000000","message":"Technically I am not even sure this is EPERM from kill(2), it is just error code?","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"3dbbf11028a519659b912bb7db60e1da3aeb634b","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            # (which we want to handle here) but also in cases like e.g. when"},{"line_number":312,"context_line":"            # user don\u0027t have privileges to kill process (which we don\u0027t want"},{"line_number":313,"context_line":"            # to silently hide)"},{"line_number":314,"context_line":"            if e.returncode !\u003d errno.EPERM or \"No such process\" not in str(e):"},{"line_number":315,"context_line":"                raise"},{"line_number":316,"context_line":"            LOG.debug(\"Process %s didn\u0027t exists already so it couldn\u0027t be \""},{"line_number":317,"context_line":"                      \"killed\", pid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5faad753_453cbdc7","line":314,"range":{"start_line":314,"start_character":15,"end_line":314,"end_character":75},"updated":"2019-09-10 13:48:20.000000000","message":"When this is not going to be the same?","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"7c1423d09e4051821d46aced2f145b19ecd174c8","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            # (which we want to handle here) but also in cases like e.g. when"},{"line_number":312,"context_line":"            # user don\u0027t have privileges to kill process (which we don\u0027t want"},{"line_number":313,"context_line":"            # to silently hide)"},{"line_number":314,"context_line":"            if e.returncode !\u003d errno.EPERM or \"No such process\" not in str(e):"},{"line_number":315,"context_line":"                raise"},{"line_number":316,"context_line":"            LOG.debug(\"Process %s didn\u0027t exists already so it couldn\u0027t be \""},{"line_number":317,"context_line":"                      \"killed\", pid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_258fcc23","line":314,"range":{"start_line":314,"start_character":15,"end_line":314,"end_character":75},"in_reply_to":"3fa7e38b_c2834ea8","updated":"2019-11-26 11:48:29.000000000","message":"Done","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"a96cd73e28c228036acff6167c30fb9ab33b37a0","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            # (which we want to handle here) but also in cases like e.g. when"},{"line_number":312,"context_line":"            # user don\u0027t have privileges to kill process (which we don\u0027t want"},{"line_number":313,"context_line":"            # to silently hide)"},{"line_number":314,"context_line":"            if e.returncode !\u003d errno.EPERM or \"No such process\" not in str(e):"},{"line_number":315,"context_line":"                raise"},{"line_number":316,"context_line":"            LOG.debug(\"Process %s didn\u0027t exists already so it couldn\u0027t be \""},{"line_number":317,"context_line":"                      \"killed\", pid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5faad753_603767e5","line":314,"range":{"start_line":314,"start_character":15,"end_line":314,"end_character":75},"in_reply_to":"5faad753_0508052a","updated":"2019-09-10 14:11:40.000000000","message":"\u003e\u003e\u003e import os\n\u003e\u003e\u003e os.kill(25899, 9)\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\nProcessLookupError: [Errno 3] No such process\n\u003e\u003e\u003e os.kill(25948, 9)\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\nPermissionError: [Errno 1] Operation not permitted\n\n\nBut we\u0027ll need to implement a privileged operation for this, in case of run_as_root\u003dTrue","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":21798,"name":"Bernard Cafarelli","email":"bcafarel@redhat.com","username":"bcafarel"},"change_message_id":"f96348ed598f23af5d18193adfd942cbee9b4d15","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            # (which we want to handle here) but also in cases like e.g. when"},{"line_number":312,"context_line":"            # user don\u0027t have privileges to kill process (which we don\u0027t want"},{"line_number":313,"context_line":"            # to silently hide)"},{"line_number":314,"context_line":"            if e.returncode !\u003d errno.EPERM or \"No such process\" not in str(e):"},{"line_number":315,"context_line":"                raise"},{"line_number":316,"context_line":"            LOG.debug(\"Process %s didn\u0027t exists already so it couldn\u0027t be \""},{"line_number":317,"context_line":"                      \"killed\", pid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5faad753_45d03d20","line":314,"range":{"start_line":314,"start_character":15,"end_line":314,"end_character":75},"in_reply_to":"5faad753_453cbdc7","updated":"2019-09-10 13:56:16.000000000","message":"kill has basic error reporting, from man 1 kill:\n       kill has the following return codes:\n\n       0      success\n\n       1      failure\n\n       64     partial success (when more than one process specified)\n\nSo you will get 1 on most errors here :/ (I wonder, is there not a pythonic way to do sudo kill?)","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"0eb73497bff0e6ec1c46b61d9fd85df34474f4f2","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            # (which we want to handle here) but also in cases like e.g. when"},{"line_number":312,"context_line":"            # user don\u0027t have privileges to kill process (which we don\u0027t want"},{"line_number":313,"context_line":"            # to silently hide)"},{"line_number":314,"context_line":"            if e.returncode !\u003d errno.EPERM or \"No such process\" not in str(e):"},{"line_number":315,"context_line":"                raise"},{"line_number":316,"context_line":"            LOG.debug(\"Process %s didn\u0027t exists already so it couldn\u0027t be \""},{"line_number":317,"context_line":"                      \"killed\", pid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5faad753_0508052a","line":314,"range":{"start_line":314,"start_character":15,"end_line":314,"end_character":75},"in_reply_to":"5faad753_45d03d20","updated":"2019-09-10 14:10:06.000000000","message":"os.kill(pid, signal.SIGKILL)\n\nBernard is right (and I tested it): all errors will output \"1\". So the only way to differentiate the real error is only the string.\n\n\u003e\u003e\u003e utils.execute([\u0027kill\u0027, \u0027-kill\u0027, \u002725899\u0027])\nExit code: 1; Stdin: ; Stdout: ; Stderr: kill: (25899): No such process\n\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n  File \"/opt/stack/neutron/neutron/agent/linux/utils.py\", line 147, in execute\n    returncode\u003dreturncode)\nneutron_lib.exceptions.ProcessExecutionError: Exit code: 1; Stdin: ; Stdout: ; Stderr: kill: (25899): No such process\n\n\u003e\u003e\u003e utils.execute([\u0027kill\u0027, \u0027-kill\u0027, \u002725948\u0027])\nExit code: 1; Stdin: ; Stdout: ; Stderr: kill: (25948): Operation not permitted\n\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n  File \"/opt/stack/neutron/neutron/agent/linux/utils.py\", line 147, in execute\n    returncode\u003dreturncode)\nneutron_lib.exceptions.ProcessExecutionError: Exit code: 1; Stdin: ; Stdout: ; Stderr: kill: (25948): Operation not permitted","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"bc2c67dfb3c9e90a281b8b4dc755249e6a03e1a5","unresolved":false,"context_lines":[{"line_number":311,"context_line":"            # (which we want to handle here) but also in cases like e.g. when"},{"line_number":312,"context_line":"            # user don\u0027t have privileges to kill process (which we don\u0027t want"},{"line_number":313,"context_line":"            # to silently hide)"},{"line_number":314,"context_line":"            if e.returncode !\u003d errno.EPERM or \"No such process\" not in str(e):"},{"line_number":315,"context_line":"                raise"},{"line_number":316,"context_line":"            LOG.debug(\"Process %s didn\u0027t exists already so it couldn\u0027t be \""},{"line_number":317,"context_line":"                      \"killed\", pid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_c2834ea8","line":314,"range":{"start_line":314,"start_character":15,"end_line":314,"end_character":75},"in_reply_to":"5faad753_603767e5","updated":"2019-11-21 09:19:17.000000000","message":"Bernard is right: the returncode is NOT an error code. We need to check the text only.","commit_id":"fe2a9a9aeacab06c1ef0ae73d9fe8c5349d57b33"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"f811783cec756cc21bfad29448dfd948711c14df","unresolved":false,"context_lines":[{"line_number":16,"context_line":"import abc"},{"line_number":17,"context_line":"from concurrent import futures"},{"line_number":18,"context_line":"import contextlib"},{"line_number":19,"context_line":"import errno"},{"line_number":20,"context_line":"import os"},{"line_number":21,"context_line":"import random"},{"line_number":22,"context_line":"import re"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_b640d036","line":19,"range":{"start_line":19,"start_character":0,"end_line":19,"end_character":12},"updated":"2019-11-21 12:22:13.000000000","message":"it is not used","commit_id":"585acf21dd28fcfea89f5b3b201284bd325aa82b"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"7c1423d09e4051821d46aced2f145b19ecd174c8","unresolved":false,"context_lines":[{"line_number":16,"context_line":"import abc"},{"line_number":17,"context_line":"from concurrent import futures"},{"line_number":18,"context_line":"import contextlib"},{"line_number":19,"context_line":"import errno"},{"line_number":20,"context_line":"import os"},{"line_number":21,"context_line":"import random"},{"line_number":22,"context_line":"import re"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_7117c2ef","line":19,"range":{"start_line":19,"start_character":0,"end_line":19,"end_character":12},"in_reply_to":"3fa7e38b_b640d036","updated":"2019-11-26 11:48:29.000000000","message":"right, I forgot to remove it","commit_id":"585acf21dd28fcfea89f5b3b201284bd325aa82b"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"a81844c3003a7564fe44f50dacc8f791f0498ce5","unresolved":false,"context_lines":[{"line_number":589,"context_line":"        return proc"},{"line_number":590,"context_line":""},{"line_number":591,"context_line":"    def stop_processes(self, skip_errors\u003dNone):"},{"line_number":592,"context_line":"        skip_errors \u003d ([\u0027No such process\u0027] if skip_errors is None"},{"line_number":593,"context_line":"                       else skip_errors)"},{"line_number":594,"context_line":"        for proc_attr in (\u0027_client_process\u0027, \u0027_server_process\u0027):"},{"line_number":595,"context_line":"            proc \u003d getattr(self, proc_attr)"},{"line_number":596,"context_line":"            if proc:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1fa4df85_26098130","line":593,"range":{"start_line":592,"start_character":8,"end_line":593,"end_character":40},"updated":"2020-02-28 12:04:01.000000000","message":"Unneeded, this is the default check in \"kill()\". You can just pass \"skip_errors\".","commit_id":"401a2c1936d7098648f79fc3708d1ecebe75cb77"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"2fdf6535758b5070e65623b71d748f3a42c183ce","unresolved":false,"context_lines":[{"line_number":589,"context_line":"        return proc"},{"line_number":590,"context_line":""},{"line_number":591,"context_line":"    def stop_processes(self, skip_errors\u003dNone):"},{"line_number":592,"context_line":"        skip_errors \u003d ([\u0027No such process\u0027] if skip_errors is None"},{"line_number":593,"context_line":"                       else skip_errors)"},{"line_number":594,"context_line":"        for proc_attr in (\u0027_client_process\u0027, \u0027_server_process\u0027):"},{"line_number":595,"context_line":"            proc \u003d getattr(self, proc_attr)"},{"line_number":596,"context_line":"            if proc:"}],"source_content_type":"text/x-python","patch_set":7,"id":"1fa4df85_d5160df2","line":593,"range":{"start_line":592,"start_character":8,"end_line":593,"end_character":40},"in_reply_to":"1fa4df85_26098130","updated":"2020-02-28 16:19:11.000000000","message":"Done","commit_id":"401a2c1936d7098648f79fc3708d1ecebe75cb77"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"784c66640845ce7e55d0d6639ac165a1b4cd7d89","unresolved":false,"context_lines":[{"line_number":302,"context_line":""},{"line_number":303,"context_line":"    def kill(self, sig\u003dsignal.SIGKILL, skip_errors\u003dNone):"},{"line_number":304,"context_line":"        skip_errors \u003d ("},{"line_number":305,"context_line":"            [\"No such process\"] if skip_errors is None else skip_errors)"},{"line_number":306,"context_line":"        pid \u003d self.child_pid or str(self.pid)"},{"line_number":307,"context_line":"        try:"},{"line_number":308,"context_line":"            utils.execute([\u0027kill\u0027, \u0027-%d\u0027 % sig, pid], run_as_root\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":8,"id":"1f493fa4_d86a35b1","line":305,"range":{"start_line":305,"start_character":12,"end_line":305,"end_character":72},"updated":"2020-04-28 07:54:03.000000000","message":"My idea would be to always have \"No such process\" in skip_errors list even when caller calls with skip_errors\u003d[....]\n\nSo what about :\ndef kill(self, sig, skip_errors\u003d[]):\n   skip_errors.extend([\u0027No such process\u0027])\n?","commit_id":"fd3827031d9922d0224274e5ee3a68f604712e57"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"32757a9f3514fb2336bb1d642d437c27d539c4bf","unresolved":false,"context_lines":[{"line_number":302,"context_line":""},{"line_number":303,"context_line":"    def kill(self, sig\u003dsignal.SIGKILL, skip_errors\u003dNone):"},{"line_number":304,"context_line":"        skip_errors \u003d ("},{"line_number":305,"context_line":"            [\"No such process\"] if skip_errors is None else skip_errors)"},{"line_number":306,"context_line":"        pid \u003d self.child_pid or str(self.pid)"},{"line_number":307,"context_line":"        try:"},{"line_number":308,"context_line":"            utils.execute([\u0027kill\u0027, \u0027-%d\u0027 % sig, pid], run_as_root\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":8,"id":"1f493fa4_86b95416","line":305,"range":{"start_line":305,"start_character":12,"end_line":305,"end_character":72},"in_reply_to":"1f493fa4_6307f683","updated":"2020-04-29 08:43:34.000000000","message":"yeah mutable arguments are a good argument, so +1 for Oleg\u0027s version","commit_id":"fd3827031d9922d0224274e5ee3a68f604712e57"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"3daf64665f3b6ff78b26f130fcb7aa458ffef10a","unresolved":false,"context_lines":[{"line_number":302,"context_line":""},{"line_number":303,"context_line":"    def kill(self, sig\u003dsignal.SIGKILL, skip_errors\u003dNone):"},{"line_number":304,"context_line":"        skip_errors \u003d ("},{"line_number":305,"context_line":"            [\"No such process\"] if skip_errors is None else skip_errors)"},{"line_number":306,"context_line":"        pid \u003d self.child_pid or str(self.pid)"},{"line_number":307,"context_line":"        try:"},{"line_number":308,"context_line":"            utils.execute([\u0027kill\u0027, \u0027-%d\u0027 % sig, pid], run_as_root\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":8,"id":"1f493fa4_6307f683","line":305,"range":{"start_line":305,"start_character":12,"end_line":305,"end_character":72},"in_reply_to":"1f493fa4_b8f649d6","updated":"2020-04-28 09:16:51.000000000","message":"Exactly, please see e.g. https://florimond.dev/blog/articles/2018/08/python-mutable-defaults-are-the-source-of-all-evil/ - we shouldn\u0027t do that never ever :)","commit_id":"fd3827031d9922d0224274e5ee3a68f604712e57"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"3958f5f9247175e76f222f5a899a209e34888a46","unresolved":false,"context_lines":[{"line_number":302,"context_line":""},{"line_number":303,"context_line":"    def kill(self, sig\u003dsignal.SIGKILL, skip_errors\u003dNone):"},{"line_number":304,"context_line":"        skip_errors \u003d ("},{"line_number":305,"context_line":"            [\"No such process\"] if skip_errors is None else skip_errors)"},{"line_number":306,"context_line":"        pid \u003d self.child_pid or str(self.pid)"},{"line_number":307,"context_line":"        try:"},{"line_number":308,"context_line":"            utils.execute([\u0027kill\u0027, \u0027-%d\u0027 % sig, pid], run_as_root\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":8,"id":"1f493fa4_b8f649d6","line":305,"range":{"start_line":305,"start_character":12,"end_line":305,"end_character":72},"in_reply_to":"1f493fa4_d86a35b1","updated":"2020-04-28 08:09:59.000000000","message":"Once you extend skip_errors in function body - default argument will no longer be empty list. So it\u0027s better to avoid mutable default arguments.\n\ndef kill(self, .. skip_errors\u003dNone):\n    skip_errors \u003d skip_errors or [] \n    skip_errors.append([\u0027...\u0027])","commit_id":"fd3827031d9922d0224274e5ee3a68f604712e57"}]}
