summaryrefslogtreecommitdiffstats
path: root/Python/import.c
Commit message (Collapse)AuthorAgeFilesLines
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-9/+7
| | | | | | | | | | For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
* Marc-Andre Lemburg:Guido van Rossum2000-05-011-8/+20
| | | | | | | | | | | Changed all references to the MAGIC constant to use a global pyc_magic instead. This global is initially set to MAGIC, but can be changed by the _PyImport_Init() function to provide for special features implemented in the compiler which are settable using command line switches and affect the way PYC files are generated. Currently this change is only done for the -U flag.
* Robin Becker: The following patch seems to fix a module case bug inGuido van Rossum2000-05-011-4/+4
| | | | | 1.6a2 caused by wrong return values in routine allcaps83. [GvR: I also changed the case for end-s>8 to return 0.]
* As Marc-Andre Lemburg points out, the magic number needs to changeGuido van Rossum2000-04-281-1/+1
| | | | because we've added Unicode marshalling to the repertoire.
* Jack Jansen: The new version of the GUSI i/o library on the MacintoshGuido van Rossum2000-04-241-2/+2
| | | | has a few slightly different calls from the old one.
* Massive patch by Skip Montanaro to add ":name" to as manyGuido van Rossum2000-02-291-15/+15
| | | | PyArg_ParseTuple() format string arguments as possible.
* Cleanup patches from Greg Stein:Guido van Rossum1999-12-221-0/+8
| | | | | | | | | | | | | | | | | | | * in import.c, #ifdef out references to dynamic loading based on HAVE_DYNAMIC_LOADING * clean out the platform-specific crud from importdl.c. [ maybe fold this function into import.c and drop the importdl.c file? Greg.] * change GetDynLoadFunc's "funcname" parameter to "shortname". change "name" to "fqname" for clarification. * each GetDynLoadFunc now creates its own funcname value. WARNING: as I mentioned previously, we may run into an issue with a missing "_" on some platforms. Testing will show this pretty quickly, however. * move pathname munging into dynload_shlib.c
* In _PyImport_Init(), dynamically construct the table of legal suffixesGuido van Rossum1999-12-201-5/+33
| | | | | | | from two static tables (one standard, one provided by the platform's dynload_*.c variant). This is part of a set of patches by Greg Stein.
* Changes by Mark Hammond for Windows CE. Mostly of the formGuido van Rossum1999-04-071-0/+4
| | | | #ifdef DONT_HAVE_header_H ... #endif around #include <header.h>.
* PyImport_ReloadModule(): Nailed a small memory leak. In theBarry Warsaw1999-01-271-0/+1
| | | | | else-clause of the subname test, the parentname object was never DECREF'd.
* Improve comment for PyImport_Import() as suggested by Bill Tutt.Guido van Rossum1998-12-211-1/+4
|
* Thanks to Chris Herborth, the thread primitives now have proper Py*Guido van Rossum1998-12-211-7/+7
| | | | | names in the source code (they already had those for the linker, through some smart macros; but the source still had the old, un-Py names).
* Jim Fulton writes:Guido van Rossum1998-10-221-0/+1
| | | | | | | | """ I had originally not realized that PyEval_GetGlobals did not INCREF it's return value. The fix is to add the INCREF, as shown below. """
* Replace fprintf(stderr, ...) with PySys_WriteStderr(...).Guido van Rossum1998-10-121-22/+22
|
* Renamed thread.h to pythread.h.Guido van Rossum1998-10-011-1/+1
|
* While scalling sys.modules, skip entries that don't have string keys,Guido van Rossum1998-10-011-4/+4
| | | | | to protect us from jokers who put items with non-string keys in sys.modules. Reported by Greg Stein.
* Mac-specific mod to enable aliases on import paths.Guido van Rossum1998-09-141-9/+26
| | | | (Jack Jansen and/or Just van Rossum)
* __file__ used to be always set to the .pyc (or .pyo) file, even ifGuido van Rossum1998-08-251-1/+2
| | | | | | | that file in fact did not exist or at least was not used. Change this so that __file__ is *only* set to the .pyc/.pyo file when it actually read the code object from it; otherwise __file__ is set to the .py file.
* Patch by Just van Rossum that changes how we search for submodules ofGuido van Rossum1998-08-111-19/+20
| | | | | | | frozen packages. (I *think* this means that we can now have a built-in module bar that's a submodule of a frozen package foo, by registering the built-in module with a name "foo.bar" in the table of builtin modules.)
* Added handling for Mac code resource modules (Jack Jansen).Guido van Rossum1998-08-061-0/+10
|
* Changes for BeOS, QNX and long long, by Chris Herborth.Guido van Rossum1998-08-041-1/+1
|
* Fix two smal memory leaks discovered by Vadim Chugunov.Guido van Rossum1998-07-011-3/+2
|
* Ignore Windows case check for ALL CAPS 8.3 filesGuido van Rossum1998-06-241-1/+39
|
* Fix a curious bug: statements like "import sys.time" would succeed,Guido van Rossum1998-05-191-3/+10
| | | | | | because the path through the code would notice that sys.__path__ did not exist and it would fall back to the default path (builtins + sys.path) instead of failing). No longer.
* New APIs for embedding applications that want to add their own entriesGuido van Rossum1998-05-141-0/+58
| | | | | | | | | | | to the table of built-in modules. This should normally be called *before* Py_Initialize(). When the malloc() or realloc() call fails, -1 is returned and the existing table is unchanged. After a similar function by Just van Rossum. int PyImport_ExtendInittab(struct _inittab *newtab); int PyImport_AppendInittab(char *name, void (*initfunc)());
* Reject empty module names -- otherwise __import__("") does somethingGuido van Rossum1998-04-111-0/+5
| | | | weird!
* Comment out a label on an #endif.Guido van Rossum1998-04-101-1/+1
|
* Address warnings issued by the MSVC++ compilerGuido van Rossum1998-04-101-1/+1
|
* Support for frozen packages, matching the revamped Tools/freeze.Guido van Rossum1998-03-051-14/+60
| | | | | | Frozen packages are indicated by a negative size (the code string is the __import__.py file). A frozen package module has its __path__ set to a string, the package name.
* Oops -- overuse of dabbrev-expand introduced a strange bug, whereGuido van Rossum1998-03-031-1/+1
| | | | instead of 'locals' I was passing 'lock_import' to import_module_ex().
* Add a single Python-wide (!) lock on import. Only one thread at aGuido van Rossum1998-03-031-8/+71
| | | | | | | | | | | | | | | | | | | | time can be in PyImport_ImportModuleEx(). Recursive calls from the same thread are okay. Potential problems: - The lock should really be part of the interpreter state rather than global, but that would require modifying more files, and I first want to figure out whether this works at all. - One could argue that the lock should be per module -- however that would be complicated to implement. We would have to have a linked list of locks per module name, *or* invent a new object type to represent a lock, so we can store the locks in the module or in a separate dictionary. Both seem unwarranted. The one situation where this can cause problems is when loading a module takes a long time, e.g. when the module's initialization code interacts with the user -- during that time, no other threads can run. I say, "too bad."
* Moved clear_carefully() to _PyModule_Clear() in moduleobject.cGuido van Rossum1998-02-191-69/+31
| | | | | | | | | | | | | | | (modified) and use that. Some differences in the cleanup algorithm: - Clear __main__ before the other modules. - Delete more sys variables: including ps1, ps2, exitfunc, argv, and even path -- this will prevent new imports! - Restore stdin, stdout, stderr from __stdin__, __stdout__, __stderr__, effectively deleting hooks that the user might have installed -- so their (the hooks') destructors will run.
* Small patches to the DJGPP version of check_case().Guido van Rossum1998-02-181-1/+3
|
* Added DJGPP version of check_case(), by Pit Scrorpion (Hans Nowak).Guido van Rossum1998-02-131-0/+28
| | | | (BTW, the Mac version was by Jack Jansen.)
* Add case checking feature on import.Guido van Rossum1998-02-131-1/+78
| | | | | | | | | | | | | This is an option for OS-es with case-insensitive but case-preserving filesystems. It is currently supported for Win32 and MacOS. To enable it, #define CHECK_IMPORT_CASE in your platform specific config.h. It is enabled by default on those systems where it is supported. On Win32, it can be disabled at runtime by setting the environment variable PYTHONCASEOK (to any value). When enabled, the feature checks that the case of the requested module name matches that of the filename found in the filesystem, and raises a NameError exception when they don't match.
* Added PyImport_ExecCodeModuleEx(), which adds an extra parameter toGuido van Rossum1998-02-111-5/+25
| | | | | | pass it the true file. This is used to set __file__ properly, instead of believing what the code object carries with it. (If the pointer is NULL, the code object's co_filename is still used.)
* Two more refinements of the cleanup process.Guido van Rossum1998-02-061-3/+52
| | | | | | | | | | | | (1) Explicitly clear __builtin__._ and sys.{last,exc}_* before clearing anything else. These are common places where user values hide and people complain when their destructors fail. Since the modules containing them are deleted *last* of all, they would come too late in the normal destruction order. Sigh. (2) Add some debugging aid to cleanup (after a suggestion by Marc Lemburg) -- print the names of the modules being cleaned, and (when -vv is used) print the names of the variables being cleared.
* Rewritten PyImport_Cleanup() and its helper, clear_carefully(). TheyGuido van Rossum1998-01-191-12/+98
| | | | | | | | | | | | | | | | | | now implement the following finalization strategy. 1. Whenever this code deletes a module, its directory is cleared carefully, as follows: - set all names to None that begin with exactly one underscore - set all names to None that don't begin with two underscores - clear the directory 2. Modules are deleted in the following order: - modules with a reference count of 1, except __builtin__ or __sys__ - repeat until no more are found with a reference count of 1 - __main__ if it's still there - all remaining modules except __builtin__ or sys - sys _ __builtin__
* Oops! Should've renamed dos_8x3 to dos-8x3 here, too.Guido van Rossum1997-12-171-3/+3
|
* Jeff Rush: add definition for S_IFMT for VisualAge C/C++ under OS2.Guido van Rossum1997-12-051-0/+5
|
* New policy for package imports: only a directory containingGuido van Rossum1997-10-311-2/+38
| | | | | | __init__.py (or __init__.pyc/.pyo, whichever applies) is considered a package. All other subdirectories are left alone. Should make Konrad Hinsen happy!
* Instead of using _PyImport_Inittab[] directly, use the new "official"Guido van Rossum1997-10-311-4/+8
| | | | pointer *PyImport_Inittab which is initialized to _PyImport_Inittab.
* Moved mac-specific speedup to a different place (Jack)Guido van Rossum1997-10-081-5/+5
|
* Remove unreachable "return 1" at end of ensure_fromlist().Guido van Rossum1997-10-031-1/+1
|
* Added docstrings. Not for the obsolete functions though.Guido van Rossum1997-09-091-6/+46
|
* Deleted find_module_in_package and find_module_in_directory -- theyGuido van Rossum1997-09-091-53/+0
| | | | aren't needed and it was a mistake to add them.
* Crrected a flow control error that caused the wrong error message whenGuido van Rossum1997-09-091-22/+6
| | | | | | load-module() didn't find a built-in or frozen module. Also got rid of is_frozen(), which duplicated the functionality of find_frozen()!=NULL.
* Added support for __all__, which should be a list of modules to beGuido van Rossum1997-09-081-3/+16
| | | | imported when the user says "from package import *".
* Bugfix: import A.B from inside package was busted by mark_miss optimization.Guido van Rossum1997-09-071-1/+1
|
* Significant speedup -- when a submodule imports a global module, add aGuido van Rossum1997-09-061-5/+20
| | | | | | | | | | | | | | | | | | dummy entry to sys.modules, marking the absence of a submodule by the same name. Thus, if module foo.bar executes the statement "import time", sys.modules['foo.time'] will be set to None, once the absence of a module foo.time is confirmed (by looking for it in foo's path). The next time when foo.bar (or any other submodule of foo) executes "import time", no I/O is necessary to determine that there is no module foo.time. (Justification: It may seem strange to pollute sys.modules. However, since we're doing the lookup anyway it's definitely the fastest solution. This is the same convention that 'ni' uses and I haven't heard any complaints.)