]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #12037: Fix test_email for desktop Windows.
authorTerry Jan Reedy <tjreedy@udel.edu>
Sat, 31 Aug 2013 21:16:45 +0000 (17:16 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Sat, 31 Aug 2013 21:16:45 +0000 (17:16 -0400)
1  2 
Lib/test/test_email/test_email.py
Misc/NEWS

index 202cee82b744c4ccbe6f6f60415e44c85cbe6b7e,904c06a18c00f4337360180d56313fccb62fd43d..b62a889238bdeadc03108b97470920d4e6522aa1
@@@ -256,35 -257,7 +256,35 @@@ class TestMessageAPI(TestEmailBase)
          fullrepr = msg.as_string(unixfrom=True)
          lines = fullrepr.split('\n')
          self.assertTrue(lines[0].startswith('From '))
 -        eq(text, NL.join(lines[1:]))
 +        self.assertEqual(text, NL.join(lines[1:]))
 +
 +    def test_as_string_policy(self):
 +        msg = self._msgobj('msg_01.txt')
 +        newpolicy = msg.policy.clone(linesep='\r\n')
 +        fullrepr = msg.as_string(policy=newpolicy)
 +        s = StringIO()
 +        g = Generator(s, policy=newpolicy)
 +        g.flatten(msg)
 +        self.assertEqual(fullrepr, s.getvalue())
 +
 +    def test_as_bytes(self):
 +        msg = self._msgobj('msg_01.txt')
-         with openfile('msg_01.txt', 'rb') as fp:
-             data = fp.read()
++        with openfile('msg_01.txt') as fp:
++            data = fp.read().encode('ascii')
 +        self.assertEqual(data, bytes(msg))
 +        fullrepr = msg.as_bytes(unixfrom=True)
 +        lines = fullrepr.split(b'\n')
 +        self.assertTrue(lines[0].startswith(b'From '))
 +        self.assertEqual(data, b'\n'.join(lines[1:]))
 +
 +    def test_as_bytes_policy(self):
 +        msg = self._msgobj('msg_01.txt')
 +        newpolicy = msg.policy.clone(linesep='\r\n')
 +        fullrepr = msg.as_bytes(policy=newpolicy)
 +        s = BytesIO()
 +        g = BytesGenerator(s,policy=newpolicy)
 +        g.flatten(msg)
 +        self.assertEqual(fullrepr, s.getvalue())
  
      # test_headerregistry.TestContentTypeHeader.bad_params
      def test_bad_param(self):
diff --cc Misc/NEWS
index f6dbfdf248e284f3392c2874ada7e260f881154e,3961ef99f67d2177f670223333538fd075cf1427..41e430fad6bfe63080ec24db1f9d02698b93d5c1
+++ b/Misc/NEWS
@@@ -150,241 -130,6 +150,243 @@@ Librar
  - Issue #8112: xlmrpc.server's DocXMLRPCServer server no longer raises an error
    if methods have annotations; it now correctly displays the annotations.
  
 +- Issue #18600: Added policy argument to email.message.Message.as_string,
 +  and as_bytes and __bytes__ methods to Message.
 +
 +- Issue #18671: Output more information when logging exceptions occur.
 +
 +- Issue #18621: Prevent the site module's patched builtins from keeping
 +  too many references alive for too long.
 +
 +- Issue #4885: Add weakref support to mmap objects.  Patch by Valerie Lambert.
 +
 +- Issue #8860: Fixed rounding in timedelta constructor.
 +
 +Tests
 +-----
 +
++- Issue #12037: Fix test_email for desktop Windows.
++
 +- Issue #15507: test_subprocess's test_send_signal could fail if the test
 +  runner were run in an environment where the process inherited an ignore
 +  setting for SIGINT.  Restore the SIGINT handler to the desired
 +  KeyboardInterrupt raising one during that test.
 +
 +- Issue #16799: Switched from getopt to argparse style in regrtest's argument
 +  parsing.  Added more tests for regrtest's argument parsing.
 +
 +- Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as
 +  possible, since "localhost" goes through a DNS lookup under recent Windows
 +  versions.
 +
 +IDLE
 +----
 +
 +- Issue #18489: Add tests for SearchEngine. Original patch by Phil Webster.
 +
 +Documentation
 +-------------
 +
 +- Issue #18743: Fix references to non-existant "StringIO" module.
 +
 +- Issue #18783: Removed existing mentions of Python long type in docstrings,
 +  error messages and comments.
 +
 +
 +What's New in Python 3.4.0 Alpha 1?
 +===================================
 +
 +Release date: 2013-08-03
 +
 +Core and Builtins
 +-----------------
 +
 +- Issue #16741: Fix an error reporting in int().
 +
 +- Issue #17899: Fix rare file descriptor leak in os.listdir().
 +
 +- Issue #10241: Clear extension module dict copies at interpreter shutdown.
 +  Patch by Neil Schemenauer, minimally modified.
 +
 +- Issue #9035: ismount now recognises volumes mounted below a drive root
 +  on Windows. Original patch by Atsuo Ishimoto.
 +
 +- Issue #18214: Improve finalization of Python modules to avoid setting
 +  their globals to None, in most cases.
 +
 +- Issue #18112: PEP 442 implementation (safe object finalization).
 +
 +- Issue #18552: Check return value of PyArena_AddPyObject() in
 +  obj2ast_object().
 +
 +- Issue #18560: Fix potential NULL pointer dereference in sum().
 +
 +- Issue #18520: Add a new PyStructSequence_InitType2() function, same than
 +  PyStructSequence_InitType() except that it has a return value (0 on success,
 +  -1 on error).
 +
 +- Issue #15905: Fix theoretical buffer overflow in handling of sys.argv[0],
 +  prefix and exec_prefix if the operation system does not obey MAXPATHLEN.
 +
 +- Issue #18408: Fix many various bugs in code handling errors, especially
 +  on memory allocation failure (MemoryError).
 +
 +- Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all().
 +
 +- Issue #18342: Use the repr of a module name when an import fails when using
 +  ``from ... import ...``.
 +
 +- Issue #17872: Fix a segfault in marshal.load() when input stream returns
 +  more bytes than requested.
 +
 +- Issue #18338: `python --version` now prints version string to stdout, and
 +  not to stderr.  Patch by Berker Peksag and Michael Dickens.
 +
 +- Issue #18426: Fix NULL pointer dereference in C extension import when
 +  PyModule_GetDef() returns an error.
 +
 +- Issue #17206: On Windows, increase the stack size from 2 MB to 4.2 MB to fix
 +  a stack overflow in the marshal module (fix a crash in test_marshal).
 +  Patch written by Jeremy Kloth.
 +
 +- Issue #3329: Implement the PEP 445: Add new APIs to customize Python memory
 +  allocators.
 +
 +- Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the
 +  tstate is first removed from TLS and then deallocated.
 +
 +- Issue #13483: Use VirtualAlloc in obmalloc on Windows.
 +
 +- Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise
 +  OverflowError when an argument of %c format is out of range.
 +
 +- Issue #18111: The min() and max() functions now support a default argument
 +  to be returned instead of raising a ValueError on an empty sequence.
 +  (Contributed by Julian Berman.)
 +
 +- Issue #18137: Detect integer overflow on precision in float.__format__()
 +  and complex.__format__().
 +
 +- Issue #18183: Fix various unicode operations on strings with large unicode
 +  codepoints.
 +
 +- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows().
 +
 +- Issue #18038: SyntaxError raised during compilation sources with illegal
 +  encoding now always contains an encoding name.
 +
 +- Issue #17931: Resolve confusion on Windows between pids and process
 +  handles.
 +
 +- Tweak the exception message when the magic number or size value in a bytecode
 +  file is truncated.
 +
 +- Issue #17932: Fix an integer overflow issue on Windows 64-bit in iterators:
 +  change the C type of seqiterobject.it_index from long to Py_ssize_t.
 +
 +- Issue #18065: Don't set __path__ to the package name for frozen packages.
 +
 +- Issue #18088: When reloading a module, unconditionally reset all relevant
 +  attributes on the module (e.g. __name__, __loader__, __package__, __file__,
 +  __cached__).
 +
 +- Issue #17937: Try harder to collect cyclic garbage at shutdown.
 +
 +- Issue #12370: Prevent class bodies from interfering with the __class__
 +  closure.
 +
 +- Issue #17644: Fix a crash in str.format when curly braces are used in square
 +  brackets.
 +
 +- Issue #17237: Fix crash in the ASCII decoder on m68k.
 +
 +- Issue #17927: Frame objects kept arguments alive if they had been
 +  copied into a cell, even if the cell was cleared.
 +
 +- Issue #1545463: At shutdown, defer finalization of codec modules so
 +  that stderr remains usable.
 +
 +- Issue #7330: Implement width and precision (ex: "%5.3s") for the format
 +  string of PyUnicode_FromFormat() function, original patch written by Ysj Ray.
 +
 +- Issue #1545463: Global variables caught in reference cycles are now
 +  garbage-collected at shutdown.
 +
 +- Issue #17094: Clear stale thread states after fork().  Note that this
 +  is a potentially disruptive change since it may release some system
 +  resources which would otherwise remain perpetually alive (e.g. database
 +  connections kept in thread-local storage).
 +
 +- Issue #17408: Avoid using an obsolete instance of the copyreg module when
 +  the interpreter is shutdown and then started again.
 +
 +- Issue #5845: Enable tab-completion in the interactive interpreter by
 +  default, thanks to a new sys.__interactivehook__.
 +
 +- Issue #17115,17116: Module initialization now includes setting __package__ and
 +  __loader__ attributes to None.
 +
 +- Issue #17853: Ensure locals of a class that shadow free variables always win
 +  over the closures.
 +
 +- Issue #17863: In the interactive console, don't loop forever if the encoding
 +  can't be fetched from stdin.
 +
 +- Issue #17867: Raise an ImportError if __import__ is not found in __builtins__.
 +
 +- Issue #18698: Ensure importlib.reload() returns the module out of sys.modules.
 +
 +- Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3,
 +  such as was shipped with Centos 5 and Mac OS X 10.4.
 +
 +- Issue #17413: sys.settrace callbacks were being passed a string instead of an
 +  exception instance for the 'value' element of the arg tuple if the exception
 +  originated from C code; now an exception instance is always provided.
 +
 +- Issue #17782: Fix undefined behaviour on platforms where
 +  ``struct timespec``'s "tv_nsec" member is not a C long.
 +
 +- Issue #17722: When looking up __round__, resolve descriptors.
 +
 +- Issue #16061: Speed up str.replace() for replacing 1-character strings.
 +
 +- Issue #17715: Fix segmentation fault from raising an exception in a __trunc__
 +  method.
 +
 +- Issue #17643: Add __callback__ attribute to weakref.ref.
 +
 +- Issue #16447: Fixed potential segmentation fault when setting __name__ on a
 +  class.
 +
 +- Issue #17669: Fix crash involving finalization of generators using yield from.
 +
 +- Issue #14439: Python now prints the traceback on runpy failure at startup.
 +
 +
 +- Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks()
 +  when running on valgrind.
 +
 +- Issue #17619: Make input() check for Ctrl-C correctly on Windows.
 +
 +- Issue #17357: Add missing verbosity messages for -v/-vv that were lost during
 +  the importlib transition.
 +
 +- Issue #17610: Don't rely on non-standard behavior of the C qsort() function.
 +
 +- Issue #17323: The "[X refs, Y blocks]" printed by debug builds has been
 +  disabled by default.  It can be re-enabled with the `-X showrefcount` option.
 +
 +Library
 +-------
 +
 +- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit
 +  platforms.  Patch by Yogesh Chaudhari.
 +
 +- Issue #18681: Fix a NameError in importlib.reload() (noticed by Weizhao Li).
 +
 +- Issue #14323: Expanded the number of digits in the coefficients for the
 +  RGB -- YIQ conversions so that they match the FCC NTSC versions.
 +
  - Issue #17998: Fix an internal error in regular expression engine.
  
  - Issue #17557: Fix os.getgroups() to work with the modified behavior of