Commit Graph

3976 Commits

Author SHA1 Message Date
Victor Stinner 76df43de30 Issue #16330: Use surrogate-related macros
Patch written by Serhiy Storchaka.
2012-10-30 01:42:39 +01:00
Philip Jenvey 16bb5450d6 merge with 3.3 2012-10-26 17:05:55 -07:00
Philip Jenvey 5f9459fbed merge with 3.2 2012-10-26 17:05:09 -07:00
Philip Jenvey 45c41494bf bounds check for bad data (thanks amaury) 2012-10-26 17:01:53 -07:00
Nick Coghlan 557c76c136 Fix compilation on Windows 2012-10-20 11:43:58 +10:00
Nick Coghlan d4f5ad6c6e Merge fix from #6074 from 3.3 2012-10-19 23:36:15 +10:00
Nick Coghlan eb8d627bbd Issue #6074: Apply an appropriate fix for importlib based imports 2012-10-19 23:32:00 +10:00
Nick Coghlan 34937ce249 Issue #6074: Forward port Windows read-only source file fix from 2.7 2012-10-19 22:38:14 +10:00
Christian Heimes 743e0cd6b5 Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified
endianess detection and handling.
2012-10-17 23:52:17 +02:00
Trent Nelson 744faddae8 Merge issue #15833: don't raise an exception if importlib can't write
byte-compiled files.

This fixes a regression introduced by 3.3.

Patch by Charles-François Natali.
2012-10-16 08:03:21 -04:00
Trent Nelson d783c8ed00 Issue #15833: don't raise an exception if importlib can't write byte-compiled
files.

This fixes a regression introduced by 3.3.  Patch by Charles-François Natali.
2012-10-16 07:47:34 -04:00
Benjamin Peterson fe1bcb64cd move more variable declarations to the top of blocks 2012-10-12 11:40:01 -04:00
Benjamin Peterson f208df3618 move declaration to top of block 2012-10-12 11:37:56 -04:00
Benjamin Peterson 31a58ff1c3 ceval cleanup
- Make many variables local to the opcode; Kill u, v, w, and x.
- Force every opcode to end with DISPATCH or jump to error handling.
- Simplify error handling.
- Check error statuses in more places.

Closes #16191.
2012-10-12 11:34:51 -04:00
Brett Cannon 6072e0bf42 Remove uses of % with str.format. 2012-10-12 10:00:34 -04:00
Brett Cannon 9407d50208 Merge fix for issue #15111. 2012-10-10 19:18:37 -04:00
Brett Cannon a6ce4fd426 Closes issue #15111: Calling __import__ with a module specified in
fromlist which causes its own ImportError (e.g. the module tries to
import a non-existent module) should have that exception propagate.
2012-10-10 19:03:46 -04:00
Benjamin Peterson 00f86f2202 add some missing DISPATCH() 2012-10-10 14:10:33 -04:00
Jesus Cea f01d695ccd Closes #16135: Removal of OS/2 support 2012-10-05 03:36:11 +02:00
Jesus Cea b48925a406 #16135: Removal of OS/2 support (I) 2012-10-05 01:04:27 +02:00
Victor Stinner 3b635cd447 Close #15766: Catch exceptions while raising the ImportError in imp.load_dynamic() 2012-10-02 00:55:07 +02:00
Victor Stinner 621ef3d84f Issue #15609: Optimize str%args for integer argument
- Use _PyLong_FormatWriter() instead of formatlong() when possible, to avoid
   a temporary buffer
 - Enable the fast path when width is smaller or equals to the length,
   and when the precision is bigger or equals to the length
 - Add unit tests!
 - formatlong() uses PyUnicode_Resize() instead of _PyUnicode_FromASCII()
   to resize the output string
2012-10-02 00:33:47 +02:00
Brett Cannon 8ed677db12 Add some comments. 2012-09-28 16:41:39 -04:00
Benjamin Peterson feaa54f537 don't depend on __debug__ because it's baked in at freeze time (issue #16046) 2012-09-25 11:22:59 -04:00
Antoine Pitrou ca8aa4acf6 Issue #15144: Fix possible integer overflow when handling pointers as integer values, by using Py_uintptr_t instead of size_t.
Patch by Serhiy Storchaka.
2012-09-20 20:56:47 +02:00
Christian Heimes 10ca1fee8f Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases. 2012-09-12 17:58:20 +02:00
Christian Heimes 55ad6515c9 Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases. 2012-09-12 17:58:10 +02:00
Christian Heimes 9c5b521c71 Partly revert ad3824a90261 and add comment about reference ownership 2012-09-12 17:53:15 +02:00
Christian Heimes 1526582df6 Partly revert ad3824a90261 and add comment about reference ownership 2012-09-12 17:52:46 +02:00
Christian Heimes e9a6d62d9f Fix null pointer dereferencing in structmember.c PyMember_SetOne() for T_CHAR. _PyUnicode_AsStringAndSize() can return NULL without touching the len argument. Also remove unnecessary PyUnicode_Check(), _PyUnicode_AsStringAndSize() performance the test again. CID 486815 2012-09-11 17:31:08 +02:00
Christian Heimes 5557a9c73f Fix null pointer dereferencing in structmember.c PyMember_SetOne() for T_CHAR. _PyUnicode_AsStringAndSize() can return NULL without touching the len argument. Also remove unnecessary PyUnicode_Check(), _PyUnicode_AsStringAndSize() performance the test again. CID 486815 2012-09-11 17:30:53 +02:00
Christian Heimes 6d29352cfd Issue #15895: my analysis was slightly off. The FILE pointer is only leaked when set_main_loader() fails for a pyc file with closeit=0. In the success case run_pyc_file() does its own cleanup of the fp. I've changed the code to use another FILE ptr for pyc files and moved the fclose() to PyRun_SimpleFileExFlags() to make it more obvious what's happening. 2012-09-11 15:47:28 +02:00
Christian Heimes 6a77af690f Issue #15895: Fix FILE pointer leak in PyRun_SimpleFileExFlags() when filename points to a pyc/pyo file and closeit is false. 2012-09-11 14:11:03 +02:00
Christian Heimes 10e85ded9b Fixed memory leak in error branch of parsestrplus. CID 715374 Variable s going out of scope leaks the storage it points to. 2012-09-10 16:53:28 +02:00
Christian Heimes 3d463393bb Fixed memory leak in error branch of parsestrplus. CID 715374 Variable s going out of scope leaks the storage it points to. 2012-09-10 16:52:42 +02:00
Christian Heimes 879329d66e Added missing va_end in error branch of PyArg_UnpackTuple(). CID 486641 2012-09-10 13:17:23 +02:00
Christian Heimes 48d8d21438 Added missing va_end in error branch of PyArg_UnpackTuple(). CID 486641 2012-09-10 13:16:45 +02:00
Christian Heimes 310f81449a Closed reference leak of variable 'k' in function ste_new which wasn't decrefed in error cases 2012-09-10 03:09:17 +02:00
Christian Heimes 837e53a7c2 Closed reference leak of variable 'k' in function ste_new which wasn't decrefed in error cases 2012-09-10 03:08:46 +02:00
Antoine Pitrou 8c195afcac Issue #15340: Fix importing the random module when /dev/urandom cannot be opened.
This was a regression caused by the hash randomization patch.
2012-09-07 23:51:22 +02:00
Antoine Pitrou 7ff1822ec7 Issue #15340: Fix importing the random module when /dev/urandom cannot be opened.
This was a regression caused by the hash randomization patch.
2012-09-07 23:49:07 +02:00
Stefan Krah d9c1bf7f1f After the jump in line 1051 unicode_tmp is NULL. Found by Coverity. 2012-09-06 13:02:46 +02:00
Antoine Pitrou 5b4faae307 Issue #13992: The trashcan mechanism is now thread-safe. This eliminates
sporadic crashes in multi-thread programs when several long deallocator
chains ran concurrently and involved subclasses of built-in container
types.

Note that the trashcan functions are part of the stable ABI, therefore
they have to be kept around for binary compatibility of extensions.
2012-09-06 01:17:42 +02:00
Antoine Pitrou 56cd62c04a Issue #13992: The trashcan mechanism is now thread-safe. This eliminates
sporadic crashes in multi-thread programs when several long deallocator
chains ran concurrently and involved subclasses of built-in container
types.

Because of this change, a couple extension modules compiled for 3.2.4
(those which use the trashcan mechanism, despite it being undocumented)
will not be loadable by 3.2.3 and earlier. However, extension modules
compiled for 3.2.3 and earlier will be loadable by 3.2.4.
2012-09-06 00:59:49 +02:00
Benjamin Peterson d40528fe9a merge 3.2 2012-09-02 16:37:09 -04:00
Benjamin Peterson c7dedb0945 put * in the normal place 2012-09-02 16:36:01 -04:00
Benjamin Peterson bd0df50fb6 get rid of ast_error_finish by passing the compiling struct to ast_error 2012-09-02 15:04:51 -04:00
Benjamin Peterson e9f72dbf0d merge 3.2 2012-09-02 14:38:15 -04:00
Benjamin Peterson c5d7518a2e move variable decl to the top of the function 2012-09-02 14:38:08 -04:00
Benjamin Peterson c7f447c89f merge 3.2 (#15846) 2012-09-02 14:24:44 -04:00