Victor Stinner
6664426d7c
Issue #3137 : Don't ignore errors at startup, especially a keyboard interrupt
...
(SIGINT). If an error occurs while importing the site module, the error is
printed and Python exits. Initialize the GIL before importing the site
module.
2010-03-10 22:30:19 +00:00
Gregory P. Smith
9e5d1327f8
Issue #7242 : On Solaris 9 and earlier calling os.fork() from within a
...
thread could raise an incorrect RuntimeError about not holding the import
lock. The import lock is now reinitialized after fork.
2010-03-01 01:22:39 +00:00
Alexandre Vassalotti
b646547bb4
Issue #2333 : Backport set and dict comprehensions syntax.
2010-01-11 22:36:12 +00:00
Alexandre Vassalotti
ee936a2130
Issue #2335 : Backport set literals syntax from Python 3.x.
2010-01-09 23:35:54 +00:00
Thomas Wouters
c4dcb3801e
Fix issue #1590864 , multiple threads and fork() can cause deadlocks, by
...
acquiring the import lock around fork() calls. This prevents other threads
from having that lock while the fork happens, and is the recommended way of
dealing with such issues. There are two other locks we care about, the GIL
and the Thread Local Storage lock. The GIL is obviously held when calling
Python functions like os.fork(), and the TLS lock is explicitly reallocated
instead, while also deleting now-orphaned TLS data.
This only fixes calls to os.fork(), not extension modules or embedding
programs calling C's fork() directly. Solving that requires a new set of API
functions, and possibly a rewrite of the Python/thread_*.c mess. Add a
warning explaining the problem to the documentation in the mean time.
This also changes behaviour a little on AIX. Before, AIX (but only AIX) was
getting the import lock reallocated, seemingly to avoid this very same
problem. This is not the right approach, because the import lock is a
re-entrant one, and reallocating would do the wrong thing when forking while
holding the import lock.
Will backport to 2.6, minus the tiny AIX behaviour change.
2009-09-16 19:55:54 +00:00
Amaury Forgeot d'Arc
982b2fa32d
Better name a variable: 'buf' seems to imply a mutable buffer.
2009-07-25 16:22:06 +00:00
R. David Murray
3310a10a68
Update issue 6070 patch to match the patch that was actually tested
...
on Windows.
2009-07-07 09:54:16 +00:00
R. David Murray
23a736a4f0
Issue 6070: when creating a compiled file, after copying the mode bits, on
...
posix zap the execute bit in case it was set on the .py file, since the
compiled files are not directly executable on posix. Patch by Marco N.
2009-07-07 01:06:13 +00:00
Benjamin Peterson
1880d8b823
add a SETUP_WITH opcode
...
It speeds up the with statement and correctly looks up the special
methods involved.
2009-05-25 13:13:44 +00:00
Brett Cannon
238cedcd63
Fix two issues introduced by issue #71031 by changing the signature of
...
PyImport_AppendInittab() to take a const char *.
2009-04-02 03:34:53 +00:00
Brett Cannon
c4f90ebea7
PyImport_AppendInittab() took a char * as a first argument even though that
...
string was stored beyond the life of the call. Changed the signature to be
const char * to help make this point.
Closes issue #1419652 .
2009-04-02 03:17:39 +00:00
Jeffrey Yasskin
68d6852006
Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
...
POP_JUMP_IF_{TRUE,FALSE} and JUMP_IF_{TRUE,FALSE}_OR_POP. This avoids executing
a POP_TOP on each conditional and sometimes allows the peephole optimizer to
skip a JUMP_ABSOLUTE entirely. It speeds up list comprehensions significantly.
2009-02-28 19:03:21 +00:00
Kristján Valur Jónsson
3b2a6b819d
Issue 3677: Fix import from UNC paths on Windows.
2009-01-09 20:10:59 +00:00
Antoine Pitrou
e96d4ea4e2
Issue #1180193 : When importing a module from a .pyc (or .pyo) file with
...
an existing .py counterpart, override the co_filename attributes of all
code objects if the original filename is obsolete (which can happen if the
file has been renamed, moved, or if it is accessed through different paths).
Patch by Ziga Seilnacht and Jean-Paul Calderone.
2009-01-06 18:10:47 +00:00
Martin v. Löwis
0fa10b3cd5
Issue #4817 : Remove unused function PyOS_GetLastModificationTime.
2009-01-03 17:19:26 +00:00
Antoine Pitrou
d0c3515bc5
Issue #2183 : Simplify and optimize bytecode for list comprehensions.
2008-12-17 00:38:28 +00:00
Benjamin Peterson
17f03ca962
Fix compilation when --without-threads is given #3683
...
Reviewer: Georg Brandl, Benjamin Peterson
2008-09-01 14:18:30 +00:00
Brett Cannon
3aa2a49ec9
Add imp.reload(). This to help with transitioning to 3.0 the reload() built-in
...
has been removed there.
2008-08-06 22:28:09 +00:00
Nick Coghlan
b028f50911
Fix issue 3221 by emitting a RuntimeWarning instead of raising SystemError when the parent module can't be found during an absolute import (likely due to non-PEP 361 aware code which sets a module level __package__ attribute)
2008-07-13 14:52:36 +00:00
Gregory P. Smith
dd96db63f6
This reverts r63675 based on the discussion in this thread:
...
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes
593daf545b
Renamed PyString to PyBytes
2008-05-26 12:51:38 +00:00
Christian Heimes
61e4590ec9
Build bots are working again - removing the hack
2008-03-27 10:35:52 +00:00
Christian Heimes
81caa790b6
Quick 'n dirty hack: Increase the magic by 2 to force a rebuild of pyc/pyo files on the build bots
2008-03-27 09:02:33 +00:00
Christian Heimes
7f23d86107
Initialize PyCompilerFlags cf_flags with 0
2008-03-26 22:51:58 +00:00
Christian Heimes
3c60833e1e
Patch #2477 : Added from __future__ import unicode_literals
...
The new PyParser_*Ex() functions are based on Neal's suggestion and initial patch. The new __future__ feature makes all '' and r'' unicode strings. b'' and br'' stay (byte) strings.
2008-03-26 22:01:37 +00:00
Nick Coghlan
7af53be66f
Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files)
2008-03-07 14:13:28 +00:00
Christian Heimes
5e8e6d2454
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
2008-02-23 23:59:45 +00:00
Christian Heimes
4034685a58
Issue #2051 and patch from Alexander Belopolsky:
...
Permission for pyc and pyo files are inherited from the py file.
2008-02-23 17:52:07 +00:00
Christian Heimes
0d9244332b
Fixed some references leaks in sys.
2008-01-30 17:21:22 +00:00
Christian Heimes
3403f1589d
Fixed #1776 . __import__() no longer imports modules by file name
2008-01-09 19:56:33 +00:00
Georg Brandl
aed6c66aa8
patch #1668 : clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
2008-01-07 17:25:53 +00:00
Georg Brandl
2da0fceba7
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
2008-01-07 17:09:35 +00:00
Christian Heimes
000a074c95
Modified PyImport_Import and PyImport_ImportModule to always use absolute imports by calling __import__ with an explicit level of 0
...
Added a new API function PyImport_ImportModuleNoBlock. It solves the problem with dead locks when mixing threads and imports
2008-01-03 22:16:32 +00:00
Raymond Hettinger
effde12f5f
Speed-up dictionary constructor by about 10%.
...
New opcode, STORE_MAP saves the compiler from awkward stack manipulations
and specializes for dicts using PyDict_SetItem instead of PyObject_SetItem.
Old disassembly:
0 BUILD_MAP 0
3 DUP_TOP
4 LOAD_CONST 1 (1)
7 ROT_TWO
8 LOAD_CONST 2 ('x')
11 STORE_SUBSCR
12 DUP_TOP
13 LOAD_CONST 3 (2)
16 ROT_TWO
17 LOAD_CONST 4 ('y')
20 STORE_SUBSCR
New disassembly:
0 BUILD_MAP 0
3 LOAD_CONST 1 (1)
6 LOAD_CONST 2 ('x')
9 STORE_MAP
10 LOAD_CONST 3 (2)
13 LOAD_CONST 4 ('y')
16 STORE_MAP
2007-12-18 18:26:18 +00:00
Nick Coghlan
ef01d822aa
Implement PEP 366
2007-12-03 12:55:17 +00:00
Nick Coghlan
327a39b047
Patch #1739468 : Directories and zipfiles containing __main__.py are now executable
2007-11-18 11:56:28 +00:00
Christian Heimes
004c1c1562
Backport of Guido's review of my patch.
2007-11-07 18:30:22 +00:00
Christian Heimes
cea681be19
Backported fix for bug #1392 from py3k branch r58903.
2007-11-07 17:50:54 +00:00
Georg Brandl
add36e5fdf
Second half of #1752175 : #ifdef out references to PyImport_DynLoadFiletab if HAVE_DYNAMIC_LOADING is not defined.
2007-08-23 18:08:06 +00:00
Georg Brandl
d7e9f608c3
Revert accidental checkins from last commit.
2007-08-21 06:03:43 +00:00
Georg Brandl
fdca6d8599
Demand version 2.5.1 since 2.5 has a bug with codecs.open context managers.
2007-08-21 06:01:18 +00:00
Martin v. Löwis
6819210b9e
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
...
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00
Neal Norwitz
2fca81cc4c
Fix indentation (whitespace only).
2007-05-30 04:53:41 +00:00
Kristján Valur Jónsson
67387fb4aa
Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
2007-04-25 00:17:39 +00:00
Collin Winter
47c52a8b60
Inline PyImport_GetModulesReloading().
2007-03-13 23:02:15 +00:00
Neal Norwitz
75c7c80ee5
Fix some style nits:
...
* lines too long
* wrong indentation
* space after a function name
* wrong function name in error string
* simplifying some logic
Also add an error check to PyDict_SetItemString.
2007-03-13 05:31:38 +00:00
Collin Winter
276887b16d
Bug #742342 : make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167 .
...
Will backport.
2007-03-12 16:11:39 +00:00
Georg Brandl
7478096148
Typos.
2007-03-10 07:38:14 +00:00
Neal Norwitz
cbeb687c68
Update the peephole optimizer to remove more dead code (jumps after returns)
...
and inline jumps to returns.
2006-10-14 21:33:38 +00:00
Brett Cannon
5a9aa4f31c
Fix minor typo in a comment.
2006-10-03 21:58:55 +00:00