From: SourceForge.net <no...@so...> - 2006-01-11 11:43:51
|
Bugs item #1402763, was opened at 2006-01-11 11:09 Message generated for change (Comment added) made by dkf You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1402763&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: 42. Regexp Group: current: 8.4.12 Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Donal K. Fellows (dkf) Summary: bytearray object converted to string on searched by regexp Initial Comment: 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) ---------------------------------------------------------------------- >Comment By: Donal K. Fellows (dkf) Date: 2006-01-11 11:43 Message: Logged In: YES user_id=79902 Quite apart from the fact that you shouldn't be relying on the internal rep of objects in the first place, it is still reasonable to expect that REs would be able to use a bytearray object without conversion (after all, all they really need is constant time indexing). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1402763&group_id=10894 |