This value determines the size of the per-module memory area. Setting
this value to -1 as it was before this change means that the module has
global state and therefore does not support subinterpreters.
However, subinterpreters are used to run the Python scripts, so the
weechat module has to support subinterpreters. Therefore we should set
this value to 0 as no per-module memory is required.
This seems to fix the crash reported in #2046 without the need for the
workaround added in commit 85c7494dc (it does for me when testing with
Python 3.12.0 at least).
This change came up as a suggestion in cpython's issue tracker where it
was pointed out that using modules with m_size set to -1 is not
supported in subinterpreters. See these two comments:
https://github.com/python/cpython/issues/116510#issuecomment-2377915771
https://github.com/python/cpython/issues/116510#issuecomment-2389485369
It's not completely clear to me what is required for a module to support
subinterpreters and re-initialization (which is required for setting
m_size to 0), but https://peps.pythondiscord.com/pep-0489/ says:
A simple rule of thumb is: Do not define any static data, except
built-in types with no mutable or user-settable class attributes.
The only static data we define is of type int and str, so I think it
should be fine.
WeeChat
WeeChat (Wee Enhanced Environment for Chat) is a free chat client, fast and light, designed for many operating systems.
It is highly customizable and extensible with scripts.
Homepage: https://weechat.org/
Features
- Modular chat client: WeeChat has a lightweight core and optional plugins. All plugins (including IRC) are independent and can be unloaded.
- Multi-platform: WeeChat runs on GNU/Linux, *BSD, GNU/Hurd, Haiku, macOS and Windows (Bash/Ubuntu and Cygwin).
- Multi-protocols: WeeChat is designed to support multiple protocols by plugins, like IRC.
- Standards-compliant: the IRC plugin is compliant with RFCs 1459, 2810, 2811, 2812, 2813 and 7194.
- Small, fast, and very light: the core is and should stay as light and fast as possible.
- Customizable and extensible: there are a lot of options to customize WeeChat, and it is extensible with C plugins and scripts (Perl, Python, Ruby, Lua, Tcl, Scheme, JavaScript and PHP).
- Fully documented: there is comprehensive documentation, which is translated into several languages.
- Developed from scratch: WeeChat was built from scratch and is not based on any other client.
- Free software: WeeChat is released under GPLv3.
On WeeChat's website you can find more screenshots.
Installation
WeeChat can be installed using your favorite package manager (recommended) or by compiling it yourself.
For detailed instructions, please check the WeeChat user's guide.
Semantic versioning
WeeChat is following a "practical" semantic versioning, see file CONTRIBUTING.md.
Copyright
Copyright © 2003-2024 Sébastien Helleu
This file is part of WeeChat, the extensible chat client.
WeeChat is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
WeeChat is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with WeeChat. If not, see https://www.gnu.org/licenses/.

