Commit Graph

8030 Commits

Author SHA1 Message Date
Mark Dickinson 039e0cdc28 Issue #16305: Merge fix from 3.2. 2012-10-25 10:47:46 +01:00
Mark Dickinson 76464494bc Fix math.factorial KeyboardInterrupt segfault. Thanks Amaury for report and diagnosis. 2012-10-25 10:46:28 +01:00
Petri Lehtinen 5445a8cb41 Replace tabs with spaces in posixmodule.c 2012-10-23 16:29:59 +03:00
Nadeem Vawda 18b7fcc7a6 Merge #14398: Fix size truncation and overflow bugs in bz2 module. 2012-10-21 21:16:58 +02:00
Nadeem Vawda 5f8f0d6777 Issue #14398: Fix size truncation and overflow bugs in bz2 module. 2012-10-21 21:13:27 +02:00
Gregory P. Smith a10ddb8a55 Fixes Issue #16114: The subprocess module no longer provides a
misleading error message stating that args[0] did not exist when
either the cwd or executable keyword arguments specified a path that
did not exist.
2012-10-10 03:44:47 -07:00
Gregory P. Smith 5591b02a4c Fixes Issue #16114: The subprocess module no longer provides a
misleading error message stating that args[0] did not exist when
either the cwd or executable keyword arguments specified a path that
did not exist.

It now keeps track of if the child got as far as preexec and reports it if
not back to the parent via a special "noexec" error message value in
the error pipe so that the cwd can be blamed for a failed chdir
instead of the exec of the executable being blamed instead.

The executable is also always reported accurately when exec fails.

Unittests enhanced to cover these cases.
2012-10-10 03:34:47 -07:00
Mark Dickinson c04ddff290 Issue #16096: Fix several occurrences of potential signed integer overflow. Thanks Serhiy Storchaka. 2012-10-06 18:04:49 +01:00
Antoine Pitrou ee329318db Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element element_factory (fixes a regression in SimpleTAL). 2012-10-04 19:53:29 +02:00
Jesus Cea 6e1d2b6e78 Closes #16126: PyErr_Format format mismatch in _testcapimodule.c 2012-10-04 16:06:30 +02:00
Jesus Cea cf45325b61 Closes #15897: zipimport.c doesn't check return value of fseek(). Typo 2012-10-03 03:16:42 +02:00
Jesus Cea fb22f542d2 MERGE: Closes #15897: zipimport.c doesn't check return value of fseek() 2012-10-03 03:00:37 +02:00
Jesus Cea 09bf7a799d Closes #15897: zipimport.c doesn't check return value of fseek() 2012-10-03 02:13:05 +02:00
Antoine Pitrou c194884983 Sanitize and modernize some of the _elementtree code (see issue #16089). 2012-10-01 23:40:37 +02:00
Stefan Krah a0346e56ac Support gcc's -ansi flag: use "__asm__" instead of "asm". 2012-09-30 17:31:04 +02:00
Stefan Krah e59aa8c94d Revert 29506c7db353 (build output should be accurate). 2012-09-30 17:20:47 +02:00
Christian Heimes 5c9a5895d4 merge 2012-09-30 15:51:39 +02:00
Christian Heimes 72c9946718 Change libmpdec to use ANSI code in strict ansi mode as inline asm isn't supported in ANSI C 2012-09-30 15:49:56 +02:00
Stefan Krah 9a3f05e60f Make it clear that the pi function is modified for benchmarking purposes. 2012-09-30 09:24:41 +02:00
Stefan Krah 6b6a1df996 Restore the benchmark order to avoid waiting for decimal.py if just the
prec=9 test is used.
2012-09-25 17:07:55 +02:00
Brett Cannon 6cf50c5b1d Fix whitespace. 2012-09-25 10:26:15 -04:00
Brett Cannon 63092fe0ea Fix whitespace. 2012-09-25 10:25:41 -04:00
Brett Cannon d266c4451f Make the decimal bench file run under Python 2.7. 2012-09-25 10:23:47 -04:00
Senthil Kumaran 49d130227b merge 3.2: Issue #16013: Fix CSV Reader parsing issue with ending quote characters. Patch by Serhiy Storchaka. 2012-09-25 02:37:20 -07:00
Senthil Kumaran 67b7b98a47 Issue #16013: Fix CSV Reader parsing issue with ending quote characters. Patch by Serhiy Storchaka. 2012-09-25 02:30:27 -07:00
Christian Heimes 22340be15e Issue #16012: Fix a regression in pyexpat. The parser's UseForeignDTD()
method doesn't require an argument again.
2012-09-24 13:27:28 +02:00
Christian Heimes e26d3af7ee Issue #16012: Fix a regression in pyexpat. The parser's UseForeignDTD()
method doesn't require an argument again.
2012-09-24 13:17:08 +02:00
Christian Heimes 3b9493b53c Use C-style comments for C89 / ANSI C compatibility 2012-09-23 16:11:15 +02:00
Stefan Krah 91ceeceea7 Use C-style comments (required for the AIX build slave). 2012-09-23 15:51:16 +02:00
Stefan Krah 7e6523fbd7 Use C-style comments. 2012-09-23 15:46:09 +02:00
Victor Stinner a3ff101e6a Issue #5969: faulthandler module: rename dump_tracebacks_later() to
dump_traceback_later() and cancel_dump_tracebacks_later() to
cancel_dump_traceback_later().
2012-09-23 11:06:21 +02:00
Alexander Belopolsky 57caede470 Issue #15973: fixed 3.2 backport. 2012-09-20 17:23:46 -04:00
Alexander Belopolsky 9b9ed867bc merged 3.2 2012-09-20 16:42:34 -04:00
Alexander Belopolsky 3ec153681e Issue #15973: Fixed segmentation fault on timezone comparison to other types. 2012-09-20 16:39:33 -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 1c47222a25 merge 2012-09-20 12:43:24 +02:00
Christian Heimes 5cb31c9277 Issue #15977: Fix memory leak in Modules/_ssl.c when the function _set_npn_protocols() is called multiple times 2012-09-20 12:42:54 +02:00
Trent Nelson 9a46105a89 #15965: Explicitly cast AT_FDCWD as (int).
Required on Solaris 10 (which defines AT_FDCWD as 0xffd19553),
harmless on other platforms.
2012-09-18 21:50:06 -04:00
Ezio Melotti 6d10b4d591 #15796: merge with 3.2. 2012-09-18 07:21:18 +03:00
Ezio Melotti 16d2b47837 #15796: Fix \n in readline docstring. Patch by Serhiy Storchaka. 2012-09-18 07:20:18 +03:00
Antoine Pitrou 9d20e0edd9 Issue #15926: Fix crash after multiple reinitializations of the interpreter. 2012-09-12 18:01:36 +02:00
Benjamin Peterson 6f3e5e48d3 remove useless and defined initialization (closes #15921) 2012-09-11 12:05:05 -04:00
Jesus Cea b7a2800831 MERGE: Closes #15793: Stack corruption in ssl.RAND_egd() 2012-09-11 02:08:48 +02:00
Jesus Cea c8754a13e6 Closes #15793: Stack corruption in ssl.RAND_egd() 2012-09-11 02:00:58 +02:00
Jesus Cea 67bd81b867 MERGE: #15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete (fix 2) 2012-09-10 22:58:35 +02:00
Jesus Cea e8db356cf1 #15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete (fix 2) 2012-09-10 22:58:07 +02:00
Jesus Cea 4886d5b338 #15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete 2012-09-10 22:50:21 +02:00
Jesus Cea 1f2799bef4 #15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete 2012-09-10 22:49:50 +02:00
Stefan Krah 76e12179c5 Issue #15882: Change _decimal to accept any coefficient tuple when
constructing infinities. This is done for backwards compatibility
with decimal.py: Infinity coefficients are undefined in _decimal
(in accordance with the specification).
2012-09-10 19:34:58 +02:00
Christian Heimes f47d79fec1 Fixed reference leak in error branch of _bufferedreader_read_all(). The variable data can contain a bytes object but it wasn't cleaned up when PyList_New() failed. CID 715364 2012-09-10 17:46:09 +02:00
Christian Heimes 89ff3c7f20 Fixed out-of-bounce write to rawmode buffer. The fixed size buffer wasn't enlarged for the new 'x' flag. The buffer may contain the 5 flags xrwa+ and the \0 byte 2012-09-10 03:50:48 +02:00
Christian Heimes 1b5c76a283 Fixed two memory leaks in make_filename() in zipimport.c. The allocated buffer wasn't cleaned up in two error cases. CID 486832 2012-09-10 02:00:34 +02:00
Christian Heimes 15b6885fe0 Make sure that *really* no more than sizeof(ifr.ifr_name) chars are strcpy-ed to ifr.ifr_name and that the string is *always* NUL terminated. New code shouldn't use strcpy(), too. CID 719692 2012-09-10 01:25:50 +02:00
Jesus Cea 1b3f3b0316 Closes #15676: mmap: add empty file check prior to offset check 2012-09-10 01:23:05 +02:00
Jesus Cea 941bfcc537 Closes #15676: mmap: add empty file check prior to offset check 2012-09-10 00:27:55 +02:00
Stefan Krah ea94ba45fa Merge 3.2. 2012-09-08 11:19:27 +02:00
Stefan Krah 96efdd422c Issue #15868: Fix refleak in bytesio.c (Coverity #715365). 2012-09-08 11:12:33 +02:00
Ross Lagerwall 2dabaf63cf Issue #15876: Fix a refleak in the curses module
The refleak occurred when assigning to window.encoding.
2012-09-07 08:34:23 +02:00
Stefan Krah 527a2400fb _testbuffer.c: In all current use cases of cmp_structure() dest->format and
src->format are either both NULL or both non-NULL. However, it is safer to
generalize the function. Found by Coverity.
2012-09-06 09:42:29 +02:00
Antoine Pitrou 11946fbe80 Issue #15841: The readable(), writable() and seekable() methods of BytesIO
and StringIO objects now raise ValueError when the object has been closed.
Patch by Alessandro Moura.
2012-09-05 20:13:48 +02:00
Antoine Pitrou 1d857453b7 Issue #15841: The readable(), writable() and seekable() methods of BytesIO
and StringIO objects now raise ValueError when the object has been closed.
Patch by Alessandro Moura.
2012-09-05 20:11:49 +02:00
Victor Stinner 9f16e44a47 Close #14223: Fix window.addch(curses.ACS_HLINE)
Fix window.addch() of the curses module for special characters like
curses.ACS_HLINE: the Python function addch(int) and addch(bytes) is now
calling the C function waddch()/mvwaddch() (as it was done in Python 3.2),
instead of wadd_wch()/mvwadd_wch(). The Python function addch(str) is still
calling the C function wadd_wch()/mvwadd_wch() if the Python curses is linked
to libncursesw.
2012-09-01 15:00:34 +02:00
Victor Stinner 1d39cde50c Issue #15785: Modify window.get_wch() API of the curses module: return a
character for most keys, and an integer for special keys, instead of always
returning an integer. So it is now possible to distinguish special keys like
keypad keys.
2012-08-29 01:40:57 +02:00
Ronald Oussoren cb460b920f Fix issue 13370: Ensure that ctypes works on Mac OS X when Python is
compiled using the clang compiler

(merge from 3.2)
2012-08-25 11:24:00 +02:00
Ronald Oussoren 25437565f9 Fix issue 13370: Ensure that ctypes works on Mac OS X when Python is compiled using the clang compiler 2012-08-25 11:19:14 +02:00
Mark Dickinson fc33d4ce0a Issue #15544: Fix Decimal.__float__ to work with payload-carrying NaNs. 2012-08-24 18:53:10 +01:00
Ross Lagerwall a4b070102a Merge with 3.2 2012-08-24 13:32:14 +02:00
Ross Lagerwall f2b34b8b96 Issue 15777: Fix a refleak in _posixsubprocess.
It was exposed by 03c98d05b140 and dbbf3ccf72e8.
2012-08-24 13:25:59 +02:00
Stefan Krah 66e63170d9 Issue #15770: Check invalid arguments in test function. Patch by Victor Stinner. 2012-08-23 15:53:45 +02:00
Stefan Krah f21587e3a8 mpd_qpowmod(): calculate result with zero-exponent for compatibility with
decimal.py. The hack to remove the ideal exponent is no longer required.
2012-08-23 15:05:29 +02:00
Stefan Krah 17183a2972 Use zero bottom margin. 2012-08-22 19:28:12 +02:00
Stefan Krah ad5b43995e In the 32-bit build, dec_hash() raised InvalidOperation if the operand
had a coefficient with MAX_PREC=425000000 digits and a negative exponent.
Increasing the context limits above the official values fixes the issue
and is safe (in this case!).
2012-08-22 19:11:50 +02:00
Stefan Krah 2fd502f6a1 1) Use _mpd_basedivmod() regardless of the length of the dividend. This is
required for a corner case in dec_hash() in the following commit and also
   usually faster. dec_hash() needs some extra precision above MPD_MAX_PREC,
   and _mpd_base_ndivmod() is not audited for that.

2) Use _mpd_basemul() if the length of the smaller operand is less than
   or equal to 256. While this is technically an optimization, it is
   required for *testing* corner cases in dec_hash() in reasonable time.
2012-08-22 18:54:37 +02:00
Ronald Oussoren 9bd9cd3fb9 Fix for issue 15716: interpreter could crash when PYTHONEXECUTABLE was set on Mac OS X.
This is due to an off-by-one error: the allocated buffer didn't have room for a NUL
character at the end of the mbstowcs result.

(merge with 3.2)
2012-08-22 14:40:35 +02:00
Ronald Oussoren eb61f8b3a7 Fix for issue 15716: interpreter could crash when PYTHONEXECUTABLE was set on Mac OS X.
This is due to an off-by-one error: the allocated buffer didn't have room for a NUL
character at the end of the mbstowcs result.
2012-08-22 14:24:14 +02:00
Richard Oudkerk 6733927761 Fix typo in error handling for WaitForMultipleObjects() 2012-08-21 14:54:22 +01:00
Stefan Krah c0c03be53e Merge 3.2. 2012-08-20 14:42:59 +02:00
Stefan Krah db579d7b25 Issue #15738: Fix a missing NULL check in subprocess_fork_exec(). 2012-08-20 14:36:47 +02:00
Stefan Krah 000fde9651 Closes #15737: Fix potential NULL dereference in zipimport.c. 2012-08-20 14:14:49 +02:00
Mark Dickinson 35fa864840 Issue #15477: Merge fix from 3.2 2012-08-18 12:26:15 +01:00
Mark Dickinson 05d79e9abf Issue #15477: Add workaround for log1p(-0.0) on platforms where it's broken. 2012-08-18 12:24:30 +01:00
Antoine Pitrou 721738fbee Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
2012-08-15 23:20:39 +02:00
Antoine Pitrou 6f430e4963 Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
2012-08-15 23:18:25 +02:00
Andrew Svetlov c53eb9dfe2 Merge 3.2 to default 2012-08-14 18:42:10 +03:00
Matthias Klose d182a6c77e Modules/socketmodule.c: netdb_lock: define static. 2012-08-14 17:29:04 +02:00
Meador Inge 80dd1af4e0 Issue #15424: Add a __sizeof__ implementation for array objects.
Patch by Ludwig Hähne.
2012-08-10 23:21:39 -05:00
Meador Inge 03b4d5072a Issue #15424: Add a __sizeof__ implementation for array objects.
Patch by Ludwig Hähne.
2012-08-10 22:35:45 -05:00
Victor Stinner 3cc635dabb faulthandler: fix the handler of user signals
Restore the errno before calling the previous signal handler, and not after.
2012-08-09 02:43:41 +02:00
Larry Hastings 22701e86d0 Issue #15589: Ensure double-alignment for brute-force capi argument parser test
that occasionally uses doubles.
2012-08-08 14:52:22 -07:00
Victor Stinner 62bb394729 Close #13072: Restore code before the PEP 393 for the array module
'u' format of the array module uses again Py_UNICODE type for backward
compatibility with Python 3.2.

The only change from Python 3.2 is that PyUnicode_AsUnicode() result is now
checked for NULL value.
2012-08-06 00:46:05 +02:00
Antoine Pitrou 848698727f Issue #12655: Instead of requiring a custom type, os.sched_getaffinity and
os.sched_setaffinity now use regular sets of integers to represent the
CPUs a process is restricted to.
2012-08-04 16:16:35 +02:00
Victor Stinner d1f9352bd4 (Merge 3.2) open() / TextIOWrapper doc: make it explicit than newline='\n'
doesn't translate newlines on output.
2012-08-04 01:22:07 +02:00
Victor Stinner 401e17d0f0 open() / TextIOWrapper doc: make it explicit than newline='\n' doesn't
translate newlines on output.
2012-08-04 01:18:56 +02:00
Antoine Pitrou 3c25dfbf13 Make TextIOWrapper's documentation clearer by copying the newline argument's description from open(). 2012-08-04 00:56:19 +02:00
Antoine Pitrou 0c1c0d42dc Make TextIOWrapper's documentation clearer by copying the newline argument's description from open(). 2012-08-04 00:55:38 +02:00
Jesus Cea 1659b75189 MERGE: Closes #15469: Correct __sizeof__ support for deque 2012-08-03 14:52:12 +02:00
Jesus Cea 16e2fca47e Closes #15469: Correct __sizeof__ support for deque 2012-08-03 14:49:42 +02:00
Jesus Cea 88ca04e6a8 MERGE: Closes #15512: Correct __sizeof__ support for parser 2012-08-03 14:29:26 +02:00
Jesus Cea e9c5318967 Closes #15512: Correct __sizeof__ support for parser 2012-08-03 14:28:37 +02:00
Jesus Cea 5323173dee Closes #15514: Correct __sizeof__ support for cpu_set 2012-08-03 14:18:11 +02:00
Antoine Pitrou 77821b68a7 Issue #15538: Fix compilation of the getnameinfo() / getaddrinfo() emulation code.
Patch by Philipp Hagemeister.
2012-08-02 20:39:10 +02:00
Antoine Pitrou a9a53c7dc0 Issue #15538: Fix compilation of the getnameinfo() / getaddrinfo() emulation code.
Patch by Philipp Hagemeister.
2012-08-02 20:37:12 +02:00
Victor Stinner 98a387b65f Fix the user signal handler of faulthandler
Don't exit the tstate is NULL to restore the errno and chain the signal handler
if needed.
2012-08-01 19:36:36 +02:00
Antoine Pitrou 57911f6c1a Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
Patch by Serhiy Storchaka.
2012-07-30 00:01:44 +02:00
Antoine Pitrou 8f328d0c1d Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
Patch by Serhiy Storchaka.
2012-07-30 00:01:06 +02:00
Antoine Pitrou a264384fe6 Issue #15487: Add a __sizeof__ implementation for buffered I/O objects.
Patch by Serhiy Storchaka.
2012-07-29 19:04:57 +02:00
Antoine Pitrou 10f0c50a0b Issue #15487: Add a __sizeof__ implementation for buffered I/O objects.
Patch by Serhiy Storchaka.
2012-07-29 19:02:46 +02:00
Meador Inge bb9b1c165d Issue #15402: Simplify Struct.__sizeof__ and make tests more precise. 2012-07-28 22:32:50 -05:00
Meador Inge 90bc2dbcce Issue #15402: Simplify Struct.__sizeof__ and make tests more precise. 2012-07-28 22:16:39 -05:00
Martin v. Löwis ee365ac254 Issue #15431: Declare PyImport_FrozenModules conditionally on Unix only. 2012-07-28 21:55:20 +02:00
Martin v. Löwis 96d97ec9c0 Issue #15431: Add _freeze_importlib project to regenerate importlib.h on Windows.
Patch by Kristján Valur Jónsson.
2012-07-28 20:46:52 +02:00
Stefan Krah b9e36b97f2 Add unused parameter to a couple of METH_NOARGS functions. The previous
form is used in many places in the source tree, but was found to be incorrect
in a recent tracker discussion.
2012-07-28 13:53:47 +02:00
Stefan Krah 7d12d9df13 Issue #12834: Fix PyBuffer_ToContiguous() for non-contiguous arrays. 2012-07-28 12:25:55 +02:00
Antoine Pitrou f3923e9dd7 Issue #15413: os.times() had disappeared under Windows. 2012-07-24 21:23:53 +02:00
Meador Inge 9f65899d19 Issue #15402: Add a __sizeof__ method to struct.Struct.
Initial patch by Serhiy Storchaka.
2012-07-23 10:22:36 -05:00
Meador Inge b14d8c9bcf Issue #15402: Add a __sizeof__ method to struct.Struct.
Initial patch by Serhiy Storchaka.
2012-07-23 10:01:29 -05:00
Andrew Svetlov 80823d7ed7 #15094: fix incorrectly placed #endif in _tkinter.c.
Patch by Serhiy Storchaka.
2012-07-22 13:56:54 +03:00
Eli Bendersky 7b31b1a2a4 Raise ImportError if pyexpat's version is incompatible 2012-07-21 20:32:39 +03:00
Eli Bendersky ef391ac982 Raise ImportError if pyexpat's version is incompatible 2012-07-21 20:28:46 +03:00
Stefan Krah 26a1c7a905 Fix Visual Studio warning. 2012-07-20 12:34:18 +02:00
Jesus Cea 024abca053 MERGE: Closes #15395: memory leaks in selectmodule.c 2012-07-19 21:32:07 +02:00
Jesus Cea 62a5c3216d Closes #15395: memory leaks in selectmodule.c 2012-07-19 21:31:26 +02:00
Jesus Cea 3cd346ae33 MERGE: Closes #15396: memory leak in tkinter 2012-07-19 21:18:45 +02:00
Jesus Cea ef86d12979 Closes #15396: memory leak in tkinter 2012-07-19 21:18:07 +02:00
Meador Inge 7506dab2e8 Issue #6493: Fix handling of c_uint32 bitfields with width of 32 on Windows. 2012-07-19 00:14:35 -05:00
Meador Inge 60c2266afe Issue #6493: Fix handling of c_uint32 bitfields with width of 32 on Windows. 2012-07-19 00:01:22 -05:00
Vinay Sajip 90db661b43 Closes #15307: symlinks now work on OS X with framework Python builds. Patch by Ronald Oussoren. 2012-07-17 17:33:46 +01:00
Eli Bendersky b48ff7fdda Merge for #14988 2012-07-17 14:25:14 +03:00
Eli Bendersky 66099b0cdc ISsue #14988: restore Python 2's behavior of raising ImportError when unable to load pyexpat, instead of a SystemError/RuntimeError 2012-07-17 14:20:38 +03:00
Atsuo Ishimoto da0fc14d46 Issue #7171: Add Windows implementation of ``inet_ntop`` and ``inet_pton`` to socket module. 2012-07-16 15:16:54 +09:00
Stefan Krah f35b0274f9 Move PyErr_NoMemory() closer to the failure. 2013-11-08 18:05:02 +01:00
Stefan Krah 5ec6be9b50 Change style to match the surrounding code (no early returns). 2013-11-08 17:48:58 +01:00
Victor Stinner 70e11acdbd Issue #19437: Fix datetime_subtract(), handle new_delta() failure 2013-11-08 00:50:58 +01:00
Victor Stinner aa5bbfaa77 Issue #19437: Fix _io._IOBase.close(), handle _PyObject_SetAttrId() failure 2013-11-08 00:29:41 +01:00
Victor Stinner 50abf2294e Issue #19437: Fix fsconvert_strdup(), raise a MemoryError on PyMem_Malloc()
failure
2013-11-07 23:56:10 +01:00
Victor Stinner bd303c165b Issue #19512, #19515: remove shared identifiers, move identifiers where they
are used.

Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
2013-11-07 23:07:29 +01:00
Martin v. Löwis e75fc14813 Issue #19514: Deduplicate some _Py_IDENTIFIER declarations.
Patch by Andrei Dorian Duma.
2013-11-07 18:46:53 +01:00
R David Murray 589327ea7a Merge #18985: Improve fcntl documentation. 2013-11-07 10:51:41 -05:00
Victor Stinner 53e9ec48e5 Issue #19512: Use the new _PyId_builtins identifier 2013-11-07 00:43:05 +01:00
Victor Stinner e7f516cbb8 Issue #19512: _count_elements() of _collections reuses PyId_get identifier
instead of literal "get" string
2013-11-06 23:52:55 +01:00
Victor Stinner d9d0419a9f Issue #19512: fileio_init() reuses PyId_name identifier instead of "name"
literal string
2013-11-06 23:50:10 +01:00
Victor Stinner 090543736f Issue #19512: add some common identifiers to only create common strings once,
instead of creating temporary Unicode string objects

Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
2013-11-06 22:41:44 +01:00
Victor Stinner bb52020d44 Issue #19512: pickle now uses an identifier to only create the Unicode string
"modules" once
2013-11-06 22:40:41 +01:00
Christian Heimes 6853108ccd Issue #18582: fix memory leak in pbkdf2 code 2013-11-06 17:25:17 +01:00
Victor Stinner 357f5155dc Issue #19437: Fix _threading.RLock constructor (rlock_new), call
Py_DECREF(self) if PyThread_allocate_lock() failed instead of calling directly
type->tp_free(self), to keep the chained list of objects consistent when Python
is compiled in debug mode

fails, don't consume the row (restore it) and fail immediatly (don't call
pysqlite_step())
2013-11-05 15:10:19 +01:00
Victor Stinner 85a12a8beb Issue #19437: Fix pysqlite_cursor_iternext() of sqlite3, when the row factory
fails, don't consume the row (restore it) and fail immediatly (don't call
pysqlite_step())
2013-11-05 14:50:30 +01:00
Victor Stinner b3e1ef1ce0 Issue #19437: Fix pysqlite_connection_call() of sqlite3, return NULL when
PyList_Append() fails
2013-11-05 14:46:13 +01:00
Victor Stinner dd4b299df1 Issue #19437: Fix pysqlite_cursor_iternext() of sqlite3, handle
_pysqlite_fetch_one_row() failure
2013-11-05 14:30:11 +01:00
R David Murray bd90d09dd0 #18678: Correct names of spwd struct members.
The old names (sp_nam and sp_pwd) are kept for backward compatibility.  Since
this is a long standing bug that hasn't caused any real-world problems, I'm
not backporting it.  However, it is worth fixing because the corrected names
match the documentation, and more importantly now match the C struct, just
like the other struct members.

Patch by Vajrasky Kok.
2013-11-03 19:54:05 -05:00
R David Murray c3f57e4a35 Merge #19411: Clarify that b2a_hex/hexlify returns a bytes object. 2013-11-03 13:22:17 -05:00
Brett Cannon 2be28a6984 Silence a compiler warning about an unused function 2013-11-01 10:25:13 -04:00
Victor Stinner a9eb38f02a Issue #19437: Fix newPySSLSocket(), handle PyWeakref_NewRef() failure 2013-10-31 16:35:38 +01:00
Victor Stinner e75996a77c Issue #19437: Fix PyCFuncPtrType constructor, handle
_ctypes_alloc_format_string() failure
2013-10-31 16:34:08 +01:00
Victor Stinner a215002453 Issue #19437: Fix PyCArrayType constructor, raise MemoryError on PyMem_Malloc()
failure
2013-10-31 16:33:05 +01:00
Victor Stinner ba9be477b0 Issue #19437: Fix fill_and_set_sslerror() of _ssl, handle Py_BuildValue()
failure

Don't call PyObject_CallObject() with NULL parameters and an exception set.
2013-10-31 15:00:24 +01:00
Victor Stinner 2ae57e3cf8 Issue #19437: Fix _pickle, don't call _Unpickler_SkipConsumed() with an
exception set
2013-10-31 13:39:23 +01:00
Victor Stinner b43ad1d569 cleanup _Unpickler_SkipConsumed(): remove 1 level of indentation 2013-10-31 13:38:42 +01:00
Tim Golden fa6ab0fa5b Issue #19418 Fix some warnings on Win64 2013-10-31 10:25:47 +00:00
Guido van Rossum 90fb914b4b asyncio: Make the IOCP proactor support "waitable" handles (Richard Oudkerk). 2013-10-30 14:44:05 -07:00
Victor Stinner 7613542a27 Issue #19437: Fix select.epoll.poll(), fix code handling PyMem_New() error
The bug was introduced with the select.epoll module! So it's 5 years old :-)
2013-10-30 19:57:52 +01:00
Victor Stinner f0a7bac201 Issue #19437: Fix os.statvfs(), handle errors 2013-10-30 18:55:24 +01:00
Christian Heimes dc6b933d23 merge 2013-10-29 21:16:58 +01:00
Christian Heimes ee0bac66b2 Issue #19227 / Issue #18747: Remove pthread_atfork() handler to remove OpenSSL re-seeding
It is causing trouble like e.g. hanging processes.
2013-10-29 21:11:55 +01:00
Victor Stinner 34f7383d7a Issue #19437: Fix dec_format() of the _decimal module, handle dec_strdup()
failure (memory allocation failure): raise a MemoryError exception
2013-10-29 20:33:14 +01:00
Victor Stinner f866f97ca8 Issue #19433: test_capi: check signness of some C types 2013-10-29 19:59:31 +01:00
Victor Stinner 01076554b7 Issue #19433: test_capi: add tests on the size of some C types 2013-10-29 19:39:52 +01:00
Victor Stinner f38a5c28e0 Cleanup locale.localeconv(): move Py_DECREF() closer to the error 2013-10-29 19:28:20 +01:00
Victor Stinner 1ce3f840be Issue #19437: Fix convert_op_cmp() of decimal.Decimal rich comparator, handle
PyObject_IsInstance() failure
2013-10-29 19:26:11 +01:00
Victor Stinner 6decccdafe Issue #19437: Fix Array_subscript() of ctypes, handle Array_item() failure 2013-10-29 16:05:14 +01:00
Christian Heimes db816d6546 Issue #19420: Fix reference leak in module initalization code of _hashopenssl.c 2013-10-29 12:14:55 +01:00
Victor Stinner dd371b92c4 Issue #18408: Fix PyCStructUnionType_update_stgdict(), handle
_ctypes_alloc_format_string() failure
2013-10-29 03:50:45 +01:00
Victor Stinner 68f6adca6d Issue #18408: Fix _ctypes_alloc_format_string(), raise MemoryError on memory
allocation failure
2013-10-29 03:50:21 +01:00
Victor Stinner cc024d1820 Issue #18408: Fix iobase_readline(), handle PyByteArray_Resize() failure 2013-10-29 02:23:46 +01:00
Victor Stinner af8b7e8233 Issue #18408: Fix zipimport, handle PyUnicode_Substring() and get_subname() failures 2013-10-29 01:46:24 +01:00
Victor Stinner 73660af6af Issue #19428: zipimport now handles errors when reading truncated or invalid
ZIP archive.
2013-10-29 01:43:44 +01:00
Victor Stinner 28c63f7ffb CJK codecs: less magical macros, semicolon is now explicit 2013-10-29 00:59:44 +01:00
Victor Stinner 14c9fea60a CJK codecs: less magic macros, require explicit semicolon 2013-10-29 00:19:27 +01:00
Victor Stinner 146a2ed0f2 CJK codecs: add newlines for readability 2013-10-29 00:09:41 +01:00
Victor Stinner bd97ac35f7 CJK codecs: use less magic and more readable macros, write explicit if 2013-10-28 23:54:13 +01:00
Victor Stinner 0a6e2c59d3 CJK codecs: remove unused TRYMAP_ENC_MPLANE macro 2013-10-28 23:47:26 +01:00
Victor Stinner 11bdf91a5f Issue #18509: handle PyUnicode_Writer() error 2013-10-28 23:18:39 +01:00
Nadeem Vawda e6514f533e #19395: Raise exception when pickling a (BZ2|LZMA)(Compressor|Decompressor).
The underlying C libraries provide no mechanism for serializing compressor and
decompressor objects, so actually pickling these classes is impractical.
Previously, these objects would be pickled without error, but attempting to use
a deserialized instance would segfault the interpreter.
2013-10-28 21:41:24 +01:00
Georg Brandl fb404f528a #19227: merge with 3.3 2013-10-27 07:57:42 +01:00
Serhiy Storchaka 1985f7b133 Issue #19405: Fixed outdated comments in the _sre module. 2013-10-27 08:07:46 +02:00
Benjamin Peterson 77353664e2 merge 3.3 (#19393) 2013-10-26 13:22:08 -04:00
Serhiy Storchaka 8444ebbd72 Issue #18685: Extract template part of _sre.c into separated sre_lib.h file. 2013-10-26 11:18:42 +03:00
Serhiy Storchaka 9eabac68a3 Issue #18685: Restore re performance to pre-PEP 393 levels. 2013-10-26 10:45:48 +03:00
Tim Golden 781bbebacb Issue13234 Allow listdir to handle extended paths on Windows (Patch by Santoso Wijaya) 2013-10-25 20:24:06 +01:00
Tim Golden 23005084ad Issue4905: use INVALID_FILE_ATTRIBUTES where appropriate. (Patch by Ulrich Eckhardt) 2013-10-25 11:22:37 +01:00
Serhiy Storchaka 4f056d43d6 Issue #19288: Fixed the "in" operator of dbm.gnu databases for string
argument.  Original patch by Arfrever Frehtes Taifersar Arahesis.
2013-10-25 00:08:13 +03:00
Serhiy Storchaka 124a0b314b Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string
argument.  Original patch by Arfrever Frehtes Taifersar Arahesis.
2013-10-25 00:01:25 +03:00
Serhiy Storchaka 8b150ecfc9 Issue #19327: Fixed the working of regular expressions with too big charset. 2013-10-24 22:04:37 +03:00
Antoine Pitrou 4d397008cd Issue #19356: Avoid using a C variabled named "_self", it's a reserved word in some C compilers. 2013-10-23 19:21:55 +02:00
Christian Heimes 327dd732ce Issue #18742: Expose the internal hash type object for ABCs. 2013-10-22 15:05:23 +02:00
Christian Heimes b7bd5df809 Issue #16595: Add prlimit() to resource module
prlimit() is a Linux specific command that combines setrlimit, getrlimit and can set the limit
of other processes.
2013-10-22 11:21:54 +02:00
Christian Heimes 6fc79bf813 Issue #19324: Expose Linux-specific constants in resource module 2013-10-22 11:09:27 +02:00
Christian Heimes b7ddbc855c Load SSL's error strings in hashlib.
Without ERR_load_crypto_strings() functions like ERR_lib_error_string() return NULL.
2013-10-21 19:48:22 +02:00
Christian Heimes c20bcde58d Issue #18527: Upgrade internal copy of zlib to 1.2.8 2013-10-21 12:03:09 +02:00
Christian Heimes c6564b9474 Make PKCS5_PBKDF2_HMAC_fast() a static function 2013-10-20 13:23:03 +02:00
Serhiy Storchaka 36af10c1f7 Issue #17087: Improved the repr for regular expression match objects. 2013-10-20 13:13:31 +03:00
Serhiy Storchaka ce82eb2e13 Issue #12866: Fix bias() for 24-bit. Add more tests. 2013-10-20 09:42:26 +03:00
Christian Heimes ebe83f9875 fix compile issue on windows. path is now a struct ptr 2013-10-19 22:36:17 +02:00
Serhiy Storchaka eaea5e9107 Issue #12866: The audioop module now supports 24-bit samples. 2013-10-19 21:10:46 +03:00
Serhiy Storchaka c679227e31 Issue #1772673: The type of `char*` arguments now changed to `const char*`. 2013-10-19 21:03:34 +03:00
Christian Heimes 351f539ad8 Issue #18582: HMAC_CTX_copy() is not available on OpenSSL < 1.0 2013-10-19 17:59:48 +02:00
Christian Heimes e723622775 Issue #18582: provide a faster C implementation of pbkdf2_hmac that works with OpenSSL < 1.0 2013-10-19 14:24:44 +02:00
Serhiy Storchaka a412f763b3 Fix compilation of the curses module (broken by issue #16612). 2013-10-19 10:45:48 +03:00
Larry Hastings 3182680210 Issue #16612: Add "Argument Clinic", a compile-time preprocessor
for C files to generate argument parsing code.  (See PEP 436.)
2013-10-19 00:09:25 -07:00
Brett Cannon baced5668a Fix a refleak in _sre 2013-10-18 14:03:16 -04:00
Guido van Rossum 27b7c7ebf1 Initial checkin of asyncio package (== Tulip, == PEP 3156). 2013-10-17 13:40:50 -07:00
Nick Coghlan 7d270ee05d Issue #16129: Add `Py_SetStandardStreamEncoding`
This new pre-initialization API allows embedding
applications like Blender to force a particular
encoding and error handler for the standard IO streams.

Also refactors Modules/_testembed.c to let us start
testing multiple embedding scenarios.

(Initial patch by Bastien Montagne)
2013-10-17 22:35:35 +10:00
Serhiy Storchaka 25324971fb Issue #18468: The re.split, re.findall, and re.sub functions and the group()
and groups() methods of match object now always return a string or a bytes
object.
2013-10-16 12:46:28 +03:00
Georg Brandl 6083a4bc1c Re #18521: remove assignments of variables that are immediately reassigned. 2013-10-14 06:51:46 +02:00
Georg Brandl 782952b8fe Re #18521: fix not-quite-C syntax that works only because the PyXXX_Check are macros defined with () around them. 2013-10-14 06:46:12 +02:00
Georg Brandl daa1fa991c Back out accidentally pushed changeset b51218966201. 2013-10-13 09:32:59 +02:00
Georg Brandl 4300019e1a Add re.fullmatch() function and regex.fullmatch() method, which anchor the
pattern at both ends of the string to match.

Patch by Matthew Barnett.
Closes #16203.
2013-10-13 09:18:45 +02:00
Ned Deily 9809ca9d9e Issue #18458: merge comments from 3.3 2013-10-12 15:57:04 -07:00
Christian Heimes e92ef13b0a Issue #18582: Add 'pbkdf2_hmac' to the hashlib module. 2013-10-13 00:52:43 +02:00
Christian Heimes 2582762b1b Issue #19209: Remove import of copyreg from the os module to speed up
interpreter startup. stat_result and statvfs_result are now hard-coded to
reside in the os module.
The patch is based on Victor Stinner's patch.
2013-10-12 01:27:08 +02:00
Antoine Pitrou fd4722cacf Issue #9548: Add a minimal "_bootlocale" module that is imported by the _io module instead of the full locale module. 2013-10-12 00:13:50 +02:00
Benjamin Peterson a76795bf53 merge 3.3 2013-10-10 20:22:39 -04:00
Benjamin Peterson f0a1b87560 merge 3.3 2013-10-10 20:17:29 -04:00
Benjamin Peterson d3c43a993c merge 3.3 (#19220) 2013-10-10 17:40:30 -04:00
Benjamin Peterson 94d08d908b upgrade unicode db to 6.3.0 (closes #19221) 2013-10-10 17:24:45 -04:00
Victor Stinner 2fe9bac4dc Close #16742: Fix misuse of memory allocations in PyOS_Readline()
The GIL must be held to call PyMem_Malloc(), whereas PyOS_Readline() releases
the GIL to read input.

The result of the C callback PyOS_ReadlineFunctionPointer must now be a string
allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL if an error
occurred), instead of a string allocated by PyMem_Malloc() or PyMem_Realloc().

Fixing this issue was required to setup a hook on PyMem_Malloc(), for example
using the tracemalloc module.

PyOS_Readline() copies the result of PyOS_ReadlineFunctionPointer() into a new
buffer allocated by PyMem_Malloc(). So the public API of PyOS_Readline() does
not change.
2013-10-10 16:18:20 +02:00
Raymond Hettinger 07573d7b24 merge 2013-10-04 16:52:39 -07:00
Ned Deily f55697ca6d Issue #19147: merge from 3.3 2013-10-02 12:22:05 -07:00
Raymond Hettinger 75f65e368e merge 2013-10-01 21:38:37 -07:00
Raymond Hettinger c13516b0a0 merge 2013-10-01 01:00:59 -07:00
Antoine Pitrou b2201e1aa6 Properly initialize all fields of a SSL object after allocation. 2013-09-29 19:53:45 +02:00
Antoine Pitrou 20b85557f2 Issue #19095: SSLSocket.getpeercert() now raises ValueError when the SSL handshake hasn't been done. 2013-09-29 19:50:53 +02:00
Serhiy Storchaka 463bd4b5c6 Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation. 2013-09-23 22:49:02 +03:00
Serhiy Storchaka 1eb87629cd Merge heads 2013-09-20 23:28:27 +03:00
Serhiy Storchaka dac8b8b7a6 Issue #3015: Fixed tkinter with wantobject=False. Any Tcl command call
returned empty string.
2013-09-20 23:24:20 +03:00
Antoine Pitrou b4a46cb428 Add a comment making it explicit that itertools.tee() is already 64bit-safe (issue #19049) 2013-09-20 22:19:22 +02:00
doko@ubuntu.com 9937155a1c - followup for issue #18997, make _clear_joined_ptr static. 2013-09-18 12:13:18 +02:00
Charles-François Natali 0cc86850b6 Issue #16201: socket: Use inet_pton()/inet_addr() instead of ad-hoc parsing for
numeric IP addresses.
2013-09-13 19:53:08 +02:00
Eli Bendersky 12f18289c0 Merge for Issue #18997: Issue #18997: fix ElementTree crash with using pickle and __getstate__. 2013-09-13 06:27:52 -07:00
Raymond Hettinger 8df58f7ae8 Issue 18752: Make chain.from_iterable() more visible in the documentation. 2013-09-09 01:29:40 -05:00
Victor Stinner 8898350076 Close #18957: The PYTHONFAULTHANDLER environment variable now only enables the
faulthandler module if the variable is non-empty. Same behaviour than other
variables like PYTHONDONTWRITEBYTECODE.
2013-09-08 11:36:23 +02:00
Antoine Pitrou 7b4769937f Issue #18808: Thread.join() now waits for the underlying thread state to be destroyed before returning.
This prevents unpredictable aborts in Py_EndInterpreter() when some non-daemon threads are still running.
2013-09-07 23:38:37 +02:00
Richard Oudkerk b988ee0632 Fix conversion from Py_ssize_t to int. 2013-09-07 17:40:45 +01:00
Ned Deily f70f4a63b6 Issue #18458: Prevent crashes with newer versions of libedit. Its readline
emulation has changed from 0-based indexing to 1-based like gnu readline.
Original patch by Ronald Oussoren.
2013-09-06 15:16:19 -07:00
Serhiy Storchaka a83a022f9a Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in
the _sre moduel.
2013-09-05 18:02:31 +03:00
Christian Heimes 2d7aba3db1 Issue #18709: GCC 4.6 complains that 'v' may be used uninitialized in GEN_EMAIL/GEN_URI/GEN_DNS case 2013-09-05 16:04:50 +02:00
Victor Stinner 555e57de19 (Merge 3.3) Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit,
don't cast 64-bit pointer to long (32 bits).
2013-09-05 00:23:08 +02:00
Antoine Pitrou e619427f7e Issue #18876: The FileIO.mode attribute now better reflects the actual mode under which the file was opened.
Patch by Erik Bray.
2013-09-04 20:52:14 +02:00
Tim Peters c6171e49ab Merge 3.3 into default.
cwr_next():  move invariants out of loops.

This simplifies and clarifies the code, and gives a small speedup.
2013-09-03 11:52:59 -05:00
Eli Bendersky 207fe01187 Issue #18912: Fix indentation in docstring
Contributed by Jeroen Van Goey
2013-09-03 06:38:55 -07:00
Charles-François Natali 24aa041731 Use INADDR_BROADCAST instead of hard-coded value (it's part of POSIX and
already appears without #ifdef a couple lines above).
2013-08-31 14:48:25 +02:00
Victor Stinner d72fe89b80 select.epoll.fromfd(fd) must be not change the inheritable flag of the file
descriptor
2013-08-28 12:22:39 +02:00
Victor Stinner 1fa174a418 Get rid of signed/unsigned comparaison in _sre.c
Fix compilation warnings on Windows (Visual C++) like: "_sre.c(3121): warning
C4018: '>' : signed/unsigned mismatch".

_validate_outer() ensures that groups >= 0, so _validate_inner() can cast
groups to size_t.
2013-08-28 02:06:21 +02:00
Victor Stinner 36a5a062dc _datetimemodule.c: fix the compilation warning "conversion from 'double' to
'long', possible loss of data" in delta_new(), use an explicit cast from double
to long
2013-08-28 01:53:39 +02:00
Victor Stinner b9981ba680 fix a compilation warning in posix_openpty() on "PPC64 AIX 3.x" buildbot 2013-08-28 01:51:06 +02:00
Victor Stinner 340f712b84 (Merge 3.3) Fix compilation of the _sqlite module if threads are disabled 2013-08-28 01:45:39 +02:00
Victor Stinner daf455554b Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Serhiy Storchaka 46e1ce214b Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 20:17:03 +03:00
Victor Stinner 14e461d5b9 Close #11619: The parser and the import machinery do not encode Unicode
filenames anymore on Windows.
2013-08-26 22:28:21 +02:00
Ezio Melotti d640fe2af5 #18803: merge with 3.3. 2013-08-26 01:33:30 +03:00
Charles-François Natali a439b32cf0 Merge. 2013-08-25 18:28:44 +02:00
Christian Heimes 9dd279a3ac Issue #11973: Fix a problem in kevent. The flags and fflags fields are now
properly handled as unsigned.
2013-08-25 14:57:38 +02:00
Christian Heimes cfa47962c2 Issue #18747: Fix spelling errors in my commit message and comments,
thanks to Vajrasky Kok for proof-reading.
2013-08-25 14:19:29 +02:00
Richard Oudkerk cabbde9e1e Fix compiler warning on Windows. 2013-08-24 23:46:27 +01:00
Eli Bendersky 6eb50b1f5b Use consistent style for else if / else 2013-08-24 15:17:08 -07:00
Benjamin Peterson 3a7dffa4ce remove support for compiling on systems without getcwd()
Do we need a fallback implementation of getcwd() from 1991 that claims to
support "really old Unix systems"? I don't think so.
2013-08-23 21:01:48 -05:00
Serhiy Storchaka 254954aacd Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj
argument.

This is needed for support Tcl/Tk 8.6.
2013-08-22 17:42:05 +03:00
Richard Oudkerk a93bf7b9a6 Fix devpoll_dealloc(). 2013-08-22 14:03:44 +01:00
Richard Oudkerk 168d59b669 Move definition of devpoll_internal_close() before devpoll_close(). 2013-08-22 13:31:15 +01:00
Richard Oudkerk 069d65c35a Fix compilation of select module on Solaris. 2013-08-22 13:04:23 +01:00
Christian Heimes f54c24628b Issue #18747: Use a parent atfork handler instead of a child atfork handler.
fork() is suppose to be async-signal safe but the handler calls unsafe functions. A parent handler mitigates the issue.
2013-08-22 13:19:56 +02:00
Victor Stinner 13423c3726 Close #18794: Add a fileno() method and a closed attribute to select.devpoll
objects.

Add also tests on fileno() method and closed attribute of select.epoll and select.kqueue.
2013-08-22 00:19:50 +02:00
Serhiy Storchaka 4e4088d273 Issue #17119: Fixed integer overflows when processing large strings and tuples
in the tkinter module.
2013-08-21 21:43:08 +03:00
Christian Heimes 6acbe2aaa3 Issue #18747: Re-seed OpenSSL's pseudo-random number generator after fork.
A pthread_atfork() child handler is used to seeded the PRNG with pid, time
and some stack data.
2013-08-21 13:26:34 +02:00
Serhiy Storchaka 5617df1be6 Issue #8865: Concurrent invocation of select.poll.poll() now raises a
RuntimeError exception.  Patch by Christian Schubert.
2013-08-20 20:50:32 +03:00
Serhiy Storchaka edd0de58a8 Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit platforms.
Patch by Yogesh Chaudhari.
2013-08-20 20:07:50 +03:00
Christian Heimes 85532eb212 Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of
OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function.
2013-08-19 17:36:39 +02:00
Christian Heimes 44ed3de6f4 Issue #18774: Remove last bits of GNU PTH thread code, patch by Vajrasky Kok. 2013-08-18 12:43:24 +02:00
Antoine Pitrou 6f6ec37838 Issue #16105: When a signal handler fails to write to the file descriptor registered with ``signal.set_wakeup_fd()``, report an exception instead of ignoring the error. 2013-08-17 20:27:56 +02:00
Christian Heimes f920a1c1f1 Issue 18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok. 2013-08-17 17:25:27 +02:00
Christian Heimes 9b5907cbd5 Issue #18768: coding style nitpick. Thanks to Vajrasky Kok 2013-08-17 17:19:03 +02:00
Ezio Melotti a7e7497d88 #18466: merge with 3.3. 2013-08-17 16:58:13 +03:00
Christian Heimes 1d8e7dbf1a Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke malloc weak symbols. 2013-08-17 15:02:05 +02:00
Christian Heimes e06d47c70c Issue #18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes
inside subjectAltName correctly. Formerly the module has used OpenSSL's
GENERAL_NAME_print() function to get the string represention of ASN.1
strings for rfc822Name (email), dNSName (DNS) and
uniformResourceIdentifier (URI).
2013-08-17 00:58:00 +02:00
Serhiy Storchaka cbad3a367e Issue #18701: Remove sqlitecompat.h. 2013-08-17 01:01:23 +03:00
Serhiy Storchaka 8fa8ee3970 Issue #18701: Remove support of old CPython versions (<3.0) from C code. 2013-08-17 00:48:02 +03:00
Christian Heimes 177b3f9982 Issue #18673: Add O_TMPFILE to os module. O_TMPFILE requires Linux kernel
3.11 or newer. It's only defined on system with 3.11 uapi headers, too.
2013-08-16 14:35:09 +02:00
Antoine Pitrou c69c9bc24b Replace an overly optimistic assert() in _PyGC_CollectNoFail with a simple guard. 2013-08-15 20:15:15 +02:00
Christian Heimes 37d5cebb48 Change the builtin hash algorithms' names to lower case names
as promised by hashlib's documentation.
2013-08-15 18:31:48 +02:00
Richard Oudkerk 84ed9a68bd Issue #8713: Support alternative start methods in multiprocessing on Unix.
See http://hg.python.org/sandbox/sbt#spawn
2013-08-14 15:35:41 +01:00
Antoine Pitrou 9ed5f27266 Issue #18722: Remove uses of the "register" keyword in C code. 2013-08-13 20:18:52 +02:00
Larry Hastings e70f2d588a Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions. 2013-08-12 13:53:20 -04:00
Antoine Pitrou 584e815114 Fix refcounting issue with extension types in tkinter.
(issue #15721)
2013-08-11 00:22:30 +02:00
Ethan Furman a4998a7041 Close #18264: int- and float-derived enums now converted to int or float. 2013-08-10 13:01:45 -07:00
Eli Bendersky 532d03e547 Issue #15651: PEP 3121 refactoring for _elementtree
Patch by Antoine Pitrou (based on Robin Schreiber's original patch)
2013-08-10 08:00:39 -07: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
Larry Hastings a27b83ad2d Issue #15301: Parsing fd, uid, and gid parameters for builtins
in Modules/posixmodule.c is now far more robust.
2013-08-08 00:19:50 -07:00
Antoine Pitrou 257cf2fb83 In _PyGC_Fini(), lose the reference that was kept to the time module 2013-08-06 20:50:48 +02:00
Antoine Pitrou c53204b947 Issue #4885: Add weakref support to mmap objects. Patch by Valerie Lambert. 2013-08-05 23:17:30 +02:00
Mark Dickinson e5192cdbb9 Issue #18661: typo in grp.struct_group docstring (fix merged from 3.3). Thanks Vajrasky Kok. 2013-08-05 17:57:54 +01:00
Raymond Hettinger 28dc9b9fc0 merge 2013-08-04 12:43:59 -07:00
Alexander Belopolsky df7027bb9e Reuse us_per_second in delta_total_seconds. 2013-08-04 15:18:58 -04:00
Alexander Belopolsky 790d269d39 Fixes #8860: Round half-microseconds to even in the timedelta constructor.
(Original patch by Mark Dickinson.)
2013-08-04 14:51:35 -04:00
Serhiy Storchaka b94f61b6fb Issue #17998: Fix an internal error in regular expression engine. 2013-08-03 19:22:28 +03:00
Christian Heimes 865d12a2d9 Fix warning: ‘ptr2’ may be used uninitialized in this function 2013-08-02 11:10:51 +02:00
Ned Deily 970a87fc07 Closes #18627: merge from 3.3 2013-08-01 22:13:30 -07:00
Ned Deily ffb32893a3 Issue #17557: merge from 3.3 2013-08-01 21:37:17 -07:00
Larry Hastings 4dbc95e258 Issue #17899: Fix rare file descriptor leak in os.listdir(). 2013-08-01 18:18:56 -07:00
Victor Stinner ffff763161 Issue #18519: Fix test_sqlite on old versions of libsqlite3
With old SQLite versions, _sqlite3_result_error() sets a new Python exception,
so don't restore the previous exception.
2013-08-02 01:48:10 +02:00
Victor Stinner 044c516854 Issue #18609, #18408: _ctypes_add_traceback() now clears the current exception
while adding the traceback, because it may call indirectly a Python function
and Python functions must not be called with an exception set.

In the case of the issue #18609, _ctypes_add_traceback() called the iso8859-1
decoder which is implemented in Python. Python has a ISO-8859-1 codec
implemented in C. It is not used because PyUnicode_Decode() only uses the C
codec for other names (aliases) of this codec ("latin-1", "latin1" and
"iso-8859-1").
2013-08-02 00:47:47 +02:00
Antoine Pitrou 932ff83682 Issue #18608: Avoid keeping a strong reference to the locale module inside the _io module. 2013-08-01 21:04:50 +02:00
Antoine Pitrou 2d350fd8af Issue #18619: Fix atexit leaking callbacks registered from sub-interpreters, and make it GC-aware. 2013-08-01 20:56:12 +02:00
Tim Golden 6b528067c5 Issue #9035: os.path.ismount now recognises volumes mounted below
a drive root on Windows. Original patch by Atsuo Ishimoto.
2013-08-01 12:44:00 +01:00
Christian Heimes abe639f115 Initialize utime with 0. It fixes a couple of compiler warnung:
warning: 'utime.mtime_ns' may be used uninitialized in this function [-Wmaybe-uninitialized]
2013-08-01 00:12:06 +02:00
Antoine Pitrou c27cd71cd7 Merge 2013-07-31 21:54:18 +02:00
Antoine Pitrou 5c30a75722 Issue #15699: The readline module now uses PEP 3121-style module initialization, so as to reclaim allocated resources (Python callbacks) at shutdown.
Original patch by Robin Schreiber.
2013-07-31 21:52:53 +02:00
Christian Heimes 0ce642ebca yet another WITH_THREADS typo 2013-07-31 13:32:40 +02:00
Christian Heimes 6ffa5ce1f3 Fix _sha3 module to actually release the GIL around its update function.
gcov is great.
2013-07-31 11:58:18 +02:00
Christian Heimes 4efdb4177e Test Py_IncRef() and Py_DecRef() C functions 2013-07-31 02:36:43 +02:00
Christian Heimes 72f455e96c Fix use of uninitialized scalar variable, see 3f994367a979
CID 1058763
2013-07-31 01:33:50 +02:00
Antoine Pitrou 796564c27b Issue #18112: PEP 442 implementation (safe object finalization). 2013-07-30 19:59:21 +02:00
Christian Heimes d49a371e91 Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns
'SHA1' instead of 'SHA'.
Add more tests for hashlib and hash object attributes
2013-07-30 15:35:54 +02:00
Raymond Hettinger 77578204d6 Restore the data block size to 62.
The former block size traded away good fit within cache lines in
order to gain faster division in deque_item().  However, compilers
are getting smarter and can now replace the slow division operation
with a fast integer multiply and right shift.  Accordingly, it makes
sense to go back to a size that lets blocks neatly fill entire
cache-lines.

GCC-4.8 and CLANG 4.0 both compute "x // 62" with something
roughly equivalent to "x * 9520900167075897609 >> 69".
2013-07-28 02:39:49 -07:00
Raymond Hettinger 3223dd5c22 Assertions key off NDEBUG 2013-07-26 23:14:22 -07:00
Victor Stinner c588feeea9 Issue #15893: Improve error handling in main() and Py_FrozenMain()
* handle _PyMem_RawStrdup() failure
* Py_FrozenMain() releases memory on error
* Py_FrozenMain() duplicates the old locale, as done in main()
2013-07-27 02:39:09 +02:00
Christian Heimes f6e7e36c3d Issue #18561: Skip name in ctypes' _build_callargs() if name is NULL.
CID 486199
2013-07-26 23:04:39 +02:00
Christian Heimes f446d21708 Issue #18559: Fix NULL pointer dereference error in _pickle module 2013-07-26 22:45:47 +02:00
Victor Stinner d4095d95f8 Issue #18519: the Python authorizer callback of sqlite3 must not raise Python exceptions
The exception is printed if sqlite3.enable_callback_tracebacks(True) has been
called, otherwise the exception is cleared.
2013-07-26 22:23:33 +02:00
Christian Heimes ebf4204e84 Handle yet another potential failure in testcapi
CID 1058280
2013-07-26 15:54:13 +02:00
Christian Heimes 9bfcaa6fb3 Check return value of PyLong_FromLong(X509_get_version()). It might be NULL if
X509_get_version() grows beyond our small int cache.
CID 1058279
2013-07-26 15:51:35 +02:00
Christian Heimes dd6f3899f7 remove surplus and wrong Py_DECREF() introduced in 33891989c9cf 2013-07-26 15:26:26 +02:00
Christian Heimes cb7ca526e8 Fix memory leaks and add checks for failing malloc() calls to testcapi module
CID 1058288
Fix declaration-after-statement of d49f65ff4f3c
2013-07-26 15:07:34 +02:00
Christian Heimes 5e3de55b01 Fix possible NULL pointer dereferences in testcapi module
CID 1058280
CID 1058282
CID 1058284
2013-07-26 14:52:26 +02:00
Christian Heimes ef86368ea6 Fix possible NULL pointer dereference in PyCurses_Start_Color()
CID 1058276
2013-07-26 14:46:02 +02:00
Brett Cannon 5d7c1b1a2b merge for issue #18556 2013-07-25 17:36:15 -04:00
Christian Heimes 7c8cd257e4 Issue #18549: Eliminate dead code in socket_ntohl().
CID 982369
2013-07-25 11:47:25 +02:00
Ezio Melotti 3e1e97a99a #16937: merge with 3.3. 2013-07-25 05:04:50 +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
Christian Heimes de0e63bd9c Issue #15905: Fix theoretical buffer overflow in handling of sys.argv[0],
prefix and exec_prefix if the operation system does not obey MAXPATHLEN.
2013-07-22 12:54:21 +02:00
Victor Stinner 3a8573230c Issue #18488: Fix _pysqlite_final_callback()
Restore behaviour of Python 3.3: print the finalizer() error if
sqlite3.enable_callback_tracebacks() has been called, clear the error
otherwise.

But keep (save/restore) also the AttributeError raised in
_pysqlite_step_callback().
2013-07-22 08:34:32 +02:00
Christian Heimes e5378e2223 Now all error paths of _freeze_importlib use 'goto error' and the error label cleans up all used resources. 2013-07-21 23:05:11 +02:00
Christian Heimes 71945880fb Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj() 2013-07-21 16:25:30 +02:00
Christian Heimes 992fe2ab84 Fix reference and memory leaks in _freeze_importlib 2013-07-21 16:19:16 +02:00
Victor Stinner 41801f5812 Issue #18519, #18408: Fix sqlite authorizer callback
If a previous call to the authorizer callback failed and raised an exception,
don't call the Python authorizer callback, but just return SQLITE_DENY.
2013-07-21 13:05:38 +02:00
Raymond Hettinger b97cc49c3a Minor code simplification by eliminating an unnecessary temporary variable. 2013-07-21 01:51:07 -07:00
Christian Heimes 603bd2d374 Check return value of PyEval_GetGlobals() for NULL
CID 486814
2013-07-20 22:54:39 +02:00
Christian Heimes 5df8ff01d9 Check return value of flush_character_buffer()
CID 486663
2013-07-20 22:42:06 +02:00
Mark Dickinson 60d634ae4a Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect(0.0,-0.0) results. 2013-07-20 18:00:06 +01:00
Christian Heimes 2ef710e40f Add missing check of PyDict_Update()'s return value in _elementtree.c
CID 719637
2013-07-20 15:12:19 +02:00
Christian Heimes 3f95bdcdbe Add missing check of PyDict_SetItem()'s return value
CID 486659
2013-07-20 15:01:36 +02:00
Christian Heimes abfc4d838a Fix fishy sizeof(Py_ssize_t *).
sizeof(Py_ssize_t *) == sizeof(Py_ssize_t) but it's not a portable assumption.
CID 486403
2013-07-20 14:11:52 +02:00
Christian Heimes e91ad501c5 Use strncat() instead of strcat() to silence some warnings.
CID 486616, CID 486617, CID 486615
2013-07-20 14:11:28 +02:00
Raymond Hettinger 5ea0f80165 Make the GCC-4.8 compiler happy by moving declarations to the top of the function. 2013-07-19 19:52:04 -07:00
Ronald Oussoren ced1226cce (3.3->default): #18480: Add missing PyType_Ready call to _elementtree extension 2013-07-19 11:14:05 +02:00
Victor Stinner d85032e25d (Merge 3.3) Fix posix_chflags(): return_value was uninitialized when
follow_symlinks=False whereas the fchmodat() function is not avaialble.
2013-07-18 23:58:08 +02:00
Victor Stinner 9e09c26e8a Issue #18501, #18408: Fix expat handlers in pyexpat, don't call Python
functions if a Python exception was raised
2013-07-18 23:17:01 +02:00
Victor Stinner 3fd8cbd5e4 Issue #18408: Fix _elementtree.c, don't call Python function from an expat
handler if a Python exception is set
2013-07-18 22:46:14 +02:00
Victor Stinner ca713c014e Fix a compiler warning on FreeBSD
Modules/python.c:40: warning: ISO C90 forbids mixed declarations and code
2013-07-18 02:43:47 +02:00
Victor Stinner 569f364017 Issue #18408: Fix PyInit__curses_panel(), handle import_curses() failure
Don't call PyErr_NewException() if an exception is set, or type_call() would
fail with an assertion error.
2013-07-18 02:31:21 +02:00
Victor Stinner 4abda5d5b0 Issue #18408: Fix _pysqlite_fetch_one_row(), in debug mode, don't call
type_call() with an exception set
2013-07-18 01:54:37 +02:00
Victor Stinner ace47d7efd Issue #18408: PyEval_EvalFrameEx() and PyEval_CallObjectWithKeywords() now fail
with an assertion error if they are called with an exception set
(PyErr_Occurred()).

If these functions are called with an exception set, the exception may be
cleared and so the caller looses its exception.

Add also assertions to PyEval_CallObjectWithKeywords() and call_function() to
check if the function succeed with no exception set, or the function failed
with an exception set.
2013-07-18 01:41:08 +02:00
Victor Stinner e9af4cface Issue #18488: _pysqlite_final_callback() should not clear the exception set by
the last call to the step() method of a user function
2013-07-18 01:42:04 +02:00
Victor Stinner 4755beac3c Issue #18408: Fix array_tolist(), handle PyList_SetItem() failure 2013-07-18 01:12:35 +02:00
Victor Stinner 0b142e2809 Issue #18408: Fix array_index(), handle getarrayitem() failure 2013-07-17 23:01:30 +02:00
Victor Stinner 764a46d2ed Issue #18408: Fix heapq.heappop(), handle PyList_SetSlice() failure 2013-07-17 21:50:21 +02:00
Victor Stinner 2ff51b83b8 Issue #18408: Fix time.tzset(), detect exception when calling PyInit_timezone() 2013-07-17 21:42:45 +02:00
Victor Stinner d594f24fbc Issue #18408: Fix locale.localeconv(), handle PyDict_SetItemString() failure 2013-07-17 00:55:57 +02:00
Victor Stinner 6684bdf73d Issue #18408: Fix typo in build_node_tree() of the parser module
Type "o" format of Py_BuildValue() is invalid: it must be "O".
2013-07-17 00:13:52 +02:00
Victor Stinner 1e53bbaced Issue #18408: handle PySys_GetObject() failure, raise a RuntimeError 2013-07-16 22:26:05 +02:00
Victor Stinner d1f9942ae3 Issue #18408: Fix cjkcodecs decoders, add a new MBERR_EXCEPTION constant to
notify exceptions raised by the _PyUnicodeWriter API
2013-07-16 21:41:43 +02:00
Victor Stinner 85c761d3d3 Issue #18408: Fix fileio_read() on _PyBytes_Resize() failure
bytes is NULL on _PyBytes_Resize() failure
2013-07-16 21:36:02 +02:00
Victor Stinner a4ced86f03 Issue #18408: random_seed() now raises a MemoryError on memory allocation
failure
2013-07-15 20:00:36 +02:00
Victor Stinner 33283ba300 Issue #18408: Fix CJK decoders, raise MemoryError on memory allocation failure 2013-07-15 17:47:39 +02:00
Victor Stinner 54b2d2ec69 Issue #18408: Fix pyexpat.ParserCreate()
Check if XML_ParserCreate_MM() failed (ex: MemoryError) before using
self->itself.
2013-07-15 17:15:57 +02:00
Ronald Oussoren 0fedb37c47 Issue #18393: Remove use of deprecated API on OSX
The "Gestalt" function on OSX is deprecated (starting with OSX 10.8),
remove its usage from the stdlib. The patch removes a number of private
functions and a private module, but does not change the public API.

The removed code was effectively dead, the platform module has used
other code to fetch the OSX version for years and could only use
on the Gestalt-based code as a fallback. That fallback can only trigger
on broken OSX installs (that is, someone has removed parts of the system
install)
2013-07-15 18:32:09 +02:00
Richard Oudkerk 9ba6962a04 Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all(). 2013-07-15 16:10:28 +01:00
Raymond Hettinger 90dea4ce43 Tweak the deque struct by moving the least used fields (maxlen and weakref) to the end. 2013-07-13 22:30:25 -07:00
Raymond Hettinger 840533bf1c Use a do-while loop in the inner loop for rotate (m is always greater than zero). 2013-07-13 17:03:58 -07:00
Raymond Hettinger 3959af9b2a Move the freeblock() call outside the main loop to speed-up and simplify the block re-use logic. 2013-07-13 02:34:08 -07:00
Victor Stinner d917dcbe5e Issue #18408: Fix constructors of _elementtree.c
* Use Py_DECREF() instead of PyObject_GC_Del() to release correctly all
  resources
* Raise MemoryError on memory allocation failure
2013-07-12 02:05:17 +02:00
Victor Stinner 81aac734e1 Issue #18408: Fix create_extra() of _elementtree.c, raise MemoryError on memory
allocation failure
2013-07-12 02:03:34 +02:00
Victor Stinner df4572cc71 Issue #18408: parser module: fix error handling in node2tuple()
Handle PyLong_FromLong() and PyUnicode_FromString() failures
2013-07-12 01:35:10 +02:00
Victor Stinner 3bd6abd129 Issue #18408: Fix parser.sequence2st() and parser.tuple2st(): raise MemoryError
on memory allocation failure

Instead of ignoring the memory allocation failure and create invalid objects.
2013-07-12 01:33:59 +02:00
Victor Stinner 4202456cd4 Issue #18408: _pickle.c: Add missing PyErr_NoMemory() on memory allocation failures 2013-07-12 00:53:57 +02:00
Victor Stinner 8ca72e2e3d Issue #18408: _PyMemoTable_ResizeTable() now restores the old table if
allocating a bigger table failed

PyMemoTable destructor does crash if mt_table is NULL.
2013-07-12 00:53:26 +02:00
Victor Stinner c31df04234 Issue #18408: Oh, I was wrong: Pickler_New() must call Py_DECREF() to destroy
the newly created pickler, and not PyObject_GC_Del().
2013-07-12 00:08:59 +02:00
Victor Stinner 71c8b7ec04 Issue #18408: Different fixes in _elementtree.c to handle correctly MemoryError
* create_new_element() initializes all attributes before handling errors,
   to fix a crash in the destructor
* create_new_element() calls PyObject_GC_Del() on error, instead of
  PyObject_Del(), because the object was created by PyObject_GC_New()
* subelement() now handles create_new_element() failure
* element_getattro() now handles element_get_text() failure
* makeuniversal() now handles PyBytes_FromStringAndSize() failure
2013-07-11 23:08:39 +02:00
Victor Stinner 4d46343340 Cleanup _elementtree.c 2013-07-11 23:05:03 +02:00
Victor Stinner 5f0af23f5e Issue #18408: _elementtree.c now handles create_extra() failure 2013-07-11 23:01:36 +02:00
Victor Stinner 68c8ea25f1 Issue #18408: Fix _Pickler_New() and _Unpickler_New(): initialize all
attributes before handling errors

_Pickler_New() now calls PyObject_GC_Del() instead of Py_DECREF() on error,
because the pickle object is created using PyObject_GC_New().

Fix a crash in the destructor when an attribute is not initiallized.
2013-07-11 22:56:25 +02:00
Serhiy Storchaka 50ae3f680b Issue #18101: Tcl.split() now process strings nested in a tuple as it
do with byte strings.

Added tests for Tcl.split() and Tcl.splitline().
2013-07-11 20:36:00 +03:00
Serhiy Storchaka e3ed4edb94 Issue #18338: `python --version` now prints version string to stdout, and
not to stderr.  Patch by Berker Peksag and Michael Dickens.
2013-07-11 20:01:17 +03:00
R David Murray 609142ef05 Merge: #18399: fix comment typo. 2013-07-10 11:57:39 -04:00
Raymond Hettinger d9c116ca40 Add a spacing saving heuristic to deque's extend methods 2013-07-09 00:13:21 -07:00
Victor Stinner bbf8ce5b87 Issue #18408: Fix select.select() to handle PyList_New() failure (MemoryError)
in set2list()
2013-07-09 00:49:03 +02:00
Victor Stinner 7979926616 Issue #18408: Fix usage of _PyBytes_Resize()
_PyBytes_Resize(&v, new_size) sets v to NULL on error, so v cannot be used
anymore. Replace "Py_DECREF(v); v = NULL;" with "Py_CLEAR(v);".
2013-07-09 00:35:22 +02:00
Victor Stinner bf2e2f9bdf Issue #18408: Fix zlib.compressobj() to handle PyThread_allocate_lock() failure
(MemoryError).
2013-07-09 00:29:03 +02:00
Victor Stinner 3f15cf0961 Issue #18408: Fix ConvParam() of the ctypes module to handle paramfunc failure
(MemoryError).
2013-07-09 00:27:12 +02:00
Victor Stinner 064bbdc79b fix indentation 2013-07-08 22:28:27 +02:00
Victor Stinner 5d1866c78a Issue #18408: PyObject_GC_NewVar() now raises SystemError exception if nitems
is negative
2013-07-08 22:17:52 +02:00
Victor Stinner c1eb26cd2f gcmodule.c: strip trailing spaces 2013-07-08 22:15:05 +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
Christian Heimes fa535f5220 Issue #18227: pyexpat now uses a static XML_Memory_Handling_Suite. cElementTree uses the same approach since at least Python 2.6 2013-07-07 17:35:11 +02:00
Victor Stinner b7f1f65f1c Issue #18227: "Free" function of bz2, lzma and zlib modules has no return value (void) 2013-07-07 17:10:34 +02:00
Victor Stinner 11ebff2757 Issue #18203: Replace malloc() with PyMem_Malloc() in _ssl for the password 2013-07-07 17:07:52 +02:00
Victor Stinner 5064a52bcb Issue #18227: Use PyMem_RawAlloc() in bz2, lzma and zlib modules 2013-07-07 16:50:27 +02:00
Victor Stinner 6ce0dbf460 Fix a compiler warning in posix_sendfile() on FreeBSD:
Modules/posixmodule.c: In function 'posix_sendfile':
Modules/posixmodule.c:7700: warning: ISO C90 forbids mixed declarations and code
2013-07-07 16:32:36 +02:00
Victor Stinner b64049183c Issue #18203: Replace malloc() with PyMem_Malloc() in Python modules
Replace malloc() with PyMem_Malloc() when the GIL is held, or with
PyMem_RawMalloc() otherwise.
2013-07-07 16:21:41 +02:00
Victor Stinner 1a7425f67a Issue #18203: Replace malloc() with PyMem_RawMalloc() at Python initialization
* Replace malloc() with PyMem_RawMalloc()
* Replace PyMem_Malloc() with PyMem_RawMalloc() where the GIL is not held.
* _Py_char2wchar() now returns a buffer allocated by PyMem_RawMalloc(), instead
  of PyMem_Malloc()
2013-07-07 16:25:15 +02:00
Raymond Hettinger b385529ddf Fix #ifdef 2013-07-07 02:07:23 -10:00
Raymond Hettinger 82df925451 Use macros for marking and checking endpoints in the doubly-linked list of blocks.
* Add comment explaining the endpoint checks
* Only do the checks in a debug build
* Simplify newblock() to only require a length argument
  and leave the link updates to the calling code.
* Also add comment for the freelisting logic.
2013-07-07 01:43:42 -10:00
Raymond Hettinger ef9b47f0b8 merge 2013-07-06 17:50:01 -10:00
Raymond Hettinger f3a67b7e57 Improve variable names in deque_count() 2013-07-06 17:49:06 -10: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
Raymond Hettinger df715ba54d Apply the PyObject_VAR_HEAD and Py_SIZE macros
to be consistent with practices in other modules.
2013-07-06 13:01:13 -10:00
Raymond Hettinger 5bfa8671bc Refactor deque_traverse().
Hoist conditional expression out of the loop.
Use rightblock as the guard instead of checking for NULL.
2013-07-06 11:58:09 -10:00
Raymond Hettinger 98054b4c1b Remove unnecessary branches from count() and reverse(). 2013-07-06 09:07:06 -10:00
Raymond Hettinger de68e0cf0e Speed-up deque indexing by changing the deque block length to a power of two.
The division and modulo calculation in deque_item() can be compiled
to fast bitwise operations when the BLOCKLEN is a power of two.

Timing before:

 ~/cpython $ py -m timeit -r7 -s 'from collections import deque' -s 'd=deque(range(10))' 'd[5]'
10000000 loops, best of 7: 0.0627 usec per loop

Timing after:

~/cpython $ py -m timeit -r7 -s 'from collections import deque' -s 'd=deque(range(10))' 'd[5]'
10000000 loops, best of 7: 0.0581 usec per loop
2013-07-05 18:05:29 -10:00
Victor Stinner 0857ab4c77 (Merge 3.3) Issue #18343: faulthandler.register() now keeps the previous signal
handler when the function is called twice, so faulthandler.unregister()
restores correctly the original signal handler.
2013-07-02 00:17:14 +02:00
Christian Heimes 54882bfc18 Singular form just like the other error message. 2013-07-01 15:23:48 +02:00
Christian Heimes bfafab1849 Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a
segfault inside the _pickle C extension.
2013-07-01 15:18:49 +02:00
Christian Heimes 721724270d Fix segfault in pyexpat.c caused by 84375
u can be NULL, use XDECREF
2013-06-29 21:49:27 +02:00
Christian Heimes 82e6b94b95 Fix resource leak in pickle module
CID 983309 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable unicode_str going out of scope leaks the storage it points to.
2013-06-29 21:37:34 +02:00
Christian Heimes b91ffaa1d8 Fix NULL ptr dereferencing in local_timezone(). nameo can be NULL
CID 1040362 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
var_deref_op: Dereferencing null pointer _py_decref_tmp.
2013-06-29 20:52:33 +02:00
Christian Heimes b582155789 Fix memory leak in pyexpat PyUnknownEncodingHandler
CID 1040367 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable u going out of scope leaks the storage it points to.
2013-06-29 20:43:13 +02:00
Victor Stinner dd3a6a5533 Fix os.confstr(): the result type of the C function is size_t, not int 2013-06-25 23:13:47 +02:00
Victor Stinner 93037498d1 Fix time.mktime() and datetime.datetime.timestamp() on AIX
On AIX, the C function mktime() alwaysd sets tm_wday, even on error. So tm_wday
cannot be used as a sentinel to detect an error, we can only check if the
result is (time_t)-1.
2013-06-25 22:54:35 +02:00
Victor Stinner d7a034bd75 (Merge 3.3) Fix time.strftime("%Y") on AIX: raise a ValueError for year > 9999
time.strtime("%Y") returned "2345" when formatting year 12345.
2013-06-25 02:34:13 +02:00
Victor Stinner 7e00151e1f _ssl.c: strip trailing spaces 2013-06-25 00:44:31 +02:00
Victor Stinner 86073dc3c2 (Merge 3.3) Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if
the input string in longer than 2 gigabytes, and
ssl.SSLContext.load_cert_chain() raises a ValueError if the password is longer
than 2 gigabytes. The ssl module does not support partial write.
2013-06-25 00:43:47 +02: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
Victor Stinner 9a644b23cc Issue #9566: recv(), recvfrom(), send(), sendall() and sendto() methods
of socket.socket objects now truncate the input buffer to INT_MAX bytes on
Windows to avoid an integer overflow.

(sendall() still send the whole buffer.)
2013-06-24 23:47:41 +02:00
Victor Stinner 71765770a4 Issue #9566: _winapi.WriteFile() now truncates length to DWORD_MAX (4294967295) 2013-06-24 23:13:24 +02:00
Victor Stinner bc8ccce729 Issue #9566: zlib: Explicit cast to unsigned int to fix a compiler warning on Windows x64 2013-06-24 23:02:51 +02:00
Victor Stinner 9a282975ef Issue #9566: _io: Use Py_SAFE_DOWNCAST for fix a compiler warning on Windows x64 2013-06-24 23:01:33 +02:00
Raymond Hettinger b4f39eea49 merge 2013-06-23 15:47:03 -07:00
Raymond Hettinger 20b0f87e1d Misc improvements to collections.deque()
* Clarified comment on the impact of BLOCKLEN on deque_index
  (with a power-of-two, the division and modulo
   computations are done with a right-shift and bitwise-and).

* Clarified comment on the overflow check to note that
  it is general and not just applicable the 64-bit builds.

* In deque._rotate(), the "deque->" indirections are
  factored-out of the loop (loop invariant code motion),
  leaving the code cleaner looking and slightly faster.

* In deque._rotate(), replaced the memcpy() with an
  equivalent loop.  That saved the memcpy setup time
  and allowed the pointers to move in their natural
  leftward and rightward directions.

See comparative timings at:  http://pastebin.com/p0RJnT5N
2013-06-23 15:44:33 -07:00
Christian Heimes 5b2f18411b Issue #11016: Don't define macros and constants that are already set by pyport.h 2013-06-24 00:13:14 +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
Christian Heimes 9975877f46 Check for correct macro, code uses S_ISDIR(). 2013-06-23 23:52:40 +02:00
Victor Stinner 1ce46d99db Issue #11016: Detect integer conversion on conversion from Python int to C mode_t 2013-06-23 22:57:43 +02:00
Christian Heimes 858c947155 Fix a typo in S_ISDIR, S_ISCHR, S_ISBLK and S_ISREG.
Add extra braces to S_IS*() macros
2013-06-23 22:57:02 +02:00
Victor Stinner 8cfd67cfe7 (Merge 3.3) Issue #18135: Fix a possible integer overflow in
ssl.SSLSocket.write() and in ssl.SSLContext.load_cert_chain() for strings and
passwords longer than 2 gigabytes.
2013-06-23 15:09:26 +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
Andrew Kuchling 0e03d6f2e9 Merge from 3.3 2013-06-22 19:27:59 -04:00
Christian Heimes c77d9f38c2 Issue #11016: Add C implementation of the stat module as _stat 2013-06-22 21:05:02 +02:00
Andrew Kuchling 6ce8d17d02 Merge from 3.3 2013-06-22 14:57:45 -04:00
Andrew Kuchling 3468d25a80 Merge from 3.3 2013-06-21 08:07:35 -04:00
Brett Cannon 83358c9f13 Grammatical mistake in a comment 2013-06-20 21:30:32 -04:00
Benjamin Peterson 15a7d2e8d6 merge 3.3 (#18248) 2013-06-19 09:01:58 -07:00
Christian Heimes 262e7f389c fixed libffi on PPC without __NO_FPRS__
ISO C90 forbids mixed declarations and code
2013-06-19 02:43:19 +02:00
Christian Heimes 71515510d8 Issue #18259: Declare sethostname in socketmodule.c for AIX 2013-06-19 02:07:20 +02:00
Christian Heimes 360b89ca5e Fix for r84195: add HAVE_ALLOCA_H to configure and only include alloca.h if it's available 2013-06-18 13:22:37 +02:00
Victor Stinner 8f0aae54ba (Merge 3.3) ctypes: AIX needs an explicit #include <alloca.h> to get alloca() 2013-06-17 22:02:14 +02: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
Andrew Kuchling f567727abc Merge with 3.3 2013-06-16 13:02:55 -04:00
Andrew Kuchling 8a2a902f88 Merge with 3.3 2013-06-15 15:10:08 -04: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
Christian Heimes 200bb1b08c Simplify return value of ssl.get_default_verify_paths
prefix function with PySSL_, too. Other module level functions have a prefix, too.
2013-06-14 15:14:29 +02:00
Christian Heimes 75b8426698 fixd refleak 2013-06-10 10:47:22 +02:00
Ronald Oussoren 36451f076b (3.3->default) Ensure that the fix for #17269 also works on OSX 10.4
AI_NUMERICSERV isn't defined on OSX 10.4.
2013-06-10 10:37:12 +02: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
Christian Heimes 142ec2c014 get_default_verify_paths doesn't belong inside the ifdef block 2013-06-09 18:29:54 +02:00
Christian Heimes 6d7ad13a45 Issue #18143: Implement ssl.get_default_verify_paths() in order to debug
the default locations for cafile and capath.
2013-06-09 18:02:55 +02:00
Richard Oudkerk ac0ad884d1 Issue #17931: Resolve confusion on Windows between pids and process handles. 2013-06-05 23:29:30 +01:00
Łukasz Langa 6f69251980 Add reference implementation for PEP 443
PEP accepted: http://mail.python.org/pipermail/python-dev/2013-June/126734.html
2013-06-05 12:20:24 +02:00
Victor Stinner 072318b178 Issue #13772: Use syntax for literal wchar_t character 2013-06-05 02:07:46 +02:00
Victor Stinner 31b3b92f7a Issue #13772: Mark helper functions as private (static)
Cleanup also the code to follow the Python coding style (PEP 7).
2013-06-05 01:49:17 +02:00
Victor Stinner e87267dc6e Issue #13772: Fix a compiler warning on Windows 2013-06-05 01:30:25 +02:00
Victor Stinner 5a4367600f Issue #13772: fix _check_dirA(): call *A() functions, not *W() functions 2013-06-05 00:37:12 +02:00
Victor Stinner e7e7eba108 Issue #13772: Fix compiler warnings on Windows 2013-06-05 00:35:54 +02:00
Victor Stinner fbf50d43da Issue #9566: Fix compiler warning on Windows 64-bit in _bz2module.c 2013-06-04 23:18:48 +02:00
Victor Stinner 640c35ce13 Reuse Py_MIN and Py_MAX macros: remove duplicate MIN/MAX macros
multiprocessing.h: remove unused MIN and MAX macros
2013-06-04 23:14:37 +02:00
Victor Stinner 0b81111b18 (Merge 3.3) Close #18109: os.uname() now decodes fields from the locale
encoding, and socket.gethostname() now decodes the hostname from the locale
encoding, instead of using the UTF-8 encoding in strict mode.
2013-06-03 22:09:14 +02:00
Victor Stinner 725e421222 Fix compilater warnings on Windows 64-bit 2013-05-17 00:19:59 +02:00
Stefan Krah b6cc0aad4b Merge 3.3. 2013-05-29 21:12:46 +02:00
Stefan Krah a0547b8ac4 Mark untestable lines for gcov. 2013-05-29 19:08:34 +02:00
Stefan Krah 8d90e383a3 Merge 3.3. 2013-05-29 15:47:24 +02:00
Serhiy Storchaka 281945f427 Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw
stream's read() returns more bytes than requested.
2013-05-28 16:27:08 +03:00
Jason R. Coombs 8f1a8e32b1 Merge with 3.3 2013-05-27 23:26:36 -04: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
Antoine Pitrou 19fef69b75 Fix compilation under MSVC: ssl_set_mode() is a macro, and the MSVC preprocessor doesn't process #ifdef's inside a macro argument list.
(found explanation at http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2007-05/msg00385.html)
2013-05-25 13:23:03 +02:00
Antoine Pitrou 3a65ad7f08 Issue #8240: Set the SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag on SSL sockets. 2013-05-25 13:02:32 +02:00
Benjamin Peterson e08b583d88 merge 3.3 2013-05-24 14:36:04 -07:00
Ronald Oussoren dc3e6cc452 (3.3->default) Issue #17269: Workaround for a platform bug in getaddrinfo on OSX
Without this patch socket.getaddrinfo crashed when called
with some unusual argument combinations.
2013-05-24 13:51:21 +02: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
Giampaolo Rodola' 80e1c43ddf Fix issue #17996: expose socket.AF_LINK constant on BSD and OSX. 2013-05-21 21:02:04 +02:00
Charles-François Natali b10c71daa2 Backed out changeset c0f2b038fc12 2013-05-21 10:45:46 +02:00
Charles-François Natali c7c333d25d Issue #17683: socket module: return AF_UNIX addresses in Linux abstract
namespace as string.
2013-05-21 09:49:18 +02:00
Charles-Francois Natali 74ca886788 Issue #17917: Use PyModule_AddIntMacro() instead of PyModule_AddIntConstant()
when applicable.
2013-05-20 19:13:19 +02:00
Charles-Francois Natali 7c4f8dacf4 Issue #17914: We can now inline _bsd_cpu_count(). 2013-05-20 17:40:32 +02:00
Charles-Francois Natali d59087de5b Issue #17914: Remove OS-X special-case, and use the correct int type. 2013-05-20 17:31:06 +02:00
Charles-Francois Natali 44feda3cd0 Issue #17914: Add os.cpu_count(). Patch by Yogesh Chaudhari, based on an
initial patch by Trent Nelson.
2013-05-20 14:40:46 +02:00
Eli Bendersky a369923cab Get rid of ugly code duplication for ElementTree.parse when the accelerator
is imported. Instead, ElementTree.parse can look for a special internal method
defined by the accelerator.
2013-05-19 18:47:23 -07:00
Eli Bendersky 3a36756ba1 Issue #17989: fix typo in error message 2013-05-19 17:00:28 -07:00
Eli Bendersky 3a4fbd8241 _elementtree.XMLParser._setevents should support any sequence, not just tuples
Also clean up some code around this
2013-05-19 09:01:49 -07:00
Antoine Pitrou fef34e3186 Issue #17937: Try harder to collect cyclic garbage at shutdown. 2013-05-19 01:11:58 +02:00
Eli Bendersky 20c1cdd64a Issue #17901: fix TreeBuilder construction for an explicit element_factory=None
Based on report and patch by Aaron Oakley.
2013-05-18 15:47:58 -07:00
Eli Bendersky 1a8c3e247a Issue #17989: element_setattro returned incorrect error value.
This caused an exception to be raised later than expected.
2013-05-18 07:53:47 -07:00
Victor Stinner 3e269397e3 FileIO.readall(): remove trailing space from an exception message 2013-05-18 00:38:43 +02:00
Richard Oudkerk af7260e81a Issue #15758: Fix FileIO.readall() so it no longer has O(n**2) complexity. 2013-05-17 23:34:42 +01:00
Serhiy Storchaka fff61f2cd3 Issue #14596: The struct.Struct() objects now use more compact implementation. 2013-05-17 10:49:44 +03:00
Benjamin Peterson aa96588399 merge 3.3 2013-05-16 15:30:09 -05:00
Victor Stinner 6fdd7b81fa Issue #17964: Fix os.sysconf(): the return type of the C sysconf() function
is long, not int.
2013-05-16 22:26:29 +02:00
doko@ubuntu.com 94fd53ba4e - Fix typos in the multiprocessing module. 2013-05-15 18:08:03 +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 cde88dcf10 merge 3.3 (#17968) 2013-05-13 19:56:35 -05:00
Antoine Pitrou 5f18791902 Issue #17968: Fix memory leak in os.listxattr(). 2013-05-13 19:48:46 +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
Antoine Pitrou 070cb3c9be Issue #1545463: At shutdown, defer finalization of codec modules so that stderr remains usable.
(should fix Windows buildbot failures on test_gc)
2013-05-08 13:23:25 +02:00
Ezio Melotti 0fbdf26158 #16523: merge with 3.3. 2013-05-08 10:56:32 +03:00
Victor Stinner 70792d268e Fix compiler warnings: explicit cast to int in sha256/sha512 modules 2013-05-08 00:00:44 +02:00
Victor Stinner e8289618bf zlib: Explicit cast to fix a compiler warning 2013-05-07 23:50:21 +02:00
Victor Stinner f2b9a340ef audioop: explicit cast to fix a compiler warning 2013-05-07 23:49:15 +02:00
Antoine Pitrou 9b5d4d8cef Issue #17289: The readline module now plays nicer with external modules or applications changing the rl_completer_word_break_characters global variable.
Initial patch by Bradley Froehle.
2013-05-06 21:54:07 +02:00
Charles-Francois Natali b1294fa9f4 Issue #12181: select module: Fix struct kevent definition on OpenBSD 64-bit
platforms. Patch by Federico Schwindt.
2013-05-06 21:26:05 +02:00
Antoine Pitrou 5f454a07a0 Issue #1545463: Global variables caught in reference cycles are now garbage-collected at shutdown. 2013-05-06 21:15:57 +02:00
Antoine Pitrou 52c5f85cf9 Issue #14173: Avoid crashing when reading a signal handler during interpreter shutdown. 2013-05-04 23:21:09 +02:00
Antoine Pitrou 1a6cb30a34 Issue #5845: Enable tab-completion in the interactive interpreter by default, thanks to a new sys.__interactivehook__.
(original patch by Éric Araujo)
2013-05-04 20:08:35 +02:00
Gregory P. Smith d8fe1f7881 * Fix remaining bits of issue 17192 for 3.4 - these changes
were missing from a messed up merge during the libffi 3.0.13
  import.  the diffs from upstream libffi 3.0.13 are now small.
2013-04-30 00:03:30 -07:00
Gregory P. Smith 6897267759 * Fix PART of issue 17192 for 3.4 - reapply the issue11729 patch
that was undone in the merge fun from upstream which already
  had it in 3.0.13.
* Add the missing update to libffi.info.
2013-04-29 23:48:03 -07:00
Serhiy Storchaka 5f99fa7287 Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3,
such as was shipped with Centos 5 and Mac OS X 10.4.
2013-04-28 14:11:55 +03:00
Antoine Pitrou 9f14681959 Issue #17804: New function ``struct.iter_unpack`` allows for streaming struct unpacking. 2013-04-27 00:20:04 +02:00
Eli Bendersky 45f3d2fff0 Revert c9674421d78e, leaving an additional comment 2013-04-24 05:34:07 -07:00
Eli Bendersky 1859fe80c4 Simplify the code of get_attrib_from_keywords somewhat. 2013-04-22 05:52:16 -07:00
Eli Bendersky ed8b86d323 Issue #17736: fix misleading comment in _elementtree.c
Patch by Jonas Wagner
2013-04-22 05:29:09 -07:00
Alexandre Vassalotti 4fe2184a0f Merge 3.3 2013-04-20 21:28:49 -07:00
Antoine Pitrou a85017fbe3 Issue #16694: Add a pure Python implementation of the operator module.
Patch by Zachary Ware.
2013-04-20 19:21:44 +02:00
Eli Bendersky ddcc6798f6 Remove useless #define and #ifdefs 2013-04-20 06:36:43 -07:00
Eli Bendersky bf05df2396 Make license notices more consistent and remove old changelog.
Also remove unused macro.
2013-04-20 05:44:01 -07:00
Victor Stinner 8f674ccd64 Close #17694: Add minimum length to _PyUnicodeWriter
* Add also min_char attribute to _PyUnicodeWriter structure (currently unused)
 * _PyUnicodeWriter_Init() has no more argument (except the writer itself):
   min_length and overallocate must be set explicitly
 * In error handlers, only enable overallocation if the replacement string
   is longer than 1 character
 * CJK decoders don't use overallocation anymore
 * Set min_length, instead of preallocating memory using
   _PyUnicodeWriter_Prepare(), in many decoders
 * _PyUnicode_DecodeUnicodeInternal() checks for integer overflow
2013-04-17 23:02:17 +02:00
Richard Oudkerk 245bbee0d5 Merge. 2013-04-17 21:24:58 +01:00
Alexandre Vassalotti 7c5e094cbf Make C and Python implementations of pickle load STRING opcodes the same way.
The C version tried to remove trailing whitespace between the last quote and
the newline character. I am not sure why it had this because pickle never
generated such pickles---for this to happen repr(some_string) would need to
return trailing whitespace. It was maybe there to make it easier for people
to write pickles in text editors. Anyhow, the Python version doesn't do this
so there is no point keeping this around anymore.

Also, I've changed the exception raised when a bad pickle is encountered.
Again this unlikely to make much difference to anyone though it does make
testing slightly nicer for us.
2013-04-15 23:14:55 -07:00
Benjamin Peterson 48a2e7c357 merge 3.3 2013-04-15 21:38:33 -04:00
Antoine Pitrou af94051a93 Issue #17710: Fix pickle raising a SystemError on bogus input. 2013-04-15 21:55:14 +02:00
Victor Stinner 322cc7438c Issue #17693: Fix memory/reference leaks 2013-04-14 18:11:41 +02:00
Alexandre Vassalotti cc7571727f Style cleanups for pickle.py and _pickle. 2013-04-14 02:25:10 -07:00
Alexandre Vassalotti 6d9e14593e Merge 3.3 2013-04-14 02:11:16 -07:00
Victor Stinner d949126995 Issue #17693: CJK encoders now use the new Unicode API (PEP 393) 2013-04-14 02:06:32 +02:00
Serhiy Storchaka 6d80046628 Issue #17016: Get rid of possible pointer wraparounds and integer overflows
in the re module.  Patch by Nickolai Zeldovich.
2013-04-13 21:16:40 +03:00
Victor Stinner a0dd0213cc Close #17693: Rewrite CJK decoders to use the _PyUnicodeWriter API instead of
the legacy Py_UNICODE API.

Add also a new _PyUnicodeWriter_WriteChar() function.
2013-04-11 22:09:04 +02:00
Antoine Pitrou 50b24d0d7c Fix a crash when setting a servername callback on a SSL server socket and the client doesn't send a server name.
Patch by Kazuhiro Yoshida.
(originally issue #8109)
2013-04-11 20:48:42 +02:00
Victor Stinner 7d36e4f074 Close #14439: Python now prints the traceback on runpy failure at startup. 2013-04-10 00:27:23 +02:00
Antoine Pitrou 4b7b0f06b4 gibibytes (Arfrever) 2013-04-07 23:46:52 +02:00
Antoine Pitrou 299978dfe3 Issue #15596: Faster pickling of unicode strings. 2013-04-07 17:38:11 +02:00
Serhiy Storchaka ee57f159af Revert a premature patch for issue #14010 (changeset 846bd418aee5). 2013-04-06 22:55:12 +03:00
Serhiy Storchaka aac81e2780 Issue #14010: Fix a crash when iterating or deleting deeply nested filters
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:20:30 +03:00
Antoine Pitrou 7faf70512a Issue #17591: Use lowercase filenames when including Windows header files.
Patch by Roumen Petrov.
2013-03-31 22:48:04 +02:00
Antoine Pitrou ce852cb8b9 Fix comment about the OpenSSL version in which SNI version was introduced. 2013-03-30 16:45:04 +01:00
Antoine Pitrou edbc18e9d0 Improve set_servername_callback docstring. 2013-03-30 16:40:27 +01:00
Antoine Pitrou a596338bb8 Fix previous fix (the cause was actually a misplaced #endif, or so it seems) 2013-03-30 16:39:00 +01:00
Antoine Pitrou 41f8c4f5e4 Further compiling fixes (issue #17581) 2013-03-30 16:36:54 +01:00
Antoine Pitrou 912fbff105 Issue #17581: try to fix building on old OpenSSL versions 2013-03-30 16:29:32 +01:00
Antoine Pitrou 2463e5fee4 Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial patch by Michele Orrù. 2013-03-28 22:24:43 +01:00
Victor Stinner d06b35c1b6 (Merge 3.3) Issue #17209: curses.window.get_wch() now handles correctly KeyboardInterrupt (CTRL+c) 2013-03-21 12:21:43 +01:00
Gregory P. Smith 40a2160a09 Refactor the common code out of the posix and windows listdir
implementations from my previous commit into the higher level
function.
2013-03-20 20:52:50 -07:00
Gregory P. Smith 16ea14a690 Refactor the Windows specific and POSIX specific implementations of
listdir into two separate coherent functions rather than interleaved
#ifdef's.
2013-03-20 18:51:33 -07:00
R David Murray 9a7d3768a3 Use logic operator, not bitwise operator, for conditional. 2013-03-20 00:15:20 -04:00
R David Murray c7c42efb16 #15927: Fix cvs.reader parsing of escaped \r\n with quoting off.
This fix means that such values are correctly roundtripped, since
cvs.writer already does the correct escaping.

Patch by Michael Johnson.
2013-03-19 22:41:47 -04:00
Kristján Valur Jónsson 23f854ca68 Issue #10296: Merge to default 2013-03-19 15:38:32 -07:00
Gregory P. Smith c70e53aca8 Fixes Issue #17192: Update the ctypes module's libffi to v3.0.13. This
specifically addresses a stack misalignment issue on x86 and issues
on some more recent platforms.
2013-03-19 15:24:46 -07:00
R David Murray af3ba4873a Merge: #8862: Fix curses cleanup with getchar is interrupted by a signal.
I have no idea how one would write a test for this.

Patch by July Tikhonov.
2013-03-19 16:26:19 -04:00
Benjamin Peterson 7701e6ef93 make some freezing related stuff const 2013-03-13 14:06:39 -05:00
Benjamin Peterson 3b965a237c expose O_PATH if possible 2013-03-13 10:27:41 -05:00
Terry Jan Reedy 8b53559a89 Merge with 3.3, issue #17047: remove doubled words added in 3.3,
as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 18:36:38 -04:00
Terry Jan Reedy 16c41d8520 Merge 3.3, issue #17047: remove doubled words found in 2.7 to 3.4
Modules/*, as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:46:07 -04:00
Ezio Melotti 03e667d15a Fix memory leak introduced in 15190138d3f3. 2013-03-07 21:18:45 +02:00
Eli Bendersky ca83233216 Fix formatting changes that led to compilation errors 2013-03-06 06:30:23 -08:00
Eli Bendersky 3612da6b2b call_commethod was only used in samples/Windows, which no longer exists.
This method is dead code - not documented, not tested. As far as we know, it
can be horribly broken.
2013-03-06 06:21:46 -08:00
Eli Bendersky d867bad0fc Fix some formatting 2013-03-06 05:45:57 -08:00
Victor Stinner e5c0533b58 Issue #17223: Add another test to check that _PyUnicode_Ready() rejects
code points bigger than U+10ffff
2013-03-06 00:39:03 +01:00
Antoine Pitrou 221760a3aa Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when the list is being resized concurrently. 2013-03-04 20:35:55 +01:00
Gregory P. Smith b394c1dac8 Fixes Issue #16962: Use getdents64 instead of the obsolete getdents syscall
in the subprocess module on Linux.
2013-03-03 10:53:27 -08:00
Victor Stinner 25c3053a4f (Merge 3.3) Issue #17223: array module: Fix a crasher when converting an array
containing invalid characters (outside range [U+0000; U+10ffff]) to Unicode:
repr(array), str(array) and array.tounicode(). Patch written by Manuel Jacob.
2013-02-26 00:27:56 +01:00
R David Murray d7c59e101f Merge #17275: Fix class name in init errors in C bufferedio classes.
This fixes an apparent copy-and-paste error.

Patch by Manuel Jacob.
2013-02-23 22:21:48 -05:00
Serhiy Storchaka 2cca36ed3c Issue #13153: Tkinter functions now raise TclError instead of ValueError when
a string argument contains non-BMP character.
2013-02-18 13:03:07 +02:00
Serhiy Storchaka e924ddb23e Issue #9669: Protect re against infinite loops on zero-width matching in
non-greedy repeat.  Patch by Matthew Barnett.
2013-02-16 21:25:40 +02:00
Serhiy Storchaka 0e6b7b5cd2 Issue #8745: Small speed up zipimport on Windows. Patch by Catalin Iacob. 2013-02-16 17:43:45 +02:00
Serhiy Storchaka 0cad7eca45 Issue #17193: Use binary prefixes (KiB, MiB, GiB) for memory units. 2013-02-16 17:30:31 +02:00
Serhiy Storchaka 165ee9645b Issue #13169: The maximal repetition number in a regular expression has been
increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on
64-bit).
2013-02-16 16:55:54 +02:00
Richard Oudkerk 76450e6a84 Merge 2013-02-13 12:33:53 +00:00
doko@ubuntu.com 38e2a2afbd - Issue #17192: Import libffi-3.0.12. 2013-02-12 15:33:16 +01:00
Serhiy Storchaka fd6e6cfa29 Raise KeyError instead of OverflowError when getpwuid's argument is out of
uid_t range.
2013-02-11 20:33:24 +02:00
Serhiy Storchaka a7b5e82ff0 Reject float as uid or gid.
A regression was introduced in the commit for issue #4591.
2013-02-10 23:28:33 +02:00
Serhiy Storchaka c2d020090b Issue #4591: Uid and gid values larger than 2**31 are supported now. 2013-02-10 22:03:08 +02:00
Antoine Pitrou 902fc8b5a0 Issue #13773: sqlite3.connect() gets a new `uri` parameter to pass the filename as a URI, allowing to pass custom options. 2013-02-10 00:02:44 +01:00
Antoine Pitrou 8ad5b07ccb Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag), mpdecimal (needs to build without Python.h).
2013-02-09 23:16:51 +01:00
Serhiy Storchaka 7611d9a8cf Issue #16686: Fixed a lot of bugs in audioop module.
* avgpp() and maxpp() no more crash on empty and 1-samples input fragment. They now work when peak-peak values are greater INT_MAX.
* ratecv() no more crashes on empty input fragment.
* Fixed an integer overflow in ratecv().
* Fixed an integer overflow in add() and bias() for 32-bit samples.
* reverse(), lin2lin() and ratecv() no more lose precision for 32-bit samples.
* max() and rms() no more returns negative result for 32-bit sample -0x80000000.
* minmax() now returns correct max value for 32-bit sample -0x80000000.
* avg(), mul(), tomono() and tostereo() now round negative result down and can return 32-bit sample -0x80000000.
* add() now can return 32-bit sample -0x80000000.
2013-02-09 11:13:46 +02:00
Serhiy Storchaka eae3b33316 Issue #17073: Fix some integer overflows in sqlite3 module. 2013-02-07 17:05:32 +02:00
Raymond Hettinger 59cf23ab07 Minor tweaks to varnames, declarations, and comments. 2013-02-07 00:57:19 -05:00
Charles-François Natali 773e42dff8 Issue #15359: Add CAN_BCM protocol support to the socket module. Patch by Brian
Thorne.
2013-02-05 19:42:01 +01:00
Raymond Hettinger 1f0044c473 Minor variable access clean-ups for deque.rotate(). 2013-02-05 01:30:46 -05:00
Serhiy Storchaka 88eea543d6 Issue #17089: Expat parser now correctly works with string input not only when
an internal XML encoding is UTF-8 or US-ASCII.  It now accepts bytes and
strings larger than 2 GiB.
2013-02-04 18:29:47 +02:00
R David Murray 811724ce7f merge #17091: update docstring for _thread.Lock.acquire. 2013-02-04 10:25:51 -05:00
Serhiy Storchaka b6a53404b7 Issue #6083: Fix multiple segmentation faults occured when PyArg_ParseTuple
parses nested mutating sequence.
2013-02-04 12:57:16 +02:00
Raymond Hettinger a4409c18eb Minor edits: Tighten-up the halflen logic and touch-up the assertions and comments. 2013-02-04 00:08:12 -05:00
Serhiy Storchaka cce1b8eda8 Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying
stream or a decoder produces data of an unexpected type (i.e. when
io.TextIOWrapper initialized with text stream or use bytes-to-bytes codec).
2013-02-03 17:09:17 +02:00
Raymond Hettinger 3a9ae7fd98 Issue 16398: One more assertion for good measure. 2013-02-02 12:26:37 -08:00
Nadeem Vawda 56265564ff Back out fix for issue #13886; it introduced a new bug in interactive readline use. 2013-02-02 20:29:39 +01:00