From: Victor Stinner Date: Mon, 16 May 2011 14:32:33 +0000 (+0200) Subject: (Merge 3.1) Issue #11614: import __hello__ prints "Hello World!". Patch written X-Git-Tag: v3.2.1rc2~154 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9cd6626f3ded4c4fd0bd1e47a8c7f87051876909;p=thirdparty%2FPython%2Fcpython.git (Merge 3.1) Issue #11614: import __hello__ prints "Hello World!". Patch written by Andreas Stührk. --- 9cd6626f3ded4c4fd0bd1e47a8c7f87051876909 diff --cc Lib/test/test_frozen.py index 07131af1cce7,a9713f5cd4d5..5243ebb1658a --- a/Lib/test/test_frozen.py +++ b/Lib/test/test_frozen.py @@@ -6,31 -6,37 +6,37 @@@ import sy class FrozenTests(unittest.TestCase): def test_frozen(self): - try: - import __hello__ - except ImportError as x: - self.fail("import __hello__ failed:" + str(x)) - self.assertEqual(__hello__.initialized, True) - self.assertEqual(len(dir(__hello__)), 7, dir(__hello__)) - - try: - import __phello__ - except ImportError as x: - self.fail("import __phello__ failed:" + str(x)) - self.assertEqual(__phello__.initialized, True) - if not "__phello__.spam" in sys.modules: - self.assertEqual(len(dir(__phello__)), 8, dir(__phello__)) - else: - self.assertEqual(len(dir(__phello__)), 9, dir(__phello__)) - self.assertEqual(__phello__.__path__, [__phello__.__name__]) + with captured_stdout() as stdout: + try: + import __hello__ + except ImportError as x: + self.fail("import __hello__ failed:" + str(x)) + self.assertEqual(__hello__.initialized, True) - self.assertEqual(len(dir(__hello__)), 6, dir(__hello__)) ++ self.assertEqual(len(dir(__hello__)), 7, dir(__hello__)) + self.assertEqual(stdout.getvalue(), 'Hello world!\n') + + with captured_stdout() as stdout: + try: + import __phello__ + except ImportError as x: + self.fail("import __phello__ failed:" + str(x)) + self.assertEqual(__phello__.initialized, True) + if not "__phello__.spam" in sys.modules: - self.assertEqual(len(dir(__phello__)), 7, dir(__phello__)) - else: + self.assertEqual(len(dir(__phello__)), 8, dir(__phello__)) ++ else: ++ self.assertEqual(len(dir(__phello__)), 9, dir(__phello__)) + self.assertEqual(__phello__.__path__, [__phello__.__name__]) + self.assertEqual(stdout.getvalue(), 'Hello world!\n') - try: - import __phello__.spam - except ImportError as x: - self.fail("import __phello__.spam failed:" + str(x)) - self.assertEqual(__phello__.spam.initialized, True) - self.assertEqual(len(dir(__phello__.spam)), 7) - self.assertEqual(len(dir(__phello__)), 9) + with captured_stdout() as stdout: + try: + import __phello__.spam + except ImportError as x: + self.fail("import __phello__.spam failed:" + str(x)) + self.assertEqual(__phello__.spam.initialized, True) - self.assertEqual(len(dir(__phello__.spam)), 6) - self.assertEqual(len(dir(__phello__)), 8) ++ self.assertEqual(len(dir(__phello__.spam)), 7) ++ self.assertEqual(len(dir(__phello__)), 9) + self.assertEqual(stdout.getvalue(), 'Hello world!\n') try: import __phello__.foo diff --cc Misc/NEWS index 00a370452976,f6eb63ed3889..e31d8b87e0a5 --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -20,75 -16,6 +20,78 @@@ Core and Builtin - Issue #1195: Fix input() if it is interrupted by CTRL+d and then CTRL+c, clear the end-of-file indicator after CTRL+d. +Library +------- + - - Issue #9516: Issue #9516: avoid errors in sysconfig when MACOSX_DEPLOYMENT_TARGET ++- Issue #9516: Issue #9516: avoid errors in sysconfig when MACOSX_DEPLOYMENT_TARGET + is set in shell. + +- Issue #12012: ssl.PROTOCOL_SSLv2 becomes optional. + +- Issue #8650: Make zlib module 64-bit clean. compress(), decompress() and + their incremental counterparts now raise OverflowError if given an input + larger than 4GB, instead of silently truncating the input and returning + an incorrect result. + +- Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail + attribute when called without a max_length argument. + +- Issue #12062: Fix a flushing bug when doing a certain type of I/O sequence + on a file opened in read+write mode (namely: reading, seeking a bit forward, + writing, then seeking before the previous write but still within buffered + data, and writing again). + +- Issue #1028: Tk returns invalid Unicode null in %A: UnicodeDecodeError. + With Tk < 8.5 _tkinter.c:PythonCmd() raised UnicodeDecodeError, caused + IDLE to exit. Converted to valid Unicode null in PythonCmd(). + +- Issue #11169: compileall module uses repr() to format filenames and paths to + escape surrogate characters and show spaces. + +- Issue #10419, #6011: build_scripts command of distutils handles correctly + non-ASCII path (path to the Python executable). Open and write the script in + binary mode, but ensure that the shebang is decodable from UTF-8 and from the + encoding of the script. + +- Issue #8498: In socket.accept(), allow to specify 0 as a backlog value in + order to accept exactly one connection. Patch by Daniel Evers. + +- Issue #11164: Stop trying to use _xmlplus in the xml module. + +Build +----- + +- Issue #11347: Use --no-as-needed when linking libpython3.so. + +Tools/Demos +----------- + +- Issue #11996: libpython (gdb), replace "py-bt" command by "py-bt-full" and + add a smarter "py-bt" command printing a classic Python traceback. + +Tests +----- + ++- Issue #11614: import __hello__ prints "Hello World!". Patch written by ++ Andreas Stührk. ++ +- Issue #5723: Improve json tests to be executed with and without accelerations. + +- Issue #11910: Fix test_heapq to skip the C tests when _heapq is missing. + + +What's New in Python 3.2.1 beta 1? +================================== + +*Release date: 08-May-2011* + +Core and Builtins +----------------- + +- Issue #1856: Avoid crashes and lockups when daemon threads run while the + interpreter is shutting down; instead, these threads are now killed when they + try to take the GIL. + - Issue #9756: When calling a method descriptor or a slot wrapper descriptor, the check of the object type doesn't read the __class__ attribute anymore. Fix a crash if a class override its __class__ attribute (e.g. a proxy of the