Commit Graph

79455 Commits

Author SHA1 Message Date
Brett Cannon f4375ef4d4 importlib.abc.SourceLoader.get_source() was re-raising SyntaxError and
UnicodeDecodeError as ImportError. That was over-reaching the point of
raising ImportError in get_source() (which is to signal the source
code was not found when it should have). Conflating the two exceptions
with ImportError could lead to masking errors with the source which
should be known outside of whether there was an error simply getting
the source to begin with.
2013-06-16 18:05:54 -04:00
Brett Cannon 01b0475b08 Issue #18115: Abstract out managing the cleanup of modules to use in
loaders where C code provides the loaded module.
2013-06-16 17:23:06 -04:00
Brett Cannon 6d26eba186 Check that warnings.showwarning() is not changed. 2013-06-16 15:20:48 -04:00
Brett Cannon 13d8ff9c5b Issues #18058, 18057: Make importlib._bootstrap.NamespaceLoader
conform the the InspectLoader ABC. Perk of this is that runpy/-m can
now work with namespace packages.
2013-06-16 14:56:58 -04:00
Brett Cannon 645ab68f25 merge 2013-06-16 13:14:06 -04:00
Brett Cannon e4f41deccf Issue #17177: The imp module is pending deprecation.
To make sure there is no issue with code that is both Python 2 and 3
compatible, there are no plans to remove the module any sooner than
Python 4 (unless the community moves to Python 3 solidly before then).
2013-06-16 13:13:40 -04:00
Andrew Kuchling f567727abc Merge with 3.3 2013-06-16 13:02:55 -04:00
Andrew Kuchling c7b6c50f29 Describe 'surrogateescape' in the documentation.
Also, improve some docstring descriptions of the 'errors' parameter.

Closes #14015.
2013-06-16 12:58:48 -04:00
Brett Cannon 39295e7a55 Stop using the deprecated unittest.TestCase.assertRaisesRegexp() 2013-06-16 11:37:57 -04:00
Brett Cannon 2f9f056db1 Make test_builtin work when executed directly 2013-06-15 23:24:11 -04:00
Gregory P. Smith 22ba31a3af Prevent a possible double close of parent pipe fds when the subprocess
exec runs into an error.  Prevent a regular multi-close of the /dev/null
fd when any of stdin, stdout and stderr was set to DEVNULL.
2013-06-15 18:14:56 -07:00
Gregory P. Smith 893f2ffc7c news entry for subprocess double close fix. 2013-06-15 18:05:17 -07:00
Gregory P. Smith b5461b9884 Prevent a possible double close of parent pipe fds when the subprocess
exec runs into an error.  Prevent a regular multi-close of the /dev/null
fd when any of stdin, stdout and stderr was set to DEVNULL.
2013-06-15 18:04:26 -07:00
Brett Cannon ef888024d8 Issue #17177: stop using imp in test_importlib 2013-06-15 18:39:21 -04:00
Brett Cannon 53e600c24a Issue #17177: update checkpyc to stop using imp 2013-06-15 18:10:18 -04:00
Brett Cannon ca5ff3a069 Issue # 17177: Stop using imp in setup.py 2013-06-15 17:52:59 -04:00
Brett Cannon e7e1deef17 Issue # 17177: Stop using imp in turtledemo 2013-06-15 17:33:27 -04:00
Brett Cannon b57a085c74 Issue #17177: Stop using imp in zipfile 2013-06-15 17:32:30 -04:00
Brett Cannon 9529fbfd36 Issue #17177: Stop using imp in a bunch of tests 2013-06-15 17:11:25 -04:00
Andrew Kuchling 8a2a902f88 Merge with 3.3 2013-06-15 15:10:08 -04:00
Brett Cannon f15a59fdf3 Issue #17177: Stop using imp in sysconfig 2013-06-15 14:32:11 -04:00
Brett Cannon 82d2107668 Issue #17177: switch from imp.new_module to types.ModuleType for runpy 2013-06-15 14:27:21 -04:00
Brett Cannon f4ba4ec160 Issue #17177: Stop using imp in pydoc 2013-06-15 14:25:04 -04:00
Brett Cannon df960682a5 Issue #17177: Stop using imp with py_compile 2013-06-15 14:07:21 -04:00
Andrew Kuchling 53e5ea7951 #18113: Objects associated to a curses.panel object with set_userptr() were leaked.
Reported by Atsuo Ishimoto.
2013-06-15 14:04:04 -04:00
Brett Cannon fc06443c98 merge 2013-06-15 13:38:07 -04:00
Brett Cannon cc39b1ed1d merge w/ 3.3 2013-06-15 13:37:38 -04:00
Brett Cannon 27bbfdbc4c Drop some dead imports of imp 2013-06-15 13:37:12 -04:00
Andrew Kuchling 0d0813a816 Fix typo; clarify that the methods were removed entirely 2013-06-15 13:29:09 -04:00
Brett Cannon 4f4088eb6f Issue #17177: Stop using imp in multiprocessing 2013-06-15 13:23:01 -04:00
Brett Cannon 61c3556c14 Issue #17177: Stop using imp in distutils 2013-06-15 12:59:53 -04:00
Brett Cannon 7822e123c4 Issue #17177: stop using imp for compileall. 2013-06-14 23:04:02 -04:00
Brett Cannon 0b16b0d3f0 make test more robust under Windows 2013-06-14 22:50:57 -04:00
Brett Cannon 4f422e3414 Issue #17177: Update the programming FAQ to use importlib 2013-06-14 22:49:00 -04:00
Brett Cannon 82b3d6ae93 Move something to the right section of What's New 2013-06-14 22:37:11 -04:00
Brett Cannon a38e81428a Issue #18194: Introduce importlib.util.cache_from_source() and
source_from_cache(), finishing the work introduced in changset
4134:9cacdb9d0c59.
2013-06-14 22:35:40 -04:00
Brett Cannon 589c4fffd2 Make it more obvious what things used in imp are snuck in through private APIs 2013-06-14 22:29:58 -04:00
Brett Cannon a3c96154d2 Issue #17907: touch up the code for imp.new_module(). 2013-06-14 22:26:30 -04:00
Brett Cannon 15e489f7c5 Fix markup of the synopsis along with changing to state what is in the
module and not as a definition of what an enumeration is.
2013-06-14 21:59:16 -04:00
Victor Stinner d016900080 Merge heads 2013-06-15 03:37:45 +02:00
Victor Stinner 36f01ad9ac Revert changeset 6661a8154eb3: Issue #3329: Add new APIs to customize memory allocators
The new API require more discussion.
2013-06-15 03:37:01 +02:00
Ethan Furman 6b3d64ab5d Closes issue 17947. Adds PEP-0435 (Adding an Enum type to the Python standard library).
Missing files added.
News entry added.
2013-06-14 16:55:46 -07:00
Brett Cannon 2d77204180 Issue #17907: Document types.ModuleType's constructor and attributes,
allowing for documenting imp.new_module() as deprecated.
2013-06-14 19:19:57 -04:00
Brett Cannon 05a647deed Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document the
deprecation of imp.get_magic().
2013-06-14 19:02:34 -04:00
Victor Stinner 4d7056258b Issue #3329: Add new APIs to customize memory allocators
* Add a new PyMemAllocators structure
* New functions:

  - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree(): GIL-free memory
    allocator functions
  - PyMem_GetRawAllocators(), PyMem_SetRawAllocators()
  - PyMem_GetAllocators(), PyMem_SetAllocators()
  - PyMem_SetupDebugHooks()
  - _PyObject_GetArenaAllocators(), _PyObject_SetArenaAllocators()

* Add unit test for PyMem_Malloc(0) and PyObject_Malloc(0)
* Add unit test for new get/set allocators functions
* PyObject_Malloc() now falls back on PyMem_Malloc() instead of malloc() if
  size is bigger than SMALL_REQUEST_THRESHOLD, and PyObject_Realloc() falls
  back on PyMem_Realloc() instead of realloc()
* PyMem_Malloc() and PyMem_Realloc() now always call malloc() and realloc(),
  instead of calling PyObject_Malloc() and PyObject_Realloc() in debug mode
2013-06-15 00:37:46 +02:00
Brett Cannon 8c18da20f9 merge 2013-06-14 18:33:21 -04:00
Brett Cannon 33915eba7c Issue #17222: Raise FileExistsError when py_compile.compile would
overwrite a symlink or non-regular file with a regular file.
2013-06-14 18:33:00 -04:00
Ned Deily 7bff3cbe3d Issue #18149: Add filecmp.clear_cache() to manually clear the filecmp cache.
Patch by Mark Levitt
2013-06-14 15:19:11 -07:00
Brett Cannon 3fe35e6503 Issue #18193: Add importlib.reload(), documenting (but not
implementing in code) the deprecation of imp.reload().

Thanks to Berker Peksag for the patch.
2013-06-14 15:04:26 -04:00
Brett Cannon 6f1057605b Remove a dead import line.
Noticed by Serhly Storchaka.
2013-06-14 10:42:48 -04:00