title: Why does the same code using struct.unpack with a bytearray raise an exception in Python 2.7.3 but not in 2.7.5?
body: <p>I wrote an application that uses <code>struct.unpack</code> on byte arrays. Running it on my machine using Python 2.7.5 it works well:</p>
  <pre><code>&gt;&gt;&gt; data
  bytearray(b'\x07\x00\x00\x00\x00\x00\x00\x00')
  &gt;&gt;&gt; struct.unpack(&quot;&lt;Q&quot;, data)   
  (7,)
  </code></pre>
  <p>However, I tried to use it with Python version 2.7.3 I got an exception:</p>
  <blockquote>
  <p>error: unpack requires a string argument of length 8</p>
  </blockquote>
  <p>I need to explicitly cast the bytearray to string before unpacking it. Is this related to the Python version change? the <a href="http://docs.python.org/2/library/struct.html" rel="nofollow noreferrer">struct manual</a> says nothing about this. I would like to avoid doing all the casting, is there any way around this?</p>