summaryrefslogtreecommitdiffstats
path: root/Python/import.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix issue #1590864, multiple threads and fork() can cause deadlocks, byThomas Wouters2009-09-161-19/+12
| | | | | | | | | | | | | | | | | | | | | | 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.
* Better name a variable: 'buf' seems to imply a mutable buffer.Amaury Forgeot d'Arc2009-07-251-7/+7
|
* Update issue 6070 patch to match the patch that was actually testedR. David Murray2009-07-071-1/+3
| | | | on Windows.
* Issue 6070: when creating a compiled file, after copying the mode bits, onR. David Murray2009-07-071-1/+3
| | | | | 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.
* add a SETUP_WITH opcodeBenjamin Peterson2009-05-251-1/+2
| | | | | It speeds up the with statement and correctly looks up the special methods involved.
* Fix two issues introduced by issue #71031 by changing the signature ofBrett Cannon2009-04-021-1/+1
| | | | PyImport_AppendInittab() to take a const char *.
* PyImport_AppendInittab() took a char * as a first argument even though thatBrett Cannon2009-04-021-1/+1
| | | | | | | string was stored beyond the life of the call. Changed the signature to be const char * to help make this point. Closes issue #1419652.
* Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} withJeffrey Yasskin2009-02-281-1/+3
| | | | | | 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.
* Issue 3677: Fix import from UNC paths on Windows.Kristján Valur Jónsson2009-01-091-15/+19
|
* Issue #1180193: When importing a module from a .pyc (or .pyo) file withAntoine Pitrou2009-01-061-0/+45
| | | | | | | 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.
* Issue #4817: Remove unused function PyOS_GetLastModificationTime.Martin v. Löwis2009-01-031-2/+0
|
* Issue #2183: Simplify and optimize bytecode for list comprehensions.Antoine Pitrou2008-12-171-1/+2
|
* Fix compilation when --without-threads is given #3683Benjamin Peterson2008-09-011-1/+4
| | | | Reviewer: Georg Brandl, Benjamin Peterson
* Add imp.reload(). This to help with transitioning to 3.0 the reload() built-inBrett Cannon2008-08-061-0/+13
| | | | has been removed there.
* Fix issue 3221 by emitting a RuntimeWarning instead of raising SystemError ↵Nick Coghlan2008-07-131-3/+22
| | | | 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)
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-34/+34
| | | | | | | 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.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-34/+34
|
* Build bots are working again - removing the hackChristian Heimes2008-03-271-1/+1
|
* Quick 'n dirty hack: Increase the magic by 2 to force a rebuild of pyc/pyo ↵Christian Heimes2008-03-271-1/+1
| | | | files on the build bots
* Initialize PyCompilerFlags cf_flags with 0Christian Heimes2008-03-261-0/+2
|
* Patch #2477: Added from __future__ import unicode_literalsChristian Heimes2008-03-261-1/+2
| | | | 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.
* Speed up with statements by storing the __exit__ method on the stack instead ↵Nick Coghlan2008-03-071-1/+2
| | | | of in a temp variable (bumps the magic number for pyc files)
* MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.Christian Heimes2008-02-231-0/+5
|
* Issue #2051 and patch from Alexander Belopolsky:Christian Heimes2008-02-231-13/+14
| | | | Permission for pyc and pyo files are inherited from the py file.
* Fixed some references leaks in sys.Christian Heimes2008-01-301-0/+2
|
* Fixed #1776. __import__() no longer imports modules by file nameChristian Heimes2008-01-091-0/+10
|
* patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.Georg Brandl2008-01-071-1/+1
|
* Patch #602345 by Neal Norwitz and me: add -B option and ↵Georg Brandl2008-01-071-2/+5
| | | | PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
* Modified PyImport_Import and PyImport_ImportModule to always use absolute ↵Christian Heimes2008-01-031-23/+51
| | | | | | 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
* Speed-up dictionary constructor by about 10%.Raymond Hettinger2007-12-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Implement PEP 366Nick Coghlan2007-12-031-26/+86
|
* Patch #1739468: Directories and zipfiles containing __main__.py are now ↵Nick Coghlan2007-11-181-7/+20
| | | | executable
* Backport of Guido's review of my patch.Christian Heimes2007-11-071-7/+5
|
* Backported fix for bug #1392 from py3k branch r58903.Christian Heimes2007-11-071-1/+19
|
* Second half of #1752175: #ifdef out references to PyImport_DynLoadFiletab if ↵Georg Brandl2007-08-231-1/+5
| | | | HAVE_DYNAMIC_LOADING is not defined.
* Revert accidental checkins from last commit.Georg Brandl2007-08-211-10/+0
|
* Demand version 2.5.1 since 2.5 has a bug with codecs.open context managers.Georg Brandl2007-08-211-0/+10
|
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-2/+1
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Fix indentation (whitespace only).Neal Norwitz2007-05-301-2/+2
|
* Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit ↵Kristján Valur Jónsson2007-04-251-0/+1
| | | | typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
* Inline PyImport_GetModulesReloading().Collin Winter2007-03-131-11/+8
|
* Fix some style nits:Neal Norwitz2007-03-131-13/+15
| | | | | | | | | | * 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.
* Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. ↵Collin Winter2007-03-121-2/+35
| | | | | | Fixed by patch #922167. Will backport.
* Typos.Georg Brandl2007-03-101-1/+1
|
* Update the peephole optimizer to remove more dead code (jumps after returns)Neal Norwitz2006-10-141-1/+2
| | | | and inline jumps to returns.
* Fix minor typo in a comment.Brett Cannon2006-10-031-1/+1
|
* Very minor grammatical fix in a comment.Brett Cannon2006-09-281-1/+1
|
* Properly handle a NULL returned from PyArena_New().Neal Norwitz2006-09-111-2/+4
| | | | | | (Also fix some whitespace) Klocwork #364.
* Bug #1550983: emit better error messages for erroneous relativeGeorg Brandl2006-09-061-2/+3
| | | | imports (if not in package and if beyond toplevel package).
* Bug #1520864 (again): unpacking singleton tuples in list comprehensions andNeal Norwitz2006-09-051-1/+2
| | | | | | | | | | | | | generator expressions (x for x, in ... ) works again. Sigh, I only fixed for loops the first time, not list comps and genexprs too. I couldn't find any more unpacking cases where there is a similar bug lurking. This code should be refactored to eliminate the duplication. I'm sure the listcomp/genexpr code can be refactored. I'm not sure if the for loop can re-use any of the same code though. Will backport to 2.5 (the only place it matters).