Benjamin Peterson
e8e14591eb
rather than passing locals to the class body, just execute the class body in the proper environment
2013-05-16 14:37:25 -05:00
Benjamin Peterson
1e93b06007
complain about "global __class__" in a class body ( closes #17983 )
2013-05-15 16:17:25 -05:00
Benjamin Peterson
312595ce3a
hide the __class__ closure from the class body ( #12370 )
2013-05-15 15:26:42 -05:00
Benjamin Peterson
e1b4cbc422
when arguments are cells clear the locals slot (backport of #17927 )
2013-05-14 22:31:26 -05:00
Benjamin Peterson
159ae41da6
when an argument is a cell, set the local copy to NULL (see #17927 )
2013-05-12 18:16:06 -05:00
Guido van Rossum
6832c81d5d
#17927 : Keep frame from referencing cell-ified arguments.
2013-05-10 08:47:42 -07:00
Charles-Francois Natali
f28dfdd07b
Issue #17912 : Use a doubly linked-list for thread states.
2013-05-08 21:09:52 +02:00
Antoine Pitrou
070cb3c9be
Issue #1545463 : At shutdown, defer finalization of codec modules so that stderr remains usable.
...
(should fix Windows buildbot failures on test_gc)
2013-05-08 13:23:25 +02:00
Victor Stinner
22c103b3cc
Fix a compiler warning: use unsigned int type instead of enum PyUnicode_Kind to
...
compare two Unicode kinds
2013-05-07 23:50:03 +02:00
Victor Stinner
313f10c722
Fix a compiler warning: in and out are unused in _Py_char2wchar() if
...
HAVE_MBRTOWC is not defined
2013-05-07 23:48:56 +02:00
Antoine Pitrou
5f454a07a0
Issue #1545463 : Global variables caught in reference cycles are now garbage-collected at shutdown.
2013-05-06 21:15:57 +02:00
Antoine Pitrou
8408cea0cd
Issue #17094 : Clear stale thread states after fork().
...
Note that this is a potentially disruptive change since it may
release some system resources which would otherwise remain
perpetually alive (e.g. database connections kept in thread-local
storage).
2013-05-05 23:47:09 +02:00
Antoine Pitrou
4adb566ad7
Fix crash caused by 8c1385205a35
...
(thanks Arfrever for reporting).
2013-05-05 08:14:53 +02:00
Antoine Pitrou
fd417cc54b
Fix crash caused by 8c1385205a35
...
(thanks Arfrever for reporting).
2013-05-05 08:12:42 +02:00
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
Benjamin Peterson
9272279afd
use error label instead of breaking eval loop ( closes #16693 )
2012-12-15 12:51:05 -05:00
Benjamin Peterson
5cb8a31dc4
cleanup and fix refleaks
2012-12-15 00:05:16 -05:00
Andrew Svetlov
6b2cbeba58
Issue #16421 : allow to load multiple modules from the same shared object.
...
Patch by Václav Šmilauer.
2012-12-14 17:04:59 +02:00
Philip Jenvey
f76f0eea5c
compile doesn't accept code objects
2012-12-13 15:44:18 -08:00
Antoine Pitrou
f9d0b1256f
Issue #13390 : New function :func:`sys.getallocatedblocks()` returns the number of memory blocks currently allocated.
...
Also, the ``-R`` option to regrtest uses this function to guard against memory allocation leaks.
2012-12-09 14:28:26 +01:00
Benjamin Peterson
70b224d8d4
assert than we never try to deal with True, False, or None as a name
2012-12-06 17:49:58 -05:00
Benjamin Peterson
442f20996d
create NameConstant AST class for None, True, and False literals ( closes #16619 )
2012-12-06 17:41:04 -05:00
Eric Snow
a6cfb28bd2
Issue #15627 : This is simply an update to the name of a new method recently added
...
to importlib.abc.SourceLoader.
2012-12-04 23:43:43 -08:00
Victor Stinner
d45c7f8d74
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.
2012-12-04 01:34:47 +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
4569467539
Issue #16588 : Silence unused-but-set warnings in Python/thread_pthread.h
2012-12-02 08:39:23 +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
073f067369
Issue #16546 : merge fix from 3.3
2012-11-25 14:37:43 +00:00
Mark Dickinson
ded35aeb9d
Issue #16546 : make ast.YieldFrom argument mandatory.
2012-11-25 14:36:26 +00:00
Ezio Melotti
8b9a8f3c98
#16306 : merge with 3.3.
2012-11-23 19:01:42 +02: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
b72c10996e
- 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:35:27 -05: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
Christian Heimes
5c1c831211
RISCOS support has been removed a long time ago. Remove last remains in sys.flags code. #16501 can be closed, too.
2012-11-19 00:44:37 +01:00
Brett Cannon
540187f719
Regen importlib.h
2012-11-18 10:27:12 -05:00
Brett Cannon
5650e4f41c
Issue #15627 : Add the compile_source() method to
...
importlib.abc.SourceLoader.
This provides an easy hook into the import system to allow for source
transformations, AST optimizations, etc.
2012-11-18 10:03:31 -05:00
Ezio Melotti
195ad6ce05
#16306 : merge with 3.3.
2012-11-18 14:06:54 +02: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
Brett Cannon
e4710cfced
Issue #15894 : Document why we don't worry about re-acquiring the
...
global import lock after forking.
2012-11-15 21:39:36 -05:00
Victor Stinner
0d92c4f667
Issue #16416 : Fix error handling in _Py_wchar2char() _Py_char2wchar() functions
2012-11-12 23:32:21 +01:00
Benjamin Peterson
fc93ec5966
merge heads
2012-11-12 17:04:43 -05:00
Benjamin Peterson
c7a8a210d6
merge 3.3 (sort of)
2012-11-12 17:04:28 -05:00
Victor Stinner
e262377cab
Issue #16416 : OS 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-11-12 23:04:02 +01:00
Benjamin Peterson
2a0e226131
recompile importlib.h
2012-11-12 17:02:32 -05:00
Stefan Krah
abaca8cb06
Merge 3.3.
2012-11-12 20:24:09 +01:00
Stefan Krah
6df5cae49a
Issue #15835 : Define PATH_MAX on HP-UX.
2012-11-12 20:14:36 +01:00
Hynek Schlawack
15c02e3048
Issue #15001 : fix segfault on "del sys.module['__main__']"
...
Patch by Victor Stinner.
2012-11-07 09:10:49 +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
e69bfc3fb6
Issue #5765 : Merge from 3.3
2012-11-04 23:53:15 +10: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
1e58ae44df
#16336 : merge with 3.3.
2012-11-03 23:05:18 +02: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
76bcff27b2
Issue #7317 : Display full tracebacks when an error occurs asynchronously.
...
Patch by Alon Horev with update by Alexey Kachayev.
2012-11-03 15:56:05 +02:00
Andrew Svetlov
1511a5a3af
Merge issue #16218 : Support non ascii characters in python launcher.
...
Patch by Serhiy Storchaka.
2012-11-01 14:52:03 +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
d9c8702c0f
point errors related to nonlocals and globals to the statement declaring them ( closes #10189 )
2012-10-31 20:26:20 -04:00
Benjamin Peterson
da58c3d81a
merge 3.3
2012-10-31 19:01:48 -04:00
Benjamin Peterson
e132f527c9
check return value of _PyUnicode_AsString
2012-10-31 19:01:42 -04:00
Benjamin Peterson
42124a727d
initialize map/filter/zip in _PyBuiltin_Init rather than the catch-all function
2012-10-30 23:41:54 -04:00
Victor Stinner
76df43de30
Issue #16330 : Use surrogate-related macros
...
Patch written by Serhiy Storchaka.
2012-10-30 01:42:39 +01:00
Philip Jenvey
16bb5450d6
merge with 3.3
2012-10-26 17:05:55 -07:00
Philip Jenvey
5f9459fbed
merge with 3.2
2012-10-26 17:05:09 -07:00
Philip Jenvey
45c41494bf
bounds check for bad data (thanks amaury)
2012-10-26 17:01:53 -07:00
Nick Coghlan
557c76c136
Fix compilation on Windows
2012-10-20 11:43:58 +10:00
Nick Coghlan
d4f5ad6c6e
Merge fix from #6074 from 3.3
2012-10-19 23:36:15 +10:00
Nick Coghlan
eb8d627bbd
Issue #6074 : Apply an appropriate fix for importlib based imports
2012-10-19 23:32:00 +10:00
Nick Coghlan
34937ce249
Issue #6074 : Forward port Windows read-only source file fix from 2.7
2012-10-19 22:38:14 +10:00
Christian Heimes
743e0cd6b5
Issue #16166 : Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified
...
endianess detection and handling.
2012-10-17 23:52:17 +02:00
Trent Nelson
744faddae8
Merge issue #15833 : don't raise an exception if importlib can't write
...
byte-compiled files.
This fixes a regression introduced by 3.3.
Patch by Charles-François Natali.
2012-10-16 08:03:21 -04:00
Trent Nelson
d783c8ed00
Issue #15833 : don't raise an exception if importlib can't write byte-compiled
...
files.
This fixes a regression introduced by 3.3. Patch by Charles-François Natali.
2012-10-16 07:47:34 -04:00
Benjamin Peterson
fe1bcb64cd
move more variable declarations to the top of blocks
2012-10-12 11:40:01 -04:00
Benjamin Peterson
f208df3618
move declaration to top of block
2012-10-12 11:37:56 -04:00
Benjamin Peterson
31a58ff1c3
ceval cleanup
...
- Make many variables local to the opcode; Kill u, v, w, and x.
- Force every opcode to end with DISPATCH or jump to error handling.
- Simplify error handling.
- Check error statuses in more places.
Closes #16191 .
2012-10-12 11:34:51 -04:00
Brett Cannon
6072e0bf42
Remove uses of % with str.format.
2012-10-12 10:00:34 -04:00
Brett Cannon
9407d50208
Merge fix for issue #15111 .
2012-10-10 19:18:37 -04:00
Brett Cannon
a6ce4fd426
Closes issue #15111 : Calling __import__ with a module specified in
...
fromlist which causes its own ImportError (e.g. the module tries to
import a non-existent module) should have that exception propagate.
2012-10-10 19:03:46 -04:00
Benjamin Peterson
00f86f2202
add some missing DISPATCH()
2012-10-10 14:10:33 -04:00
Jesus Cea
f01d695ccd
Closes #16135 : Removal of OS/2 support
2012-10-05 03:36:11 +02:00
Jesus Cea
b48925a406
#16135 : Removal of OS/2 support (I)
2012-10-05 01:04:27 +02:00
Victor Stinner
3b635cd447
Close #15766 : Catch exceptions while raising the ImportError in imp.load_dynamic()
2012-10-02 00:55:07 +02:00
Victor Stinner
621ef3d84f
Issue #15609 : Optimize str%args for integer argument
...
- Use _PyLong_FormatWriter() instead of formatlong() when possible, to avoid
a temporary buffer
- Enable the fast path when width is smaller or equals to the length,
and when the precision is bigger or equals to the length
- Add unit tests!
- formatlong() uses PyUnicode_Resize() instead of _PyUnicode_FromASCII()
to resize the output string
2012-10-02 00:33:47 +02:00
Brett Cannon
8ed677db12
Add some comments.
2012-09-28 16:41:39 -04:00
Benjamin Peterson
feaa54f537
don't depend on __debug__ because it's baked in at freeze time (issue #16046 )
2012-09-25 11:22:59 -04:00
Antoine Pitrou
ca8aa4acf6
Issue #15144 : Fix possible integer overflow when handling pointers as integer values, by using Py_uintptr_t instead of size_t.
...
Patch by Serhiy Storchaka.
2012-09-20 20:56:47 +02:00
Christian Heimes
10ca1fee8f
Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases.
2012-09-12 17:58:20 +02:00
Christian Heimes
55ad6515c9
Cleanup 'k' when the creation of PySTEntryObject fails. ad3824a90261 used to decref 'k' in too many error cases.
2012-09-12 17:58:10 +02:00
Christian Heimes
9c5b521c71
Partly revert ad3824a90261 and add comment about reference ownership
2012-09-12 17:53:15 +02:00
Christian Heimes
1526582df6
Partly revert ad3824a90261 and add comment about reference ownership
2012-09-12 17:52:46 +02:00
Christian Heimes
e9a6d62d9f
Fix null pointer dereferencing in structmember.c PyMember_SetOne() for T_CHAR. _PyUnicode_AsStringAndSize() can return NULL without touching the len argument. Also remove unnecessary PyUnicode_Check(), _PyUnicode_AsStringAndSize() performance the test again. CID 486815
2012-09-11 17:31:08 +02:00
Christian Heimes
5557a9c73f
Fix null pointer dereferencing in structmember.c PyMember_SetOne() for T_CHAR. _PyUnicode_AsStringAndSize() can return NULL without touching the len argument. Also remove unnecessary PyUnicode_Check(), _PyUnicode_AsStringAndSize() performance the test again. CID 486815
2012-09-11 17:30:53 +02:00
Christian Heimes
6d29352cfd
Issue #15895 : my analysis was slightly off. The FILE pointer is only leaked when set_main_loader() fails for a pyc file with closeit=0. In the success case run_pyc_file() does its own cleanup of the fp. I've changed the code to use another FILE ptr for pyc files and moved the fclose() to PyRun_SimpleFileExFlags() to make it more obvious what's happening.
2012-09-11 15:47:28 +02:00
Christian Heimes
6a77af690f
Issue #15895 : Fix FILE pointer leak in PyRun_SimpleFileExFlags() when filename points to a pyc/pyo file and closeit is false.
2012-09-11 14:11:03 +02:00
Christian Heimes
10e85ded9b
Fixed memory leak in error branch of parsestrplus. CID 715374 Variable s going out of scope leaks the storage it points to.
2012-09-10 16:53:28 +02:00
Christian Heimes
3d463393bb
Fixed memory leak in error branch of parsestrplus. CID 715374 Variable s going out of scope leaks the storage it points to.
2012-09-10 16:52:42 +02:00
Christian Heimes
879329d66e
Added missing va_end in error branch of PyArg_UnpackTuple(). CID 486641
2012-09-10 13:17:23 +02:00
Christian Heimes
48d8d21438
Added missing va_end in error branch of PyArg_UnpackTuple(). CID 486641
2012-09-10 13:16:45 +02:00
Christian Heimes
310f81449a
Closed reference leak of variable 'k' in function ste_new which wasn't decrefed in error cases
2012-09-10 03:09:17 +02:00
Christian Heimes
837e53a7c2
Closed reference leak of variable 'k' in function ste_new which wasn't decrefed in error cases
2012-09-10 03:08:46 +02:00
Antoine Pitrou
8c195afcac
Issue #15340 : Fix importing the random module when /dev/urandom cannot be opened.
...
This was a regression caused by the hash randomization patch.
2012-09-07 23:51:22 +02:00
Antoine Pitrou
7ff1822ec7
Issue #15340 : Fix importing the random module when /dev/urandom cannot be opened.
...
This was a regression caused by the hash randomization patch.
2012-09-07 23:49:07 +02:00
Stefan Krah
d9c1bf7f1f
After the jump in line 1051 unicode_tmp is NULL. Found by Coverity.
2012-09-06 13:02:46 +02:00
Antoine Pitrou
5b4faae307
Issue #13992 : The trashcan mechanism is now thread-safe. This eliminates
...
sporadic crashes in multi-thread programs when several long deallocator
chains ran concurrently and involved subclasses of built-in container
types.
Note that the trashcan functions are part of the stable ABI, therefore
they have to be kept around for binary compatibility of extensions.
2012-09-06 01:17:42 +02:00
Antoine Pitrou
56cd62c04a
Issue #13992 : The trashcan mechanism is now thread-safe. This eliminates
...
sporadic crashes in multi-thread programs when several long deallocator
chains ran concurrently and involved subclasses of built-in container
types.
Because of this change, a couple extension modules compiled for 3.2.4
(those which use the trashcan mechanism, despite it being undocumented)
will not be loadable by 3.2.3 and earlier. However, extension modules
compiled for 3.2.3 and earlier will be loadable by 3.2.4.
2012-09-06 00:59:49 +02:00
Benjamin Peterson
d40528fe9a
merge 3.2
2012-09-02 16:37:09 -04:00
Benjamin Peterson
c7dedb0945
put * in the normal place
2012-09-02 16:36:01 -04:00
Benjamin Peterson
bd0df50fb6
get rid of ast_error_finish by passing the compiling struct to ast_error
2012-09-02 15:04:51 -04:00
Benjamin Peterson
e9f72dbf0d
merge 3.2
2012-09-02 14:38:15 -04:00
Benjamin Peterson
c5d7518a2e
move variable decl to the top of the function
2012-09-02 14:38:08 -04:00
Benjamin Peterson
c7f447c89f
merge 3.2 ( #15846 )
2012-09-02 14:24:44 -04:00
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
Brett Cannon
b428f47cf6
Don't overwrite a __path__ value from extension modules if already
...
set.
2012-08-11 19:43:29 -04:00
Philip Jenvey
688a551ca0
fix docstring wording
2012-08-10 16:21:35 -07:00
Brett Cannon
f410ce8c09
Issue #15502 : Refactor some code.
2012-08-10 17:41:23 -04:00
Senthil Kumaran
e9175bd0af
Fix issue #15607 : Update the print builtin function docstring with the new flush keyword.
...
Patch contributed by Daniel Ellis.
2012-08-10 13:53:45 -07:00
Philip Jenvey
731d48a65f
update docstring per the extension package fix, refactor
2012-08-10 11:53:54 -07:00
Brett Cannon
ac9f2f3de3
Issue #15576 : Allow extension modules to be a package's __init__
...
module again. Also took the opportunity to stop accidentally exporting
_imp.extension_suffixes() as public.
2012-08-10 13:47:54 -04:00
Brett Cannon
f4dc9204cc
Issue #15502 : Finish bringing importlib.abc in line with the current
...
state of the import system. Also make importlib.invalidate_caches()
work with sys.meta_path instead of sys.path_importer_cache to
completely separate the path-based import system from the overall
import system.
Patch by Eric Snow.
2012-08-10 12:21:12 -04:00
Victor Stinner
2d6266d5f1
Remove now unused IntOrLongToString type
2012-08-09 21:38:23 +02:00
Benjamin Peterson
0ed05059de
merge heads
2012-08-06 17:53:19 -07:00
Benjamin Peterson
b37df519c7
fix yield from return value on custom iterators ( closes #15568 )
2012-08-06 17:53:09 -07:00
Brett Cannon
cb4996afe4
Issue #15471 : Don't use mutable object as default values for the
...
parameters of importlib.__import__().
2012-08-06 16:34:44 -04:00
Brett Cannon
ecfefb7956
Fix a spelling mistake in a comment.
2012-08-05 19:24:57 -04:00
Antoine Pitrou
c4d974d3fa
Remove unused variable `trim_get_code`.
2012-08-04 23:26:25 +02:00
Victor Stinner
90ef747e04
Close #13119 : use "\r\n" newline for sys.stdout/err on Windows
...
sys.stdout and sys.stderr are now using "\r\n" newline on Windows, as Python 2.
2012-08-04 01:37:32 +02:00
Victor Stinner
7b3f0fa68e
Close #13119 : use "\r\n" newline for sys.stdout/err on Windows
...
sys.stdout and sys.stderr are now using "\r\n" newline on Windows, as Python 2.
2012-08-04 01:28:00 +02:00
Nick Coghlan
4941774f59
Issue #15502 : Bring the importlib.PathFinder docs and docstring more in line with the new import system documentation, and fix various parts of the new docs that weren't quite right given PEP 420 or were otherwise a bit misleading. Also note the key terminology problem still being discussed in the issue
2012-08-02 23:03:58 +10:00
Nick Coghlan
ff79486bb5
Close #15519 : Properly expose WindowsRegistryFinder in importlib and bring the name into line with normal import terminology. Original patch by Eric Snow
2012-08-02 21:45:24 +10:00
Nick Coghlan
42c0766a53
Close #15486 : Simplify the mechanism used to remove importlib frames from tracebacks when they just introduce irrelevant noise
2012-07-31 21:14:18 +10:00