The title says it all. I have observed that the `OnChanMsg` method on a python module is being called twice per message. It seems that `modpython` calls `OnChanMsg` in its override of `OnChanTextMessage` https://github.com/znc/znc/blob/d58563a88014610b0fd1112e74f7e127d55774b4/modules/modpython/znc.py#L640 but so does the core https://github.com/znc/znc/blob/d58563a88014610b0fd1112e74f7e127d55774b4/src/Modules.cpp#L947
<!-- github-sync-id:345483227 -->
Your python module is broken, and doesn't follow the contract. My telepathy skills tell me that you didn't return the EModRet value from your OnChanMsg, but next time please pastebin the module, so that I don't have to guess.
Your python module is broken, and doesn't follow the contract. My telepathy skills tell me that you didn't return the `EModRet` value from your `OnChanMsg`, but next time please pastebin the module, so that I don't have to guess.
<!-- github-comment-id:408644065 -->
The module in question is https://github.com/snoonetIRC/znc-modules/blob/master/push.py and you were correct. The original author of the module neglected to return znc.CONTINUE from some of the callbacks that have an EModRet return value. Sorry to bother you.
The module in question is https://github.com/snoonetIRC/znc-modules/blob/master/push.py and you were correct. The original author of the module neglected to return `znc.CONTINUE` from some of the callbacks that have an `EModRet` return value. Sorry to bother you.
<!-- github-comment-id:408645626 -->
Your python module is broken, and doesn't follow the contract. My telepathy skills tell me that you didn't return the EModRet value from your OnChanMsg, but next time please pastebin the module, so that I don't have to guess.
According to the modpython documentation, functions that return None should have a 'reasonable default' substituted (If a callback returns None, a reasonable default is substituted. If a callback raises an exception, the default value is assumed too. Note: You should return something explicitly anyway (PEP 20), also such default behavior WILL be changed in some future version.)
The function being called twice does not exactly fit under reasonable default, and while this is now a deprecated function, it should still maintain past functionality. Or the docs should be changed to indicate that a return is required rather than simply suggested. Especially given that this was not always the case.
>Your python module is broken, and doesn't follow the contract. My telepathy skills tell me that you didn't return the EModRet value from your OnChanMsg, but next time please pastebin the module, so that I don't have to guess.
According to the [modpython documentation](https://wiki.znc.in/Modpython), functions that return None should have a 'reasonable default' substituted (`If a callback returns None, a reasonable default is substituted. If a callback raises an exception, the default value is assumed too. Note: You should return something explicitly anyway (PEP 20), also such default behavior WILL be changed in some future version.`)
The function being called twice does not exactly fit under `reasonable default`, and while this is now a deprecated function, it should still maintain past functionality. Or the docs should be changed to indicate that a return is **required** rather than simply suggested. Especially given that this was not always the case.
<!-- github-comment-id:408994055 -->
also such default behavior WILL be changed in some future version
It was changed in 1.7, alright :) But docs should be updated to reflect this, sure.
> also such default behavior WILL be changed in some future version
It was changed in 1.7, alright :) But docs should be updated to reflect this, sure.
<!-- github-comment-id:409055011 -->
This started as an implementation detail, followed by the description of current behavior, with no guarantees that this behavior will persist, even vice versa, it was suggested that it will not persist.
This started as an implementation detail, followed by the description of current behavior, *with no guarantees* that this behavior will persist, even vice versa, it was suggested that it will *not* persist.
<!-- github-comment-id:409055619 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The title says it all. I have observed that the
OnChanMsgmethod on a python module is being called twice per message. It seems thatmodpythoncallsOnChanMsgin its override ofOnChanTextMessagehttps://github.com/znc/znc/blob/d58563a88014610b0fd1112e74f7e127d55774b4/modules/modpython/znc.py#L640 but so does the core https://github.com/znc/znc/blob/d58563a88014610b0fd1112e74f7e127d55774b4/src/Modules.cpp#L947Your python module is broken, and doesn't follow the contract. My telepathy skills tell me that you didn't return the
EModRetvalue from yourOnChanMsg, but next time please pastebin the module, so that I don't have to guess.The module in question is https://github.com/snoonetIRC/znc-modules/blob/master/push.py and you were correct. The original author of the module neglected to return
znc.CONTINUEfrom some of the callbacks that have anEModRetreturn value. Sorry to bother you.According to the modpython documentation, functions that return None should have a 'reasonable default' substituted (
If a callback returns None, a reasonable default is substituted. If a callback raises an exception, the default value is assumed too. Note: You should return something explicitly anyway (PEP 20), also such default behavior WILL be changed in some future version.)The function being called twice does not exactly fit under
reasonable default, and while this is now a deprecated function, it should still maintain past functionality. Or the docs should be changed to indicate that a return is required rather than simply suggested. Especially given that this was not always the case.It was changed in 1.7, alright :) But docs should be updated to reflect this, sure.
This started as an implementation detail, followed by the description of current behavior, with no guarantees that this behavior will persist, even vice versa, it was suggested that it will not persist.
Agreed, on both counts