Commit graph

20634 commits

Author SHA1 Message Date
Antoine Pitrou
6b64fc6bff Fix refleak in test_gc 2012-04-16 21:29:02 +02:00
Vinay Sajip
7706d9ae4f Closes #14452: brought tests in line with removal of BOM insertion code. 2012-04-16 16:22:38 +01:00
Vinay Sajip
b4e59e9dc1 Closes #14452: remove BOM insertion code. 2012-04-16 14:44:31 +01:00
Vinay Sajip
ee9e485c21 Closes #14452: remove BOM insertion code. 2012-04-16 14:39:53 +01:00
Brian Curtin
b206a80dab Fix #10854. Make use of the new path and name attributes on ImportError
for extension modules on Windows.
2012-04-16 00:10:17 -05:00
Brett Cannon
15439817bf merge 2012-04-15 22:28:45 -04:00
Brett Cannon
2ee61422ed Issue #13959: Re-implement imp.load_package() in imp.py.
Thanks to Eric Snow for helping with imp.load_module() (previous
commit) which led to the removal of a bunch of C code.
2012-04-15 22:28:28 -04:00
Antoine Pitrou
d15e6a32c4 Issue #14589: Update certificate chain for sha256.tbs-internet.com, fixing a test failure in test_ssl. 2012-04-16 03:37:35 +02:00
Antoine Pitrou
aa292f91bb Issue #14589: Update certificate chain for sha256.tbs-internet.com, fixing a test failure in test_ssl. 2012-04-16 03:34:44 +02:00
Brett Cannon
01a76171a0 Issue #13959: Re-implement imp.load_module() in imp.py. 2012-04-15 20:25:23 -04:00
Brett Cannon
7c3e150d06 merge 2012-04-15 19:06:40 -04:00
Brett Cannon
2fef4d2e6b Consider load_dynamic() something to keep in _imp. 2012-04-15 19:06:23 -04:00
Victor Stinner
0db176f8f6 Issue #14386: Expose the dict_proxy internal type as types.MappingProxyType 2012-04-16 00:16:30 +02:00
Brett Cannon
6f44d66bc4 Issue #13959: Rename imp to _imp and add Lib/imp.py and begin
rewriting functionality in pure Python.

To start, imp.new_module() has been rewritten in pure Python, put into
importlib (privately) and then publicly exposed in imp.
2012-04-15 16:08:47 -04:00
Brett Cannon
7788838473 merge 2012-04-15 15:25:10 -04:00
Brett Cannon
881535b726 Issue #14582: Import returns the module returned by a loader instead
of sys.modules when possible.

This is being done for two reasons. One is to gain a little bit of
performance by skipping an unnecessary dict lookup in sys.modules. But
the other (and main) reason is to be a little bit more clear in how
things should work from the perspective of import's interactions with
loaders. Otherwise loaders can easily forget to return the module even
though PEP 302 explicitly states they are expected to return the module
they loaded.
2012-04-15 15:24:04 -04:00
Philip Jenvey
f8f3190d32 utilize startswith(tuple) 2012-04-15 12:21:32 -07:00
Mark Dickinson
da4210f77d Issue #13496: Merge from 3.2 2012-04-15 16:32:04 +01:00
Mark Dickinson
a13b109bc0 Issue 13496: Fix bisect.bisect overflow bug for large collections. 2012-04-15 16:30:35 +01:00
Kristján Valur Jónsson
69c635266e Issue #10576: Add a progress callback to gcmodule 2012-04-15 11:41:32 +00:00
Brett Cannon
49f8d8b016 Handle importing pkg.mod by executing
__import__('mod', {'__packaging__': 'pkg', level=1) w/o properly (and
thus not segfaulting).
2012-04-14 21:50:00 -04:00
Brett Cannon
aef82d3d1e IDLE was relying on implicit relative imports which have gone away in
Python 3.3 thanks to importlib finishing the work in PEP 328 that
accidently got carried forward.
2012-04-14 20:44:23 -04:00
Brett Cannon
44590e4786 Add some comments. 2012-04-14 18:37:07 -04:00
Brett Cannon
afbdc13c1b Fix an import race condition. 2012-04-14 15:06:17 -04:00
Brett Cannon
73def61edd Try to fix a sporadic test failure from what is probably a caching race condition. 2012-04-14 14:38:19 -04:00
Brett Cannon
fd0741555b Issue #2377: Make importlib the implementation of __import__().
importlib._bootstrap is now frozen into Python/importlib.h and stored
as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen
code along with sys and imp and then uses _frozen_importlib._install()
to set builtins.__import__() w/ _frozen_importlib.__import__().
2012-04-14 14:10:13 -04:00
Michael Foord
0682a0c0a9 Minor docstring / docs corrections for unittest.mock 2012-04-13 20:51:20 +01:00
Michael Foord
656319e58d Make unittest.mock.create_autospec resilient against AttributeError on original object 2012-04-13 17:39:16 +01:00
Michael Foord
c287062fcf unittest.mock.PropertyMock return value and attributes are now standard MagicMocks 2012-04-13 16:57:22 +01:00
Brett Cannon
bbb6680ee5 Have importlib take advantage of ImportError's new 'name' and 'path'
attributes.
2012-04-12 21:09:01 -04:00
Brett Cannon
79ec55e980 Issue #1559549: Add 'name' and 'path' attributes to ImportError.
Currently import does not use these attributes as they are planned
for use by importlib (which will be another commit).

Thanks to Filip Gruszczyński for the initial patch and Brian Curtin
for refining it.
2012-04-12 20:24:54 -04:00
R David Murray
f50b38a11f Merge #14399: zipfile now correctly handles comments added to empty zipfiles.
Patch by Serhiy Storchaka.

This also moves the TypeError that results from trying to use a unicode
comment from the 'close' step to the point at which the comment is added to
the zipfile.
2012-04-12 18:44:58 -04:00
R David Murray
51804e9725 #14399: zipfile now correctly handles comments added to empty zipfiles.
Patch by Serhiy Storchaka.

This also moves the TypeError that results from trying to use a unicode
comment from the 'close' step to the point at which the comment is added to
the zipfile.
2012-04-12 18:44:42 -04:00
Senthil Kumaran
80a133b91c code improvement. 'as cm' not required when not used. Review comment by Georg Brandl 2012-04-12 19:28:07 +08:00
R David Murray
ea169801e1 #14508: make gprof2html script runnable under python3
Not that I haven't tested it to make sure it works, just that it
can run against an empty source file.

Initial patch by Popa.Claudiu.

Here we also add a test (which uses mock, which is why I didn't
check it in on 3.2).
2012-04-11 15:17:37 -04:00
Senthil Kumaran
690598aba2 merge to default - Issue 10484 - Incorporate improvements to CGI module - Suggested by Glenn Linderman. Refactor code and tests 2012-04-12 02:37:11 +08:00
Senthil Kumaran
d70846b1b1 3.2 - Issue 10484 - Incorporate improvements to CGI module - Suggested by Glenn Linderman. Refactor code and tests 2012-04-12 02:34:32 +08:00
Senthil Kumaran
08bd4aaaf9 use assertWarns instead of check_warnings - Issue14341 2012-04-11 23:05:49 +08:00
Georg Brandl
a51497ab86 Merge 3.2.3 release clone. 2012-04-11 12:46:24 +02:00
Brett Cannon
9fe92d1de5 Make the trace module ignore modules whose names start with "<" and
end with ">", i.e. follow convention.
2012-04-10 21:05:53 -04:00
Senthil Kumaran
d05853da97 merge - fix the incorrect changes made for PATH_INFO value - Issue10484 2012-04-11 03:16:16 +08:00
Senthil Kumaran
dbb369d0ef 3.2- fix the incorrect changes made for PATH_INFO value - Issue10484 2012-04-11 03:15:28 +08:00
Georg Brandl
44036016b9 Bump to 3.2.3 final. 2012-04-10 19:28:09 +02:00
R David Murray
75d9aca97a Rename test_ file that is really a support file to remove test_ prefix.
I thought I had run the full test suite before the last checkin, but
obviously I didn't.  test_multibytecodec_support.py isn't really a test file,
it is a support file that contains a base test class.  Rename it to
multibytecodec_support so that regrtest test discovery doesn't think it is a
test file that should be run.
2012-04-09 09:37:52 -04:00
R David Murray
78fc25c77f #14533: if a test has no test_main, use loadTestsFromModule.
This moves us further in the direction of using normal unittest facilities
instead of specialized regrtest ones.  Any test module that can be correctly
run currently using 'python unittest -m test.test_xxx' can now be converted to
use normal unittest test loading by simply deleting its test_main, thus no
longer requiring manual maintenance of the list of tests to run.  (Not all
tests can be converted that easily, since test_main sometimes does some
additional things (such as reap_children or reap_threads).  In those cases the
extra code may be moved to setUpModule/tearDownModule methods, or perhaps the
same ends can be achieved in a different way, such as moving the decorators to
the test classes that need them, etc.)

I don't advocate going through and making this change wholesale, but any time
a list of tests in test_main would otherwise need to be updated, consideration
should instead be given to deleting test_main.
2012-04-09 08:55:42 -04:00
R David Murray
b019ee752a #12537: in mailbox avoid depending on knowledge of email package internals
Previously mailbox was copying a list of attributes from one message object to
another in order to "copy the message data".  This means that any time new
attributes were added to email.message.Message, mailbox broke.  Now instead it
copies all attributes from the source object to the target object, skipping
any mailbox-object-specific attributes to produce the same clean initial
state it was previously getting by copying only the "known" attributes.

David Lam assisted in the development of this patch.
2012-04-08 22:36:07 -04:00
R David Murray
c988e24240 Remove redundancy in listing of all mailbox classes in test_mailbox. 2012-04-08 21:00:27 -04:00
Antoine Pitrou
c0aa9eeb90 Fix the patch for issue #7978: select() raises select.error before 3.3, not OSError. 2012-04-09 01:37:19 +02:00
Antoine Pitrou
0ec2c075a2 Fix flakiness in test_socketserver 2012-04-09 01:18:07 +02:00
Antoine Pitrou
f18d6f3f44 Fix flakiness in test_socketserver 2012-04-09 01:16:47 +02:00