Commit Graph

15022 Commits

Author SHA1 Message Date
Brett Cannon 27bc441f5e merge for issue #18278 2013-06-21 18:37:02 -04:00
Brett Cannon 29b2f174da Issue #18278: properly document how the loaders are called for FileFinder 2013-06-21 18:31:55 -04:00
Andrew Kuchling 4921a089e2 #12716: reorganize docs for os module a bit
* Move the constants used by os.open() to after the description of os.open(),
  instead of putting them in their own section.

* Move RTLD_* constants to "Miscellaneous System Information" section, and
  mention the sys functions they're used with.

* Mention dir_fd parameter in os.open() text.

* Typo fix ("are a supported by").
2013-06-21 11:49:57 -04:00
Andrew Kuchling c61b913078 #13226: update references from ctypes/DLFCN modules to os module 2013-06-21 10:58:41 -04:00
Andrew Kuchling 3468d25a80 Merge from 3.3 2013-06-21 08:07:35 -04:00
Andrew Kuchling edb4260ffd Closes #18218: use correct variable name for starting point 2013-06-21 08:00:58 -04:00
Andrew Kuchling 29303d4ea5 Merge from 3.3 2013-06-20 21:40:14 -04:00
Andrew Kuchling c3db3739aa Closes #18267: use floor division in code example 2013-06-20 21:33:05 -04:00
Andrew Kuchling f862dc53e8 Merge from 3.3 2013-06-20 21:20:20 -04:00
Andrew Kuchling 1d7d580d0e Closes #18272: use 'builtins' for 3.3 instead of __builtin__ 2013-06-20 21:17:41 -04:00
Victor Stinner 854ffcb6f3 whatsnew/3.4: mention functools.singledispatch, PEP 443 2013-06-21 00:36:30 +02:00
Victor Stinner 84e33c8431 whatsnew/3.4: mention the new enum module, PEP 435 2013-06-21 00:31:55 +02:00
Andrew Kuchling 7aed567f2b Merge from 3.3 2013-06-20 09:51:51 -04:00
Andrew Kuchling 2151fc6416 #4153: update Unicode howto for Python 3.3
* state that python3 source encoding is UTF-8, and give examples

* mention surrogateescape in the 'tips and tricks' section, and
  backslashreplace in the "Python's Unicode Support" section.

* Describe Unicode support provided by the re module.

* link to Nick Coghlan's and Ned Batchelder's notes/presentations.

* default filesystem encoding is now UTF-8, not ascii.

* Describe StreamRecoder class.

* update acks section

* remove usage of "I think", "I'm not going to", etc.

* various edits

* remove revision history and original outline
2013-06-20 09:29:09 -04:00
R David Murray 2f72aed1b4 Merge: Tweak programming faq examples so that it (mostly) passes doctest. 2013-06-19 16:59:22 -04:00
R David Murray fdf9503038 Tweak programming faq examples so that it (mostly) passes doctest.
The exception is the import related questions at the end, which
need to be rewritten anyway.
2013-06-19 16:58:26 -04:00
Brett Cannon 89df7b4e64 Issue #17177: Clarify some deprecations 2013-06-18 20:49:55 -04:00
Brett Cannon 8dd823340f Grammar tweak 2013-06-17 19:58:57 -04:00
Christian Heimes 9a5395ae2b Issue #18147: Add diagnostic functions to ssl.SSLContext().
get_ca_list() lists all loaded CA certificates and cert_store_stats() returns
amount of loaded X.509 certs, X.509 CA certs and CRLs.
2013-06-17 15:44:12 +02:00
Brett Cannon a81d527ca9 documentation suggesting something which doesn't exist 2013-06-16 19:17:12 -04:00
Brett Cannon 390f6c1bf7 Merge doc/argument name fix 2013-06-16 19:09:46 -04:00
Brett Cannon a269d821a1 merge 2013-06-16 19:07:16 -04:00
Brett Cannon 1d75382e81 Fix a misnaming of a method and an argument 2013-06-16 19:06:55 -04:00
Brett Cannon f24fecd4ac Issue #18076: Introduce imoportlib.util.decode_source().
The helper function makes it easier to implement
imoprtlib.abc.InspectLoader.get_source() by making that function
require just the raw bytes for source code and handling all other
details.
2013-06-16 18:37:53 -04:00
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 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
Andrew Kuchling 0d0813a816 Fix typo; clarify that the methods were removed entirely 2013-06-15 13:29:09 -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 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
Ethan Furman 0fff6ad1a1 Closes issue 17947. Adds PEP-0435 (Enum, IntEnum) to the stdlib. 2013-06-14 00:30:27 -07:00
Brett Cannon 8f5ac5106e Issue #15767: Touch up ModuleNotFoundError usage by import.
Forgot to raise ModuleNotFoundError when None is found in sys.modules.
This led to introducing the C function PyErr_SetImportErrorSubclass()
to make setting ModuleNotFoundError easier.

Also updated the reference docs to mention ModuleNotFoundError
appropriately. Updated the docs for ModuleNotFoundError to mention the
None in sys.modules case.

Lastly, it was noticed that PyErr_SetImportError() was not setting an
exception when returning None in one case. That issue is now fixed.
2013-06-12 23:29:18 -04:00
Brett Cannon b1611e2772 Issue #15767: Introduce ModuleNotFoundError, a subclass of
ImportError.

The exception is raised by import when a module could not be found.
Technically this is defined as no viable loader could be found for the
specified module. This includes ``from ... import`` statements so that
the module usage is consistent for all situations where import
couldn't find what was requested.

This should allow for the common idiom of::

  try:
    import something
  except ImportError:
    pass

to be updated to using ModuleNotFoundError and not accidentally mask
ImportError messages that should propagate (e.g. issues with a
loader).

This work was driven by the fact that the ``from ... import``
statement needed to be able to tell the difference between an
ImportError that simply couldn't find a module (and thus silence the
exception so that ceval can raise it) and an ImportError that
represented an actual problem.
2013-06-12 16:59:46 -04:00
Ned Deily 982c6efeb5 Issue #18187: merge from 3.3 2013-06-11 14:40:23 -07:00
Ned Deily 3886120428 Issue #18187: Fix broken link in venv documentation. Patch by Berker Peksag. 2013-06-11 14:38:39 -07:00
Christian Heimes 46bebee25f Issue #17134: Add ssl.enum_cert_store() as interface to Windows' cert store. 2013-06-09 19:03:31 +02:00