Commit Graph

8030 Commits

Author SHA1 Message Date
Serhiy Storchaka e7e9c32195 Clean trailing whitespace in itertoolsmodule.c. 2013-01-25 13:37:39 +02:00
Serhiy Storchaka 339e91d4cb Issue #13454: Fix a crash when deleting an iterator created by itertools.tee()
if all other iterators were very advanced before.
2013-01-25 13:24:47 +02:00
Serhiy Storchaka a3e9128aba Issue #13454: Fix a crash when deleting an iterator created by itertools.tee()
if all other iterators were very advanced before.
2013-01-25 13:19:31 +02:00
Stefan Krah eb8c451bd2 Since the return type of format() is not a Decimal, raise ValueError instead of
InvalidOperation if the format specification (width, prec) exceeds the internal
limits of libmpdec.
2013-01-24 15:22:33 +01:00
Charles-François Natali 986a56cefe Issue #16953: Fix socket module compilation on platforms with HAVE_BROKEN_POLL.
Patch by Jeffrey Armstrong.
2013-01-19 12:19:10 +01:00
Serhiy Storchaka 441d30fac7 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:26:26 +02:00
Charles-François Natali 95195b35b8 Issue #16953: Fix socket module compilation on platforms with HAVE_BROKEN_POLL.
Patch by Jeffrey Armstrong.
2013-01-19 12:21:26 +01:00
Serhiy Storchaka 9101e23ff6 Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.

This is a backport of changesets 13e2e44db99d and 525407d89277.
2013-01-19 12:41:45 +02:00
Raymond Hettinger bd8f29028e Show the function signature in the docstring 2013-01-18 17:35:25 -08:00
Benjamin Peterson c68a4a048c check windows fd validity (closes #16992) 2013-01-18 00:10:24 -05:00
Stefan Krah 897c3e994f Issue #11729: Backport commit bff052d9 from libffi upstream in order to fix
a ctypes build failure with clang.
2013-01-16 23:18:34 +01:00
Stefan Krah 752bfb71d8 Remove trailing whitespace. 2013-01-16 15:16:10 +01:00
Stefan Krah 59a4a93f43 Issue #16422: Use strings for rounding mode constants for better readability
and pickling compatibility.
2013-01-16 12:58:59 +01:00
Richard Oudkerk ad1d5f908a Issue #10527: Use poll() instead of select() for multiprocessing pipes 2013-01-15 01:01:01 +00:00
Eli Bendersky 25771b3749 Issue #16922: fixed findtext() to return empty Unicode string instead of empty bytes object when there's no text.
Patch by Serhiy Storchaka.
2013-01-13 05:26:07 -08:00
Eli Bendersky b09b167419 Issue #16922: fixed findtext() to return empty Unicode string instead of empty bytes object when there's no text.
Patch by Serhiy Storchaka.
2013-01-13 05:22:05 -08:00
Eli Bendersky 4583990143 Clean trailing whitespace in _elementtree.c 2013-01-13 05:14:47 -08:00
Benjamin Peterson 0e5c48a917 make deque_clear void, since it's infallible 2013-01-12 21:22:18 -05:00
Antoine Pitrou 457a2292ca SSLContext.load_dh_params() now properly closes the input file. 2013-01-12 21:43:45 +01:00
Eli Bendersky 799e3edaf7 Issue #16076: check for return value of PyTuple_New for args (following
Coverity report) and cleanup code.
2013-01-12 05:42:38 -08:00
Eli Bendersky b8f6dc855c Issue #16076: fix refleak in pickling of Element.
Thanks to Ezio Melotti and Daniel Shahaf for the patch.
2013-01-12 05:20:16 -08:00
Eli Bendersky e6174ca85e Issue #16913: Fix Element.itertext()'s handling of text with XML entities.
Patch by Serhiy Storchaka
2013-01-10 06:27:53 -08:00
Eli Bendersky 698bdb2a6c Issue #16076: make _elementtree.Element pickle-able in a way that is compatible
with the Python version of the class.

Patch by Daniel Shahaf.
2013-01-10 06:01:06 -08:00
Serhiy Storchaka a2ad5c3ad1 Issue #15972: Fix error messages when os functions expecting a file name or
file descriptor receive the incorrect type.
2013-01-07 23:13:46 +02:00
Eli Bendersky a873690d2c The get() and iter() are now able to accept keyword arguments.
In conformance with the documentation and the Python version.
Patch by Franck Michea.
2013-01-05 06:26:39 -08:00
Christian Heimes f402e922f3 Issue #16847: Fixed improper use of _PyUnicode_CheckConsistency() in
non-pydebug builds. Several extension modules now compile cleanly when
assert()s are enabled in standard builds (-DDEBUG flag).
2013-01-03 09:21:55 +01:00
Victor Stinner 6f84659e5e (Merge 3.2) Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB. 2013-01-03 03:37:47 +01:00
Victor Stinner c44057dfbd Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB 2013-01-03 03:33:21 +01:00
Nadeem Vawda 57cb81d161 Issue #16828: Fix error incorrectly raised by bz2.compress('').
Initial patch by Martin Packman.
2013-01-02 23:05:56 +01:00
Nadeem Vawda 638fb9bbed Issue #16828: Fix error incorrectly raised by bz2.compress('').
Patch by Martin Packman.
2013-01-02 23:02:00 +01:00
Victor Stinner e4110dc11f Issue #9644: Fix the encoding used by os.statvfs(): use the filesystem encoding
with the surrogateescape error handler, instead of UTF-8 in strict mode.
2013-01-01 23:05:55 +01:00
Richard Oudkerk 9b4599322d Issue #9586: Merge 2013-01-01 17:36:53 +00:00
Richard Oudkerk 9866231eab Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy. 2013-01-01 17:29:44 +00:00
Eli Bendersky b829dea0cd Make indentation consistent 2013-01-01 07:41:51 -08:00
Eli Bendersky 03ab4d3581 Make indentation consistent and remove dead commented-out code. 2012-12-31 15:34:20 -08:00
Serhiy Storchaka c1b59d4552 Issue #16688: Fix backreferences did make case-insensitive regex fail on non-ASCII strings.
Patch by Matthew Barnett.
2012-12-29 23:38:48 +02:00
Andrew Svetlov 41dc9f3cd1 rename MathcObject to match object in doctrings for re module (#16760) 2012-12-25 18:49:08 +02:00
Andrew Svetlov 0b64c1415e rename MathcObject to match object in doctrings for re module (#16760) 2012-12-25 18:48:54 +02:00
Andrew Svetlov 70dcef4789 Issue #16443: Add docstrings to regular expression match objects.
Patch by Anton Kasyanov.
2012-12-23 19:59:27 +02:00
Andrew Svetlov 56ad5ed5ad Issue #16443: Add docstrings to regular expression match objects.
Patch by Anton Kasyanov.
2012-12-23 19:23:07 +02:00
Stefan Krah e3dff55a5e Issue #16753: Define __GNUC_STDC_INLINE__ to an integer (same as gcc). 2012-12-23 15:42:21 +01:00
Stefan Krah f03eee12b4 Issue #16745: The gcc visibility pragma is buggy on OpenIndiana and NetBSD. 2012-12-22 23:05:51 +01:00
Stefan Krah 66a6f3fa81 Fix Visual Studio build. 2012-12-22 14:46:44 +01:00
Stefan Krah fdf1a34ba1 Issue #16745: Hide symbols in _decimal.so. 2012-12-22 14:18:35 +01:00
Stefan Krah fb7f580e81 Issue #16745: Hide a couple of symbols by making them local. 2012-12-21 23:11:05 +01:00
Kristjan Valur Jonsson c51bafbbda Merge with 3.2 : Don't DECREF the ctypes error_object without the GIL held. 2012-12-21 11:22:29 +00:00
Kristjan Valur Jonsson 3cbdaa3fee Merge with 3.1 : Don't DECREF the ctypes error_object without the GIL held. 2012-12-21 11:20:53 +00:00
Kristjan Valur Jonsson 9946bd69fa Don't DECREF the ctypes error_object without the GIL held. 2012-12-21 09:41:25 +00:00
Benjamin Peterson 68623614f0 call close on the underlying stream even if flush raises (closes #16597)
Patch by Serhiy Storchaka.
2012-12-20 11:53:11 -06:00
Andrew Svetlov 5b89840d9c Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:26:36 +02:00
Andrew Svetlov 737fb89dd1 Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:14:22 +02:00
Stefan Krah 9a4ff437d1 Issue #15783: Support None default values in the Context() constructor. 2012-12-16 21:10:35 +01:00
Stefan Krah 040e311826 Issue #15783: Except for the number methods, the C version of decimal now
supports all None default values present in decimal.py. These values were
largely undocumented.
2012-12-15 22:33:33 +01:00
Benjamin Peterson 18d105b824 merge 3.2 2012-12-15 15:44:08 -05:00
Benjamin Peterson 7eb8a1a0cb remove dead code 2012-12-15 15:43:58 -05:00
Ezio Melotti 11def426c0 #16681: merge with 3.2. 2012-12-14 20:13:39 +02:00
Ezio Melotti e3d7e54b11 #16681: use "bidirectional class" instead of "bidirectional category" in the docstring too. 2012-12-14 20:12:25 +02:00
Gregory P. Smith 08d5ca6cd4 Code style fixup: No need for double ((parenthesis)) and use {} on an if else. 2012-12-10 20:22:31 -08:00
Gregory P. Smith 9504b13145 Code style fixup: No need for double ((parenthesis)) and use {} on an if else. 2012-12-10 20:20:20 -08:00
Gregory P. Smith c0dd80e439 1 << 31 is invalid for signed integers, fix it by making 1 unsigned.
Found by Clang trunk's Undefined-Behavior Sanitizer.  [more to come]
2012-12-10 17:45:03 -08:00
Gregory P. Smith 90555d0f0d 1 << 31 is invalid for signed integers, fix it by making 1 unsigned.
Found by Clang trunk's Undefined-Behavior Sanitizer.  [more to come]
2012-12-10 17:44:44 -08:00
Antoine Pitrou 12f33df4a2 Issue #16628: Fix a memory leak in ctypes.resize(). 2012-12-08 11:07:16 +01:00
Antoine Pitrou 305e1a749f Issue #16628: Fix a memory leak in ctypes.resize(). 2012-12-08 11:05:50 +01:00
Victor Stinner 2660e427d1 (Merge 3.2) Issue #16416: On Mac OS X, operating system data are now always
encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding
(which may be ASCII if no locale environment variable is set), to avoid
inconsistencies with os.fsencode() and os.fsdecode() functions which are
already using UTF-8/surrogateescape.
2012-12-03 12:48:53 +01:00
Victor Stinner 27b1ca29cc Issue #16416: On Mac OS X, operating system data are now always
encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding
(which may be ASCII if no locale environment variable is set), to avoid
inconsistencies with os.fsencode() and os.fsdecode() functions which are
already using UTF-8/surrogateescape.
2012-12-03 12:47:59 +01:00
Benjamin Peterson 47a00f3d1a support encoding error handlers that return bytes (closes #16585) 2012-12-02 11:20:28 -05:00
Benjamin Peterson aff472394c unicode -> str 2012-12-02 10:53:41 -05:00
Antoine Pitrou 9a2b26748b Issue #10182: The re module doesn't truncate indices to 32 bits anymore.
Patch by Serhiy Storchaka.
2012-12-02 12:54:28 +01:00
Antoine Pitrou 43fb54cd4f Issue #10182: The re module doesn't truncate indices to 32 bits anymore.
Patch by Serhiy Storchaka.
2012-12-02 12:52:36 +01:00
Gregory P. Smith 14b04cd350 Plug a leak in timemodule. The module dictionary is saved during
initialization. If the interpreter is shut down and reinitialized (embedded
CPython), the old module dictionary was not dec-refed during the next import of
the time extension module.

Contributed by Torsten Marek of Google.
2012-11-27 10:16:55 -08:00
Antoine Pitrou 9982c53c2f Issue #12848: The pure Python pickle implementation now treats object lengths as unsigned 32-bit integers, like the C implementation does.
Patch by Serhiy Storchaka.
2012-11-24 20:41:34 +01:00
Antoine Pitrou bf6ecf92fa Issue #12848: The pure Python pickle implementation now treats object lengths as unsigned 32-bit integers, like the C implementation does.
Patch by Serhiy Storchaka.
2012-11-24 20:40:21 +01:00
Ezio Melotti 8a6d1fed41 #16306: merge with 3.2. 2012-11-23 18:52:39 +02:00
Ezio Melotti a0dd22e5e8 #16306: report only the first unknown option and add more tests. Patch by Serhiy Storchaka. 2012-11-23 18:48:32 +02:00
Antoine Pitrou 39bdad813a Issue #1160: Fix compiling large regular expressions on UCS2 builds.
Patch by Serhiy Storchaka.
2012-11-20 22:30:42 +01:00
Nadeem Vawda 6ff262e18f Issue #15677: Document that zlib and gzip accept a compression level of 0 to mean 'no compression'.
Patch by Brian Brazil.
2012-11-11 14:14:47 +01:00
Nadeem Vawda 19e568d254 Issue #15677: Document that zlib and gzip accept a compression level of 0 to mean 'no compression'.
Patch by Brian Brazil.
2012-11-11 14:04:14 +01:00
Gregory P. Smith 34b14951ee Fixes issue #9535: Fix pending signals that have been received but not
yet handled by Python to not persist after os.fork() in the child process.
2012-11-10 20:33:39 -08:00
Gregory P. Smith 9463e3ac8b Fixes issue #9535: Fix pending signals that have been received but not
yet handled by Python to not persist after os.fork() in the child process.
2012-11-10 20:33:07 -08:00
Nadeem Vawda ec6dfcffa0 Issue #16411: Fix a bug where zlib.decompressobj().flush() might try to access previously-freed memory.
Patch by Serhiy Storchaka.
2012-11-11 03:16:44 +01:00
Nadeem Vawda 7ee955550b Issue #16411: Fix a bug where zlib.decompressobj().flush() might try to access previously-freed memory.
Patch by Serhiy Storchaka.
2012-11-11 03:15:32 +01:00
Nadeem Vawda dd1253abdd Issue #16350, part 2: Set unused_data (and unconsumed_tail) correctly in decompressobj().flush().
Additionally, fix a bug where a MemoryError in allocating a bytes object could
leave the decompressor object in an invalid state (with its unconsumed_tail
member being NULL).

Patch by Serhiy Storchaka.
2012-11-11 02:21:22 +01:00
Nadeem Vawda ee7889dec3 Issue #16350, part 2: Set unused_data (and unconsumed_tail) correctly in decompressobj().flush().
Additionally, fix a bug where a MemoryError in allocating a bytes object could
leave the decompressor object in an invalid state (with its unconsumed_tail
member being NULL).

Patch by Serhiy Storchaka.
2012-11-11 02:14:36 +01:00
Stefan Krah 6e467049c6 Accept Unicode legacy strings in the Decimal constructor. 2012-11-10 23:09:04 +01:00
Stefan Krah 0f82b76b57 Issue #16431: Finally, consider all permutations. 2012-11-08 11:17:29 +01:00
Stefan Krah ed16eff57e Issue #16431: Also fix the opposite direction. 2012-11-07 23:47:19 +01:00
Stefan Krah f4abc7b8a0 Issue #16431: Use the type information when constructing a Decimal subtype
from a Decimal argument.
2012-11-07 23:12:25 +01:00
Nadeem Vawda 519f43844b Issue #16350: Fix zlib decompressor handling of unused_data with multiple calls to decompress() after EOF.
Patch by Serhiy Storchaka.
2012-11-05 00:38:48 +01:00
Nadeem Vawda 39079946a2 Issue #16350: Fix zlib decompressor handling of unused_data with multiple calls to decompress() after EOF.
Patch by Serhiy Storchaka.
2012-11-05 00:37:42 +01:00
Stefan Krah e6996ed5d9 Issue #16145: Support legacy strings in the _csv module. 2012-11-02 14:44:20 +01:00
Antoine Pitrou 0168d3d9b1 Issue #16230: Fix a crash in select.select() when one the lists changes size while iterated on.
Patch by Serhiy Storchaka.
2012-11-01 20:15:23 +01:00
Antoine Pitrou e4ad37e50e Issue #16230: Fix a crash in select.select() when one the lists changes size while iterated on.
Patch by Serhiy Storchaka.
2012-11-01 20:13:54 +01:00
Antoine Pitrou 5ebe65f8cb Issue #16228: Fix a crash in the json module where a list changes size while it is being encoded.
Patch by Serhiy Storchaka.
2012-11-01 19:59:21 +01:00
Antoine Pitrou 9f69e79c45 Issue #16228: Fix a crash in the json module where a list changes size while it is being encoded.
Patch by Serhiy Storchaka.
2012-11-01 19:52:06 +01:00
Andrew Svetlov 796c443f3d Merge: fix docstring for deque ctor to mark iterable parameter optional 2012-10-31 11:51:13 +02:00
Andrew Svetlov 6a5c7c341a Fix docstring for deque ctor to mark iterable parameter optional 2012-10-31 11:50:40 +02:00
Benjamin Peterson e8ea97fffb merge 3.2 (#16369) 2012-10-30 23:27:52 -04:00
Benjamin Peterson c43112823b initialize more global type objects (closes #16369) 2012-10-30 23:21:10 -04:00
Petri Lehtinen 4648b4779a #14897: Enhance error messages of struct.pack and struct.pack_into
Patch by Matti Mäki.
2012-10-29 21:25:01 +02:00
Petri Lehtinen 92c28cace4 #14897: Enhance error messages of struct.pack and struct.pack_into
Patch by Matti Mäki.
2012-10-29 21:24:07 +02:00
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