Commit Graph

4179 Commits

Author SHA1 Message Date
Brett Cannon 13853a67cf #17115: I hate you MS for not supporting C99. 2013-05-04 17:37:09 -04:00
Antoine Pitrou df6931dbbc Issue #17408: Avoid using an obsolete instance of the copyreg module when the interpreter is shutdown and then started again. 2013-05-04 20:46:19 +02:00
Antoine Pitrou 957a23b088 Issue #17408: Avoid using an obsolete instance of the copyreg module when the interpreter is shutdown and then started again. 2013-05-04 20:45:02 +02:00
Brett Cannon 4c14b5de1c #17115,17116: Have modules initialize the __package__ and __loader__
attributes to None.

The long-term goal is for people to be able to rely on these
attributes existing and checking for None to see if they have been
set. Since import itself sets these attributes when a loader does not
the only instances when the attributes are None are from someone
overloading __import__() and not using a loader or someone creating a
module from scratch.

This patch also unifies module initialization. Before you could have
different attributes with default values depending on how the module
object was created. Now the only way to not get the same default set
of attributes is to circumvent initialization by calling
ModuleType.__new__() directly.
2013-05-04 13:56:58 -04:00
Alexandre Vassalotti 865eaa1b53 Closes #17892: Fix the name of _PyObject_CallMethodObjIdArgs 2013-05-02 10:44:04 -07:00
Benjamin Peterson 3b0431dc60 check local class namespace before reaching for cells (closes #17853) 2013-04-30 09:41:40 -04:00
Benjamin Peterson 0bb83f812f merge 3.3 (#17863) 2013-04-29 10:23:31 -04:00
Benjamin Peterson fe1b22af0a ignore errors when trying to fetch sys.stdin.encoding (closes #17863) 2013-04-29 10:23:08 -04:00
Benjamin Peterson 5c089314ef merge 3.3 2013-04-29 09:08:33 -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
Antoine Pitrou 208ac5cf65 Issue #17832: fix a compilation warning about a function prototype.
Also, make the private function static.
2013-04-24 20:17:53 +02:00
R David Murray f097f175dd Merge #17413: make sure settrace funcs get passed exception instances for 'value'.
Patch by Ingrid Cheung and Brendan McLoughlin.
2013-04-19 12:57:54 -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 03a0c27569 Merge indentation fix from 3.3. 2013-04-19 07:10:45 +03:00
Ezio Melotti 1b6424fc4b Fix indentation. 2013-04-19 07:10:09 +03:00
Brett Cannon edfd6ae79c Issue #17244: Don't mask exceptions raised during the creation of
bytecode files in py_compile.

Thanks to Arfrever Frehtes Taifersar Arahesis for the bug report.
2013-04-14 12:48:15 -04:00
Benjamin Peterson 214a7d2674 properly lookup the __round__ special method (closes #17722) 2013-04-13 17:19:01 -04:00
Antoine Pitrou e9bbe8b87b Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal.
Initial patch by Daniel Riti.
2013-04-13 22:41:09 +02:00
Brett Cannon 100883f0cb Issue #17093,17566,17567: Methods from classes in importlib.abc now raise/return
the default exception/value when called instead of raising/returning
NotimplementedError/NotImplemented (except where appropriate).
This should allow for the ABCs to act as the bottom/end of the MRO with expected
default results.

As part of this work, also make importlib.abc.Loader.module_repr()
optional instead of an abstractmethod.
2013-04-09 16:59:39 -04:00
Serhiy Storchaka ee57f159af Revert a premature patch for issue #14010 (changeset 846bd418aee5). 2013-04-06 22:55:12 +03:00
Serhiy Storchaka 278d03bd66 Revert a premature patch for issue #14010 (changeset aaaf36026511). 2013-04-06 22:52:34 +03:00
Antoine Pitrou 7d8c29a022 Issue #17645: convert an assert() into a proper exception in _Py_Mangle(). 2013-04-06 21:21:46 +02: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 aac81e2780 Issue #14010: Fix a crash when iterating or deleting deeply nested filters
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:20:30 +03:00
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 eea1f5c2e4 Merge 2013-04-03 13:49:36 +01:00
Richard Oudkerk 614c578dec Issue #17619: Make input() check for Ctrl-C correctly on Windows. 2013-04-03 13:44:50 +01:00
Victor Stinner eb4b5ac8af Close #16757: Avoid calling the expensive _PyUnicode_FindMaxChar() function
when possible
2013-04-03 02:02:33 +02:00
Brett Cannon daf4daa295 merge 2013-04-01 13:25:40 -04: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
Benjamin Peterson d0924b3d38 update importlib.h 2013-03-27 17:53:17 -04:00
Ezio Melotti 1f8898a591 #17323: The "[X refs, Y blocks]" printed by debug builds has been disabled by default. It can be re-enabled with the `-X showrefcount` option. 2013-03-26 01:59:56 +02:00
Gregory P. Smith d6f1d1647b Fixes issue4653 - Correctly specify the buffer size to FormatMessageW and
correctly check for errors on two CreateFileMapping calls.
2013-03-23 16:06:06 -07: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 684cd0e643 Issue #17522: Add the PyGILState_Check() API. 2013-03-23 03:36:16 -07:00
Benjamin Peterson 440282ba8a copy 2.7 magic numbers for historical interest 2013-03-21 23:04:45 -05:00
Kristján Valur Jónsson 6168362509 Issue #16475 : Correctly handle the EOF when reading marshal streams. 2013-03-20 14:26:33 -07:00
Kristján Valur Jónsson e178187bf6 Issue #16475: Simplify the interface to r_ref_allocate and improve comments. 2013-03-20 11:43:57 -07:00
Benjamin Peterson eddb0a7884 fix compiler warning 2013-03-20 00:40:07 -05:00
Benjamin Peterson 605a774a98 Backed out changeset 521232b05b97 2013-03-20 00:39:41 -05:00
Benjamin Peterson c6dc12484b fix compiler warning 2013-03-19 23:20:59 -05:00
Kristján Valur Jónsson dc32d18d11 Issue #15038 : Fixing the condition broadcast and docs. 2013-03-19 20:18:37 -07:00
Kristján Valur Jónsson 32ecccaf63 Issue #15038 : Fixing the condition broadcast and docs. 2013-03-19 20:18:37 -07:00
Kristján Valur Jónsson d7009c6913 Issue #16475: Support object instancing, recursion and interned strings
in marshal
2013-03-19 18:02:10 -07:00
Benjamin Peterson 3a61943b7b bump Python-ast.c 2013-03-18 23:40:53 -07:00
Benjamin Peterson b72406b8fa refactor to fix refleaks 2013-03-18 23:24:41 -07:00
Benjamin Peterson 6fba3dbce0 sprinkle const 2013-03-18 23:13:31 -07:00
Benjamin Peterson aad1d87339 move declaration to top of block 2013-03-18 10:59:41 -07:00
Benjamin Peterson cda75be02a unify some ast.argument's attrs; change Attribute column offset (closes #16795)
Patch from Sven Brauch.
2013-03-18 10:48:58 -07:00
Benjamin Peterson aa14dc3b4e C89 compliance 2013-03-16 15:38:28 -07:00
Benjamin Peterson 2d6acd2ac2 reject non-docs strings between future imports (closes #17434) 2013-03-16 09:15:47 -07:00
Benjamin Peterson 7701e6ef93 make some freezing related stuff const 2013-03-13 14:06:39 -05:00
Brett Cannon 4802becb16 Issue #17117: Have both import itself and importlib.util.set_loader()
set __loader__ on a module when set to None.

Thanks to Gökcen Eraslan for the fix.
2013-03-13 10:41:36 -07:00
Ezio Melotti 04a29554c1 #17032: The "global" in the "NameError: global name 'x' is not defined" error message has been removed. Patch by Ram Rachum. 2013-03-03 15:12:44 +02:00
Brett Cannon c190389834 Issue #17220: two fixes for changeset 2528e4aea338.
First, because the mtime can exceed 4 bytes, make sure to mask it down to 4
bytes before getting its little-endian representation for writing out to a .pyc
file.

Two, cap an rsplit() call to 1 split, else can lead to too many values being
returned for unpacking.
2013-02-25 17:10:11 -05:00
Serhiy Storchaka 39e47f94ec Issue #17220: Little cleanup of _bootstrap.py. 2013-02-25 15:40:33 +02:00
Ezio Melotti 92bd4ef640 Merge importlib.h rebuild from 3.3 after the changes introduced in 65eaac000147. 2013-02-20 22:15:47 +02:00
Ezio Melotti 795c10b3b6 Rebuild importlib.h after the changes introduced in 0f65bf6063ca. 2013-02-20 21:42:46 +02:00
Antoine Pitrou 7056cb2867 Issue #17170: speed up PyArg_ParseTuple[AndKeywords] a bit. 2013-02-17 01:04:57 +01:00
Ezio Melotti 178e6fef9e #17178: merge with 3.3. 2013-02-15 23:38:23 +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 0c15b5d897 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:12:11 +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 b8cbba5877 Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:43:25 +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
Benjamin Peterson 419d9a83d5 evaluate lambda keyword-only defaults after positional defaults (#16967 again) 2013-02-10 09:48:22 -05:00
Benjamin Peterson 1ef876cd28 evaluate positional defaults before keyword-only defaults (closes #16967) 2013-02-10 09:29:59 -05:00
Antoine Pitrou 8ad5b07ccb Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag), mpdecimal (needs to build without Python.h).
2013-02-09 23:16:51 +01:00
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 85ae3566d1 Merge w/ 3.3 more fixes thanks to issue #17098 2013-02-01 16:36:29 -05: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
Brett Cannon f3220d6af7 Tweak an exception message 2013-01-27 13:04:56 -05:00
Brett Cannon 14581d5dc4 Port py_compile over to importlib 2013-01-26 08:48:36 -05:00
Brett Cannon 686e880f20 Touch up exception messaging 2013-01-25 13:49:19 -05:00
Martin v. Löwis b26a9b10ea Replace WaitForSingleObject with WaitForSingleObjectEx,
for better WinRT compatibility.
2013-01-25 14:25:48 +01:00
Martin v. Löwis 3f50bf652b Drop support for Windows 2000; allow any XP API (but not Vista+).
Drop SDK version configuration for Tk compilation, to not bind it to W2k
anymore. Binding it to XP would conflict with Tk's own binding of tkMenu to W2k.
2013-01-25 14:06:18 +01:00
Benjamin Peterson 51f4616f6e revert #16672 for incorrect semantics 2013-01-23 08:38:47 -05:00
Benjamin Peterson f0472f6995 merge 3.3 2013-01-19 14:58:51 -05:00
Benjamin Peterson c71741f413 remove unnecessary clearing of list 2013-01-19 14:58:38 -05:00
Philip Jenvey 215c49a509 thinko 2013-01-15 13:24:12 -08:00
Brett Cannon 569ff4fbbc Issue #15031: Refactor some code in importlib pertaining to validating
and compiling bytecode.

Thanks to Ronan Lamy for pointing the redundancy and taking an initial
stab at the refactor (as did Nick Coghlan).
2013-01-11 18:09:25 -05:00
Brett Cannon c57f9f9419 Merge from 3.3 for fix for issue #16730 2013-01-11 15:42:30 -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 ae2039e62c merge 3.3 2012-12-31 21:37:30 -06:00
Benjamin Peterson 198399d92c bring Python into 2013 2012-12-31 21:37:21 -06:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Andrew Svetlov 3ba3a3ee56 Issue #15422: get rid of PyCFunction_New macro 2012-12-25 13:32:35 +02:00
Benjamin Peterson 6f0c94df50 improve tracing performance when f_trace is NULL (closes #16672)
Patch by Xavier de Gaye.
2012-12-24 11:53:30 -06:00
Benjamin Peterson fc8f5c5e0f update importlib.h 2012-12-19 15:16:51 -06:00
Andrew Svetlov 2606a6f197 Issue #16719: Get rid of WindowsError. Use OSError instead
Patch by Serhiy Storchaka.
2012-12-19 14:33:35 +02:00
Antoine Pitrou ad8c461e2c Add sanity assertions in some import lock code (issue #15599). 2012-12-18 22:18:58 +01:00
Antoine Pitrou 202b60640b Add sanity assertions in some import lock code (issue #15599). 2012-12-18 22:18:17 +01:00
Andrew Svetlov ad28c7f9da Issue #16706: get rid of os.error 2012-12-18 22:02:39 +02:00