summaryrefslogtreecommitdiffstats
path: root/Python/import.c
Commit message (Collapse)AuthorAgeFilesLines
* _PyImport_Fini(): Closed small memory leak when an embedded app callsBarry Warsaw2000-10-031-0/+2
| | | | | Py_Initialize()/Py_Finalize() in a loop. _PyImport_Filetab needed to be deallocated. Partial closure of SF #110681, Jitterbug PR#398.
* The 2.0b2 change to write .pyc files in exclusive mode (if possible)Tim Peters2000-09-291-1/+6
| | | | | | | | unintentionally caused them to get written in text mode under Windows. As a result, when .pyc files were later read-- in binary mode --the magic number was always wrong (note that .pyc magic numbers deliberately include \r and \n characters, so this was "good" breakage, 100% across all .pyc files, not random corruption in a subset). Fixed that.
* On Unix, use O_EXCL when creating the .pyc/.pyo files, to avoid a race conditionGuido van Rossum2000-09-201-1/+31
|
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* Replace the run-time 'future-bytecode-stream-inspection' hack to find outThomas Wouters2000-08-271-2/+2
| | | | | | | how 'import' was called with a compiletime mechanism: create either a tuple of the import arguments, or None (in the case of a normal import), add it to the code-block constants, and load it onto the stack before calling IMPORT_NAME.
* Support for three-token characters (**=, >>=, <<=) which was written byThomas Wouters2000-08-241-1/+1
| | | | | Michael Hudson, and support in general for the augmented assignment syntax. The graminit.c patch is large!
* Thomas reminds me to bump the MAGIC number for the extended printBarry Warsaw2000-08-211-1/+1
| | | | opcode additions.
* Apply SF patch #101135, adding 'import module as m' and 'from module importThomas Wouters2000-08-171-1/+1
| | | | | | | | name as n'. By doing some twists and turns, "as" is not a reserved word. There is a slight change in semantics for 'from module import name' (it will now honour the 'global' keyword) but only in cases that are explicitly undocumented.
* Merge UNPACK_LIST and UNPACK_TUPLE into a single UNPACK_SEQUENCE, since theyThomas Wouters2000-08-111-1/+1
| | | | | | | did the same anyway. I'm not sure what to do with Tools/compiler/compiler/* -- that isn't part of distutils, is it ? Should it try to be compatible with old bytecode version ?
* Oops. One of last nights ANSIfication patches accidentily upped the bytecodeThomas Wouters2000-07-231-1/+1
| | | | | | MAGIC number. When updating it next time, be sure it's higher than 50715 * constants. (Shouldn't be a problem if everyone keeps to the proper algorithm.)
* ANSIfy as many declarations as possible.Thomas Wouters2000-07-221-1/+2
|
* Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters2000-07-221-179/+69
| | | | declarations yet, those come later.
* Include macglue.h for some function prototypes, and renamed a fewJack Jansen2000-07-111-1/+1
| | | | mac-specific functions to have a PyMac_ name.
* Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters2000-07-091-16/+14
|
* Jack Jansen, Mac patch:Guido van Rossum2000-07-011-2/+3
| | | | Include stat.h if needed; different Mac filename compare
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Trent Mick <trentm@activestate.com>:Fred Drake2000-06-301-13/+31
| | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes possible overflow in the use of PyOS_GetLastModificationTime in getmtime.c and Python/import.c. Currently PyOS_GetLastModificationTime returns a C long. This can overflow on Win64 where sizeof(time_t) > sizeof(long). Besides it should logically return a time_t anyway (this patch changes this). As well, import.c uses PyOS_GetLastModificationTime for .pyc timestamping. There has been recent discussion about the .pyc header format on python-dev. This patch adds oveflow checking to import.c so that an exception will be raised if the modification time overflows. There are a few other minor 64-bit readiness changes made to the module as well: - size_t instead of int or long for function-local buffer and string length variables - one buffer overflow check was added (raises an exception on possible overflow, this overflow chance exists on 32-bit platforms as well), no other possible buffer overflows existed (from my analysis anyway) Closes SourceForge patch #100509.
* another typo caught by Rob HooftJeremy Hylton2000-06-301-1/+1
|
* 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."