Commit Graph

20740 Commits

Author SHA1 Message Date
Brett Cannon e69f0df45b Issue #13959: Re-implement imp.find_module() in Lib/imp.py.
Thanks to Eric Snow for taking an initial stab at the implementation.
2012-04-21 21:09:46 -04:00
Brett Cannon b8c0206bd4 Issue #14637: Fix the UNC import test under Windows to actually use
the UNC path. Also clean up sys.path and invalidate finder caches.

Thanks to Vinay Sajip for spotting the use of the wrong path.
2012-04-21 19:11:58 -04:00
Brett Cannon 2f92389d5c Don't worry about moving imp.get_tag() over to Lib/imp.py. 2012-04-21 18:55:51 -04:00
Brett Cannon b582c923ba merge 2012-04-21 18:53:14 -04:00
Brett Cannon a64faf0771 Issue #13959: Re-implement imp.source_from_cache() in Lib/imp.py. 2012-04-21 18:52:52 -04:00
Michael Foord 9cf5c9d85e Remove incorrect comment 2012-04-21 18:32:56 +01:00
Michael Foord 3af125a4aa Closes issue 14634. unittest.mock.create_autospec now supports keyword only arguments. 2012-04-21 18:22:28 +01:00
Michael Foord 2cd48738ba Closes issue 14636. mock objects raise exceptions from an iterable side_effect 2012-04-21 15:52:11 +01:00
Brett Cannon ea59dbff16 Issue #13959: Re-implement imp.cache_from_source() in Lib/imp.py. 2012-04-20 21:44:46 -04:00
Brett Cannon ed672d6872 Make path manipulation more robust for platforms with alternative path
separators.
2012-04-20 21:19:53 -04:00
Brett Cannon 24117a748b Issue #13959: Keep imp.get_magic() in C code, but cache in importlib
for performance. While get_magic() could move to Lib/imp.py, having to
support PyImport_GetMagicNumber() would lead to equal, if not more, C
code than sticking with the status quo.
2012-04-20 18:04:03 -04:00
Brett Cannon 9e924ed1ac Fix a cleanup. 2012-04-20 17:34:59 -04:00
Brett Cannon 5d5296d36e Merge 2012-04-20 17:19:14 -04:00
Mark Dickinson 9a359bd97f Issue #14630: Merge fix from 3.2. 2012-04-20 21:44:09 +01:00
Mark Dickinson bcc17eefd2 Issue #14630: Fix an incorrect access of ob_digit[0] for a zero instance of an int subclass. 2012-04-20 21:42:49 +01:00
Brett Cannon bbdc9cd3d2 Use a skipUnless decorator instead of conditional renaming. 2012-04-20 16:29:39 -04:00
Brett Cannon 1032af95ff Issue #14585: test_import now runs all tests under
importlib.test.import_ using builtins.__import__() instead of just the
relative import tests.
2012-04-20 15:52:17 -04:00
Brett Cannon f0434e647a Issue #14599: Generalize a test for ImportError.path and add support
in Python/dynload_shlibs.c.

This should fix the remaining importlib test failure on Windows.
Support in AIX and HP-UX will be in a separate checkin.
2012-04-20 15:22:50 -04:00
Brett Cannon a2898c1d79 Try to debug a Windows failure on the buildbots. 2012-04-20 13:34:35 -04:00
Brett Cannon c33f3f2339 Issue #14629: Mention the filename in SyntaxError exceptions from
tokenizer.detect_encoding() (when available).
2012-04-20 13:23:54 -04:00
Brett Cannon dd9a56953e Issue #14633: Simplify imp.find_modue() test after fixes from issue
#14629 changed the message.
2012-04-20 12:59:59 -04:00
Brett Cannon 8ff6baf25b Issue #14581: Windows users are allowed to import modules w/o taking
the file suffix's case into account, even when doing a case-sensitive
import.
2012-04-20 12:53:14 -04:00
Brett Cannon 91900eaf96 Have importlib.test.regrtest clear sys.path_importer_cache to make
sure finders from importlib are used instead of _frozen_importlib.
2012-04-20 12:51:44 -04:00
Martin v. Löwis 63c39fe38e merge 3.2: issue 14629 2012-04-20 14:37:17 +02:00
Martin v. Löwis 63674f4b52 Issue #14629: Raise SyntaxError in tokenizer.detect_encoding
if the first two lines have non-UTF-8 characters without an encoding declaration.
2012-04-20 14:36:47 +02:00
Victor Stinner 7b17a4e117 Close #14386: Register types.MappingProxyType as a Mapping 2012-04-20 01:41:36 +02:00
Larry Hastings 6fe20b3aee Issue #14127: Add st_{cma}time_ns fields to os.stat() result object. 2012-04-19 15:07:49 -07:00
Antoine Pitrou dd5aa36f17 Issue #14308: Fix an exception when a dummy thread is in the threading module's active list after a fork(). 2012-04-20 00:05:17 +02:00
Antoine Pitrou 8e6e0fdb7f Issue #14308: Fix an exception when a "dummy" thread is in the threading module's active list after a fork(). 2012-04-19 23:55:01 +02:00
Martin v. Löwis aa2efcb0bc Issue #14098: New functions PyErr_GetExcInfo and PyErr_SetExcInfo.
Patch by Stefan Behnel.
2012-04-19 14:33:43 +02:00
Nick Coghlan e27b3608ef Merge from 3.2 2012-04-19 22:22:37 +10:00
Nick Coghlan 10ac77d2d8 Close #14032: fix incorrect variable reference in test_cmd_line_script 2012-04-19 22:19:36 +10:00
Ezio Melotti dea6c21a9c #14538: merge with 3.2. 2012-04-18 19:36:03 -06:00
Ezio Melotti 0780b6bc58 #14538: HTMLParser can now parse correctly start tags that contain a bare /. 2012-04-18 19:18:22 -06:00
Victor Stinner b0b224233e Issue #14385: Support other types than dict for __builtins__
It is now possible to use a custom type for the __builtins__ namespace, instead
of a dict. It can be used for sandboxing for example.  Raise also a NameError
instead of ImportError if __build_class__ name if not found in __builtins__.
2012-04-19 00:57:45 +02:00
Benjamin Peterson 2a481e58ff don't bother keeping a set we'll never use 2012-04-18 15:25:50 -04:00
Antoine Pitrou 23bba4ca39 Issue #11750: The Windows API functions scattered in the _subprocess and
_multiprocessing.win32 modules now live in a single module "_winapi".
Patch by sbt.
2012-04-18 20:51:15 +02:00
Benjamin Peterson 6e3358a1d5 merge 3.2 (#14612) 2012-04-18 11:19:00 -04:00
Benjamin Peterson e42fb307ed SETUP_WITH acts like SETUP_FINALLY for the purposes of setting f_lineno (closes #14612) 2012-04-18 11:14:31 -04:00
Benjamin Peterson d76bc7abac rollback 005fd1fe31ab (see #14609 and #14582)
Being able to overload a sys.module entry during import of a module was broken
by this changeset.
2012-04-18 10:55:43 -04:00
Brett Cannon 03c7ed1580 Merge 2012-04-17 21:42:07 -04:00
Brett Cannon 7bd329d800 Issue #12599: Be more strict in accepting None vs. a false-like object
in importlib.

Thanks to PJE for pointing out the issue and Nick Coghlan for filing
the bug.
2012-04-17 21:41:35 -04:00
Benjamin Peterson 2a1fdc4c76 merge 3.2 (#14607) 2012-04-17 19:54:35 -04:00
Benjamin Peterson 32c59b6fc1 mangle keyword-only argname when loading defaults (closes #14607) 2012-04-17 19:53:21 -04:00
Brett Cannon 64befe939c Issue #13959: Re-implement imp.load_compiled() in imp.py. 2012-04-17 19:14:26 -04:00
Brett Cannon 273323cf68 Issue #14592: A relative import will raise a KeyError if __package__
or __name__ are not set in globals.

Thanks to Stefan Behnel for the bug report.
2012-04-17 19:05:11 -04:00
Charles-François Natali fba807ac44 Issue #5113: Fix a test_posix failure on HP-UX, where non-root users can
chown() to root under certain circumstances.
2012-04-17 19:58:50 +02:00
Charles-François Natali ab2d58eefa Issue #5113: Fix a test_posix failure on HP-UX, where non-root users can
chown() to root under certain circumstances.
2012-04-17 19:48:35 +02:00
Charles-François Natali c8ce715a82 Issue #14087: multiprocessing: add Condition.wait_for(). Patch by sbt. 2012-04-17 18:45:57 +02:00
Ezio Melotti 006917ec7f #14603: use a listcomp in ZipFile.namelist. 2012-04-16 21:34:24 -06:00
Brett Cannon 578393b286 Properly guard against special-casing. 2012-04-16 23:11:28 -04:00
Brett Cannon 16475adcbb Issue #13959: Re-implement imp.load_source() in imp.py. 2012-04-16 22:11:25 -04:00
Brett Cannon 4132368d0a Issue #14599: Fix an import caching race condition. 2012-04-16 20:50:33 -04:00
Brett Cannon ceffda822f Issue #14599: Make test_reprlib robust against import cache race
conditions when regrtest is run with its -j option.
2012-04-16 20:48:50 -04:00
Brett Cannon de10bf4f4d Issue #13959: Fix a logic bug. 2012-04-16 20:44:21 -04:00
Antoine Pitrou de3c73b57c pep8-ize test names 2012-04-16 21:29:58 +02:00
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