Commit Graph

4061 Commits

Author SHA1 Message Date
Benjamin Peterson fe1b22af0a ignore errors when trying to fetch sys.stdin.encoding (closes #17863) 2013-04-29 10:23:08 -04:00
Benjamin Peterson 7d110042c5 raise an ImportError (rather than fatal) when __import__ is not found in __builtins__ (closes #17867) 2013-04-29 09:08:14 -04:00
R David Murray 3583761bcd #17413: make sure settrace funcs get passed exception instances for 'value'.
Patch by Ingrid Cheung and Brendan McLoughlin.
2013-04-19 12:56:57 -04:00
Ezio Melotti 1b6424fc4b Fix indentation. 2013-04-19 07:10:09 +03:00
Serhiy Storchaka 278d03bd66 Revert a premature patch for issue #14010 (changeset aaaf36026511). 2013-04-06 22:52:34 +03:00
Antoine Pitrou 55bff89190 Issue #17645: convert an assert() into a proper exception in _Py_Mangle(). 2013-04-06 21:21:04 +02:00
Serhiy Storchaka e8f706eda7 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:14:43 +03:00
Richard Oudkerk 614c578dec Issue #17619: Make input() check for Ctrl-C correctly on Windows. 2013-04-03 13:44:50 +01:00
Brett Cannon f8ffec0617 Issue #17357: Add missing verbosity messages when running under
-v/-vv that were lost in the transition to importlib.
2013-04-01 13:10:51 -04:00
Gregory P. Smith b803c6c4b8 Fixes issue4653 - Correctly specify the buffer size to FormatMessageW and
correctly check for errors on two CreateFileMapping calls.
2013-03-23 16:05:36 -07:00
Kristján Valur Jónsson dc32d18d11 Issue #15038 : Fixing the condition broadcast and docs. 2013-03-19 20:18:37 -07:00
Ezio Melotti 795c10b3b6 Rebuild importlib.h after the changes introduced in 0f65bf6063ca. 2013-02-20 21:42:46 +02:00
Ezio Melotti 293ab9728a #17178: merge with 3.2. 2013-02-15 23:38:05 +02:00
Ezio Melotti b19ed57d8d #17178: update any()/all() docstrings to document their behavior with empty iterables. Patch by Ankur Ankan. 2013-02-15 23:35:14 +02:00
Serhiy Storchaka 5a1f152d19 Issue #5308: Raise ValueError when marshalling too large object (a sequence
with size >= 2**31), instead of producing illegal marshal data.
2013-02-13 12:11:03 +02:00
Serhiy Storchaka 7e0191170e Issue #5308: Raise ValueError when marshalling too large object (a sequence
with size >= 2**31), instead of producing illegal marshal data.
2013-02-13 12:08:15 +02:00
Serhiy Storchaka 801d955f04 Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:42:01 +02:00
Serhiy Storchaka 5e61f14c6d Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:36:00 +02:00
Antoine Pitrou c73c561181 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:14:42 +01:00
Antoine Pitrou 4de7457009 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).
2013-02-09 23:11:27 +01:00
Brett Cannon da9cf0eef8 Issue #17098: Be more stringent of setting __loader__ on early imported
modules. Also made test more rigorous.
2013-02-01 15:31:49 -05:00
Brett Cannon 0ecd30b4af Issue #17098: Make sure every module has __loader__ defined.
Thanks to Thomas Heller for the bug report.
2013-02-01 14:04:12 -05:00
Benjamin Peterson c71741f413 remove unnecessary clearing of list 2013-01-19 14:58:38 -05:00
Brett Cannon a9976b3e32 Issue #16730: Don't raise an exception in
importlib.machinery.FileFinder when the directory has become
unreadable or a file. This brings semantics in line with Python 3.2
import.

Reported and diagnosed by David Pritchard.
2013-01-11 15:40:12 -05:00
Victor Stinner 7ae320d667 (Merge 3.2) Issue #16455: On FreeBSD and Solaris, if the locale is C, the
ASCII/surrogateescape codec is now used, instead of the locale encoding, to
decode the command line arguments. This change fixes inconsistencies with
os.fsencode() and os.fsdecode() because these operating systems announces an
ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
2013-01-03 01:21:07 +01:00
Victor Stinner 20b654acb5 Issue #16455: On FreeBSD and Solaris, if the locale is C, the
ASCII/surrogateescape codec is now used, instead of the locale encoding, to
decode the command line arguments. This change fixes inconsistencies with
os.fsencode() and os.fsdecode() because these operating systems announces an
ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
2013-01-03 01:08:58 +01:00
Benjamin Peterson 198399d92c bring Python into 2013 2012-12-31 21:37:21 -06:00
Antoine Pitrou 202b60640b Add sanity assertions in some import lock code (issue #15599). 2012-12-18 22:18:17 +01:00
Victor Stinner 41a234a679 Issue #16416: Fix compilation error 2012-12-03 14:11:57 +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
Christian Heimes 17485bf6f9 Issue #16588: Silence unused-but-set warnings in Python/thread_pthread.h 2012-12-02 08:38:42 +01:00
Christian Heimes 56379c0d8f Issue #16588: Silence unused-but-set warnings in Python/thread_pthread.h 2012-12-02 08:37:00 +01:00
Mark Dickinson ded35aeb9d Issue #16546: make ast.YieldFrom argument mandatory. 2012-11-25 14:36:26 +00: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
Ezio Melotti 3c76aa6b23 Remove unused variabile "plain" in builtin_exec. 2012-11-21 18:36:08 +02:00
Barry Warsaw 82c1c781c7 - Issue #16514: Fix regression causing a traceback when sys.path[0] is None
(actually, any non-string or non-bytes type).
2012-11-20 15:22:51 -05:00
Ezio Melotti f7c709d62d #16306: merge with 3.2. 2012-11-18 14:02:08 +02:00
Ezio Melotti 7c66319edc #16306: Fix multiple error messages when unknown command line parameters where passed to the interpreter. Patch by Hieu Nguyen. 2012-11-18 13:55:52 +02:00
Benjamin Peterson 2a0e226131 recompile importlib.h 2012-11-12 17:02:32 -05:00
Stefan Krah 6df5cae49a Issue #15835: Define PATH_MAX on HP-UX. 2012-11-12 20:14:36 +01:00
Hynek Schlawack 33363f43e3 Issue #15001: fix segfault on "del sys.module['__main__']"
Patch by Victor Stinner.
2012-11-07 09:07:22 +01:00
Hynek Schlawack 5c6b3e214c Issue #15001: fix segfault on "del sys.module['__main__']"
Patch by Victor Stinner.
2012-11-07 09:02:24 +01:00
Ezio Melotti 6c5f5210be #5057: the peepholer no longer optimizes subscription on unicode literals (e.g. u"foo"[0]) in order to produce compatible pyc files between narrow and wide builds. 2012-11-05 00:06:32 +02:00
Nick Coghlan aab9c2b2ea Issue #5765: Apply a hard recursion limit in the compiler
Previously, excessive nesting in expressions would blow the
stack and segfault the interpreter. Now, a hard limit based
on the configured recursion limit and a hardcoded scaling
factor is applied.
2012-11-04 23:14:34 +10:00
Ezio Melotti a0b5c46fa2 #16336: merge with 3.2. 2012-11-03 23:04:41 +02:00
Ezio Melotti 540da76115 #16336: fix input checking in the surrogatepass error handler. Patch by Serhiy Storchaka. 2012-11-03 23:03:39 +02:00
Andrew Svetlov 90c0eb28c5 Issue #16218: Support non ascii characters in python launcher.
Patch by Serhiy Storchaka.
2012-11-01 14:51:14 +02:00
Benjamin Peterson e132f527c9 check return value of _PyUnicode_AsString 2012-10-31 19:01:42 -04:00
Philip Jenvey 5f9459fbed merge with 3.2 2012-10-26 17:05:09 -07:00
Philip Jenvey 45c41494bf bounds check for bad data (thanks amaury) 2012-10-26 17:01:53 -07:00
Nick Coghlan 557c76c136 Fix compilation on Windows 2012-10-20 11:43:58 +10:00
Nick Coghlan eb8d627bbd Issue #6074: Apply an appropriate fix for importlib based imports 2012-10-19 23:32:00 +10:00
Nick Coghlan 34937ce249 Issue #6074: Forward port Windows read-only source file fix from 2.7 2012-10-19 22:38:14 +10:00
Trent Nelson d783c8ed00 Issue #15833: don't raise an exception if importlib can't write byte-compiled
files.

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

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

Because of this change, a couple extension modules compiled for 3.2.4
(those which use the trashcan mechanism, despite it being undocumented)
will not be loadable by 3.2.3 and earlier. However, extension modules
compiled for 3.2.3 and earlier will be loadable by 3.2.4.
2012-09-06 00:59:49 +02:00
Benjamin Peterson d40528fe9a merge 3.2 2012-09-02 16:37:09 -04:00
Benjamin Peterson c7dedb0945 put * in the normal place 2012-09-02 16:36:01 -04:00
Benjamin Peterson bd0df50fb6 get rid of ast_error_finish by passing the compiling struct to ast_error 2012-09-02 15:04:51 -04:00
Benjamin Peterson e9f72dbf0d merge 3.2 2012-09-02 14:38:15 -04:00
Benjamin Peterson c5d7518a2e move variable decl to the top of the function 2012-09-02 14:38:08 -04:00
Benjamin Peterson c7f447c89f merge 3.2 (#15846) 2012-09-02 14:24:44 -04:00
Benjamin Peterson 2e2c903700 prevert ast errors from being normalized before ast_error_finish is called (closes #15846) 2012-09-02 14:23:15 -04:00
Antoine Pitrou 4f0338cab7 Issue #15781: Fix two small race conditions in import's module locking. 2012-08-28 00:24:52 +02:00
Brett Cannon 12c6bda4f0 Issue #15316: Let exceptions raised during imports triggered by the
fromlist of __import__ propagate.

The problem previously was that if something listed in fromlist didn't
exist then that's okay. The fix for that was too broad in terms of
catching ImportError.

The trick with the solution to this issue is that the proper
refactoring of import thanks to importlib doesn't allow for a way to
distinguish (portably) between an ImportError because finders couldn't
find a loader, or a loader raised the exception. In Python 3.4 the
hope is to introduce a new exception (e.g. ModuleNotFound) to make it
clean to differentiate why ImportError was raised.
2012-08-24 18:25:59 -04:00
Brett Cannon ba0a3edd26 Issue #2051: Tweak last commit for this issue to pass in mode instead
of source path to set_data() and make the new argument private until
possible API changes can be discussed more thoroughly in Python 3.4.
2012-08-24 13:48:39 -04:00
Nick Coghlan a508770e20 Close #2501: Permission bits are once again correctly copied from the source file to the cached bytecode file. Test by Eric Snow. 2012-08-24 18:32:40 +10:00
Victor Stinner ad54c6d82e Issue #15766: Fix a crash in imp.load_dynamic() on PyUnicode_FromString() failure 2012-08-22 17:45:52 +02:00
Antoine Pitrou 35503c9c14 Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
Patch by Robin Schreiber.
2012-08-20 19:31:52 +02:00
Antoine Pitrou 75506e8b7c Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
Patch by Robin Schreiber.
2012-08-20 19:30:46 +02:00
Stefan Krah 66d1eb23d4 Merge 3.2. 2012-08-20 17:20:46 +02:00
Stefan Krah 07795df683 Issue #15741: Fix potential NULL dereference. Found by Coverity. 2012-08-20 17:19:50 +02:00
Stefan Krah 28a2ad556a Check return value of asdl_seq_new(). Found by Coverity. 2012-08-20 16:07:38 +02:00
Nick Coghlan 48fec05391 Close #14846: Handle a sys.path entry going away 2012-08-20 13:18:15 +10:00
Brett Cannon 7385adc84c Issue #15715: Ignore failed imports triggered by the use of fromlist.
When the fromlist argument is specified for __import__() and the
attribute doesn't already exist, an import is attempted. If that fails
(e.g. module doesn't exist), the ImportError will now be silenced (for
backwards-compatibility). This *does not* affect
``from ... import ...`` statements.

Thanks to Eric Snow for the patch and Simon Feltman for reporting the
regression.
2012-08-17 13:21:16 -04: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