Commit Graph

2167 Commits

Author SHA1 Message Date
Raymond Hettinger 3c0a4f5def Issue18771: Reduce the cost of hash collisions for set objects. 2013-08-19 07:36:04 -07:00
Ezio Melotti a7e7497d88 #18466: merge with 3.3. 2013-08-17 16:58:13 +03:00
Ezio Melotti 85a8629d21 #18466: fix more typos. Patch by Févry Thibault. 2013-08-17 16:57:41 +03:00
Antoine Pitrou 9ed5f27266 Issue #18722: Remove uses of the "register" keyword in C code. 2013-08-13 20:18:52 +02:00
Antoine Pitrou 40322e6ad5 Issue #10241: Clear extension module dict copies at interpreter shutdown.
Patch by Neil Schemenauer, minimally modified.

(re-apply after fix for tkinter-related crash)
2013-08-11 00:30:09 +02:00
Christian Heimes ad73a9cf97 Issue #16400: Add command line option for isolated mode.
-I

    Run Python in isolated mode. This also implies -E and -s. In isolated mode
    sys.path contains neither the script’s directory nor the user’s
    site-packages directory. All PYTHON* environment variables are ignored,
    too. Further restrictions may be imposed to prevent the user from
    injecting malicious code.
2013-08-10 16:36:18 +02:00
Antoine Pitrou 236a547b3e Issue #18665: fix typos. Patch by Vajrasky Kok. 2013-08-06 23:06:59 +02:00
Raymond Hettinger 536f9fdcf3 Put the most important and most frequency accessed struct member first. 2013-08-05 22:43:22 -07:00
Antoine Pitrou 58720d6145 Issue #17934: Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles. 2013-08-05 23:26:40 +02:00
Larry Hastings a3c6a1fb6f Cycled Misc/NEWS for alpha 2, touched patchlevel. 2013-08-03 23:29:24 -07:00
Larry Hastings 436151e2ca Merge from v3.4.0a1 head. 2013-08-03 13:01:39 -07:00
Larry Hastings 1f08c772f5 Bumped version to 3.4.0a1. 2013-08-03 12:58:12 -07:00
Serhiy Storchaka 579ddc2fd4 Issue #16741: Fix an error reporting in int(). 2013-08-03 21:14:05 +03:00
Serhiy Storchaka f6d0aeeadc Issue #16741: Fix an error reporting in int(). 2013-08-03 20:55:06 +03:00
Antoine Pitrou 95db2e7b8a Backout 62658d9d8926 (issue #10241): it causes a crash at shutdown when deallocating a Tkapp object. 2013-08-02 20:39:46 +02:00
Antoine Pitrou 84f31a5676 Issue #10241: Clear extension module dict copies at interpreter shutdown.
Patch by Neil Schemenauer, minimally modified.
2013-08-01 22:07:06 +02:00
Antoine Pitrou 796564c27b Issue #18112: PEP 442 implementation (safe object finalization). 2013-07-30 19:59:21 +02:00
Victor Stinner ee4b59c0f8 (Merge 3.3) According to the PEP 7, C code must "use 4-space indents"
Replace 8 spaces with 4.
2013-07-27 00:01:35 +02:00
Victor Stinner ce72e1ce6c According to the PEP 7, C code must "use 4-space indents"
Replace 8 spaces with 4.
2013-07-27 00:00:36 +02:00
Victor Stinner 1c8f059019 Issue #18520: Add a new PyStructSequence_InitType2() function, same than
PyStructSequence_InitType() except that it has a return value (0 on success,
-1 on error).

 * PyStructSequence_InitType2() now raises MemoryError on memory allocation failure
 * Fix also some calls to PyDict_SetItemString(): handle error
2013-07-22 22:24:54 +02:00
Victor Stinner 49fc8ece81 Issue #18203: Add _PyMem_RawStrdup() and _PyMem_Strdup()
Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the
GIL is held or not.
2013-07-07 23:30:24 +02:00
Victor Stinner 0507bf56f0 Issue #3329: Implement the PEP 445
Add new enum:

* PyMemAllocatorDomain

Add new structures:

* PyMemAllocator
* PyObjectArenaAllocator

Add new functions:

* PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree()
* PyMem_GetAllocator(), PyMem_SetAllocator()
* PyObject_GetArenaAllocator(), PyObject_SetArenaAllocator()
* PyMem_SetupDebugHooks()

Changes:

* PyMem_Malloc()/PyObject_Realloc() now always call malloc()/realloc(), instead
  of calling PyObject_Malloc()/PyObject_Realloc() in debug mode.
* PyObject_Malloc()/PyObject_Realloc() now falls back to
  PyMem_Malloc()/PyMem_Realloc() for allocations larger than 512 bytes.
* Redesign debug checks on memory block allocators as hooks, instead of using C
  macros
2013-07-07 02:05:46 +02:00
Brett Cannon 679ecb565b Issue #15767: back out 8a0ed9f63c6e, finishing the removal of
ModuleNotFoundError.
2013-07-04 17:51:50 -04:00
Brett Cannon 82da8886cc Issue #15767: Revert 3a50025f1900 for ModuleNotFoundError 2013-07-04 17:48:16 -04:00
Victor Stinner 14b9b11098 If MS_WIN64 is defined, MS_WINDOWS is also defined: #ifdef can be simplified. 2013-06-25 00:37:25 +02:00
Christian Heimes b3cc7eb74a Fix test for GCC 3.1+ but not strict ANSI C 2013-06-24 15:39:58 +02:00
Christian Heimes e0a2d12ee5 Fix test for GCC 3.1+ but not strict ANSI C 2013-06-24 15:39:41 +02:00
Christian Heimes 99d6135a15 Define S_IFMT and S_IFLNK in pyport.h so posixmodule.c can use named constants instead
of arbitrary looking numbers.
2013-06-23 23:56:05 +02:00
Victor Stinner c6ebd16a20 Issue #11016: Try to fix compilaton of the new _stat.c module on Windows 2013-06-23 01:49:42 +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
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 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
Richard Oudkerk ac0ad884d1 Issue #17931: Resolve confusion on Windows between pids and process handles. 2013-06-05 23:29:30 +01:00
Victor Stinner 7e91e771a9 Close #17931: Fix PyLong_FromPid() on Windows 64-bit: processes are identified
by their HANDLE which is a pointer (and not a long, which is smaller).
2013-06-04 23:56:38 +02:00
Eli Bendersky 6dc32b34dd Issue #13612: handle unknown encodings without a buffer overflow.
This affects pyexpat and _elementtree. PyExpat_CAPI now exposes a new
function - DefaultUnknownEncodingHandler.

Based on a patch by Serhiy Storchaka.
2013-05-25 05:25:48 -07:00
Serhiy Storchaka 66d53fa9ad Issue #16986: ElementTree now correctly parses a string input not only when
an internal XML encoding is UTF-8 or US-ASCII.
2013-05-22 17:07:51 +03:00
Serhiy Storchaka 1cfebc73e0 Issue #9369: The types of `char*` arguments of PyObject_CallFunction() and
PyObject_CallMethod() now changed to `const char*`.
Based on patches by Jörg Müller and Lars Buitinck.
2013-05-29 18:50:54 +03:00
Benjamin Peterson da5eb5a31c don't expand the operand to Py_XINCREF/XDECREF/CLEAR/DECREF multiple times (closes #17206)
A patch from Illia Polosukhin.
2013-05-27 14:46:14 -07:00
Eli Bendersky 7b3022f24f Issue #13612: handle unknown encodings without a buffer overflow.
This affects pyexpat and _elementtree. PyExpat_CAPI now exposes a new
function - DefaultUnknownEncodingHandler.

Based on a patch by Serhiy Storchaka.
2013-05-25 05:27:10 -07:00
Serhiy Storchaka 447b6e3c6e Issue #16986: ElementTree now correctly parses a string input not only when
an internal XML encoding is UTF-8 or US-ASCII.
2013-05-22 17:21:06 +03:00
Antoine Pitrou fef34e3186 Issue #17937: Try harder to collect cyclic garbage at shutdown. 2013-05-19 01:11:58 +02:00
Benjamin Peterson e8e14591eb rather than passing locals to the class body, just execute the class body in the proper environment 2013-05-16 14:37:25 -05:00
Benjamin Peterson 312595ce3a hide the __class__ closure from the class body (#12370) 2013-05-15 15:26:42 -05:00
Georg Brandl c032f16d18 post-release update. 2013-05-15 19:42:39 +02:00
Antoine Pitrou 9396356948 Backout c89febab4648 following private feedback by Guido.
(Issue #17807: Generators can now be finalized even when they are part of a reference cycle)
2013-05-14 20:37:52 +02:00
Benjamin Peterson f6b687fcd4 remove support GCC PyArg_ParseTuple format patch, last seen in 2006 2013-05-12 23:08:28 -05:00
Georg Brandl 88f4dd6451 bump to 3.3.2 2013-05-12 12:51:38 +02:00
Charles-Francois Natali f28dfdd07b Issue #17912: Use a doubly linked-list for thread states. 2013-05-08 21:09:52 +02:00
Antoine Pitrou 04e70d19e7 Issue #17807: Generators can now be finalized even when they are part of a reference cycle. 2013-05-08 18:12:35 +02:00