Bug #3948
closedUnexpected RangeErorr of pack and unpack with specified byte-order modifier
Description
=begin
After applying Revision 29496, I can use < > modifier for pack and unpack.
But it fails to work when the modifier occurs more than once.
C:>ruby -e 'p "1234".unpack("SS")'
[12849, 13363]
C:>ruby -e 'p "1234".unpack("SS>")'
[12849, 13108]
C:>ruby -e 'p "1234".unpack("S>S")'
[12594, 13108]
C:>ruby -e 'p "1234".unpack("S>S>")'
-e:1:in unpack': Can't use both '<' and '>' (RangeError) from -e:1:in
'
C:>ruby -e 'p "1234".unpack("S<S<")'
-e:1:in unpack': Can't use both '<' and '>' (RangeError) from -e:1:in
'
C:>ruby -e 'p "1234".unpack("S")'
-e:1:in unpack': Can't use both '<' and '>' (RangeError) from -e:1:in
'
C:>ruby -e 'p [1234,5678].pack("SS")'
"\xD2\x04.\x16"
C:>ruby -e 'p [1234,5678].pack("SS>")'
"\xD2\x04\x16."
C:>ruby -e 'p [1234,5678].pack("S>S")'
"\x04\xD2\x16."
C:>ruby -e 'p [1234,5678].pack("S<S")'
"\xD2\x04.\x16"
C:>ruby -e 'p [1234,5678].pack("S>S>")'
-e:1:in pack': Can't use both '<' and '>' (RangeError) from -e:1:in
'
C:>ruby -e 'p [1234,5678].pack("S<S<")'
-e:1:in pack': Can't use both '<' and '>' (RangeError) from -e:1:in
'
C:>ruby -e 'p [1234,5678].pack("S")'
-e:1:in pack': Can't use both '<' and '>' (RangeError) from -e:1:in
'
=end
Updated by naruse (Yui NARUSE) about 14 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r29501.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end