We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
TypeError: UpdateResource() takes no keyword arguments
引用了python 3.10.9·pyinstaller 6.1.0·imagehash 4.3.1·pyperclip 1.8.2和pyautogui 0.9.54模块，但是报错，打包的程序也用不了

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `PyInstaller/utils/win32/winresource.py`
Content:
```
1 #-----------------------------------------------------------------------------
2 # Copyright (c) 2013-2023, PyInstaller Development Team.
3 #
4 # Distributed under the terms of the GNU General Public License (version 2
5 # or later) with exception for distributing the bootloader.
6 #
7 # The full license is in the file COPYING.txt, distributed with this software.
8 #
9 # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
10 #-----------------------------------------------------------------------------
11 """
12 Read and write resources from/to Win32 PE files.
13 """
14 
15 import PyInstaller.log as logging
16 from PyInstaller.compat import pywintypes, win32api
17 
18 logger = logging.getLogger(__name__)
19 
20 LOAD_LIBRARY_AS_DATAFILE = 2
21 ERROR_BAD_EXE_FORMAT = 193
22 ERROR_RESOURCE_DATA_NOT_FOUND = 1812
23 ERROR_RESOURCE_TYPE_NOT_FOUND = 1813
24 ERROR_RESOURCE_NAME_NOT_FOUND = 1814
25 ERROR_RESOURCE_LANG_NOT_FOUND = 1815
26 
27 
28 def get_resources(filename, types=None, names=None, languages=None):
29     """
30     Retrieve resources from the given PE file.
31 
32     filename: path to the PE file.
33     types: a list of resource types (integers or strings) to search for (None = all).
34     names: a list of resource names (integers or strings) to search for (None = all).
35     languages: a list of resource languages (integers) to search for (None = all).
36 
37     Returns a dictionary of the form {type: {name: {language: data}}}, which might also be empty if no matching
38     resources were found.
39     """
40     types = set(types) if types is not None else {"*"}
41     names = set(names) if names is not None else {"*"}
42     languages = set(languages) if languages is not None else {"*"}
43 
44     output = {}
45 
46     # Errors codes for which we swallow exceptions
47     _IGNORE_EXCEPTIONS = {
48         ERROR_RESOURCE_DATA_NOT_FOUND,
49         ERROR_RESOURCE_TYPE_NOT_FOUND,
50         ERROR_RESOURCE_NAME_NOT_FOUND,
51         ERROR_RESOURCE_LANG_NOT_FOUND,
52     }
53 
54     # Open file
55     module_handle = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)
56 
57     # Enumerate available resource types
58     try:
59         available_types = win32api.EnumResourceTypes(module_handle)
60     except pywintypes.error as e:
61         if e.args[0] not in _IGNORE_EXCEPTIONS:
62             raise
63         available_types = []
64 
65     if "*" not in types:
66         available_types = [res_type for res_type in available_types if res_type in types]
67 
68     for res_type in available_types:
69         # Enumerate available names for the resource type.
70         try:
71             available_names = win32api.EnumResourceNames(module_handle, res_type)
72         except pywintypes.error as e:
73             if e.args[0] not in _IGNORE_EXCEPTIONS:
74                 raise
75             continue
76 
77         if "*" not in names:
78             available_names = [res_name for res_name in available_names if res_name in names]
79 
80         for res_name in available_names:
81             # Enumerate available languages for the resource type and name combination.
82             try:
83                 available_languages = win32api.EnumResourceLanguages(module_handle, res_type, res_name)
84             except pywintypes.error as e:
85                 if e.args[0] not in _IGNORE_EXCEPTIONS:
86                     raise
87                 continue
88 
89             if "*" not in languages:
90                 available_languages = [res_lang for res_lang in available_languages if res_lang in languages]
91 
92             for res_lang in available_languages:
93                 # Read data
94                 try:
95                     data = win32api.LoadResource(module_handle, res_type, res_name, res_lang)
96                 except pywintypes.error as e:
97                     if e.args[0] not in _IGNORE_EXCEPTIONS:
98                         raise
99                     continue
100 
101                 if res_type not in output:
102                     output[res_type] = {}
103                 if res_name not in output[res_type]:
104                     output[res_type][res_name] = {}
105                 output[res_type][res_name][res_lang] = data
106 
107     # Close file
108     win32api.FreeLibrary(module_handle)
109 
110     return output
111 
112 
113 def add_or_update_resource(filename, data, res_type, names=None, languages=None):
114     """
115     Update or add a single resource in the PE file with the given binary data.
116 
117     filename: path to the PE file.
118     data: binary data to write to the resource.
119     res_type: resource type to add/update (integer or string).
120     names: a list of resource names (integers or strings) to update (None = all).
121     languages: a list of resource languages (integers) to update (None = all).
122     """
123     if res_type == "*":
124         raise ValueError("res_type cannot be a wildcard (*)!")
125 
126     names = set(names) if names is not None else {"*"}
127     languages = set(languages) if languages is not None else {"*"}
128 
129     # Retrieve existing resources, filtered by the given resource type and given resource names and languages.
130     resources = get_resources(filename, [res_type], names, languages)
131 
132     # Add res_type, name, language combinations that are not already present
133     resources = resources.get(res_type, {})  # This is now a {name: {language: data}} dictionary
134 
135     for res_name in names:
136         if res_name == "*":
137             continue
138         if res_name not in resources:
139             resources[res_name] = {}
140 
141         for res_lang in languages:
142             if res_lang == "*":
143                 continue
144             if res_lang not in resources[res_name]:
145                 resources[res_name][res_lang] = None  # Just an indicator
146 
147     # Add resource to the target file, overwriting the existing resources with same type, name, language combinations.
148     module_handle = win32api.BeginUpdateResource(filename, 0)
149     for res_name in resources.keys():
150         for res_lang in resources[res_name].keys():
151             win32api.UpdateResource(module_handle, res_type, res_name, data, language=res_lang)
152     win32api.EndUpdateResource(module_handle, 0)
153 
154 
155 def copy_resources_from_pe_file(filename, src_filename, types=None, names=None, languages=None):
156     """
157     Update or add resources in the given PE file by copying them over from the specified source PE file.
158 
159     filename: path to the PE file.
160     src_filename: path to the source PE file.
161     types: a list of resource types (integers or strings) to add/update via copy for (None = all).
162     names: a list of resource names (integers or strings) to add/update via copy (None = all).
163     languages: a list of resource languages (integers) to add/update via copy (None = all).
164     """
165     types = set(types) if types is not None else {"*"}
166     names = set(names) if names is not None else {"*"}
167     languages = set(languages) if languages is not None else {"*"}
168 
169     # Retrieve existing resources, filtered by the given resource type and given resource names and languages.
170     resources = get_resources(src_filename, types, names, languages)
171 
172     for res_type, resources_for_type in resources.items():
173         if "*" not in types and res_type not in types:
174             continue
175         for res_name, resources_for_type_name in resources_for_type.items():
176             if "*" not in names and res_name not in names:
177                 continue
178             for res_lang, data in resources_for_type_name.items():
179                 if "*" not in languages and res_lang not in languages:
180                     continue
181                 add_or_update_resource(filename, data, res_type, [res_name], [res_lang])
182 
183 
184 def remove_all_resources(filename):
185     """
186     Remove all resources from the given PE file:
187     """
188     module_handle = win32api.BeginUpdateResource(filename, True)  # bDeleteExistingResources=True
189     win32api.EndUpdateResource(module_handle, False)
190
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/PyInstaller/utils/win32/winresource.py b/PyInstaller/utils/win32/winresource.py
--- a/PyInstaller/utils/win32/winresource.py
+++ b/PyInstaller/utils/win32/winresource.py
@@ -148,7 +148,7 @@
     module_handle = win32api.BeginUpdateResource(filename, 0)
     for res_name in resources.keys():
         for res_lang in resources[res_name].keys():
-            win32api.UpdateResource(module_handle, res_type, res_name, data, language=res_lang)
+            win32api.UpdateResource(module_handle, res_type, res_name, data, res_lang)
     win32api.EndUpdateResource(module_handle, 0)

{"golden_diff": "diff --git a/PyInstaller/utils/win32/winresource.py b/PyInstaller/utils/win32/winresource.py\n--- a/PyInstaller/utils/win32/winresource.py\n+++ b/PyInstaller/utils/win32/winresource.py\n@@ -148,7 +148,7 @@\n     module_handle = win32api.BeginUpdateResource(filename, 0)\n     for res_name in resources.keys():\n         for res_lang in resources[res_name].keys():\n-            win32api.UpdateResource(module_handle, res_type, res_name, data, language=res_lang)\n+            win32api.UpdateResource(module_handle, res_type, res_name, data, res_lang)\n     win32api.EndUpdateResource(module_handle, 0)\n", "issue": "TypeError: UpdateResource() takes no keyword arguments\n\u5f15\u7528\u4e86python 3.10.9\u00b7pyinstaller 6.1.0\u00b7imagehash 4.3.1\u00b7pyperclip 1.8.2\u548cpyautogui 0.9.54\u6a21\u5757\uff0c\u4f46\u662f\u62a5\u9519\uff0c\u6253\u5305\u7684\u7a0b\u5e8f\u4e5f\u7528\u4e0d\u4e86\n", "before_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2013-2023, PyInstaller Development Team.\n#\n# Distributed under the terms of the GNU General Public License (version 2\n# or later) with exception for distributing the bootloader.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#\n# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)\n#-----------------------------------------------------------------------------\n\"\"\"\nRead and write resources from/to Win32 PE files.\n\"\"\"\n\nimport PyInstaller.log as logging\nfrom PyInstaller.compat import pywintypes, win32api\n\nlogger = logging.getLogger(__name__)\n\nLOAD_LIBRARY_AS_DATAFILE = 2\nERROR_BAD_EXE_FORMAT = 193\nERROR_RESOURCE_DATA_NOT_FOUND = 1812\nERROR_RESOURCE_TYPE_NOT_FOUND = 1813\nERROR_RESOURCE_NAME_NOT_FOUND = 1814\nERROR_RESOURCE_LANG_NOT_FOUND = 1815\n\n\ndef get_resources(filename, types=None, names=None, languages=None):\n    \"\"\"\n    Retrieve resources from the given PE file.\n\n    filename: path to the PE file.\n    types: a list of resource types (integers or strings) to search for (None = all).\n    names: a list of resource names (integers or strings) to search for (None = all).\n    languages: a list of resource languages (integers) to search for (None = all).\n\n    Returns a dictionary of the form {type: {name: {language: data}}}, which might also be empty if no matching\n    resources were found.\n    \"\"\"\n    types = set(types) if types is not None else {\"*\"}\n    names = set(names) if names is not None else {\"*\"}\n    languages = set(languages) if languages is not None else {\"*\"}\n\n    output = {}\n\n    # Errors codes for which we swallow exceptions\n    _IGNORE_EXCEPTIONS = {\n        ERROR_RESOURCE_DATA_NOT_FOUND,\n        ERROR_RESOURCE_TYPE_NOT_FOUND,\n        ERROR_RESOURCE_NAME_NOT_FOUND,\n        ERROR_RESOURCE_LANG_NOT_FOUND,\n    }\n\n    # Open file\n    module_handle = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)\n\n    # Enumerate available resource types\n    try:\n        available_types = win32api.EnumResourceTypes(module_handle)\n    except pywintypes.error as e:\n        if e.args[0] not in _IGNORE_EXCEPTIONS:\n            raise\n        available_types = []\n\n    if \"*\" not in types:\n        available_types = [res_type for res_type in available_types if res_type in types]\n\n    for res_type in available_types:\n        # Enumerate available names for the resource type.\n        try:\n            available_names = win32api.EnumResourceNames(module_handle, res_type)\n        except pywintypes.error as e:\n            if e.args[0] not in _IGNORE_EXCEPTIONS:\n                raise\n            continue\n\n        if \"*\" not in names:\n            available_names = [res_name for res_name in available_names if res_name in names]\n\n        for res_name in available_names:\n            # Enumerate available languages for the resource type and name combination.\n            try:\n                available_languages = win32api.EnumResourceLanguages(module_handle, res_type, res_name)\n            except pywintypes.error as e:\n                if e.args[0] not in _IGNORE_EXCEPTIONS:\n                    raise\n                continue\n\n            if \"*\" not in languages:\n                available_languages = [res_lang for res_lang in available_languages if res_lang in languages]\n\n            for res_lang in available_languages:\n                # Read data\n                try:\n                    data = win32api.LoadResource(module_handle, res_type, res_name, res_lang)\n                except pywintypes.error as e:\n                    if e.args[0] not in _IGNORE_EXCEPTIONS:\n                        raise\n                    continue\n\n                if res_type not in output:\n                    output[res_type] = {}\n                if res_name not in output[res_type]:\n                    output[res_type][res_name] = {}\n                output[res_type][res_name][res_lang] = data\n\n    # Close file\n    win32api.FreeLibrary(module_handle)\n\n    return output\n\n\ndef add_or_update_resource(filename, data, res_type, names=None, languages=None):\n    \"\"\"\n    Update or add a single resource in the PE file with the given binary data.\n\n    filename: path to the PE file.\n    data: binary data to write to the resource.\n    res_type: resource type to add/update (integer or string).\n    names: a list of resource names (integers or strings) to update (None = all).\n    languages: a list of resource languages (integers) to update (None = all).\n    \"\"\"\n    if res_type == \"*\":\n        raise ValueError(\"res_type cannot be a wildcard (*)!\")\n\n    names = set(names) if names is not None else {\"*\"}\n    languages = set(languages) if languages is not None else {\"*\"}\n\n    # Retrieve existing resources, filtered by the given resource type and given resource names and languages.\n    resources = get_resources(filename, [res_type], names, languages)\n\n    # Add res_type, name, language combinations that are not already present\n    resources = resources.get(res_type, {})  # This is now a {name: {language: data}} dictionary\n\n    for res_name in names:\n        if res_name == \"*\":\n            continue\n        if res_name not in resources:\n            resources[res_name] = {}\n\n        for res_lang in languages:\n            if res_lang == \"*\":\n                continue\n            if res_lang not in resources[res_name]:\n                resources[res_name][res_lang] = None  # Just an indicator\n\n    # Add resource to the target file, overwriting the existing resources with same type, name, language combinations.\n    module_handle = win32api.BeginUpdateResource(filename, 0)\n    for res_name in resources.keys():\n        for res_lang in resources[res_name].keys():\n            win32api.UpdateResource(module_handle, res_type, res_name, data, language=res_lang)\n    win32api.EndUpdateResource(module_handle, 0)\n\n\ndef copy_resources_from_pe_file(filename, src_filename, types=None, names=None, languages=None):\n    \"\"\"\n    Update or add resources in the given PE file by copying them over from the specified source PE file.\n\n    filename: path to the PE file.\n    src_filename: path to the source PE file.\n    types: a list of resource types (integers or strings) to add/update via copy for (None = all).\n    names: a list of resource names (integers or strings) to add/update via copy (None = all).\n    languages: a list of resource languages (integers) to add/update via copy (None = all).\n    \"\"\"\n    types = set(types) if types is not None else {\"*\"}\n    names = set(names) if names is not None else {\"*\"}\n    languages = set(languages) if languages is not None else {\"*\"}\n\n    # Retrieve existing resources, filtered by the given resource type and given resource names and languages.\n    resources = get_resources(src_filename, types, names, languages)\n\n    for res_type, resources_for_type in resources.items():\n        if \"*\" not in types and res_type not in types:\n            continue\n        for res_name, resources_for_type_name in resources_for_type.items():\n            if \"*\" not in names and res_name not in names:\n                continue\n            for res_lang, data in resources_for_type_name.items():\n                if \"*\" not in languages and res_lang not in languages:\n                    continue\n                add_or_update_resource(filename, data, res_type, [res_name], [res_lang])\n\n\ndef remove_all_resources(filename):\n    \"\"\"\n    Remove all resources from the given PE file:\n    \"\"\"\n    module_handle = win32api.BeginUpdateResource(filename, True)  # bDeleteExistingResources=True\n    win32api.EndUpdateResource(module_handle, False)\n", "path": "PyInstaller/utils/win32/winresource.py"}], "after_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2013-2023, PyInstaller Development Team.\n#\n# Distributed under the terms of the GNU General Public License (version 2\n# or later) with exception for distributing the bootloader.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#\n# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)\n#-----------------------------------------------------------------------------\n\"\"\"\nRead and write resources from/to Win32 PE files.\n\"\"\"\n\nimport PyInstaller.log as logging\nfrom PyInstaller.compat import pywintypes, win32api\n\nlogger = logging.getLogger(__name__)\n\nLOAD_LIBRARY_AS_DATAFILE = 2\nERROR_BAD_EXE_FORMAT = 193\nERROR_RESOURCE_DATA_NOT_FOUND = 1812\nERROR_RESOURCE_TYPE_NOT_FOUND = 1813\nERROR_RESOURCE_NAME_NOT_FOUND = 1814\nERROR_RESOURCE_LANG_NOT_FOUND = 1815\n\n\ndef get_resources(filename, types=None, names=None, languages=None):\n    \"\"\"\n    Retrieve resources from the given PE file.\n\n    filename: path to the PE file.\n    types: a list of resource types (integers or strings) to search for (None = all).\n    names: a list of resource names (integers or strings) to search for (None = all).\n    languages: a list of resource languages (integers) to search for (None = all).\n\n    Returns a dictionary of the form {type: {name: {language: data}}}, which might also be empty if no matching\n    resources were found.\n    \"\"\"\n    types = set(types) if types is not None else {\"*\"}\n    names = set(names) if names is not None else {\"*\"}\n    languages = set(languages) if languages is not None else {\"*\"}\n\n    output = {}\n\n    # Errors codes for which we swallow exceptions\n    _IGNORE_EXCEPTIONS = {\n        ERROR_RESOURCE_DATA_NOT_FOUND,\n        ERROR_RESOURCE_TYPE_NOT_FOUND,\n        ERROR_RESOURCE_NAME_NOT_FOUND,\n        ERROR_RESOURCE_LANG_NOT_FOUND,\n    }\n\n    # Open file\n    module_handle = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)\n\n    # Enumerate available resource types\n    try:\n        available_types = win32api.EnumResourceTypes(module_handle)\n    except pywintypes.error as e:\n        if e.args[0] not in _IGNORE_EXCEPTIONS:\n            raise\n        available_types = []\n\n    if \"*\" not in types:\n        available_types = [res_type for res_type in available_types if res_type in types]\n\n    for res_type in available_types:\n        # Enumerate available names for the resource type.\n        try:\n            available_names = win32api.EnumResourceNames(module_handle, res_type)\n        except pywintypes.error as e:\n            if e.args[0] not in _IGNORE_EXCEPTIONS:\n                raise\n            continue\n\n        if \"*\" not in names:\n            available_names = [res_name for res_name in available_names if res_name in names]\n\n        for res_name in available_names:\n            # Enumerate available languages for the resource type and name combination.\n            try:\n                available_languages = win32api.EnumResourceLanguages(module_handle, res_type, res_name)\n            except pywintypes.error as e:\n                if e.args[0] not in _IGNORE_EXCEPTIONS:\n                    raise\n                continue\n\n            if \"*\" not in languages:\n                available_languages = [res_lang for res_lang in available_languages if res_lang in languages]\n\n            for res_lang in available_languages:\n                # Read data\n                try:\n                    data = win32api.LoadResource(module_handle, res_type, res_name, res_lang)\n                except pywintypes.error as e:\n                    if e.args[0] not in _IGNORE_EXCEPTIONS:\n                        raise\n                    continue\n\n                if res_type not in output:\n                    output[res_type] = {}\n                if res_name not in output[res_type]:\n                    output[res_type][res_name] = {}\n                output[res_type][res_name][res_lang] = data\n\n    # Close file\n    win32api.FreeLibrary(module_handle)\n\n    return output\n\n\ndef add_or_update_resource(filename, data, res_type, names=None, languages=None):\n    \"\"\"\n    Update or add a single resource in the PE file with the given binary data.\n\n    filename: path to the PE file.\n    data: binary data to write to the resource.\n    res_type: resource type to add/update (integer or string).\n    names: a list of resource names (integers or strings) to update (None = all).\n    languages: a list of resource languages (integers) to update (None = all).\n    \"\"\"\n    if res_type == \"*\":\n        raise ValueError(\"res_type cannot be a wildcard (*)!\")\n\n    names = set(names) if names is not None else {\"*\"}\n    languages = set(languages) if languages is not None else {\"*\"}\n\n    # Retrieve existing resources, filtered by the given resource type and given resource names and languages.\n    resources = get_resources(filename, [res_type], names, languages)\n\n    # Add res_type, name, language combinations that are not already present\n    resources = resources.get(res_type, {})  # This is now a {name: {language: data}} dictionary\n\n    for res_name in names:\n        if res_name == \"*\":\n            continue\n        if res_name not in resources:\n            resources[res_name] = {}\n\n        for res_lang in languages:\n            if res_lang == \"*\":\n                continue\n            if res_lang not in resources[res_name]:\n                resources[res_name][res_lang] = None  # Just an indicator\n\n    # Add resource to the target file, overwriting the existing resources with same type, name, language combinations.\n    module_handle = win32api.BeginUpdateResource(filename, 0)\n    for res_name in resources.keys():\n        for res_lang in resources[res_name].keys():\n            win32api.UpdateResource(module_handle, res_type, res_name, data, res_lang)\n    win32api.EndUpdateResource(module_handle, 0)\n\n\ndef copy_resources_from_pe_file(filename, src_filename, types=None, names=None, languages=None):\n    \"\"\"\n    Update or add resources in the given PE file by copying them over from the specified source PE file.\n\n    filename: path to the PE file.\n    src_filename: path to the source PE file.\n    types: a list of resource types (integers or strings) to add/update via copy for (None = all).\n    names: a list of resource names (integers or strings) to add/update via copy (None = all).\n    languages: a list of resource languages (integers) to add/update via copy (None = all).\n    \"\"\"\n    types = set(types) if types is not None else {\"*\"}\n    names = set(names) if names is not None else {\"*\"}\n    languages = set(languages) if languages is not None else {\"*\"}\n\n    # Retrieve existing resources, filtered by the given resource type and given resource names and languages.\n    resources = get_resources(src_filename, types, names, languages)\n\n    for res_type, resources_for_type in resources.items():\n        if \"*\" not in types and res_type not in types:\n            continue\n        for res_name, resources_for_type_name in resources_for_type.items():\n            if \"*\" not in names and res_name not in names:\n                continue\n            for res_lang, data in resources_for_type_name.items():\n                if \"*\" not in languages and res_lang not in languages:\n                    continue\n                add_or_update_resource(filename, data, res_type, [res_name], [res_lang])\n\n\ndef remove_all_resources(filename):\n    \"\"\"\n    Remove all resources from the given PE file:\n    \"\"\"\n    module_handle = win32api.BeginUpdateResource(filename, True)  # bDeleteExistingResources=True\n    win32api.EndUpdateResource(module_handle, False)\n", "path": "PyInstaller/utils/win32/winresource.py"}]}