summaryrefslogtreecommitdiffstats
path: root/Python/import.c
Commit message (Collapse)AuthorAgeFilesLines
* 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).
* cpathname could be NULL if it was longer than MAXPATHLEN. Don't tryNeal Norwitz2006-08-131-1/+6
| | | | | | | | to write the .pyc to NULL. Check results of PyList_GetItem() and PyModule_GetDict() are not NULL. Klocwork 282, 283, 285
* There were really two issuesNeal Norwitz2006-08-041-1/+2
|
* Bug #1191458: tracing over for loops now produces a line eventNeal Norwitz2006-08-041-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).
* Patch #1531113: Fix augmented assignment with yield expressions.Neal Norwitz2006-07-301-2/+3
| | | | Also fix a SystemError when trying to assign to yield expressions.
* Bug #1529871: The speed enhancement patch #921466 broke Python's compliancePhillip J. Eby2006-07-281-34/+132
| | | | | | with PEP 302. This was fixed by adding an ``imp.NullImporter`` type that is used in ``sys.path_importer_cache`` to cache non-directory paths and avoid excessive filesystem operations during imports.
* Speel initialise write. Tanks Anthony.Neal Norwitz2006-07-211-1/+1
|
* Handle allocation failures gracefully. Found with failmalloc.Neal Norwitz2006-07-211-2/+7
| | | | Many (all?) of these could be backported.
* Fix memory leak under some conditions.Neal Norwitz2006-07-161-7/+9
| | | | Reported by Klocwork, #98.
* Actually change the MAGIC #. Create a new section for 2.5c1 and mention the ↵Neal Norwitz2006-07-121-1/+1
| | | | impact of changing the MAGIC #.
* Bug #1520864: unpacking singleton tuples in for loop (for x, in) work again.Neal Norwitz2006-07-121-0/+1
|
* Fix refleaks reported by Shane Hathaway in SF patch #1515361. This changeNeal Norwitz2006-07-061-2/+4
| | | | contains only the changes related to leaking the copy variable.
* Correct None refcount issue in Mac modules. (Are theyGeorg Brandl2006-05-281-1/+1
| | | | still used?)
* The empty string is a valid import path.Georg Brandl2006-05-281-2/+4
| | | | (fixes #1496539)
* Need for speed: Patch #921466 : sys.path_importer_cache is now used to cache ↵Georg Brandl2006-05-261-2/+30
| | | | | | | | | | valid and invalid file paths for the built-in import machinery which leads to fewer open calls on startup. Also fix issue with PEP 302 style import hooks which lead to more open() calls than necessary.
* Replace PyObject_CallFunction calls with only object argsGeorg Brandl2006-05-251-3/+3
| | | | with PyObject_CallFunctionObjArgs, which is 30% faster.
* - Add new Warning class, ImportWarningThomas Wouters2006-04-271-7/+30
| | | | | | | | | | | | | | - Warn-raise ImportWarning when importing would have picked up a directory as package, if only it'd had an __init__.py. This swaps two tests (for case-ness and __init__-ness), but case-test is not really more expensive, and it's not in a speed-critical section. - Test for the new warning by importing a common non-package directory on sys.path: site-packages - In regrtest.py, silence warnings generated by the build-environment because Modules/ (which is added to sys.path for Setup-created modules) has 'zlib' and '_ctypes' directories without __init__.py's.
* spread the extern "C" { } magic pixie dust around. Python itself builds nowAnthony Baxter2006-04-131-0/+7
| | | | | using a C++ compiler. Still lots and lots of errors in the modules built by setup.py, and a bunch of warnings from g++ in the core.
* Fix refleak in __import__("") (probably the cause of the 2 refleaks inThomas Wouters2006-04-051-0/+2
| | | | test_builtin.)
* Fix __import__("") to raise ValueError rather than return None.Thomas Wouters2006-04-041-1/+10
|
* Found this in an old email message from Hartmut Goebel.Skip Montanaro2006-03-251-0/+1
|
* Use macro versions instead of function versions when we already know the type.Neal Norwitz2006-03-201-2/+2
| | | | | | | | This will hopefully get rid of some Coverity warnings, be a hint to developers, and be marginally faster. Some asserts were added when the type is currently known, but depends on values from another function.
* Um, I thought I'd already checked this in.Guido van Rossum2006-03-101-0/+1
| | | | | | | Anyway, this is the changes to the with-statement so that __exit__ must return a true value in order for a pending exception to be ignored. The PEP (343) is already updated.
* Change int to Py_ssize_t in several places.Martin v. Löwis2006-03-071-4/+4
| | | | | Add (int) casts to silence compiler warnings. Raise Python exceptions for overflows.
* SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters2006-02-281-13/+56
| | | | | | | | | | | | | | | | | | | | | | | - IMPORT_NAME takes an extra argument from the stack: the relativeness of the import. Only passed to __import__ when it's not -1. - __import__() takes an optional 5th argument for the same thing; it __defaults to -1 (old semantics: try relative, then absolute) - 'from . import name' imports name (be it module or regular attribute) from the current module's *package*. Likewise, 'from .module import name' will import name from a sibling to the current module. - Importing from outside a package is not allowed; 'from . import sys' in a toplevel module will not work, nor will 'from .. import sys' in a (single-level) package. - 'from __future__ import absolute_import' will turn on the new semantics for import and from-import: imports will be absolute, except for from-import with dots. Includes tests for regular imports and importhooks, parser changes and a NEWS item, but no compiler-package changes or documentation changes.
* PEP 343 -- the with-statement.Guido van Rossum2006-02-271-1/+2
| | | | | | | | | | | | | This was started by Mike Bland and completed by Guido (with help from Neal). This still needs a __future__ statement added; Thomas is working on Michael's patch for that aspect. There's a small amount of code cleanup and refactoring in ast.c, compile.c and ceval.c (I fixed the lltrace behavior when EXT_POP is used -- however I had to make lltrace a static global).