.
D 2022-11-23T15:34:14.323
J icomment First\sattempt\sfor\sa\sfix\s[58883dde6de7f4a8|here].\r\n\r\nAlthough\sthe\sfix\sworks,\sit\sshows\sthat\sTIP\s#601\s(about\smaking\sencoding\serrors\sthowing\sexceptions)\swas\snot\simplemented\sthroughout\syet.\sFor\sexample,\stestcase\sio-1.6\sdoes\sthe\sfollowing:\r\n<pre>\r\n\s\s\s\sfconfigure\s$f\s-encoding\sbinary\r\n\s\s\s\sputs\s-nonewline\s$f\s"a乍\\x00"\r\n</pre>\r\nThis\sis\sillegal,\sbecause\sthe\s"binary"\sencoding\sonly\saccepts\sbytes\swhile\s乍\sis\snot\sa\sbyte\sat\sall.\sWith\sTIP\s#601,\sI\sexpect\sthis\stest-case\sto\sthrow\san\sexception.\sThe\ssolution\s[58883dde6de7f4a8]\sdoes\sthis\sby\sgenerating\sthis\sexception\swhen\sconverting\sthe\sstring\sto\sa\sbytearray.\r\n\r\nWhat\swould\sbe\seven\sbetter,\sis\swhen\s"puts"\swould\swrite\sthe\sbytes\sto\sthe\schannel\sup\sto\sthe\serror-character\s(so,\sjust\s'a'\sin\sthis\scase),\sand\sthen\sthrow\sthe\sexception.\sThat\spart\sis\snot\sdone\syet\sin\sthis\sfirst\sattempt.
J login jan.nijtmans
J mimetype text/x-fossil-wiki
K da63e4c1efcfc3e68fdc4527df6a8109e1eac348
U jan.nijtmans
Z 61579fe63a56af5e92cf90430144d9a2