summaryrefslogtreecommitdiff
path: root/Python/import.c
AgeCommit message (Collapse)AuthorLines
2012-10-20Fix compilation on WindowsNick Coghlan-1/+1
2012-10-19Issue #6074: Forward port Windows read-only source file fix from 2.7Nick Coghlan-0/+6
2012-08-15Issue #15604: Update uses of PyObject_IsTrue() to check for and handle ↵Antoine Pitrou-2/+11
errors correctly. Patch by Serhiy Storchaka.
2012-05-09Issue #14761: Fix potential leak on an error case in the import machinery.Antoine Pitrou-1/+2
2012-03-18Fixes Issue #14331: Use significantly less stack space when importing modules byGregory P. Smith-39/+127
allocating path buffers on the heap instead of the stack.
2012-02-22Issue #14084: Fix a file descriptor leak when importing a module with a bad ↵Antoine Pitrou-1/+3
encoding.
2012-02-22In find_module(), do not silence fileno() and dup() errors.Antoine Pitrou-0/+2
2012-01-25Port import fixes from 2.7.Antoine Pitrou-10/+10
2012-01-24Issue #11235: Fix OverflowError when trying to import a source file whose ↵Antoine Pitrou-7/+4
modification time doesn't fit in a 32-bit timestamp.
2012-01-18Fix the builtin module initialization code to store the init function for ↵Antoine Pitrou-0/+4
future reinitialization.
2011-11-03Add signatures to the docstring of functions added to imp by PEP 3147Éric Araujo-2/+4
2011-10-30Issue #10363: Deallocate global locks in Py_Finalize().Antoine Pitrou-10/+15
2011-09-23Issue #7732: Don't open a directory as a file anymore while importing aVictor Stinner-1/+8
module. Ignore the direcotry if its name matchs the module name (e.g. "__init__.py") and raise a ImportError instead.
2011-09-15Fix the import machinery if there is an error on sys.path or sys.meta_pathVictor Stinner-4/+4
find_module() now raises a RuntimeError, instead of ImportError, on an error on sys.path or sys.meta_path because load_package() and import_submodule() returns None and clear the exception if a ImportError occurred.
2011-09-02Remove unused variable if Python is build without threadsVictor Stinner-0/+2
2010-12-03Merge branches/pep-0384.Martin v. Löwis-1/+1
2010-12-03import: use PyUnicode_FSConverter to support bytes path and PEP 383Victor Stinner-28/+30
(instead of PyArg_Parse*() with "es" format and Py_FileSystemDefaultEncoding)
2010-12-02Issue #9573: os.fork now works when triggered as a side effect of import ↵Nick Coghlan-2/+11
(the wisdom of actually relying on this remains questionable!)
2010-11-30Remove redundant includes of headers that are already included by Python.h.Georg Brandl-4/+0
2010-11-09Issue #10359: Remove ";" after function definition, invalid in ISO CVictor Stinner-1/+1
2010-10-17find_module(): use FS encoding to display the missing __init__ warningVictor Stinner-7/+9
2010-10-17_PyImport_FixupExtension() and _PyImport_FindExtension() uses FS encodingVictor Stinner-10/+34
* Rename _PyImport_FindExtension() to _PyImport_FindExtensionUnicode(): the filename becomes a Unicode object instead of byte string * Rename _PyImport_FixupExtension() to _PyImport_FixupExtensionUnicode(): the filename becomes a Unicode object instead of byte string
2010-10-16fix refleakBenjamin Peterson-4/+6
2010-10-15Fix imp_cache_from_source(): Decode make_compiled_pathname() result from theVictor Stinner-1/+1
filesystem encoding instead of utf-8. imp_cache_from_source() encodes the input path to filesystem encoding and this path is passed to make_compiled_pathname().
2010-10-15imp_load_module() uses PyUnicode_FSConverter() to support surrogates in moduleVictor Stinner-7/+7
path
2010-10-15imp.cache_from_source() uses PyUnicode_FSConverter() to support surrogates inVictor Stinner-5/+8
module path
2010-10-15imp.load_dynamic() uses PyUnicode_FSConverter() to support surrogatesVictor Stinner-6/+6
in the library path.
2010-10-07Create fileutils.c/.hVictor Stinner-65/+0
* _Py_fopen() and _Py_stat() come from Python/import.c * (_Py)_wrealpath() comes from Python/sysmodule.c * _Py_char2wchar(), _Py_wchar2char() and _Py_wfopen() come from Modules/main.c * (_Py)_wstat(), (_Py)_wgetcwd(), _Py_wreadlink() come from Modules/getpath.c
2010-10-07PyUnicode_AsWideCharString() takes a PyObject*, not a PyUnicodeObject*Victor Stinner-3/+3
All unicode functions uses PyObject* except PyUnicode_AsWideChar(). Fix the prototype for the new function PyUnicode_AsWideCharString().
2010-09-29Remove an unreferenced variable. len is no longer needed.Brian Curtin-1/+0
2010-09-29Issue #9979: Use PyUnicode_AsWideCharString() in import.cVictor Stinner-18/+16
Don't truncate path if it is too long anymore, and allocate fewer memory (but allocate it on the heap, not on the stack).
2010-09-19PyImport_Import was using the old import hack of sticking a dummy value intoBrett Cannon-3/+13
fromlist to get __import__ to return the module desired. Now it uses the proper approach of fetching the module from sys.modules. Closes issue #9252. Thanks to Alexander Belopolsky for the bug report.
2010-09-11Fix incorrect comment regarding MAGIC and TAG in import.cNick Coghlan-2/+5
2010-09-10bump magic number for DELETE_DEREFBenjamin Peterson-1/+2
2010-09-09Fix Issue #9752: MSVC compiler warning due to undefined functionDaniel Stutzbach-4/+7
(Patch by Jon Anglin)
2010-09-04Issue #9225: Remove the ROT_FOUR and DUP_TOPX opcode, the latter replacedAntoine Pitrou-1/+3
by the new (and simpler) DUP_TOP_TWO. Performance isn't changed, but our bytecode is a bit simplified. Patch by Demur Rumed.
2010-08-17Remove unused functions _PyImport_FindModule and _PyImport_IsScriptVictor Stinner-16/+0
2010-08-14Create _Py_fopen() for PyUnicodeObject pathVictor Stinner-0/+33
Call _wfopen() on Windows, or fopen() otherwise. Return the new file object on success, or NULL if the file cannot be open or (if PyErr_Occurred()) on unicode error.
2010-08-14_Py_stat(): ensure that path ends with a nul characterVictor Stinner-2/+3
2010-08-14Issue #9425: Create private _Py_stat() functionVictor Stinner-0/+33
Use stat() or _wstat() depending on the OS.
2010-08-13Issue #9425: NullImporter constructor is fully unicode compliantVictor Stinner-37/+51
* On non-Windows OSes: the constructor accepts bytes filenames and use surrogateescape for unicode filenames * On Windows: use GetFileAttributesW() instead of GetFileAttributesA()
2010-08-09Issue #9425: Create load_builtin() subfunctionVictor Stinner-30/+40
Just move the code and some variables.
2010-06-27Merged revisions 81380 via svnmerge fromBenjamin Peterson-1/+2
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81380 | brett.cannon | 2010-05-20 13:37:55 -0500 (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-06-17Typo repair.Barry Warsaw-4/+4
2010-05-15Issue #8715: Create PyUnicode_EncodeFSDefault() function: Encode a UnicodeVictor Stinner-10/+2
object to Py_FileSystemDefaultEncoding with the "surrogateescape" error handler, return a bytes object. If Py_FileSystemDefaultEncoding is not set, fall back to UTF-8.
2010-05-09Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou-2599/+2599
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-04-17PEP 3147Barry Warsaw-28/+363
2010-03-25Merged revisions 79428 via svnmerge fromBenjamin Peterson-2/+2
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79428 | benjamin.peterson | 2010-03-25 18:27:16 -0500 (Thu, 25 Mar 2010) | 1 line make naming convention consistent ........
2010-03-12Issue #6697: use %U format instead of _PyUnicode_AsString(), becauseVictor Stinner-2/+2
_PyUnicode_AsString() was not checked for error (NULL). The unicode string is no more truncated to 200 or 400 *bytes*.
2010-03-12Merged revisions 78826 via svnmerge fromVictor Stinner-2/+0
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. ........