|
2006-01-11
| ||
| 18:40 | • Closed ticket [1402782fff]: bytearray object converted to string on searched by ... artifact: cd292f047f user: dkf | |
| 11:29 | • New ticket [1402782fff]. artifact: d4b1dc9a00 user: nobody | |
bytearray object converted to string on searched by regexp
Closed / Duplicate1402782fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2006-01-11 11:29:22
I consider the following a bug (in version 8.4.11) set fd [open [select_file]] # Although irrelevant, in the actual test case the file selected is a pdf file. fconfigure $fd -encoding binary -translation binary set inp [read $fd] # Here the type (and internal representation) of 'inp' is 'bytearray' as it indeed should be. regexp -- "stream\x0d\x0a(.+?)\x0d\endstream" $inp x frag # Now the Tcl_Obj record that 'inp' refers to is the same as above but the type now is # 'string' and the value of both the 'bytes' and the 'internalRep' pointer is different from # its previous value. The string the latter points to seems to be in UCS-16 form. # I did not check whether the string value had been changed. If not why was it necessary to copy? Joe Németh (NJG on wiki.tcl.tk)
dkf Closed ticket [1402782fff].
[History diff]2006-01-11 18:40:44
Log in (anonymous is fine) to add a comment.