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
Victor Stinner
d5698cbbca
Fix initialization of the faulthandler module
...
faulthandler requires the importlib if "-X faulthandler" option is present on
the command line, so initialize faulthandler after importlib.
Add also an unit test.
2012-07-31 02:55:49 +02:00
Brett Cannon
722d3aec2e
Issue #15508 : Fix the docstring for __import__ to not mention negative
...
'level' values and set its document default value to 0.
Thanks to Arfrever Frehtes Taifersar Arahesis for filing the bug.
2012-07-30 17:45:54 -04:00
Victor Stinner
54f939b9ae
Issue #15463 : the faulthandler module truncates strings to 500 characters,
...
instead of 100, to be able to display long file paths
2012-07-30 13:08:58 +02:00
Nick Coghlan
5ee9892406
Close #15425 : Eliminate more importlib related traceback noise
2012-07-29 20:30:36 +10:00
Martin v. Löwis
e3010a8d12
Issue #14578 : Support modules registered in the Windows registry again.
...
Patch by Amaury Forgeot d'Arc.
2012-07-28 21:33:05 +02:00
Martin v. Löwis
7e39572aa8
Issue #15466 : Stop using TYPE_INT64 in marshal,
...
to make importlib.h (and other byte code files) equal between 32-bit
and 64-bit systems.
2012-07-28 19:44:05 +02:00
Kristján Valur Jónsson
c5963d3842
Issue #15365 : Make traceback reporting ignore any errors when printing out
...
the source line. Such errors can't be reported anyway. This makes error
reporting work, even if the "io" module can't be loaded.
2012-07-19 21:02:03 +00:00
Meador Inge
996ae04943
remove unused variable
2012-07-18 17:57:46 -05:00
Benjamin Peterson
51ab2830bb
remove unused variable
2012-07-18 15:12:47 -07:00
Meador Inge
9544aa38d9
Issue #15368 : fixing variable typo.
2012-07-18 16:49:07 -05:00
Meador Inge
f69e24e3c6
Issue #15368 : fixing variable typo.
2012-07-18 16:41:03 -05:00
Meador Inge
1f336adc8f
Issue #15368 : make bytecode generation deterministic.
2012-07-18 14:28:55 -05:00
Meador Inge
2ca6315d15
Issue #15368 : make bytecode generation deterministic.
2012-07-18 14:20:11 -05:00
Nick Coghlan
b7a5894c64
Refcounting fixes
2012-07-15 23:21:08 +10:00
Nick Coghlan
ceda83c6a9
Make set_main_loader static (noticed by Antoine Pitrou)
2012-07-15 23:18:08 +10:00
Nick Coghlan
2824cb507d
Issue #15343 : A lot more than just unicode decoding can go wrong when retrieving a source file
2012-07-15 22:12:14 +10:00
Nick Coghlan
3f94cbf9eb
Actually initialize __main__.__loader__ with loader instances, not the corresponding type objects
2012-07-15 19:10:39 +10:00
Nick Coghlan
85e729ec3b
Take the first step in resolving the messy pkgutil vs importlib edge cases by basing pkgutil explicitly on importlib, deprecating its internal import emulation and setting __main__.__loader__ correctly so that runpy still works (Affects #15343 , #15314 , #15357 )
2012-07-15 18:09:52 +10:00
Brett Cannon
a6473f9cfd
Issues #15169 , #14599 : Make PyImport_ExecCodeModuleWithPathnames() use
...
Lib/imp.py for imp.source_from_cache() instead of its own C version.
Also change PyImport_ExecCodeModuleObject() to not infer the source
path from the bytecode path like
PyImport_ExecCodeModuleWithPathnames() does. This makes the function
less magical.
This also has the side-effect of removing all uses of MAXPATHLEN in
Python/import.c which can cause failures on really long filenames.
2012-07-13 13:57:03 -04:00
Antoine Pitrou
44b4b6a9a5
Fix compilation under Windows
2012-07-10 18:27:54 +02:00
Brett Cannon
461c813164
Issue #15111 : When a module was imported using a 'from import'
...
statement (e.g. ``from distutils import msvc9compiler``) that triggers
an ImportError of its own (e.g. the non-existence of winreg), let that
exception propagate instead of raising a generic ImportError for the
module being requested (e.g. msvc9compiler).
2012-07-10 10:05:00 -04:00
Benjamin Peterson
66f3659c9e
fix refleak
2012-07-09 22:21:55 -07:00
Benjamin Peterson
fa873704a4
initialize variable for compiler happiness
2012-07-09 13:43:53 -07:00
Brett Cannon
77b2abd094
Issue #15167 (as part of #13959 ): imp.get_magic() is no implemented in
...
Lib/imp.py.
2012-07-09 16:09:00 -04:00
Brett Cannon
3adc7b75a5
Issue #15242 : Have PyImport_GetMagicTag() return a const char *
...
defined in sysmodule.c instead of straight out of a Unicode object.
Thanks to Amaury Forgeot d'Arc for noticing the bug and Eric Snow for
writing the patch.
2012-07-09 14:22:12 -04:00
Brett Cannon
19a2f5961c
Issue #15056 : imp.cache_from_source() and source_from_cache() raise
...
NotimplementedError when sys.implementation.cache_tag is None.
Thanks to Pranav Ravichandran for taking an initial stab at the patch.
2012-07-09 13:58:07 -04:00
Amaury Forgeot d'Arc
ae7b8f07c1
Issue #15110 : Also hide importlib frames when importing a builtin module fails.
2012-07-08 20:52:38 +02:00
Benjamin Peterson
8107176f9b
add gc support to the AST base type ( closes #15293 )
2012-07-08 11:03:46 -07:00
Antoine Pitrou
507507473e
Issue #15291 : Fix a memory leak where AST nodes where not properly deallocated.
2012-07-08 12:43:32 +02:00
Antoine Pitrou
bc07a5c913
Issue #15110 : Fix the tracebacks generated by "import xxx" to not show the importlib stack frames.
2012-07-08 12:01:27 +02:00
Antoine Pitrou
bc1a7ddc9b
Check-in compiled importlib changes (you must run "make" after modifying the importlib sources).
2012-07-07 19:49:44 +02:00
Antoine Pitrou
74de153681
Issue #15020 : The program name used to search for Python's path is now python3 under Unix, not python.
2012-07-05 20:57:33 +02:00
Antoine Pitrou
01cca5e451
Issue #15020 : The program name used to search for Python's path is now "python3" under Unix, not "python".
2012-07-05 20:56:30 +02:00
Brett Cannon
98979b85e7
Issue #15166 : Re-implement imp.get_tag() using sys.implementation.
...
Also eliminates some C code in Python/import.c as well.
Patch by Eric Snow with verification by comparing against another
patch from Jeff Knupp.
2012-07-02 15:13:11 -04:00
Brett Cannon
8a250fac15
Comment out a dead increment.
...
Found by Clang's static analyzer.
2012-06-25 16:13:44 -04:00
Antoine Pitrou
0ab5cf9b46
Issue #15181 : importlib bytecode is unsigned and shouldn't have negative numbers.
...
This fixes a compiler warning with suncc.
2012-06-25 17:32:43 +02:00
Eric V. Smith
e51a36922f
Fixes issue 15039: namespace packages are no longer imported in preference to modules of the same name.
2012-06-24 19:13:55 -04:00
Antoine Pitrou
edc601855d
Remove outdated statement
2012-06-23 14:19:58 +02:00
Antoine Pitrou
310f95b04d
A better repr() for FileFinder
2012-06-23 02:12:56 +02:00
David Malcolm
49526f48fc
Issue #14785 : Add sys._debugmallocstats() to help debug low-level memory allocation issues
2012-06-22 14:55:41 -04:00
Martin v. Löwis
7800f75827
Issue #15042 : Add PyState_AddModule and PyState_RemoveModule.
...
Add version guard for Py_LIMITED_API additions.
Issue #15081 : Document PyState_FindModule.
Patch by Robin Schreiber.
2012-06-22 12:20:55 +02:00
doko@ubuntu.com
39378f7f4f
format_obj: make it static
2012-06-21 12:12:20 +02:00
Antoine Pitrou
e67f48ce5e
Issue #14928 : Fix importlib bootstrap issues by using a custom executable (Modules/_freeze_importlib) to build Python/importlib.h.
2012-06-19 22:29:35 +02:00
Kristjan Valur Jonsson
0006aacb9d
Issue #15038 : Document caveats with the emulated condition variables.
2012-06-19 16:30:28 +00:00
Antoine Pitrou
1d25b6f04a
Issue #15103 : remove the NUL character (serving as a Mercurial binary marker) from Python/importlib.h.
...
Instead the email notification hook uses a configuration option to omit importlib.h diffs.
2012-06-19 16:33:39 +02:00
Kristjan Valur Jonsson
1617077bcc
Issue #15038 :
...
Fix incorrect test of the condition variable state, spotted by
Richard Oudkerk. This could cause the internal condition variable
to grow without bounds.
2012-06-19 10:10:09 +00:00
Kristján Valur Jónsson
e75ff35af2
Issue #15038 : Optimize python Locks on Windows
...
Extract cross-platform condition variable support into a separate file and
provide user-mode non-recursive locks for Windows.
2012-06-18 20:30:44 +00:00
Nick Coghlan
c40bc09942
Issue #13783 : the PEP 380 implementation no longer expands the public C API
2012-06-17 15:15:49 +10:00
Antoine Pitrou
2d9db1dfce
Try to fix issue #15086 : build failure on Ubuntu shared buildbot.
2012-06-17 00:27:30 +02:00
Victor Stinner
81c39a88a4
get_sourcefile(): use PyUnicode_READ() to avoid the creation of a temporary
...
Py_UCS4 buffer
2012-06-16 03:22:05 +02:00
Victor Stinner
c9d369f1bf
Optimize _PyUnicode_FastCopyCharacters() when maxchar(from) > maxchar(to)
2012-06-16 02:22:37 +02:00
Brett Cannon
24aa693c7e
Merge
2012-06-15 19:04:29 -04:00
Victor Stinner
2b89fdf7eb
PEP 418: Rename adjusted attribute to adjustable in time.get_clock_info() result
...
Fix also its value on Windows and Linux according to its documentation:
"adjustable" indicates if the clock *can be* adjusted, not if it is or was
adjusted.
In most cases, it is not possible to indicate if a clock is or was adjusted.
2012-06-12 22:46:37 +02:00
Brett Cannon
99d776fdf4
Update importlib.h by touching Lib/importlib/_bootstrap.py.
2012-06-11 11:02:53 -04:00
Kristján Valur Jónsson
187aa54516
Signal condition variables with the mutex held. Destroy condition variables
...
before their mutexes.
2012-06-05 22:17:42 +00:00
Barry Warsaw
409da157d7
Eric Snow's implementation of PEP 421.
...
Issue 14673: Add sys.implementation
2012-06-03 16:18:47 -04:00
Benjamin Peterson
3a37b8393c
merge 3.2
2012-06-01 23:57:50 -07:00
Benjamin Peterson
8e8fbeae27
don't leak if the __class__ closure is set
2012-06-01 23:57:36 -07:00
Benjamin Peterson
d1ab6089ff
check return for error
2012-06-01 11:18:22 -07:00
Victor Stinner
d3f0882dfb
Issue #14744 : Use the new _PyUnicodeWriter internal API to speed up str%args and str.format(args)
...
* Formatting string, int, float and complex use the _PyUnicodeWriter API. It
avoids a temporary buffer in most cases.
* Add _PyUnicodeWriter_WriteStr() to restore the PyAccu optimization: just
keep a reference to the string if the output is only composed of one string
* Disable overallocation when formatting the last argument of str%args and
str.format(args)
* Overallocation allocates at least 100 characters: add min_length attribute
to the _PyUnicodeWriter structure
* Add new private functions: _PyUnicode_FastCopyCharacters(),
_PyUnicode_FastFill() and _PyUnicode_FromASCII()
The speed up is around 20% in average.
2012-05-29 12:57:52 +02:00
Victor Stinner
a1b0c9fc4d
PyArg_Parse*("U"): ensure that the Unicode string is ready
2012-05-29 12:30:29 +02:00
Nick Coghlan
0b43bcf528
Close #14857 : fix regression in references to PEP 3135 implicit __class__ closure variable. Reopens issue #12370 , but also updates unittest.mock to workaround that issue
2012-05-27 18:17:07 +10:00
Nick Coghlan
5c6eba3a93
Tweak importlib._bootstrap to avoid zero-argument super so I can work on issue #14857 without breaking imports
2012-05-27 17:49:58 +10:00
Brett Cannon
d785cb3955
Remove some redundant decorators.
2012-05-26 14:28:21 -04:00
Vinay Sajip
7ded1f0f69
Implemented PEP 405 (Python virtual environments).
2012-05-26 03:45:29 +01:00
Eric V. Smith
984b11f88f
issue 14660: Implement PEP 420, namespace packages.
2012-05-24 20:21:04 -04:00
Antoine Pitrou
ea3eb88bca
Issue #9260 : A finer-grained import lock.
...
Most of the import sequence now uses per-module locks rather than the
global import lock, eliminating well-known issues with threads and imports.
2012-05-17 18:55:59 +02:00
Antoine Pitrou
b84bc7a7ce
Avoid "warning: no newline at end of file" in importlib.h.
2012-05-16 12:58:04 +02:00
Benjamin Peterson
77fa9379e2
use Py_ssize_t for ast sequence lengths
2012-05-15 10:10:27 -07:00
Martin v. Löwis
41829e82c1
Document f4d7ad6c9d6e.
2012-05-15 14:52:36 +02:00
Martin v. Löwis
cc10a37ef0
Widen ASDL sequences to Py_ssize_t lengths to better match PEP 353.
2012-05-15 14:45:03 +02:00
Benjamin Peterson
6ecf8ce364
apparently importlib.h wants to be updated
2012-05-14 22:17:34 -07:00
Benjamin Peterson
d5a1c44455
PEP 415: Implement suppression of __context__ display with an exception attribute
...
This replaces the original PEP 409 implementation. See #14133 .
2012-05-14 22:09:31 -07:00
Brian Curtin
401f9f3d32
Fix #13210 . Port the Windows build from VS2008 to VS2010.
2012-05-13 11:19:23 -05:00
Brett Cannon
c049952de7
Issue #13959 : Have
...
importlib.abc.FileLoader.load_module()/get_filename() and
importlib.machinery.ExtensionFileLoader.load_module() have their
single argument be optional as the loader's constructor has all the
ncessary information.
This allows for the deprecation of
imp.load_source()/load_compile()/load_package().
2012-05-11 14:48:41 -04:00
Brett Cannon
44ec91f6a5
Update importlib.h
2012-05-11 13:11:02 -04:00
Antoine Pitrou
d576c711a5
Issue #14761 : Fix potential leak on an error case in the import machinery.
2012-05-09 13:24:31 +02:00
Larry Hastings
a34790104c
Issue #14746 : Remove redundant paragraphs from skipitem() in Python/getargs.c.
2012-05-08 23:52:03 -07:00
Larry Hastings
d3f424fe45
Merge from 3.2. Issue #14749 : Add support for 'Z' to skipitem().
2012-05-08 03:54:05 -07:00
Larry Hastings
d9e4a414d7
Issue #14749 : Add support for 'Z' to skipitem() in Python/getargs.c.
2012-05-08 03:51:18 -07:00
Antoine Pitrou
6efa50a384
Issue #14583 : Fix importlib bug when a package's __init__.py would first import one of its modules then raise an error.
2012-05-07 21:41:59 +02:00
Larry Hastings
10ba07a39e
Issue #14705 : Added support for the new 'p' format unit to skipitem().
2012-05-07 02:44:50 -07:00
Antoine Pitrou
b78174c010
Fix too early decrefs.
2012-05-06 17:15:23 +02:00
Larry Hastings
faf91e75ab
Issue #14705 : Add 'p' format character to PyArg_ParseTuple* for bool support.
2012-05-05 16:54:29 -07:00
Nadeem Vawda
8f46d655b9
Fix typo in changeset eb5c5c23ca9b.
2012-05-05 12:27:30 +02:00
Brett Cannon
feccc09952
Clean up a docstring.
2012-05-04 16:47:54 -04:00
Antoine Pitrou
f3a42dee9a
Simplify code for load_dynamic()
2012-05-04 22:40:25 +02:00
Brett Cannon
0429e1a57d
Issue #13959 : Move module type constants to Lib/imp.py.
2012-05-04 16:13:30 -04:00
Brett Cannon
6b9b727695
Remove dead Windows code which no longer will compile.
2012-05-04 16:04:14 -04:00
Brett Cannon
a6685e8d36
update importlib.h
2012-05-04 16:03:20 -04:00
Brett Cannon
2657df4744
Issue #13959 : Re-implement imp.get_suffixes() in Lib/imp.py.
...
This introduces a new function, imp.extension_suffixes(), which is
currently undocumented. That is forthcoming once issue #14657 is
resolved and how to expose file suffixes is decided.
2012-05-04 15:20:40 -04:00
Larry Hastings
76ad59b7e8
Issue #14127 : Add ns= parameter to utime, futimes, and lutimes.
...
Removed futimens as it is now redundant.
Changed shutil.copystat to use st_atime_ns and st_mtime_ns from os.stat
and ns= parameter to utime--it once again preserves exact metadata on Linux!
2012-05-03 00:30:07 -07:00
Benjamin Peterson
49a69e4d48
strip is_ prefixes on clock_info fields
2012-05-01 09:38:34 -04:00
Brett Cannon
62228dbd6c
Issues #13959 , 14647: Re-implement imp.reload() in Lib/imp.py.
...
Thanks to Eric Snow for the patch.
2012-04-29 14:38:11 -04:00
Brett Cannon
acf85cd131
Issue #13959 : Re-implement imp.NullImporter in Lib/imp.py.
2012-04-29 12:50:03 -04:00
Mark Dickinson
e383e82e04
Issue #14521 : Make result of float('nan') and float('-nan') more consistent across platforms. Further, don't rely on Py_HUGE_VAL for float('inf').
2012-04-29 15:31:56 +01:00
Victor Stinner
ec89539ccc
Issue #14428 , #14397 : Implement the PEP 418
...
* Rename time.steady() to time.monotonic()
* On Windows, time.monotonic() uses GetTickCount/GetTickCount64() instead of
QueryPerformanceCounter()
* time.monotonic() uses CLOCK_HIGHRES if available
* Add time.get_clock_info(), time.perf_counter() and time.process_time()
functions
2012-04-29 02:41:27 +02:00
Brett Cannon
efad00d520
Issue #14646 : __import__() now sets __loader__ if need be.
...
importlib.util.module_for_loader also will set __loader__ along with
__package__. This is in conjunction to a forthcoming update to PEP 302
which will make these two attributes required for loaders to set.
2012-04-27 17:27:14 -04:00
Brett Cannon
fea73efc9e
Issue #14605 : Don't error out if get_importer() returns None.
2012-04-27 15:45:15 -04:00
Brett Cannon
aa93642a35
Issue #14605 : Use None in sys.path_importer_cache to represent no
...
finder instead of using some (now non-existent) implicit finder.
2012-04-27 15:30:58 -04:00
Brett Cannon
ce418b448f
Issue #14605 : Stop having implicit entries for sys.meta_path.
...
ImportWarning is raised if sys.meta_path is found to be empty.
2012-04-27 14:01:58 -04:00
Victor Stinner
8f825060f1
Check newly created consistency using _PyUnicode_CheckConsistency(str, 1)
...
* In debug mode, fill the string data with invalid characters
* Simplify also reference counting in PyCodec_BackslashReplaceErrors()
and PyCodec_XMLCharRefReplaceError()
2012-04-27 13:55:39 +02:00
Benjamin Peterson
9fa47ebafe
merge heads
2012-04-26 00:27:06 -04:00
Benjamin Peterson
1138944888
only incref when using borrowing functions
2012-04-26 00:26:37 -04:00
Brett Cannon
e0d88a173c
Issue #14605 : Make explicit the entries on sys.path_hooks that used to
...
be implicit.
Added a warning for when sys.path_hooks is found to be empty. Also
changed the meaning of None in sys.path_importer_cache to represent
trying sys.path_hooks again (an interpretation of previous semantics).
Also added a warning for when None was found.
The long-term goal is for None in sys.path_importer_cache to represent
the same as imp.NullImporter: no finder found for that sys.path entry.
2012-04-25 20:54:04 -04:00
Brett Cannon
f96bb2f9af
Update importlib.h
2012-04-25 20:18:55 -04:00
Brett Cannon
5a5d6a1033
Merge
2012-04-25 20:18:24 -04:00
Marc-Andre Lemburg
7541c8ea37
Issue #14605 and #14642 :
...
Issue a warning in case Python\importlib.h needs to be rebuilt,
but there's no Python interpreter around to freeze the bootstrap
script.
2012-04-25 10:54:48 +02:00
Brett Cannon
8923a4d4c5
Issue #14605 : Insert to the front of sys.path_hooks instead of appending.
2012-04-24 22:03:46 -04:00
Marc-Andre Lemburg
4fe29c9657
Issue #14605 : Rename _SourcelessFileLoader to SourcelessFileLoader.
...
This time also recreating the Python/importlib.h file to make
make happy. See the ticket for details.
2012-04-25 02:31:37 +02:00
Victor Stinner
ece58deb9f
Close #14648 : Compute correctly maxchar in str.format() for substrin
2012-04-23 23:36:38 +02:00
Benjamin Peterson
7d95e40721
Implement PEP 412: Key-sharing dictionaries ( closes #13903 )
...
Patch from Mark Shannon.
2012-04-23 11:24:50 -04:00
Benjamin Peterson
80d07f8251
inherit maxchar of field value where needed ( closes #14648 )
2012-04-23 10:55:29 -04:00
Brett Cannon
938d44d59c
Issue #14605 : Expose importlib.abc.FileLoader and
...
importlib.machinery.(FileFinder, SourceFileLoader,
_SourcelessFileLoader, ExtensionFileLoader).
This exposes all of importlib's mechanisms that will become public on
the sys module.
2012-04-22 19:58:33 -04:00
Brett Cannon
5c903e6ee1
Issue #13959 : Continue to try to accomodate altsep in importlib by not
...
ignoring altsep if it already exists on a path when doing a join.
2012-04-22 11:45:07 -04:00
Brett Cannon
cf649958f7
Revert to os.path.join() semantics for path manipulation in importlib
...
which is different than what imp.cache_from_source() operates on.
2012-04-22 02:06:23 -04:00
Brett Cannon
6c802b8491
Update importlib.h
2012-04-21 21:47:08 -04:00
Brett Cannon
0d05a7698b
Have importlib look for pre-existing path separators when joining
...
paths.
2012-04-21 21:21:27 -04:00
Brett Cannon
e69f0df45b
Issue #13959 : Re-implement imp.find_module() in Lib/imp.py.
...
Thanks to Eric Snow for taking an initial stab at the implementation.
2012-04-21 21:09:46 -04:00
Brett Cannon
2f92389d5c
Don't worry about moving imp.get_tag() over to Lib/imp.py.
2012-04-21 18:55:51 -04:00
Brett Cannon
a64faf0771
Issue #13959 : Re-implement imp.source_from_cache() in Lib/imp.py.
2012-04-21 18:52:52 -04:00
Brett Cannon
ea59dbff16
Issue #13959 : Re-implement imp.cache_from_source() in Lib/imp.py.
2012-04-20 21:44:46 -04:00
Brett Cannon
ed672d6872
Make path manipulation more robust for platforms with alternative path
...
separators.
2012-04-20 21:19:53 -04:00
Brett Cannon
24117a748b
Issue #13959 : Keep imp.get_magic() in C code, but cache in importlib
...
for performance. While get_magic() could move to Lib/imp.py, having to
support PyImport_GetMagicNumber() would lead to equal, if not more, C
code than sticking with the status quo.
2012-04-20 18:04:03 -04:00
Brett Cannon
3dfc22cc04
Issue #14599 : Support ImportError.path on AIX and HPUX when loading
...
extension modules.
2012-04-20 15:31:11 -04:00
Brett Cannon
f0434e647a
Issue #14599 : Generalize a test for ImportError.path and add support
...
in Python/dynload_shlibs.c.
This should fix the remaining importlib test failure on Windows.
Support in AIX and HP-UX will be in a separate checkin.
2012-04-20 15:22:50 -04:00
Brett Cannon
8ff6baf25b
Issue #14581 : Windows users are allowed to import modules w/o taking
...
the file suffix's case into account, even when doing a case-sensitive
import.
2012-04-20 12:53:14 -04:00
Larry Hastings
6fe20b3aee
Issue #14127 : Add st_{cma}time_ns fields to os.stat() result object.
2012-04-19 15:07:49 -07:00
Antoine Pitrou
bf35c156b4
Fix refleak: PyObject_GetItem returns a new reference, not a borrowed one like PyDict_GetItem.
2012-04-19 18:21:04 +02:00
Martin v. Löwis
aa2efcb0bc
Issue #14098 : New functions PyErr_GetExcInfo and PyErr_SetExcInfo.
...
Patch by Stefan Behnel.
2012-04-19 14:33:43 +02:00
Victor Stinner
b0b224233e
Issue #14385 : Support other types than dict for __builtins__
...
It is now possible to use a custom type for the __builtins__ namespace, instead
of a dict. It can be used for sandboxing for example. Raise also a NameError
instead of ImportError if __build_class__ name if not found in __builtins__.
2012-04-19 00:57:45 +02:00
Benjamin Peterson
665c3b3eec
update importlib...
2012-04-18 15:29:52 -04:00
Antoine Pitrou
eca851815d
Merge heads
2012-04-18 16:59:52 +02:00
Antoine Pitrou
ec9bac4226
Fix it for good :-)
2012-04-18 16:57:54 +02:00
Benjamin Peterson
d76bc7abac
rollback 005fd1fe31ab (see #14609 and #14582 )
...
Being able to overload a sys.module entry during import of a module was broken
by this changeset.
2012-04-18 10:55:43 -04:00
Benjamin Peterson
da20cd2b6b
fix refcnt/style/debuging oversights
2012-04-18 10:48:00 -04:00
Brian Curtin
94c001b503
Fix email post-commit review comments.
...
Add INCREFs, fix args->kwargs, and a second args==NULL check was removed,
left over from a merger with another function. Instead, checking msg==NULL
does what that used to do in a roundabout way.
2012-04-18 08:30:51 -05:00
Brett Cannon
03c7ed1580
Merge
2012-04-17 21:42:07 -04:00
Brett Cannon
7bd329d800
Issue #12599 : Be more strict in accepting None vs. a false-like object
...
in importlib.
Thanks to PJE for pointing out the issue and Nick Coghlan for filing
the bug.
2012-04-17 21:41:35 -04:00
Benjamin Peterson
2a1fdc4c76
merge 3.2 ( #14607 )
2012-04-17 19:54:35 -04:00
Benjamin Peterson
32c59b6fc1
mangle keyword-only argname when loading defaults ( closes #14607 )
2012-04-17 19:53:21 -04:00
Brett Cannon
64befe939c
Issue #13959 : Re-implement imp.load_compiled() in imp.py.
2012-04-17 19:14:26 -04:00
Brett Cannon
273323cf68
Issue #14592 : A relative import will raise a KeyError if __package__
...
or __name__ are not set in globals.
Thanks to Stefan Behnel for the bug report.
2012-04-17 19:05:11 -04:00
Brian Curtin
09b86d1196
Fix #14600 . Correct reference handling and naming of ImportError convenience function
2012-04-17 16:57:09 -05:00
Brett Cannon
16475adcbb
Issue #13959 : Re-implement imp.load_source() in imp.py.
2012-04-16 22:11:25 -04:00
Antoine Pitrou
22a1d17bb5
Fix another refleak
2012-04-16 22:06:21 +02:00
Antoine Pitrou
538ba2afb5
Fix a refleak
2012-04-16 21:52:45 +02:00
Antoine Pitrou
71382cb64b
Fix reference loss on Py_None when None is encountered in sys.modules.
2012-04-16 18:48:49 +02:00
Antoine Pitrou
a938c74751
Avoid compiler warning due to stray \x00
2012-04-16 18:30:54 +02:00
Brian Curtin
b206a80dab
Fix #10854 . Make use of the new path and name attributes on ImportError
...
for extension modules on Windows.
2012-04-16 00:10:17 -05:00
Brett Cannon
2ee61422ed
Issue #13959 : Re-implement imp.load_package() in imp.py.
...
Thanks to Eric Snow for helping with imp.load_module() (previous
commit) which led to the removal of a bunch of C code.
2012-04-15 22:28:28 -04:00
Brett Cannon
01a76171a0
Issue #13959 : Re-implement imp.load_module() in imp.py.
2012-04-15 20:25:23 -04:00
Brett Cannon
c1b3f63653
Try to get hg to treat importlib.h as binary.
2012-04-15 19:05:31 -04:00
Brett Cannon
8a1d04c643
Issue #13959 : Simplify imp.reload() by relying on a module's
...
__loader__.
Since import now sets __loader__ on all modules it creates and
imp.reload() already relied on the attribute for modules that import
didn't create, the only potential compatibility issue is if people
were deleting the attribute on modules and expecting imp.reload() to
continue to work.
2012-04-15 17:56:09 -04:00
Brett Cannon
7ceedb8c1e
Update importlib.h
2012-04-15 17:47:19 -04:00
Brett Cannon
6f44d66bc4
Issue #13959 : Rename imp to _imp and add Lib/imp.py and begin
...
rewriting functionality in pure Python.
To start, imp.new_module() has been rewritten in pure Python, put into
importlib (privately) and then publicly exposed in imp.
2012-04-15 16:08:47 -04:00
Brett Cannon
881535b726
Issue #14582 : Import returns the module returned by a loader instead
...
of sys.modules when possible.
This is being done for two reasons. One is to gain a little bit of
performance by skipping an unnecessary dict lookup in sys.modules. But
the other (and main) reason is to be a little bit more clear in how
things should work from the perspective of import's interactions with
loaders. Otherwise loaders can easily forget to return the module even
though PEP 302 explicitly states they are expected to return the module
they loaded.
2012-04-15 15:24:04 -04:00
Brett Cannon
27fc52877c
Set ImportError.name when raising the exception in the case of None
...
found in sys.modules.
2012-04-15 14:15:31 -04:00
Brett Cannon
fc9ca274b8
Plug a refleak.
2012-04-15 01:35:05 -04:00
Brett Cannon
49f8d8b016
Handle importing pkg.mod by executing
...
__import__('mod', {'__packaging__': 'pkg', level=1) w/o properly (and
thus not segfaulting).
2012-04-14 21:50:00 -04:00
Brett Cannon
59f9c3affc
Rebuild importlib.h to incorporate added comments.
2012-04-14 21:18:48 -04:00
Brian Curtin
e6b299faf5
Fix Windows build
2012-04-14 14:19:33 -05:00
Brett Cannon
740fce0e38
Undo a C99 idiom.
2012-04-14 14:23:49 -04:00
Brett Cannon
fd0741555b
Issue #2377 : Make importlib the implementation of __import__().
...
importlib._bootstrap is now frozen into Python/importlib.h and stored
as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen
code along with sys and imp and then uses _frozen_importlib._install()
to set builtins.__import__() w/ _frozen_importlib.__import__().
2012-04-14 14:10:13 -04:00
Benjamin Peterson
780b66b3e6
merge 3.2
2012-04-13 18:06:42 -04:00
Benjamin Peterson
3bf01757b6
move outside WITH_THREAD conditional
2012-04-13 18:06:36 -04:00
Benjamin Peterson
899ee613f7
merge 3.2
2012-04-13 11:59:52 -04:00
Benjamin Peterson
43162b8a02
take linkage def outside of WITH_THREAD conditional ( closes #14569 )
2012-04-13 11:58:27 -04:00
Brett Cannon
79ec55e980
Issue #1559549 : Add 'name' and 'path' attributes to ImportError.
...
Currently import does not use these attributes as they are planned
for use by importlib (which will be another commit).
Thanks to Filip Gruszczyński for the initial patch and Brian Curtin
for refining it.
2012-04-12 20:24:54 -04:00
Kristján Valur Jónsson
31668b8f7a
Issue #14288 : Serialization support for builtin iterators.
2012-04-03 10:49:41 +00:00
Benjamin Peterson
0a9a636302
merge 3.2
2012-04-03 00:35:36 -04:00
Benjamin Peterson
80d50428ce
fix parse_syntax_error to clean up its resources
2012-04-03 00:30:38 -04:00
Brett Cannon
368b4b7405
Guard an LLTRACE variable to silence an unused variable warning.
2012-04-02 12:17:59 -04:00
Victor Stinner
3c1e48176e
Issue #14383 : Add _PyDict_GetItemId() and _PyDict_SetItemId() functions
...
These functions simplify the usage of static constant Unicode strings.
Generalize the usage of _Py_Identifier in ceval.c and typeobject.c.
2012-03-26 22:10:51 +02:00
Kristján Valur Jónsson
4b0215fd99
Merge with 3.2
2012-03-23 12:52:11 +00:00
Kristján Valur Jónsson
c5d47d5ac3
Fix typo when "PyObject*" was changed to "identifier"
2012-03-23 12:50:53 +00:00
Benjamin Peterson
cc58031d6a
merge 3.2
2012-03-22 10:40:20 -04:00
Benjamin Peterson
9faf5ee750
this should technicaly be identifier
2012-03-22 10:39:16 -04:00
Benjamin Peterson
b304764ba2
merge 3.2
2012-03-22 08:56:27 -04:00
Benjamin Peterson
ab79c71f39
check for NULL
2012-03-22 08:56:15 -04:00
Benjamin Peterson
98ba753432
merge 3.2 ( #14378 )
2012-03-22 08:19:50 -04:00
Benjamin Peterson
a4e4e35783
check by equality for __future__ not identity ( closes #14378 )
2012-03-22 08:19:04 -04:00
Benjamin Peterson
302e7902c8
use identifier api
2012-03-20 23:17:04 -04:00
Larry Hastings
83a9f48699
Issue #14328 : Add keyword-only parameters to PyArg_ParseTupleAndKeywords.
...
They're optional-only for now (unlike in pure Python) but that's all
I needed. The syntax can easily be relaxed if we want to support
required keyword-only arguments for extension types in the future.
2012-03-20 20:06:16 +00:00
Gregory P. Smith
c809f98143
Fixes Issue #14331 : Use significantly less stack space when importing modules by
...
allocating path buffers on the heap instead of the stack.
2012-03-18 16:06:53 -07:00
Benjamin Peterson
01feaecbfa
plug memory leak ( closes #14325 )
2012-03-16 13:25:58 -05:00
Benjamin Peterson
eb74918685
kill capsule names that we don't need anymore
2012-03-16 12:24:01 -05:00
Benjamin Peterson
f7c132158d
use memory macros
2012-03-16 12:23:39 -05:00
Benjamin Peterson
7ed67270a8
check result of PyMem_New
2012-03-16 12:21:02 -05:00
Benjamin Peterson
f53d20f2cd
in 72556ff86828, I should have updated the magic as well as the comment ( #14230 )
2012-03-16 09:39:12 -05:00
Jean-Paul Calderone
c961b4abaa
Issue #14325 : Stop using python lists, capsules, and the garbage collector to deal with PyArg_Parse* cleanup.
2012-03-16 08:51:42 -04:00
Benjamin Peterson
abdb5528c0
fix comment
2012-03-15 15:40:37 -05:00
Benjamin Peterson
2afe6aeae8
perform yield from delegation by repeating YIELD_FROM opcode ( closes #14230 )
...
This allows generators that are using yield from to be seen by debuggers. It
also kills the f_yieldfrom field on frame objects.
Patch mostly from Mark Shannon with a few tweaks by me.
2012-03-15 15:37:39 -05:00
Benjamin Peterson
1767e0274b
free AST's dict
2012-03-14 21:50:29 -05:00
Ned Deily
577c830531
Issue #14184 : merge
2012-03-13 11:31:36 -07:00
Ned Deily
7ca97d5208
Issue #14184 : Increase the default stack size for secondary threads on
...
Mac OS X to prevent interpreter crashes when compiled on 10.7.
2012-03-13 11:18:18 -07:00
Victor Stinner
bd273c1ec3
Issue #14180 : Fix an invalid rounding when compiler optimization are enabled
...
Use volatile keyword to disable localy unsafe float optimizations.
2012-03-13 19:12:23 +01:00
Victor Stinner
3a31dd407a
Issue #14180 : Remove commented code
2012-03-13 13:50:34 +01:00
Victor Stinner
5d272cc6a2
Close #14180 : Factorize code to convert a number of seconds to time_t, timeval or timespec
...
time.ctime(), gmtime(), time.localtime(), datetime.date.fromtimestamp(),
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
raises an OverflowError, instead of a ValueError, if the timestamp does not fit
in time_t.
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
round microseconds towards zero instead of rounding to nearest with ties going
away from zero.
2012-03-13 13:35:55 +01:00
Victor Stinner
45e50de1f5
Try to fix compilation of Python-ast.c on Visual Studio 2008
2012-03-13 01:17:31 +01:00
Benjamin Peterson
518cf94ad7
merge 3.2
2012-03-12 11:16:03 -07:00
Benjamin Peterson
3f3584695e
kill this disabled code
2012-03-12 11:15:48 -07:00
Benjamin Peterson
bebcd18b75
merge 3.2
2012-03-12 11:02:10 -07:00
Benjamin Peterson
bc4665ebcb
use correct naming convention
2012-03-12 11:00:41 -07:00
Benjamin Peterson
7e0dbfbbde
give the AST class a __dict__
2012-03-12 09:46:44 -07:00
Georg Brandl
f125bf5f94
Update copyright years and version name.
2012-03-04 16:26:19 +01:00
Armin Ronacher
6ecf77b3f8
Basic support for PEP 414 without docs or tests.
2012-03-04 12:04:06 +00:00
Antoine Pitrou
0d3a003f24
- Issue #14177 : marshal.loads() now raises TypeError when given an unicode
...
string. Patch by Guilherme Gonçalves.
2012-03-03 02:38:37 +01:00
Antoine Pitrou
4a90ef0363
Issue #14177 : marshal.loads() now raises TypeError when given an unicode string.
...
Patch by Guilherme Gonçalves.
2012-03-03 02:35:32 +01:00
Victor Stinner
643cd68ea4
Issue #13964 : signal.sigtimedwait() timeout is now a float instead of a tuple
...
Add a private API to convert an int or float to a C timespec structure.
2012-03-02 22:54:03 +01:00
Antoine Pitrou
1c13f84f55
Simplify code in marshal.c.
2012-03-02 18:22:23 +01:00
Antoine Pitrou
b2677c7397
Issue #14172 : Fix reference leak when marshalling a buffer-like object (other than a bytes object).
2012-03-02 18:16:38 +01:00
Antoine Pitrou
679e9d36f7
Issue #14172 : Fix reference leak when marshalling a buffer-like object (other than a bytes object).
2012-03-02 18:12:43 +01:00
Brett Cannon
efb00c0cc1
Issue #14153 Create _Py_device_encoding() to prevent _io from having to import
...
the os module.
2012-02-29 18:31:31 -05:00
Nick Coghlan
ab7bf2143e
Close issue #6210 : Implement PEP 409
2012-02-26 17:49:52 +10:00
Victor Stinner
90f50d4df9
Issue #13706 : Fix format(float, "n") for locale with non-ASCII decimal point (e.g. ps_aF)
2012-02-24 01:44:47 +01:00
Victor Stinner
41a863cb81
Issue #13706 : Fix format(int, "n") for locale with non-ASCII thousands separator
...
* Decode thousands separator and decimal point using PyUnicode_DecodeLocale()
(from the locale encoding), instead of decoding them implicitly from latin1
* Remove _PyUnicode_InsertThousandsGroupingLocale(), it was not used
* Change _PyUnicode_InsertThousandsGrouping() API to return the maximum
character if unicode is NULL
* Replace MIN/MAX macros by Py_MIN/Py_MAX
* stringlib/undef.h undefines STRINGLIB_IS_UNICODE
* stringlib/localeutil.h only supports Unicode
2012-02-24 00:37:51 +01:00
Antoine Pitrou
cf1c8339f9
Issue #14084 : Fix a file descriptor leak when importing a module with a bad encoding.
2012-02-22 18:08:30 +01:00
Antoine Pitrou
4f22a8d739
Issue #14084 : Fix a file descriptor leak when importing a module with a bad encoding.
2012-02-22 18:05:43 +01:00
Antoine Pitrou
7214612443
In find_module(), do not silence fileno() and dup() errors.
2012-02-22 18:03:04 +01:00
Benjamin Peterson
c9f54cf512
enable hash randomization by default
2012-02-21 16:08:05 -05:00
Antoine Pitrou
528b54b263
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
2012-02-21 19:08:26 +01:00
Antoine Pitrou
86838b02f0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
2012-02-21 19:03:47 +01:00
Benjamin Peterson
d9a3591ed1
merge 3.2
2012-02-21 11:12:14 -05:00
Benjamin Peterson
e249dcab7a
merge 3.2
2012-02-21 11:09:13 -05:00
Benjamin Peterson
69e9727657
ensure no one tries to hash things before the random seed is found
2012-02-21 11:08:50 -05:00
Georg Brandl
2fb477c0f0
Merge 3.2: Issue #13703 plus some related test suite fixes.
2012-02-21 00:33:36 +01:00
Georg Brandl
91e5c08fe8
Fix typo in conditional.
2012-02-20 23:49:29 +01:00
Georg Brandl
12897d7d39
Fix typo in conditional.
2012-02-20 23:49:29 +01:00
Georg Brandl
09a7c72cad
Merge from 3.1: Issue #13703 : add a way to randomize the hash values of basic types (str, bytes, datetime)
...
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.
The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 21:31:46 +01:00
Georg Brandl
2daf6ae249
Issue #13703 : add a way to randomize the hash values of basic types (str, bytes, datetime)
...
in order to make algorithmic complexity attacks on (e.g.) web apps much more complicated.
The environment variable PYTHONHASHSEED and the new command line flag -R control this
behavior.
2012-02-20 19:54:16 +01:00
Antoine Pitrou
c229e6e8ff
Issue #14040 : Remove rarely used file name suffixes for C extensions (under POSIX mainly).
...
This will improve import performance a bit (especially under importlib).
2012-02-20 19:41:11 +01:00
Victor Stinner
4195b5caea
Backout f8409b3d6449: the PEP 410 is not accepted yet
2012-02-08 23:03:19 +01:00
Victor Stinner
ccd5715a14
PEP 410
2012-02-08 14:31:50 +01:00
Victor Stinner
09225b73c1
Issue #13845 : time.time() now uses GetSystemTimeAsFileTime() instead of ftime()
...
to have a resolution of 100 ns instead of 1 ms (the clock accuracy is between
0.5 ms and 15 ms).
2012-02-07 23:41:01 +01:00
Petri Lehtinen
4b0eab62f0
Merge branch 3.2
...
Closes #13402 .
2012-02-02 21:23:15 +02:00
Petri Lehtinen
9713321f46
Document absoluteness of sys.executable
...
Closes #13402 .
2012-02-02 20:59:50 +02:00
Victor Stinner
ed27785b32
Issue #13706 : Add assertions to detect bugs earlier
2012-02-01 00:22:23 +01:00
Victor Stinner
a3dd409b52
Remove now useless arbitrary limit of module name length
2012-01-26 00:31:49 +01:00
Antoine Pitrou
581616624d
Port import fixes from 2.7.
2012-01-25 18:06:07 +01:00
Antoine Pitrou
33d15f7c85
Port import fixes from 2.7.
2012-01-25 18:01:45 +01:00
Antoine Pitrou
abaf89b2be
Issue #11235 : Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp.
2012-01-24 17:45:50 +01:00
Antoine Pitrou
2be60afb7e
Issue #11235 : Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp.
2012-01-24 17:44:06 +01:00
Amaury Forgeot d'Arc
6d766fc3fa
Silence last compilation warning.
2012-01-23 23:20:43 +01:00
Amaury Forgeot d'Arc
cd27df3a99
Fix compilation warnings (seen on win32 buildbot)
2012-01-23 22:42:19 +01:00
Benjamin Peterson
ce79852077
use the static identifier api for looking up special methods
...
I had to move the static identifier code from unicodeobject.h to object.h in
order for this to work.
2012-01-22 11:24:29 -05:00
Victor Stinner
a4ac600d6f
Issue #13706 : Support non-ASCII fill characters
2012-01-21 15:50:49 +01:00
Eric V. Smith
d25cfe66f5
Improve exception text. Closes issue 13811.
2012-01-19 20:04:28 -05:00
Meador Inge
fa21bf015d
Issue #12705 : Raise SyntaxError when compiling multiple statements as single interactive statement
2012-01-19 01:08:41 -06:00
Antoine Pitrou
f0ecdd2ab9
Issue #13722 : Avoid silencing ImportErrors when initializing the codecs registry.
2012-01-18 22:31:12 +01:00
Antoine Pitrou
1b468af7be
Issue #13722 : Avoid silencing ImportErrors when initializing the codecs registry.
2012-01-18 22:30:21 +01:00
Antoine Pitrou
aa5c5c60f1
Finally fix all test_capi refleaks
2012-01-18 21:45:15 +01:00
Antoine Pitrou
165e01f83f
Fix the builtin module initialization code to store the init function for future reinitialization.
2012-01-18 20:17:58 +01:00
Antoine Pitrou
6c40eb7f42
Fix the builtin module initialization code to store the init function for future reinitialization.
2012-01-18 20:16:09 +01:00
Antoine Pitrou
fff47ab342
Fix a memory leak when initializing the standard I/O streams.
2012-01-18 15:28:38 +01:00
Antoine Pitrou
2fabface50
Fix a memory leak when initializing the standard I/O streams.
2012-01-18 15:14:46 +01:00
Benjamin Peterson
c64ae92bf1
fix indentation
2012-01-16 18:02:21 -05:00
Benjamin Peterson
c8909ddd28
break out switch at correct place
2012-01-16 17:44:12 -05:00
Benjamin Peterson
205ad61313
only finish error if one occurred
2012-01-16 17:31:43 -05:00
Benjamin Peterson
c0beabc2a5
move LINENO define to where it actually belongs
2012-01-16 17:29:05 -05:00
Benjamin Peterson
55e0043a51
streamline normalizer identification a bit
2012-01-16 17:22:31 -05:00
Benjamin Peterson
d3af6e30a2
fix spelling
2012-01-16 09:56:35 -05:00
Benjamin Peterson
de5827dcd2
invert condition (head bang)
2012-01-16 09:55:53 -05:00
Benjamin Peterson
0fa35ea8f3
fix possible refleaks
2012-01-16 09:50:48 -05:00
Benjamin Peterson
89f8b80202
use helpful PyUnicode_IS_ASCII macro
2012-01-16 09:49:20 -05:00
Benjamin Peterson
5eda913cd2
PyUnicode_DecodeUTF8 will always return a ready string
2012-01-16 09:47:42 -05:00
Benjamin Peterson
8f56e0909f
rewrite such that this actually makes sense
2012-01-16 09:42:36 -05:00
Meador Inge
da05f454e3
Issue #13629 : Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
2012-01-15 19:31:57 -06:00
Meador Inge
3388060127
Issue #13629 : Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.
2012-01-15 19:15:36 -06:00
Benjamin Peterson
527c622926
make YieldFrom its own distinct from Yield ( closes #13780 )
2012-01-14 08:58:23 -05:00
Amaury Forgeot d'Arc
0a239e9191
Fix compilation with C89 compilers (Windows...)
2012-01-13 21:08:49 +01:00
Benjamin Peterson
0010256de4
fold into one if statement
2012-01-11 21:00:16 -05:00
Benjamin Peterson
a12d5c62f7
fix formatting
2012-01-03 16:47:22 -06:00
Benjamin Peterson
f606e682a4
add another year to glorious PSF IP
2011-12-31 22:42:26 -06:00
Benjamin Peterson
0296a56520
NULL and no exception set from tp_iternext means StopIteration
2012-01-13 14:54:31 -05:00
Georg Brandl
bc3b682923
Closes #13761 : add a "flush" keyword argument to print().
2012-01-13 19:41:25 +01:00
Antoine Pitrou
5136ac0ca2
Issue #13645 : pyc files now contain the size of the corresponding source
...
code, to avoid timestamp collisions (especially on filesystems with a low
timestamp resolution) when checking for freshness of the bytecode.
2012-01-13 18:52:16 +01:00
Nick Coghlan
1f7ce62bd6
Implement PEP 380 - 'yield from' ( closes #11682 )
2012-01-13 21:43:40 +10:00
Antoine Pitrou
3a5d4cb940
Issue #13748 : Raw bytes literals can now be written with the `rb` prefix as well as `br`.
2012-01-12 22:46:19 +01:00
Benjamin Peterson
0ab2a26865
merge 3.2
2012-01-11 21:00:48 -05:00
Benjamin Peterson
21e0da228d
remove some usage of Py_UNICODE_TOUPPER/LOWER
2012-01-11 21:00:42 -05:00
Victor Stinner
3fe553160c
Add a new PyUnicode_Fill() function
...
It is faster than the unicode_fill() function which was implemented in
formatter_unicode.c.
2012-01-04 00:33:50 +01:00
Benjamin Peterson
332503db07
merge 3.2
2012-01-03 16:48:14 -06:00
Benjamin Peterson
a174577f55
merge 3.2
2011-12-31 22:43:01 -06:00
Antoine Pitrou
0e576f1f50
Issue #13626 : Add support for SSL Diffie-Hellman key exchange, through the
...
SSLContext.load_dh_params() method and the ssl.OP_SINGLE_DH_USE option.
2011-12-22 10:03:38 +01:00
Antoine Pitrou
2b1cc89572
_Py_fopen now allows bytes filenames under non-Windows platforms.
2011-12-19 18:19:06 +01:00
Victor Stinner
3573476271
(Merge 3.2) Handle correctly _Py_fopen() error: don't replace the exception
2011-12-18 21:05:22 +01:00
Victor Stinner
bd0850b857
import.c now catchs _Py_stat() exceptions
...
_Py_stat() now returns -2 if an exception was raised.
2011-12-18 20:47:30 +01:00
Victor Stinner
1b57967b96
Issue #13560 : Locale codec functions use the classic "errors" parameter,
...
instead of surrogateescape
So it would be possible to support more error handlers later.
2011-12-17 05:47:23 +01:00
Victor Stinner
1f33f2b0c3
Issue #13560 : os.strerror() now uses the current locale encoding instead of UTF-8
2011-12-17 04:45:09 +01:00
Victor Stinner
af02e1c85a
Add PyUnicode_DecodeLocaleAndSize() and PyUnicode_DecodeLocale()
...
* PyUnicode_DecodeLocaleAndSize() and PyUnicode_DecodeLocale() decode a string
from the current locale encoding
* _Py_char2wchar() writes an "error code" in the size argument to indicate
if the function failed because of memory allocation failure or because of a
decoding error. The function doesn't write the error message directly to
stderr.
* Fix time.strftime() (if wcsftime() is missing): decode strftime() result
from the current locale encoding, not from the filesystem encoding.
2011-12-16 23:56:01 +01:00
Florent Xicluna
aa6c1d240f
Issue #13575 : there is only one class type.
2011-12-12 18:54:29 +01:00
Florent Xicluna
720682efd1
Merge 3.2
2011-12-09 23:42:29 +01:00
Florent Xicluna
5126df602c
Remove obsolete py3k comment.
2011-12-09 23:41:21 +01:00
Charles-François Natali
1659b83b1d
Followup to a541bda2f5e2: Add a short comment.
2011-12-07 23:17:58 +01:00
Charles-François Natali
7c0b0cc9f9
Issue #11051 : Reduce the number of syscalls per import.
2011-12-07 19:16:01 +01:00
Mark Dickinson
47862d4c0e
Issue #9530 : Fix undefined behaviour due to signed overflow in Python/formatter_unicode.c.
2011-12-01 15:27:04 +00:00
Victor Stinner
ee450093a9
PyCodec_IgnoreErrors() avoids the deprecated "u#" format
2011-12-01 02:52:11 +01:00
Antoine Pitrou
39a73a4cfa
Issue #7111 : Python can now be run without a stdin, stdout or stderr stream.
...
It was already the case with Python 2. However, the corresponding
sys module entries are now set to None (instead of an unusable file object).
2011-11-28 19:09:45 +01:00
Antoine Pitrou
11942a58a1
Issue #7111 : Python can now be run without a stdin, stdout or stderr stream.
...
It was already the case with Python 2. However, the corresponding
sys module entries are now set to None (instead of an unusable file object).
2011-11-28 19:08:36 +01:00
Antoine Pitrou
5604ef3e36
Issue #13444 : When stdout has been closed explicitly, we should not attempt to flush it at shutdown and print an error.
...
This also adds a test for issue #5319 , whose resolution introduced the issue.
2011-11-26 22:02:29 +01:00
Antoine Pitrou
d7c8fbf89e
Issue #13444 : When stdout has been closed explicitly, we should not attempt to flush it at shutdown and print an error.
...
This also adds a test for issue #5319 , whose resolution introduced the issue.
2011-11-26 21:59:36 +01:00
Antoine Pitrou
86a36b500a
PEP 3155 / issue #13448 : Qualified name for classes and functions.
2011-11-25 18:56:07 +01:00
Amaury Forgeot d'Arc
942d5ba125
Merge branch 3.2
2011-11-22 22:02:01 +01:00
Amaury Forgeot d'Arc
5e8f810411
Issue #13436 : commit regenerated Python-ast.c
2011-11-22 21:52:30 +01:00
Charles-François Natali
23b0b9252e
Issue #13156 : _PyGILState_Reinit(): Re-associate the auto thread state with the
...
TLS key only if the thread that called fork() had an associated auto thread
state (this might not be the case for example for a thread created outside of
Python calling into a subinterpreter).
2011-11-22 19:51:14 +01:00
Charles-François Natali
a233df885b
Issue #13156 : _PyGILState_Reinit(): Re-associate the auto thread state with the
...
TLS key only if the thread that called fork() had an associated auto thread
state (this might not be the case for example for a thread created outside of
Python calling into a subinterpreter).
2011-11-22 19:49:51 +01:00
Victor Stinner
63ab875cfe
Remove "#ifdef Py_UNICODE_WIDE": Python is now always wide
2011-11-22 03:31:20 +01:00
Victor Stinner
9d3b93ba30
Use the new Unicode API
...
* Replace PyUnicode_FromUnicode(NULL, 0) by PyUnicode_New(0, 0)
* Replce PyUnicode_FromUnicode(str, len) by PyUnicode_FromWideChar(str, len)
* Replace Py_UNICODE by wchar_t
* posix_putenv() uses PyUnicode_FromFormat() to create the string, instead
of PyUnicode_FromUnicode() + _snwprintf()
2011-11-22 02:27:30 +01:00
Victor Stinner
9e30aa52fd
Fix misuse of PyUnicode_GET_SIZE() => PyUnicode_GET_LENGTH()
...
And PyUnicode_GetSize() => PyUnicode_GetLength()
2011-11-21 02:49:52 +01:00
Victor Stinner
3335447646
Check for PyUnicode_AS_UNICODE() failure
2011-11-21 02:01:41 +01:00
Victor Stinner
e251d6d69d
print_exception() uses PyUnicode_GetLength() instead of PyUnicode_GetSize()
2011-11-20 19:20:00 +01:00
Antoine Pitrou
f34a0cdc6c
Issue #10227 : Add an allocation cache for a single slice object.
...
Patch by Stefan Behnel.
2011-11-18 20:14:34 +01:00
Victor Stinner
ee587eaa36
Catch PyUnicode_AS_UNICODE() errors in fileutils.c
2011-11-17 00:51:38 +01:00
Victor Stinner
1f7951711c
Catch PyUnicode_AS_UNICODE() errors
2011-11-17 00:45:54 +01:00
Antoine Pitrou
8ad982cccf
Use PyUnicode_FromFormat() to create the temporary file name.
...
Also, as in importlib, append the id of an object to make the file name
pseudo-random.
2011-11-15 22:27:32 +01:00
Antoine Pitrou
1d8f3f451c
Fix regression under Windows following b75b41237380 (from issue #13392 )
2011-11-15 20:40:55 +01:00
Antoine Pitrou
28e401e717
Issue #13392 : Writing a pyc file should now be atomic under Windows as well.
2011-11-15 19:15:19 +01:00
Charles-François Natali
0c929d9d39
Issue #13303 : Fix bytecode file default permission.
2011-11-10 19:12:29 +01:00
Martin v. Löwis
d10759f6ed
Make _PyUnicode_FromId return borrowed references.
...
http://mail.python.org/pipermail/python-dev/2011-November/114347.html
2011-11-07 13:00:05 +01:00
Philip Jenvey
50add04836
quote the type name for improved readability
2011-11-06 16:37:52 -08:00
Antoine Pitrou
5ee9d8a8a2
Issue #13342 : input() used to ignore sys.stdin's and sys.stdout's unicode
...
error handler in interactive mode (when calling into PyOS_Readline()).
2011-11-06 00:38:45 +01:00
Antoine Pitrou
0d776b1ce8
Issue #13342 : input() used to ignore sys.stdin's and sys.stdout's unicode
...
error handler in interactive mode (when calling into PyOS_Readline()).
2011-11-06 00:34:26 +01:00