title: shelve module does not work with "with" statement
body: <p>I'm trying to use the shelve module in python, and I'm trying to combine it with the "with" statement, but when trying to do that I get the following error:</p>
  
  <pre><code>with shelve.open('shelve', 'c') as shlv_file:
      shlv_file['title']    = 'The main title of my app'
      shlv_file['datatype'] = 'data type int32'
      shlv_file['content']  = 'Lorem ipsum'
      shlv_file['refs']     = '&lt;htppsa: asda.com&gt;'
  
  print(shlv_file)
  </code></pre>
  
  <p>The following error is raised:</p>
  
  <pre><code> with shelve.open('shelve', 'c') as shlv_file:
  AttributeError: DbfilenameShelf instance has no attribute '__exit__'
  </code></pre>
  
  <p>Although doing this way:</p>
  
  <pre><code>shlv_file = shelve.open('data/shelve', 'c')
  shlv_file['title']    = 'The main title of my app'
  shlv_file['datatype'] = 'data type int32'
  shlv_file['content']  = 'Lorem ipsum'
  shlv_file['refs']     = '&lt;htppsa: asda.com&gt;'
  shlv_file.close()
  
  shlv_file = shelve.open('data/shelve', 'c')
  shlv_file['new_filed'] = 'bla bla bla'
  print(shlv_file)
  </code></pre>
  
  <p>No error is raised, and the output is the one that is expected. What is the problem with the first syntax ? I was watching a python course in which the instructor uses the first version without any problems.</p>