diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 8ebe1dd98..89d51edac 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -13,6 +13,10 @@ For a list of important changes that require manual actions, please look at rele [[v4.0.5]] == Version 4.0.5 (under dev) +New features:: + + * python: make stub (weechat.pyi) compatible with Python 3.8 and 3.9 (issue #2006) + Bug fixes:: * irc: fix string comparison when CASEMAPPING is set to "ascii" diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc index b450ef8d2..cb96a0f68 100644 --- a/doc/en/weechat_plugin_api.en.adoc +++ b/doc/en/weechat_plugin_api.en.adoc @@ -6796,7 +6796,7 @@ def config_new_section(config_file: str, name: str, callback_delete_option: str, callback_delete_option_data: str) -> str: ... # example -def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: +def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -6815,7 +6815,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str) # return weechat.WEECHAT_CONFIG_WRITE_ERROR # return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR -def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: +def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -7056,7 +7056,7 @@ Script (Python): # prototype def config_new_option(config_file: str, section: str, name: str, type: str, description: str, string_values: str, min: int, max: int, - default_value: str | None, value: str | None, null_value_allowed: int, + default_value: Union[str, None], value: Union[str, None], null_value_allowed: int, callback_check_value: str, callback_check_value_data: str, callback_change: str, callback_change_data: str, callback_delete: str, callback_delete_data: str) -> str: ... diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc index dc76d8667..89a621bc2 100644 --- a/doc/fr/weechat_plugin_api.fr.adoc +++ b/doc/fr/weechat_plugin_api.fr.adoc @@ -6911,7 +6911,7 @@ def config_new_section(config_file: str, name: str, callback_delete_option: str, callback_delete_option_data: str) -> str: ... # exemple -def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: +def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -6930,7 +6930,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str) # return weechat.WEECHAT_CONFIG_WRITE_ERROR # return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR -def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: +def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -7176,7 +7176,7 @@ Script (Python) : # prototype def config_new_option(config_file: str, section: str, name: str, type: str, description: str, string_values: str, min: int, max: int, - default_value: str | None, value: str | None, null_value_allowed: int, + default_value: Union[str, None], value: Union[str, None], null_value_allowed: int, callback_check_value: str, callback_check_value_data: str, callback_change: str, callback_change_data: str, callback_delete: str, callback_delete_data: str) -> str: ... diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc index 21faf71b4..d6f1788d7 100644 --- a/doc/it/weechat_plugin_api.it.adoc +++ b/doc/it/weechat_plugin_api.it.adoc @@ -7072,7 +7072,7 @@ def config_new_section(config_file: str, name: str, callback_delete_option: str, callback_delete_option_data: str) -> str: ... # esempio -def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: +def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -7091,7 +7091,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str) # return weechat.WEECHAT_CONFIG_WRITE_ERROR # return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR -def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: +def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -7337,7 +7337,7 @@ Script (Python): # prototipo def config_new_option(config_file: str, section: str, name: str, type: str, description: str, string_values: str, min: int, max: int, - default_value: str | None, value: str | None, null_value_allowed: int, + default_value: Union[str, None], value: Union[str, None], null_value_allowed: int, callback_check_value: str, callback_check_value_data: str, callback_change: str, callback_change_data: str, callback_delete: str, callback_delete_data: str) -> str: ... diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc index a91911069..0c7196719 100644 --- a/doc/ja/weechat_plugin_api.ja.adoc +++ b/doc/ja/weechat_plugin_api.ja.adoc @@ -6876,7 +6876,7 @@ def config_new_section(config_file: str, name: str, callback_delete_option: str, callback_delete_option_data: str) -> str: ... # 例 -def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: +def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -6895,7 +6895,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str) # return weechat.WEECHAT_CONFIG_WRITE_ERROR # return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR -def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: +def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -7136,7 +7136,7 @@ struct t_config_option *option5 = # プロトタイプ def config_new_option(config_file: str, section: str, name: str, type: str, description: str, string_values: str, min: int, max: int, - default_value: str | None, value: str | None, null_value_allowed: int, + default_value: Union[str, None], value: Union[str, None], null_value_allowed: int, callback_check_value: str, callback_check_value_data: str, callback_change: str, callback_change_data: str, callback_delete: str, callback_delete_data: str) -> str: ... diff --git a/doc/python_stub.py b/doc/python_stub.py index f37eddbe8..848cd16ac 100755 --- a/doc/python_stub.py +++ b/doc/python_stub.py @@ -37,7 +37,7 @@ STUB_HEADER = """\ # DO NOT EDIT BY HAND! # -from typing import Dict +from typing import Dict, Union """ CONSTANT_RE = ( diff --git a/doc/sr/weechat_plugin_api.sr.adoc b/doc/sr/weechat_plugin_api.sr.adoc index adc3f536e..5a3cb7460 100644 --- a/doc/sr/weechat_plugin_api.sr.adoc +++ b/doc/sr/weechat_plugin_api.sr.adoc @@ -6601,7 +6601,7 @@ def config_new_section(config_file: str, name: str, callback_delete_option: str, callback_delete_option_data: str) -> str: ... # пример -def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: +def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -6620,7 +6620,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str) # return weechat.WEECHAT_CONFIG_WRITE_ERROR # return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR -def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: +def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -6844,7 +6844,7 @@ struct t_config_option *option5 = # прототип def config_new_option(config_file: str, section: str, name: str, type: str, description: str, string_values: str, min: int, max: int, - default_value: str | None, value: str | None, null_value_allowed: int, + default_value: Union[str, None], value: Union[str, None], null_value_allowed: int, callback_check_value: str, callback_check_value_data: str, callback_change: str, callback_change_data: str, callback_delete: str, callback_delete_data: str) -> str: ... diff --git a/src/plugins/python/weechat.pyi b/src/plugins/python/weechat.pyi index d3c2cb214..82fb71738 100644 --- a/src/plugins/python/weechat.pyi +++ b/src/plugins/python/weechat.pyi @@ -3,7 +3,7 @@ # DO NOT EDIT BY HAND! # -from typing import Dict +from typing import Dict, Union WEECHAT_RC_OK: int = 0 WEECHAT_RC_OK_EAT: int = 1 @@ -539,7 +539,7 @@ def config_new_section(config_file: str, name: str, :: # example - def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: + def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -558,7 +558,7 @@ def config_new_section(config_file: str, name: str, # return weechat.WEECHAT_CONFIG_WRITE_ERROR # return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR - def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: + def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -594,7 +594,7 @@ def config_search_section(config_file: str, section_name: str) -> str: def config_new_option(config_file: str, section: str, name: str, type: str, description: str, string_values: str, min: int, max: int, - default_value: str | None, value: str | None, null_value_allowed: int, + default_value: Union[str, None], value: Union[str, None], null_value_allowed: int, callback_check_value: str, callback_check_value_data: str, callback_change: str, callback_change_data: str, callback_delete: str, callback_delete_data: str) -> str: