title: Python 3: Crash with free(): corrupted unsorted chunks while reading file
body: <p>I found the following strange behavior with Python 3:</p>
  
  <pre><code>file = open(path, mode='rb').read()
  file_ori = open(self.filePath, mode='rb').read()
  
  m = hashlib.md5()
  md5 = m.update(file)
  md5 = m.hexdigest()
  
  file = '0x'.encode('ascii') + binascii.hexlify(file)
  file_ori = '0x'.encode('ascii') + binascii.hexlify(file_ori)
  </code></pre>
  
  <p>In this scenario my application will crash sooner or later with <em>free(): corrupted unsorted chunks</em>.</p>
  
  <p>If I change to code to:</p>
  
  <pre><code>file = open(path, mode='rb')
  file_ori = open(self.filePath, mode='rb')
  
  filecont = file.read()
  file_oricont = file_ori.read()
  
  m = hashlib.md5()
  md5 = m.update(filecont)
  md5 = m.hexdigest()
  
  fileb = '0x'.encode('ascii') + binascii.hexlify(filecont)
  fileb_ori = '0x'.encode('ascii') + binascii.hexlify(file_oricont)
  </code></pre>
  
  <p>The application is running without problems.</p>
  
  <p>I read the documentation multiple times but can't find any reason for this behavior. Did someone may know more about this? It seems to me there is a bug with Python and the garbage collection?</p>
  
  <p>I tested with python3.4 and python3.5.</p>
  
  <p>Thanks
  Manuel</p>