On 2019/11/04 13:50, Daniel Shahaf wrote:
Yasuhito FUTATSUKI wrote on Mon, Nov 04, 2019 at 11:13:38 +0900:
On 2019/11/04 8:16, Nathan Hartman wrote:
On Sun, Nov 3, 2019 at 12:56 AM Nathan Hartman <hartman.nat...@gmail.com>
wrote:
It seems there's another problem.
Apparently the 'raise .. from' construct is Python 3+. Which means
this breaks the mailer for Python 2.7. I found this when I tested on
Python 2.7 earlier and the script terminated with a syntax error at
'raise MessageSendFailure from detail'.
Which do you think is better:
Remove the 'from detail' and lose the original cause of
MessageSendFailure. MessageSendFailure is meant to be handled and
ignored (possibly only used for outputting additional logging),
allowing the mailer to continue mailing, so this might be acceptable.
Or, alternately:
Check which version of Python is running, use 'from detail' only when
Python 3+.
The latter can't accomplish with only single script, because syntax
error occurs on parse on loading, not on execution. To hide
'from detail' from Python 2 interpreter, we should get it out of
the script.
We could do:
try:
# py3
eval("raise MessageSendFailure from detail")
except SyntaxError:
# py2
raise MessageSendFailure
Ah, I see.
Or we could just keep the «raise … from» construct in there, unconditional, and
bump the script's minimum Python veneed rsion to 3 on trunk. Analysis:
+ I assume everyone has a py3 interpreter these days, even people whose distros
will continue to support py2 past its EOL date.
+ trunk will be released in April. That's four months _after_ py2's upstream
EOL.
- It's possible that some downstreams run distros that will support py2 past
its EOL date, have written py2 code that extends mailer.py, and won't have
gotten around to upgrading their custom extensions to py3 by April.
In any case, To get mailer.py to work with Python 3, more fix is needed.
Our svn.* modules map `char *' to `bytes' object, but current mailer.py doesn't
care bytes vs str problems.
(Though it is not related to this analysis and to the discussion about py2
support.)
Cheers,
--
Yasuhito FUTATSUKI <futat...@yf.bsdclub.org>/<futat...@poem.co.jp>