classification
Title: email.message._headers is a list
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: DDarko, ezio.melotti, r.david.murray
Priority: normal Keywords:

Created on 2012-11-06 03:39 by DDarko, last changed 2012-11-06 04:13 by ezio.melotti. This issue is now closed.

Messages (2)
msg174952 - (view) Author: DDarko (DDarko) Date: 2012-11-06 03:39
in Python 3.3 lib.email.message


  File "email/message.py", line 151, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "email/generator.py", line 112, in flatten
    self._write(msg)
  File "email/generator.py", line 171, in _write
    self._write_headers(msg)
  File "email/generator.py", line 197, in _write_headers
    for h, v in msg.raw_items():
  File "email/message.py", line 441, in raw_items
    return iter(self._headers.copy())
AttributeError: 'list' object has no attribute 'copy'




http://hg.python.org/cpython/file/ec00f8570c55/Lib/email/message.py
in line 443 is:
return iter(self._headers.copy())
I think that it should be:
return iter(self._headers[:])
msg174953 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-11-06 04:13
Lists have a new copy method starting from Python 3.3:
Python 3.3.0+ (3.3:549f7b5baa83+, Nov  4 2012, 23:18:06) 
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> list.copy
<method 'copy' of 'list' objects>
History
Date User Action Args
2012-11-06 04:13:02ezio.melottisetstatus: open -> closed

type: crash -> behavior

nosy: + ezio.melotti, r.david.murray
messages: + msg174953
resolution: not a bug
stage: resolved
2012-11-06 03:39:12DDarkocreate