summaryrefslogtreecommitdiff
path: root/Python/import.c
AgeCommit message (Collapse)AuthorLines
2010-05-20Merged revisions 81380 via svnmerge fromBrett Cannon-1/+2
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81380 | brett.cannon | 2010-05-20 11:37:55 -0700 (Thu, 20 May 2010) | 8 lines Turned out that if you used explicit relative import syntax (e.g. from .os import sep) and it failed, import would still try the implicit relative import semantics of an absolute import (from os import sep). That's not right, so when level is negative, only do explicit relative import semantics. Fixes issue #7902. Thanks to Meador Inge for the patch. ........
2010-05-09Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou-2287/+2287
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
2010-03-21Partial backport of r78826: leave import site error handler unchanged (printVictor Stinner-2/+0
the error and continue). Merged revisions 78826-78827 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78826 | victor.stinner | 2010-03-10 23:30:19 +0100 (mer., 10 mars 2010) | 5 lines 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. ........ r78827 | victor.stinner | 2010-03-10 23:45:04 +0100 (mer., 10 mars 2010) | 4 lines ooops, fix error message in execusercustomize() Copy/paste failure :-) ........
2010-03-01Merged revisions 78527,78531 via svnmerge fromGregory P. Smith-5/+7
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78527 | gregory.p.smith | 2010-02-28 17:22:39 -0800 (Sun, 28 Feb 2010) | 4 lines 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. ........ r78531 | gregory.p.smith | 2010-02-28 18:31:33 -0800 (Sun, 28 Feb 2010) | 2 lines Fix for r78527. It left out updating forkpty. ........
2009-09-16Merged revisions 74841 via svnmerge fromThomas Wouters-13/+8
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74841 | thomas.wouters | 2009-09-16 12:55:54 -0700 (Wed, 16 Sep 2009) | 23 lines 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-07-19Merged revisions 73870,73879,73899-73900,73905-73906 via svnmerge fromR. David Murray-1/+5
svn+ssh://pythondev@svn.python.org/python/trunk ........ r73870 | r.david.murray | 2009-07-06 21:06:13 -0400 (Mon, 06 Jul 2009) | 5 lines 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. ........ r73879 | r.david.murray | 2009-07-07 05:54:16 -0400 (Tue, 07 Jul 2009) | 3 lines Update issue 6070 patch to match the patch that was actually tested on Windows. ........ r73899 | r.david.murray | 2009-07-08 21:43:41 -0400 (Wed, 08 Jul 2009) | 3 lines Conditionalize test cleanup code to eliminate traceback, which will hopefully reveal the real problem. ........ r73900 | r.david.murray | 2009-07-08 22:06:17 -0400 (Wed, 08 Jul 2009) | 2 lines Make test work with -O. ........ r73905 | r.david.murray | 2009-07-09 09:55:44 -0400 (Thu, 09 Jul 2009) | 3 lines Specify umask in execute bit test to get consistent results and make sure we test resetting all three execute bits. ........ r73906 | r.david.murray | 2009-07-09 11:35:33 -0400 (Thu, 09 Jul 2009) | 5 lines Curdir needs to be in the path for the test to work on all buildbots. (I copied this from another import test, but currently this will fail if TESTFN ends up in /tmp...see issue 2609). ........
2009-01-14Merged revisions ↵Georg Brandl-15/+19
68292,68344,68361,68378,68424,68426,68429-68430,68450,68457,68480-68481,68493,68495,68499,68501,68512,68514-68515 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r68292 | skip.montanaro | 2009-01-04 11:36:58 +0100 (So, 04 Jan 2009) | 3 lines If user configures --without-gcc give preference to $CC instead of blindly assuming the compiler will be "cc". ........ r68344 | marc-andre.lemburg | 2009-01-05 20:43:35 +0100 (Mo, 05 Jan 2009) | 7 lines Fix #4846 (Py_UNICODE_ISSPACE causes linker error) by moving the declaration into the extern "C" section. Add a few more comments and apply some minor edits to make the file contents fit the original structure again. ........ r68361 | antoine.pitrou | 2009-01-06 19:34:08 +0100 (Di, 06 Jan 2009) | 3 lines Use shutil.rmtree rather than os.rmdir. ........ r68378 | mark.dickinson | 2009-01-07 18:48:33 +0100 (Mi, 07 Jan 2009) | 2 lines Issue #4869: clarify documentation for random.expovariate. ........ r68424 | benjamin.peterson | 2009-01-09 03:53:35 +0100 (Fr, 09 Jan 2009) | 1 line specify what -3 warnings are about ........ r68426 | benjamin.peterson | 2009-01-09 04:03:05 +0100 (Fr, 09 Jan 2009) | 1 line fix spelling ........ r68429 | benjamin.peterson | 2009-01-09 04:05:14 +0100 (Fr, 09 Jan 2009) | 1 line add -3 to manpage ........ r68430 | benjamin.peterson | 2009-01-09 04:07:27 +0100 (Fr, 09 Jan 2009) | 1 line be more specific in -3 option help ........ r68450 | jeffrey.yasskin | 2009-01-09 17:47:07 +0100 (Fr, 09 Jan 2009) | 3 lines Fix issue 4884, preventing a crash in the socket code when python is compiled with llvm-gcc and run with a glibc <2.10. ........ r68457 | kristjan.jonsson | 2009-01-09 21:10:59 +0100 (Fr, 09 Jan 2009) | 1 line Issue 3677: Fix import from UNC paths on Windows. ........ r68480 | vinay.sajip | 2009-01-10 14:38:04 +0100 (Sa, 10 Jan 2009) | 1 line Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library. ........ r68481 | vinay.sajip | 2009-01-10 14:42:04 +0100 (Sa, 10 Jan 2009) | 1 line Corrected an incorrect self-reference. ........ r68493 | benjamin.peterson | 2009-01-10 18:18:55 +0100 (Sa, 10 Jan 2009) | 1 line rewrite verbose conditionals ........ r68495 | benjamin.peterson | 2009-01-10 18:36:44 +0100 (Sa, 10 Jan 2009) | 1 line tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901 ........ r68499 | mark.dickinson | 2009-01-10 20:14:55 +0100 (Sa, 10 Jan 2009) | 2 lines Remove an unnecessary check from test_decimal. ........ r68501 | vinay.sajip | 2009-01-10 20:22:57 +0100 (Sa, 10 Jan 2009) | 1 line Corrected minor typo and added .currentmodule directives to fix missing cross-references. ........ r68512 | benjamin.peterson | 2009-01-10 23:42:10 +0100 (Sa, 10 Jan 2009) | 1 line make tests fail if they can't be imported ........ r68514 | benjamin.peterson | 2009-01-11 00:41:59 +0100 (So, 11 Jan 2009) | 1 line move seealso to a more appropiate place ........ r68515 | benjamin.peterson | 2009-01-11 00:49:08 +0100 (So, 11 Jan 2009) | 1 line macos 9 isn't supported ........
2009-01-06Merged revisions 68360 via svnmerge fromAntoine Pitrou-0/+45
svn+ssh://pythondev@svn.python.org/python/trunk ........ r68360 | antoine.pitrou | 2009-01-06 19:10:47 +0100 (mar., 06 janv. 2009) | 7 lines 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. ........
2008-09-01Fix compilation when --without-threads is given #3683Benjamin Peterson-1/+4
Reviewer: Georg Brandl, Benjamin Peterson
2008-08-06Add imp.reload(). This to help with transitioning to 3.0 the reload() built-inBrett Cannon-0/+13
has been removed there.
2008-07-13Fix issue 3221 by emitting a RuntimeWarning instead of raising SystemError ↵Nick Coghlan-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)
2008-06-09This reverts r63675 based on the discussion in this thread:Gregory P. Smith-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.
2008-05-26Renamed PyString to PyBytesChristian Heimes-34/+34
2008-03-27Build bots are working again - removing the hackChristian Heimes-1/+1
2008-03-27Quick 'n dirty hack: Increase the magic by 2 to force a rebuild of pyc/pyo ↵Christian Heimes-1/+1
files on the build bots
2008-03-26Initialize PyCompilerFlags cf_flags with 0Christian Heimes-0/+2
2008-03-26Patch #2477: Added from __future__ import unicode_literalsChristian Heimes-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.
2008-03-07Speed up with statements by storing the __exit__ method on the stack instead ↵Nick Coghlan-1/+2
of in a temp variable (bumps the magic number for pyc files)
2008-02-23MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.Christian Heimes-0/+5
2008-02-23Issue #2051 and patch from Alexander Belopolsky:Christian Heimes-13/+14
Permission for pyc and pyo files are inherited from the py file.
2008-01-30Fixed some references leaks in sys.Christian Heimes-0/+2
2008-01-09Fixed #1776. __import__() no longer imports modules by file nameChristian Heimes-0/+10
2008-01-07patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.Georg Brandl-1/+1
2008-01-07Patch #602345 by Neal Norwitz and me: add -B option and ↵Georg Brandl-2/+5
PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
2008-01-03Modified PyImport_Import and PyImport_ImportModule to always use absolute ↵Christian Heimes-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
2007-12-18Speed-up dictionary constructor by about 10%.Raymond Hettinger-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
2007-12-03Implement PEP 366Nick Coghlan-26/+86
2007-11-18Patch #1739468: Directories and zipfiles containing __main__.py are now ↵Nick Coghlan-7/+20
executable
2007-11-07Backport of Guido's review of my patch.Christian Heimes-7/+5
2007-11-07Backported fix for bug #1392 from py3k branch r58903.Christian Heimes-1/+19
2007-08-23Second half of #1752175: #ifdef out references to PyImport_DynLoadFiletab if ↵Georg Brandl-1/+5
HAVE_DYNAMIC_LOADING is not defined.
2007-08-21Revert accidental checkins from last commit.Georg Brandl-10/+0
2007-08-21Demand version 2.5.1 since 2.5 has a bug with codecs.open context managers.Georg Brandl-0/+10
2007-07-21PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis-2/+1
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
2007-05-30Fix indentation (whitespace only).Neal Norwitz-2/+2
2007-04-25Make pythoncore compile cleanly with VisualStudio 2005. Used an explicit ↵Kristján Valur Jónsson-0/+1
typecast to get a 64 bit integer, and undefined the Yield macro that conflicts with winbase.h
2007-03-13Inline PyImport_GetModulesReloading().Collin Winter-11/+8
2007-03-13Fix some style nits:Neal Norwitz-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.
2007-03-12Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. ↵Collin Winter-2/+35
Fixed by patch #922167. Will backport.
2007-03-10Typos.Georg Brandl-1/+1
2006-10-14Update the peephole optimizer to remove more dead code (jumps after returns)Neal Norwitz-1/+2
and inline jumps to returns.
2006-10-03Fix minor typo in a comment.Brett Cannon-1/+1
2006-09-28Very minor grammatical fix in a comment.Brett Cannon-1/+1
2006-09-11Properly handle a NULL returned from PyArena_New().Neal Norwitz-2/+4
(Also fix some whitespace) Klocwork #364.
2006-09-06Bug #1550983: emit better error messages for erroneous relativeGeorg Brandl-2/+3
imports (if not in package and if beyond toplevel package).
2006-09-05Bug #1520864 (again): unpacking singleton tuples in list comprehensions andNeal Norwitz-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).
2006-08-13cpathname could be NULL if it was longer than MAXPATHLEN. Don't tryNeal Norwitz-1/+6
to write the .pyc to NULL. Check results of PyList_GetItem() and PyModule_GetDict() are not NULL. Klocwork 282, 283, 285
2006-08-04There were really two issuesNeal Norwitz-1/+2
2006-08-04Bug #1191458: tracing over for loops now produces a line eventNeal Norwitz-1/+2
on each iteration. I'm not positive this is the best way to handle this. I'm also not sure that there aren't other cases where the lnotab is generated incorrectly. It would be great if people that use pdb or tracing could test heavily. Also: * Remove dead/duplicated code that wasn't used/necessary because we already handled the docstring prior to entering the loop. * add some debugging code into the compiler (#if 0'd out).
2006-07-30Patch #1531113: Fix augmented assignment with yield expressions.Neal Norwitz-2/+3
Also fix a SystemError when trying to assign to yield expressions.